diff options
Diffstat (limited to 'java/sca')
3 files changed, 30 insertions, 9 deletions
diff --git a/java/sca/itest/nodes/two-nodes-test/src/test/java/itest/ClientNode.java b/java/sca/itest/nodes/two-nodes-test/src/test/java/itest/ClientNode.java index 1c787261eb..b9d93d1e84 100644 --- a/java/sca/itest/nodes/two-nodes-test/src/test/java/itest/ClientNode.java +++ b/java/sca/itest/nodes/two-nodes-test/src/test/java/itest/ClientNode.java @@ -25,6 +25,8 @@ import itest.nodes.Helloworld; import java.io.File;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;
import org.apache.tuscany.sca.node.configuration.NodeConfiguration;
@@ -38,7 +40,7 @@ import org.oasisopen.sca.client.SCAClientFactory; /**
* This shows how to test the Calculator service component.
*/
-public class ClientNode{
+public class ClientNode {
private static Node clientNode;
private static TestCaseRunner runner;
@@ -47,10 +49,13 @@ public class ClientNode{ public static void setUpBeforeClass() throws Exception {
runner = new TestCaseRunner(ServiceNode.class);
runner.beforeClass();
- System.setProperty("org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint.enabled", "false");
+ System.setProperty("org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint.enabled",
+ "false");
NodeFactory factory = NodeFactory.newInstance();
NodeConfiguration conf =
- factory.createNodeConfiguration().setURI("clientNode")
+ factory.createNodeConfiguration().setURI("clientNode").
+ addBinding(SCABinding.TYPE, "http://localhost:8085/sca https://localhost:9085/sca")
+ .addBinding(WebServiceBinding.TYPE, "http://localhost:8086/ws")
.addContribution("client", new File("../helloworld-client/target/classes").toURI().toString());
clientNode = factory.createNode(conf).start();
Thread.sleep(1000);
@@ -82,7 +87,7 @@ public class ClientNode{ if (clientNode != null) {
clientNode.stop();
}
- if(runner!=null) {
+ if (runner != null) {
runner.afterClass();
}
}
diff --git a/java/sca/itest/nodes/two-nodes-test/src/test/java/itest/ServiceNode.java b/java/sca/itest/nodes/two-nodes-test/src/test/java/itest/ServiceNode.java index ec1d8636aa..4b278d89a2 100644 --- a/java/sca/itest/nodes/two-nodes-test/src/test/java/itest/ServiceNode.java +++ b/java/sca/itest/nodes/two-nodes-test/src/test/java/itest/ServiceNode.java @@ -21,6 +21,8 @@ package itest; import java.io.File;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;
import org.apache.tuscany.sca.node.configuration.NodeConfiguration;
@@ -30,21 +32,23 @@ import org.junit.BeforeClass; /**
* This shows how to test the Calculator service component.
*/
-public class ServiceNode{
+public class ServiceNode {
private static Node serviceNode;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
- System.setProperty("org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint.enabled", "false");
+ System.setProperty("org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint.enabled",
+ "false");
NodeFactory factory = NodeFactory.newInstance();
NodeConfiguration conf =
factory.createNodeConfiguration().setURI("serviceNode")
+ .addBinding(SCABinding.TYPE, "http://localhost:8087/sca")
+ .addBinding(WebServiceBinding.TYPE, "http://localhost:8088/ws")
.addContribution("service", new File("../helloworld-service/target/classes").toURI().toString());
serviceNode = factory.createNode(conf).start();
}
-
@AfterClass
public static void tearDownAfterClass() throws Exception {
if (serviceNode != null) {
diff --git a/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationImpl.java b/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationImpl.java index baf6e669e7..e4f102cf4d 100644 --- a/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationImpl.java +++ b/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationImpl.java @@ -40,7 +40,7 @@ public class NodeConfigurationImpl implements NodeConfiguration { private String domainURI = DEFAULT_DOMAIN_URI;
private List<ContributionConfiguration> contributions = new ArrayList<ContributionConfiguration>();
private List<BindingConfiguration> bindings = new ArrayList<BindingConfiguration>();
- private List<Object> extensions =new ArrayList<Object>();
+ private List<Object> extensions = new ArrayList<Object>();
public String getURI() {
return uri;
@@ -69,6 +69,13 @@ public class NodeConfigurationImpl implements NodeConfiguration { }
public NodeConfiguration addBinding(BindingConfiguration bindingConfiguration) {
+ for (BindingConfiguration bc : bindings) {
+ // Try to merge first by QName
+ if (bc.getBindingType().equals(bindingConfiguration.getBindingType())) {
+ bc.getBaseURIs().addAll(bindingConfiguration.getBaseURIs());
+ return this;
+ }
+ }
bindings.add(bindingConfiguration);
return this;
}
@@ -81,7 +88,12 @@ public class NodeConfigurationImpl implements NodeConfiguration { public NodeConfiguration addBinding(QName bindingType, String... baseURIs) {
BindingConfiguration binding = new BindingConfigurationImpl().setBindingType(bindingType);
for (String u : baseURIs) {
- binding.addBaseURI(u);
+ String[] uris = u.split("(\\s)+");
+ for (String uri : uris) {
+ if (uri.length() > 0) {
+ binding.addBaseURI(uri);
+ }
+ }
}
return addBinding(binding);
}
|