I'm doing this for all the tests where practical.

In your particular example here would it be at least as appropriate to call
flushAuthCache for each test rather than for the suite as a whole?  How
about on tearDown?

david jencks

On 2001.09.18 12:18:30 -0400 Scott M Stark wrote:
> The current main branch of the JBossTest code is deploying and
> undeploying
> the test jar on every single unit test method. This is in contrast to the
> previous
> version that deployed and undeployed the test jar once for the suite of
> unit tests.
> To restore the previous behavior the deploy and undeploy need to be moved
> out of the TestCase setUp() and tearDown() methods into a static suite
> method
> as is done in the EJBSpecUnitTestCase:
> 
> import org.jboss.test.JBossTestCase;
> import org.jboss.test.JBossTestSetup;
> 
> public class EJBSpecUnitTestCase
>    extends JBossTestCase
> {
>    public EJBSpecUnitTestCase(String name)
>    {
>       super(name);
>    }
> 
> ...
> 
>    public static Test suite()
>    {
>       TestSuite suite = new TestSuite();
>       suite.addTest(new TestSuite(EJBSpecUnitTestCase.class));
> 
>       // Create an initializer for the test suite
>       TestSetup wrapper = new JBossTestSetup(suite)
>       {
>          protected void setUp() throws Exception
>          {
>             super.setUp();
>             deployJ2ee("security-spec.jar");
>             flushAuthCache();
>          }
>          protected void tearDown() throws Exception
>          {
>             undeployJ2ee("security-spec.jar");
>             super.tearDown();
>          
>          }
>       };
>       return wrapper;
>    }
> }
> 
> 
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
> <META content="MSHTML 5.50.4807.2300" name=GENERATOR>
> <STYLE></STYLE>
> </HEAD>
> <BODY bgColor=#fcf4cf>
> <DIV><FONT face=Arial size=2>The current main branch of the JBossTest
> code is 
> deploying and undeploying</FONT></DIV>
> <DIV><FONT face=Arial size=2>the test jar on every single unit test
> method. This 
> is in contrast to the previous</FONT></DIV>
> <DIV><FONT face=Arial size=2>version that deployed and undeployed the
> test jar 
> once for the suite of unit tests.</FONT></DIV>
> <DIV><FONT face=Arial size=2>To restore the previous behavior the deploy
> and 
> undeploy need to be moved</FONT></DIV>
> <DIV><FONT face=Arial size=2>out of the TestCase setUp() and tearDown()
> methods 
> into a static suite method</FONT></DIV>
> <DIV><FONT face=Arial size=2>as is done in the
> EJBSpecUnitTestCase:</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial size=2>import
org.jboss.test.JBossTestCase;<BR>import
> 
> org.jboss.test.JBossTestSetup;</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial size=2>public class
> EJBSpecUnitTestCase<BR>&nbsp;&nbsp; 
> extends JBossTestCase<BR>{<BR>&nbsp;&nbsp; public
> EJBSpecUnitTestCase(String 
> name)<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
> super(name);<BR>&nbsp;&nbsp; }<BR></FONT></DIV>
> <DIV><FONT face=Arial size=2>...</FONT></DIV>
> <DIV><FONT face=Arial size=2>&nbsp;</DIV></FONT>
> <DIV><FONT face=Arial size=2>&nbsp;&nbsp; public static Test 
> suite()<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TestSuite
> suite = 
> new TestSuite();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; suite.addTest(new 
> TestSuite(EJBSpecUnitTestCase.class));</FONT></DIV>
> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
> <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Create an 
> initializer for the test suite<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> TestSetup 
> wrapper = new JBossTestSetup(suite)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
> {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; protected void
> setUp() 
> throws Exception<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
> {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
> super.setUp();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> 
> 
>deployJ2ee("security-spec.jar");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> 
> flushAuthCache();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
> }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; protected void
> tearDown() 
> throws Exception<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
> {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
> 
>undeployJ2ee("security-spec.jar");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> 
> super.tearDown();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
> }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> return 
> wrapper;<BR>&nbsp;&nbsp; }</FONT></DIV>
> <DIV><FONT face=Arial size=2>}</FONT></DIV>
> <DIV>&nbsp;</DIV></BODY></HTML>
> 

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to