diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-03-02 23:30:54 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2010-03-02 23:30:54 +0000 |
commit | bfa3a326441cbe17ea6786dbdd658832fc2e93b8 (patch) | |
tree | 69c7d61ba6670ae696612b1f0a374936c0d3e4a9 /sca-java-2.x/trunk/itest | |
parent | 90b9b0f259d291fd9d5c801eb51d7fc20b265c1b (diff) |
Add the ability to map binding.sca to any bindings in the runtime by configuration
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@918261 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/itest')
12 files changed, 59 insertions, 7 deletions
diff --git a/sca-java-2.x/trunk/itest/implementation-spring/pom.xml b/sca-java-2.x/trunk/itest/implementation-spring/pom.xml index 548b3e955e..5c3c99567a 100644 --- a/sca-java-2.x/trunk/itest/implementation-spring/pom.xml +++ b/sca-java-2.x/trunk/itest/implementation-spring/pom.xml @@ -60,6 +60,12 @@ <dependency> <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>2.0-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-policy-security</artifactId> <version>2.0-SNAPSHOT</version> </dependency> diff --git a/sca-java-2.x/trunk/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/BindingSCATestCase.java b/sca-java-2.x/trunk/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/BindingSCATestCase.java index dde328ecd2..3ad98ba1f5 100644 --- a/sca-java-2.x/trunk/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/BindingSCATestCase.java +++ b/sca-java-2.x/trunk/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/BindingSCATestCase.java @@ -21,6 +21,8 @@ package org.apache.tuscany.sca.itest.bindingsca; 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; @@ -66,7 +68,10 @@ public class BindingSCATestCase { static Node createServiceNode(NodeFactory factory) { NodeConfiguration config2 = factory.createNodeConfiguration().setDomainURI(DOMAIN_URI).setURI("node2").addContribution("c2", ROOT) - .addDeploymentComposite("c2", SERVICE).setDomainRegistryURI(REGISTRY_URI); + .addDeploymentComposite("c2", SERVICE).setDomainRegistryURI(REGISTRY_URI) + .addBinding(WebServiceBinding.TYPE, "http://localhost:8085/").addBinding(SCABinding.TYPE, + "http://localhost:8085/"); + Node node2 = factory.createNode(config2); return node2; } @@ -79,7 +84,9 @@ public class BindingSCATestCase { static Node createClientNode(NodeFactory factory) { NodeConfiguration config1 = factory.createNodeConfiguration().setDomainURI(DOMAIN_URI).setURI("node1").addContribution("c1", ROOT) - .addDeploymentComposite("c1", CLIENT).setDomainRegistryURI(REGISTRY_URI); + .addDeploymentComposite("c1", CLIENT).setDomainRegistryURI(REGISTRY_URI) + .addBinding(WebServiceBinding.TYPE, "http://localhost:8085/").addBinding(SCABinding.TYPE, + "http://localhost:8085/"); Node node1 = factory.createNode(config1); return node1; } diff --git a/sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast/src/test/java/itest/TwoRemoteNodesTestCase.java b/sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast/src/test/java/itest/TwoRemoteNodesTestCase.java index 7e3cf0c3e6..e8a62eef99 100644 --- a/sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast/src/test/java/itest/TwoRemoteNodesTestCase.java +++ b/sca-java-2.x/trunk/itest/nodes/one-jvm-hazelcast/src/test/java/itest/TwoRemoteNodesTestCase.java @@ -25,6 +25,7 @@ import itest.nodes.Helloworld; import java.net.URI;
+import org.apache.tuscany.sca.binding.rmi.RMIBinding;
import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;
import org.junit.AfterClass;
@@ -42,6 +43,8 @@ public class TwoRemoteNodesTestCase{ @BeforeClass
public static void setUpBeforeClass() throws Exception {
+ System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", RMIBinding.TYPE.toString());
+
serviceNode = NodeFactory.newInstance().createNode(URI.create("tuscany:TwoRemoteNodesTestCase"), "../helloworld-service/target/classes");
serviceNode.start();
@@ -78,5 +81,6 @@ public class TwoRemoteNodesTestCase{ if (clientNode != null) {
clientNode.stop();
}
+ System.clearProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding");
}
}
diff --git a/sca-java-2.x/trunk/itest/nodes/one-jvm-tribes/src/test/java/itest/TwoRemoteNodesTestCase.java b/sca-java-2.x/trunk/itest/nodes/one-jvm-tribes/src/test/java/itest/TwoRemoteNodesTestCase.java index 7e3cf0c3e6..ac86083e9e 100644 --- a/sca-java-2.x/trunk/itest/nodes/one-jvm-tribes/src/test/java/itest/TwoRemoteNodesTestCase.java +++ b/sca-java-2.x/trunk/itest/nodes/one-jvm-tribes/src/test/java/itest/TwoRemoteNodesTestCase.java @@ -25,6 +25,7 @@ import itest.nodes.Helloworld; import java.net.URI;
+import org.apache.tuscany.sca.binding.rmi.RMIBinding;
import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;
import org.junit.AfterClass;
@@ -42,6 +43,7 @@ public class TwoRemoteNodesTestCase{ @BeforeClass
public static void setUpBeforeClass() throws Exception {
+ System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", RMIBinding.TYPE.toString());
serviceNode = NodeFactory.newInstance().createNode(URI.create("tuscany:TwoRemoteNodesTestCase"), "../helloworld-service/target/classes");
serviceNode.start();
@@ -78,5 +80,6 @@ public class TwoRemoteNodesTestCase{ if (clientNode != null) {
clientNode.stop();
}
+ System.clearProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding");
}
}
diff --git a/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/server.xml b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/server.xml index 6e282e1f12..98474d2cf4 100644 --- a/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/server.xml +++ b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/server.xml @@ -22,6 +22,7 @@ <target name="run">
<java classpath="${runtime_classpath}" classname="org.apache.tuscany.sca.node.launcher.NodeMain" fork="true">
+ <sysproperty key="org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding" value="{http://tuscany.apache.org/xmlns/sca/1.1}binding.rmi"/>
<arg value="-node"/>
<arg value="./server-config.xml"/>
<!-- Give the server 60 seconds to stay -->
diff --git a/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/src/test/java/itest/Client.java b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/src/test/java/itest/Client.java index 5df68b8f2f..d94c9850b5 100644 --- a/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/src/test/java/itest/Client.java +++ b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/src/test/java/itest/Client.java @@ -21,6 +21,7 @@ package itest; import java.net.URI;
+import org.apache.tuscany.sca.binding.rmi.RMIBinding;
import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;
import org.junit.AfterClass;
@@ -33,6 +34,7 @@ public class Client { @BeforeClass
public static void setUpBeforeClass() throws Exception {
+ System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", RMIBinding.TYPE.toString());
clientNode = NodeFactory.newInstance().createNode(URI.create("tuscany:default"), "../helloworld-client/target//classes");
clientNode.start();
}
@@ -46,6 +48,7 @@ public class Client { if (clientNode != null) {
clientNode.stop();
}
+ System.clearProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding");
}
public static void main(String[] args) throws Exception {
diff --git a/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/src/test/java/itest/SCAClient.java b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/src/test/java/itest/SCAClient.java index 67f2c913dc..da5ab5a27c 100644 --- a/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/src/test/java/itest/SCAClient.java +++ b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/src/test/java/itest/SCAClient.java @@ -23,12 +23,14 @@ import itest.nodes.Helloworld; import java.net.URI; +import org.apache.tuscany.sca.binding.rmi.RMIBinding; import org.apache.tuscany.sca.node.NodeFactory; import org.oasisopen.sca.client.SCAClientFactory; public class SCAClient { public void testSCAClient() throws Exception { + System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", RMIBinding.TYPE.toString()); // The configuration required when running with sca-client-rmi and endpoint-hazelcast-rmi //SCAClientFactory factory = SCAClientFactory.newInstance(URI.create("tuscanyclient:default?remotes=192.168.247.1:14820")); @@ -56,6 +58,7 @@ public class SCAClient { // or just rely on the runtime hosting the classes using the SCAClient // when it's on its way down NodeFactory.getInstance().destroy(); + System.clearProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding"); } public static void main(String[] args) throws Exception { diff --git a/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/src/test/java/itest/Service.java b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/src/test/java/itest/Service.java index dbccfd4407..51166fbef4 100644 --- a/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/src/test/java/itest/Service.java +++ b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/src/test/java/itest/Service.java @@ -21,6 +21,7 @@ package itest; import java.net.URI;
+import org.apache.tuscany.sca.binding.rmi.RMIBinding;
import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;
import org.junit.AfterClass;
@@ -33,6 +34,8 @@ public class Service { @BeforeClass
public static void setUpBeforeClass() throws Exception {
+ System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", RMIBinding.TYPE.toString());
+
serviceNode = NodeFactory.newInstance().createNode(URI.create("tuscany:default"), "../helloworld-service/target/classes");
serviceNode.start();
}
@@ -48,6 +51,7 @@ public class Service { if (serviceNode != null) {
serviceNode.stop();
}
+ System.clearProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding");
}
public static void main(String[] args) throws Exception {
diff --git a/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-test/server.xml b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-test/server.xml index 267650c2d8..05a5aa16e9 100644 --- a/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-test/server.xml +++ b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-test/server.xml @@ -22,6 +22,7 @@ <target name="run"> <java classpath="${runtime_classpath}" classname="org.apache.tuscany.sca.node.launcher.NodeMain" fork="true"> + <sysproperty key="org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding" value="{http://tuscany.apache.org/xmlns/sca/1.1}binding.rmi"/> <arg value="-node"/> <arg value="./server-config.xml"/> <arg value="-ttl"/> diff --git a/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/Client.java b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/Client.java index 4e7b099ad4..8921d90aa2 100644 --- a/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/Client.java +++ b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/Client.java @@ -21,6 +21,7 @@ package itest; import java.io.File;
+import org.apache.tuscany.sca.binding.rmi.RMIBinding;
import org.apache.tuscany.sca.domain.node.DomainNode;
import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;
@@ -35,6 +36,7 @@ public class Client { @BeforeClass
public static void setUpBeforeClass() throws Exception {
+ System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", RMIBinding.TYPE.toString());
NodeFactory factory = NodeFactory.newInstance();
clientNode = factory.createNode(new File("client-config.xml").toURI().toURL());
@@ -59,6 +61,8 @@ public class Client { if (clientNode != null) {
clientNode.stop();
}
+ System.clearProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding");
+
}
public static void main(String[] args) throws Exception {
diff --git a/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/Service.java b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/Service.java index cd020b5c33..42594f3da9 100644 --- a/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/Service.java +++ b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/Service.java @@ -21,6 +21,7 @@ package itest; import java.io.File;
+import org.apache.tuscany.sca.binding.rmi.RMIBinding;
import org.apache.tuscany.sca.domain.node.DomainNode;
import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;
@@ -35,6 +36,7 @@ public class Service { @BeforeClass
public static void setUpBeforeClass() throws Exception {
+ System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", RMIBinding.TYPE.toString());
NodeFactory factory = NodeFactory.newInstance();
serviceNode = factory.createNode(new File("server-config.xml").toURI().toURL());
@@ -56,5 +58,6 @@ public class Service { if (serviceNode != null) {
serviceNode.stop();
}
+ System.clearProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding");
}
}
diff --git a/sca-java-2.x/trunk/itest/scaclient-api-rmi/src/test/java/test/scaclient/SCAClientTestCase.java b/sca-java-2.x/trunk/itest/scaclient-api-rmi/src/test/java/test/scaclient/SCAClientTestCase.java index 35e5e28194..91a3f552f4 100644 --- a/sca-java-2.x/trunk/itest/scaclient-api-rmi/src/test/java/test/scaclient/SCAClientTestCase.java +++ b/sca-java-2.x/trunk/itest/scaclient-api-rmi/src/test/java/test/scaclient/SCAClientTestCase.java @@ -19,14 +19,17 @@ package test.scaclient;
+import static org.junit.Assert.assertEquals;
import itest.HelloworldService;
import java.net.URI;
-import junit.framework.TestCase;
-
+import org.apache.tuscany.sca.binding.rmi.RMIBinding;
import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.oasisopen.sca.client.SCAClientFactory;
@@ -35,9 +38,19 @@ import org.oasisopen.sca.client.SCAClientFactory; *
* @version $Rev: 904064 $ $Date: 2010-01-28 12:31:36 +0000 (Thu, 28 Jan 2010) $
*/
-public class SCAClientTestCase extends TestCase {
+public class SCAClientTestCase {
private Node node;
+
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", RMIBinding.TYPE.toString());
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ System.clearProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding");
+ }
@Test
public void testDefault() throws Exception {
@@ -77,8 +90,8 @@ public class SCAClientTestCase extends TestCase { assertEquals("Hello petra", service.sayHello("petra"));
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
node.stop();
}
|