Hi,

It might be a good idea to define a set of templates to shield the test cases from the environment-specific node configuration and lifecycle. This way, the test cases can be simpler and it's possible to run them with different environment (JSE or OSGi) by switching the base.

We could define two modules tuscany-test and tuscany-test-equinox to host the base test cases. Other itests can add them as test dependencies in pom.xml.

The following code is something I tried locally. But I have some issues getting the @BeforeClass and @AfterClass version going as JUNIT tries to run these methods even before the static initializer of a class is called.

Thanks,
Raymond

/**
* Base Node API based test case
*/
public abstract class NodeTestCase {
   protected final Logger logger = Logger.getLogger(getClass().getName());
   protected String compositeResource;
   protected Node node;

   protected NodeTestCase(String compositeResource) {
       super();
       this.compositeResource = compositeResource;
   }

   @Before
   public void setUp() throws Exception {
       try {
String location = ContributionLocationHelper.getContributionLocation(compositeResource); Contribution contribution = new Contribution(location, location);
           NodeFactory factory = NodeFactory.newInstance();
           node = factory.createNode(compositeResource, contribution);
           node.start();
       } catch (Exception e) {
           logger.log(Level.SEVERE, e.getMessage(), e);
           throw e;
       }
   }

   @After
   public void tearDown() throws Exception {
       if (node != null) {
           node.stop();
       }
   }
}

--------------------------------------------------
From: "Mike Edwards" <[EMAIL PROTECTED]>
Sent: Friday, December 05, 2008 1:06 PM
To: <[email protected]>
Subject: Activities in Trunk - was: svn commit: r723136 - in /tuscany/java/sca: distribution/core/pom.xml modules/pom.xml

[[SNIP]]


So far, it is mostly a case of tweak, tweak, tweak, adjusting dependencies and OSGi MANIFEST files, but in a few cases, the 2.0 APIs are different from the 1.x APIs and some changes are needed - this often affects testcases more than mainline module code. One lesson from this is that I think we should consider creating a tests-utils module to contain some of the sequences that tests seem to need commonly - and to hide the testcase code from changes in the base platform.


Yours, Mike.

Reply via email to