nodeB.installContribution("nodeAContrib", "./target/classes", null, null);
nodeB.startComposite("node1Contrib", "org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedService.composite");
*/
String [] contributions = {"./target/classes"};
Node node1 = NodeFactory.newInstance().createNode(URI.create("uri:default"),
"org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedClient.composite",
contributions);
node1.start();
Node node2 = NodeFactory.newInstance().createNode(URI.create("uri:default"),
"org/apache/tuscany/sca/itest/interfaces/match/distributed/MatchDistributedService.composite",
contributions);
// force default binding on node2 to use a different port from node 1(which will default to 8080
((NodeImpl)node2).getConfiguration().addBinding(WebServiceBinding.TYPE, "http://localhost:8081/");
((NodeImpl)node2).getConfiguration().addBinding(SCABinding.TYPE, "http://localhost:8081/");
node2.start();
SCAClientFactory clientFactory = SCAClientFactory.newInstance(URI.create("default"));
ClientComponent local = clientFactory.getService(ClientComponent.class, "LocalClientClientComponent");
ParameterObject po = new ParameterObject();
try {
String response = local.foo1(po);
Assert.assertEquals("AComponent", response);
} catch (ServiceRuntimeException ex){
Assert.fail("Unexpected exception with foo " + ex.toString());
}
/* Used to keep the composites alive when running the next (ignored) test manually
System.out.println("Press a key to end");
try {
System.in.read();
} catch (Exception ex) {
}
System.out.println("Continuing");
*/
node1.stop();
node2.stop();
}