Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
public class AtomTestCase {

	private static Node node;

	@BeforeClass
	public static void setUp() throws Exception {
		try {    try {
                // use the contribution helper to find the location of the contribution directory 
                // based on a class that is know to be in the contribution 
    		String contribution = ContributionLocationHelper.getContributionLocation(AtomTestCase.class);

                // create a note to load the contribution and run the named composite
    		node = NodeFactory.newInstance().createNode("AtomBinding.composite", new Contribution("test", contribution));

                // as an alternative to using the helper you can of course specify the location of the 
                // contribution directly, for example,
                //
                // node = NodeFactory.newInstance().createNode(new Contribution("test",
                //                                             "my/directory/structure/atom-contribution.zip"));
                //
                // Note also that no composite is named here. It is assumed that the contribution
                // specifies a deployable composite in the sca-contribution.xml file

                // start the node to make SCA services available
    		node.start();
    	    } catch (Exception e) {
    		e.printStackTrace();
    	    }
	}

	@AfterClass
	public static void tearDown() throws Exception {
		    node.stop();
    	    node.destroy();
	}

        ...
}

NOTE You will need to add the node-impl as test dependency to your modules

...