node.stopComposite("sample-helloworld", "helloworld.composite");
}
@Test
public void startDistributedTest() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, InterruptedException {
TuscanyRuntime runtime = TuscanyRuntime.newInstance();
try {
Node node = runtime.createNode("uri:ImportTestCase");
Node node2 = runtime.createNode("uri:ImportTestCase");
node.installContribution("src/test/resources/sample-helloworld.jar");
Assert.assertEquals(1, node.getInstalledContributionURIs().size());
Assert.assertEquals(1, node2.getInstalledContributionURIs().size());
node.startComposite("sample-helloworld", "helloworld.composite");
Assert.assertEquals(1, node.getStartedCompositeURIs().size());
Assert.assertEquals(1, node2.getStartedCompositeURIs().size());
Assert.assertEquals("helloworld.composite", node.getStartedCompositeURIs().get("sample-helloworld").get(0));
Assert.assertEquals("helloworld.composite", node2.getStartedCompositeURIs().get("sample-helloworld").get(0));
node.stopComposite("sample-helloworld", "helloworld.composite");
Assert.assertEquals(0, node.getStartedCompositeURIs().size());
Assert.assertEquals(0, node2.getStartedCompositeURIs().size());
node2.startComposite("sample-helloworld", "helloworld.composite");
Assert.assertEquals(1, node.getStartedCompositeURIs().size());
Assert.assertEquals("helloworld.composite", node.getStartedCompositeURIs().get("sample-helloworld").get(0));
Assert.assertEquals(1, node2.getStartedCompositeURIs().size());
Assert.assertEquals("helloworld.composite", node2.getStartedCompositeURIs().get("sample-helloworld").get(0));
} finally {
runtime.stop();
}
}