public void testStopStart() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
Node node = TuscanyRuntime.newInstance().createNode("default");
node.installContribution("helloworld", "src/test/resources/sample-helloworld.jar", null, null, true);
String ci = node.getStartedCompositeURIs("helloworld").get(0);
Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
node.stop("helloworld", ci);
try {
node.getService(Helloworld.class, "HelloworldComponent");
Assert.fail();
} catch (NoSuchServiceException e) {
// expected as there is no deployables
}
node.start("helloworld", ci);
helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
}