I have some tests[0] that behave differently under Surefire than they do
under m1/Ant.  The tests assume that a [Commons Chain] catalog that's
"application wide" will not be available after any one of the test cases
finished.

So all three tests have something like this in setUp():

       Catalog catalog = CatalogFactory.getInstance().getCatalog("remote");
       if (catalog == null) {
           catalog = new CatalogBase();
           catalog.addCommand("/list/supportedCategories.remote", command);
           CatalogFactory.getInstance().addCatalog("remote", catalog);
       }

(The Javadoc[1] for CatalogFactory, getInstance talks about the relevant
classloader.)

Under Surefire, the only time catalog is null is the first time setUp() is
called for whichever test runs first.  Under m1/Ant, the catalog is null
when setUp() is called the first time for each separate test case.

I can easily make the tests run under Surefire by moving
'catalog.addCommand(...)' outside the if statement, but I need to understand
why.

I'll post more of the related code if necessary, but I'm hoping someone who
understands more about class loading and how Surefire works will already
know what I'm talking about. :)

Possibly related:
http://www.mail-archive.com/[email protected]/msg37776.html

Thanks!

[0]
http://svn.apache.org/repos/asf/struts/shale/trunk/use-cases/src/test/org/apache/shale/usecases/remote/
[1] http://jakarta.apache.org/commons/chain/apidocs/org/apache/commons/chain/CatalogFactory.html

--
Wendy Smoak



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to