From f9be2165328dc76f562938566057e89c0723fe08 Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 11 Nov 2009 23:09:40 +0000 Subject: Moving 2.x branches git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835137 13f79535-47bb-0310-9956-ffa450edef68 --- .../itest/nodes/helloworld-client/pom.xml | 44 ++++ .../src/main/java/itest/nodes/HelloworldImpl.java | 43 +++ .../main/resources/META-INF/sca-contribution.xml | 23 ++ .../src/main/resources/helloworld-client.composite | 29 ++ .../itest/nodes/helloworld-iface/pom.xml | 39 +++ .../src/main/java/itest/nodes/Helloworld.java | 29 ++ .../itest/nodes/helloworld-service/pom.xml | 49 ++++ .../src/main/java/itest/nodes/HelloworldImpl.java | 28 ++ .../main/resources/META-INF/sca-contribution.xml | 23 ++ .../main/resources/helloworld-service.composite | 28 ++ .../itest/nodes/one-node-test/pom.xml | 48 ++++ .../src/test/java/itest/OneNodeTestCase.java | 87 ++++++ .../branches/sca-java-2.0-M4/itest/nodes/pom.xml | 45 ++++ .../itest/nodes/two-nodes-test/pom.xml | 58 ++++ .../src/test/java/itest/ClientNode.java | 92 +++++++ .../src/test/java/itest/ServiceNode.java | 58 ++++ .../test/java/itest/StopStartNodesTestCase.java | 102 +++++++ .../src/test/java/itest/TestCaseRunner.java | 292 +++++++++++++++++++++ .../src/test/java/itest/TwoNodesTestCase.java | 105 ++++++++ .../itest/nodes/two-nodes-two-vms-test/build.xml | 38 +++ .../nodes/two-nodes-two-vms-test/client-config.xml | 38 +++ .../itest/nodes/two-nodes-two-vms-test/client.xml | 33 +++ .../itest/nodes/two-nodes-two-vms-test/pom.xml | 117 +++++++++ .../nodes/two-nodes-two-vms-test/server-config.xml | 38 +++ .../itest/nodes/two-nodes-two-vms-test/server.xml | 33 +++ .../src/test/java/itest/TwoNodesTestCase.java | 57 ++++ 26 files changed, 1576 insertions(+) create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-client/pom.xml create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-client/src/main/java/itest/nodes/HelloworldImpl.java create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-client/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-client/src/main/resources/helloworld-client.composite create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-iface/pom.xml create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-iface/src/main/java/itest/nodes/Helloworld.java create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-service/pom.xml create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-service/src/main/java/itest/nodes/HelloworldImpl.java create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-service/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-service/src/main/resources/helloworld-service.composite create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/one-node-test/pom.xml create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/pom.xml create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/pom.xml create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/src/test/java/itest/ClientNode.java create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/src/test/java/itest/ServiceNode.java create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/src/test/java/itest/StopStartNodesTestCase.java create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/src/test/java/itest/TestCaseRunner.java create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/build.xml create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/client-config.xml create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/client.xml create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/pom.xml create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/server-config.xml create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/server.xml create mode 100644 sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/TwoNodesTestCase.java (limited to 'sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes') diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-client/pom.xml b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-client/pom.xml new file mode 100644 index 0000000000..13b0dd0ab2 --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-client/pom.xml @@ -0,0 +1,44 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4-SNAPSHOT + ../pom.xml + + itest-nodes-helloworld-client + Apache Tuscany SCA iTest Nodes Helloworld Client + + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0-M4-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4-SNAPSHOT + provided + + + diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-client/src/main/java/itest/nodes/HelloworldImpl.java b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-client/src/main/java/itest/nodes/HelloworldImpl.java new file mode 100644 index 0000000000..bf8a588928 --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-client/src/main/java/itest/nodes/HelloworldImpl.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package itest.nodes; + +import org.oasisopen.sca.annotation.EagerInit; +import org.oasisopen.sca.annotation.Init; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; + +@EagerInit +@Scope("COMPOSITE") +public class HelloworldImpl implements Helloworld { + + @Reference + public Helloworld service; + + @Init + public void initialize(){ + System.out.println(">>>>>> " + sayHello("init")); + } + + public String sayHello(String name) { + return "Hi " + service.sayHello(name); + } + +} diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-client/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-client/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b4ba94220c --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-client/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-client/src/main/resources/helloworld-client.composite b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-client/src/main/resources/helloworld-client.composite new file mode 100644 index 0000000000..9d5e9ae59a --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-client/src/main/resources/helloworld-client.composite @@ -0,0 +1,29 @@ + + + + + + + + + + diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-iface/pom.xml b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-iface/pom.xml new file mode 100644 index 0000000000..b8c8205eb2 --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-iface/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4-SNAPSHOT + ../pom.xml + + itest-nodes-helloworld-iface + Apache Tuscany SCA iTest Nodes Helloworld IFaces + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4-SNAPSHOT + provided + + + diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-iface/src/main/java/itest/nodes/Helloworld.java b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-iface/src/main/java/itest/nodes/Helloworld.java new file mode 100644 index 0000000000..76f8d4400d --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-iface/src/main/java/itest/nodes/Helloworld.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package itest.nodes; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface Helloworld { + + String sayHello(String name); + +} diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-service/pom.xml b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-service/pom.xml new file mode 100644 index 0000000000..a8fe3ff7b3 --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-service/pom.xml @@ -0,0 +1,49 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4-SNAPSHOT + ../pom.xml + + itest-nodes-helloworld-service + Apache Tuscany SCA iTest Nodes Helloworld Service + + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0-M4-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4-SNAPSHOT + provided + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4-SNAPSHOT + + + diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-service/src/main/java/itest/nodes/HelloworldImpl.java b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-service/src/main/java/itest/nodes/HelloworldImpl.java new file mode 100644 index 0000000000..81f7e1747d --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-service/src/main/java/itest/nodes/HelloworldImpl.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package itest.nodes; + +public class HelloworldImpl implements Helloworld { + + public String sayHello(String name) { + return "Hello " + name; + } + +} diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-service/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-service/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..c65718909d --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-service/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-service/src/main/resources/helloworld-service.composite b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-service/src/main/resources/helloworld-service.composite new file mode 100644 index 0000000000..6b2d15b7a6 --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/helloworld-service/src/main/resources/helloworld-service.composite @@ -0,0 +1,28 @@ + + + + + + + + + diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/one-node-test/pom.xml b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/one-node-test/pom.xml new file mode 100644 index 0000000000..0eb49a19fe --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/one-node-test/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4-SNAPSHOT + ../pom.xml + + itest-nodes-one-node-test + Apache Tuscany SCA iTest Nodes One Node Test + + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0-M4-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4-SNAPSHOT + + + diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java new file mode 100644 index 0000000000..6d49b718ef --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package itest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.File; + +import itest.nodes.Helloworld; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * This shows how to test the Calculator service component. + */ +public class OneNodeTestCase{ + + private static Node node; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + System.setProperty("org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint.enabled", "false"); + NodeFactory factory = NodeFactory.newInstance(); + node = factory.createNode( + new Contribution("service", getJar("../helloworld-service/target")), + new Contribution("client", getJar("../helloworld-client/target"))); + node.start(); + } + + /** + * Get the jar in the target folder without being dependent on the version name to + * make tuscany releases easier + */ + private static String getJar(String targetDirectory) { + File f = new File(targetDirectory); + for (File file : f.listFiles()) { + if (file.getName().endsWith(".jar")) { + return file.toURI().toString(); + } + } + throw new IllegalStateException("Can't find jar in: " + targetDirectory); + } + + @Test + public void testCalculator() throws Exception { + + // Ideally this would use the SCAClient API but leaving that tillwe have the basics working + + Helloworld service = node.getService(Helloworld.class, "HelloworldService"); + assertNotNull(service); + assertEquals("Hello Petra", service.sayHello("Petra")); + + Helloworld client = node.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (node != null) { + node.stop(); + } + } +} diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/pom.xml b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/pom.xml new file mode 100644 index 0000000000..0ef109c44e --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/pom.xml @@ -0,0 +1,45 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4-SNAPSHOT + ../pom.xml + + pom + itest-nodes + Apache Tuscany SCA iTest Nodes + + + install + + + + helloworld-iface + helloworld-service + helloworld-client + one-node-test + two-nodes-test + two-nodes-two-vms-test + + + diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/pom.xml b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/pom.xml new file mode 100644 index 0000000000..f5c6d11cda --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/pom.xml @@ -0,0 +1,58 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4-SNAPSHOT + ../pom.xml + + itest-nodes-two-nodes-test + Apache Tuscany SCA iTest Nodes Two Nodes Test + + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0-M4-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-sca-client-impl + 2.0-M4-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-M4-SNAPSHOT + + + diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/src/test/java/itest/ClientNode.java b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/src/test/java/itest/ClientNode.java new file mode 100644 index 0000000000..5f9453a5d6 --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/src/test/java/itest/ClientNode.java @@ -0,0 +1,92 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package itest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import itest.nodes.Helloworld; + +import java.io.File; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.apache.tuscany.sca.node.configuration.NodeConfiguration; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import org.oasisopen.sca.client.SCAClient; + +/** + * This shows how to test the Calculator service component. + */ +public class ClientNode { + private final static String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200903"; + private static Node clientNode; + private static TestCaseRunner runner; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + runner = new TestCaseRunner(ServiceNode.class); + runner.beforeClass(); + System.setProperty("org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint.enabled", + "false"); + NodeFactory factory = NodeFactory.newInstance(); + NodeConfiguration conf = + factory.createNodeConfiguration().setURI("clientNode"). + addBinding(new QName(SCA11_NS, "binding.sca"), "http://localhost:8085/sca https://localhost:9085/sca") + .addBinding(new QName(SCA11_NS, "binding.ws"), "http://localhost:8086/ws") + .addContribution("client", new File("../helloworld-client/target/classes").toURI().toString()); + clientNode = factory.createNode(conf).start(); + Thread.sleep(1000); + } + + @Test + public void testCalculator() throws Exception { + + Helloworld client = clientNode.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + } + + @Test + @Ignore("SCAClient needs to leverage the EndpointRegistry to invoke services that are not hosted on the local node") + public void testCalculatorClientAPI() throws Exception { + Helloworld service = SCAClient.getService(Helloworld.class, "HelloworldService"); + assertNotNull(service); + assertEquals("Hello Petra", service.sayHello("Petra")); + + Helloworld client = SCAClient.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (clientNode != null) { + clientNode.stop(); + } + if (runner != null) { + runner.afterClass(); + } + } +} diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/src/test/java/itest/ServiceNode.java b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/src/test/java/itest/ServiceNode.java new file mode 100644 index 0000000000..b413825106 --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/src/test/java/itest/ServiceNode.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package itest; + +import java.io.File; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.apache.tuscany.sca.node.configuration.NodeConfiguration; +import org.junit.AfterClass; +import org.junit.BeforeClass; + +/** + * This shows how to test the Calculator service component. + */ +public class ServiceNode { + private final static String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200903"; + private static Node serviceNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + System.setProperty("org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint.enabled", + "false"); + NodeFactory factory = NodeFactory.newInstance(); + NodeConfiguration conf = + factory.createNodeConfiguration().setURI("serviceNode") + .addBinding(new QName(SCA11_NS, "binding.sca"), "http://localhost:8087/sca") + .addBinding(new QName(SCA11_NS, "binding.ws"), "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) { + serviceNode.stop(); + } + } +} diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/src/test/java/itest/StopStartNodesTestCase.java b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/src/test/java/itest/StopStartNodesTestCase.java new file mode 100644 index 0000000000..4a41ae8133 --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/src/test/java/itest/StopStartNodesTestCase.java @@ -0,0 +1,102 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package itest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; +import itest.nodes.Helloworld; + +import java.io.File; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.Test; + +/** + * Tests using two nodes and stopping and restarting a service node. + */ +public class StopStartNodesTestCase { + + private static Node serviceNode; + private static Node clientNode; + + @Test + public void testCalculator() throws Exception { + NodeFactory factory = NodeFactory.newInstance(); + serviceNode = factory.createNode(new Contribution("service", getJar("../helloworld-service/target"))); + serviceNode.start(); + clientNode = factory.createNode(new Contribution("client", getJar("../helloworld-client/target"))); + clientNode.start(); + + Helloworld service = serviceNode.getService(Helloworld.class, "HelloworldService"); + assertNotNull(service); + assertEquals("Hello Petra", service.sayHello("Petra")); + + Helloworld client = clientNode.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + + serviceNode.stop(); + + client = clientNode.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + try { + client.sayHello("Petra"); + fail(); + } catch (Exception e) { + // expected + // TODO: better exception than NPE + } + + serviceNode = factory.createNode(new Contribution("service", getJar("../helloworld-service/target"))); + serviceNode.start(); + + client = clientNode.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + } + + /** + * Get the jar in the target folder without being dependent on the version name to + * make tuscany releases easier + */ + private static String getJar(String targetDirectory) { + File f = new File(targetDirectory); + for (File file : f.listFiles()) { + if (file.getName().endsWith(".jar")) { + return file.toURI().toString(); + } + } + throw new IllegalStateException("Can't find jar in: " + targetDirectory); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (serviceNode != null) { + serviceNode.stop(); + } + if (clientNode != null) { + clientNode.stop(); + } + } +} diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/src/test/java/itest/TestCaseRunner.java b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/src/test/java/itest/TestCaseRunner.java new file mode 100644 index 0000000000..7dfa6e66cc --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/src/test/java/itest/TestCaseRunner.java @@ -0,0 +1,292 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package itest; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.security.AccessController; +import java.security.PrivilegedAction; + +/** + * A helper class that can be used to run an SCA JUnit test case. The test case will run in an isolated class loader. + * + * @version $Rev$ $Date$ + */ +public class TestCaseRunner { + + private ClassLoader classLoader; + private Class testSuiteClass; + private Object testSuite; + private Class testResultClass; + private Class testCaseClass; + private Object testCase; + + private Class beforeAnnotation; + private Class beforeClassAnnotation; + private Class afterAnnotation; + private Class afterClassAnnotation; + private Class junit4AdapterClass; + private Class junit3TestCaseClass; + + /** + * Constructs a new TestCase runner. + * + * @param testClass + */ + public TestCaseRunner(Class testClass) { + try { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + classLoader = testClass.getClassLoader(); + if (classLoader instanceof URLClassLoader) { + URL[] urls = ((URLClassLoader)classLoader).getURLs(); + classLoader = new URLClassLoader(urls, classLoader.getParent()); + } else if (classLoader == tccl || classLoader.getParent() == tccl) { + classLoader = new URLClassLoader(new URL[0], classLoader); + } else { + classLoader = tccl; + } + + try { + // Thread.currentThread().setContextClassLoader(classLoader); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finalClassLoader = classLoader; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finalClassLoader); + return null; + } + }); + + testCaseClass = Class.forName(testClass.getName(), true, classLoader); + testCase = testCaseClass.newInstance(); + ClassLoader testClassLoader = testCaseClass.getClassLoader(); + + junit3TestCaseClass = Class.forName("junit.framework.TestCase", true, testClassLoader); + + testSuiteClass = Class.forName("junit.framework.TestSuite", true, testClassLoader); + Constructor testSuiteConstructor = testSuiteClass.getConstructor(Class.class); + testSuite = testSuiteConstructor.newInstance(testCaseClass); + + testResultClass = Class.forName("junit.framework.TestResult", true, testClassLoader); + + try { + beforeAnnotation = Class.forName("org.junit.Before", true, testClassLoader); + afterAnnotation = Class.forName("org.junit.After", true, testClassLoader); + beforeClassAnnotation = Class.forName("org.junit.BeforeClass", true, testClassLoader); + afterClassAnnotation = Class.forName("org.junit.AfterClass", true, testClassLoader); + junit4AdapterClass = Class.forName("junit.framework.JUnit4TestAdapter", true, testClassLoader); + } catch (Exception e) { + // Unexpected + throw new AssertionError(e); + } + } catch (Throwable e) { + e.printStackTrace(); + } finally { + // Thread.currentThread().setContextClassLoader(tccl); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finaltccl = tccl; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finaltccl); + return null; + } + }); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * Run the test case + */ + public void run() { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + try { + // Thread.currentThread().setContextClassLoader(classLoader); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finalClassLoader = classLoader; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finalClassLoader); + return null; + } + }); + + if (junit3TestCaseClass.isAssignableFrom(testCaseClass)) { + Object testResult = testResultClass.newInstance(); + Method runMethod = testSuiteClass.getMethod("run", testResultClass); + runMethod.invoke(testSuite, testResult); + } else { + Object junit4Adapter = junit4AdapterClass.getConstructor(Class.class).newInstance(testCaseClass); + Object testResult = testResultClass.newInstance(); + Method runMethod = junit4AdapterClass.getMethod("run", testResultClass); + runMethod.invoke(junit4Adapter, testResult); + } + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + // Thread.currentThread().setContextClassLoader(tccl); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finaltccl = tccl; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finaltccl); + return null; + } + }); + } + } + + /** + * Invoke the setUp method + */ + public void setUp() { + execute("setUp"); + } + + /** + * Invoke the before methods + */ + public void before() { + execute(beforeAnnotation); + } + + /** + * Invoke the beforeClass methods + */ + public void beforeClass() { + execute(beforeClassAnnotation); + } + + /** + * Invoke the tearDown method + */ + public void tearDown() { + execute("tearDown"); + } + + /** + * Invoke the after methods + */ + public void after() { + execute(afterAnnotation); + } + + /** + * Invoke the afterClass methods + */ + public void afterClass() { + execute(afterClassAnnotation); + } + + /** + * Invoke the specified test method. + */ + public void run(String methodName) { + execute(methodName); + } + + /** + * Invoke the methods annotated with the specified annotation. + */ + private void execute(Class annotationClass) { + if (annotationClass == null) { + throw new RuntimeException(new NoSuchMethodException()); + } + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + try { + // Thread.currentThread().setContextClassLoader(classLoader); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finalClassLoader = classLoader; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finalClassLoader); + return null; + } + }); + + for (Method method : testCaseClass.getDeclaredMethods()) { + for (Annotation annotation : method.getAnnotations()) { + if (annotation.annotationType() == annotationClass) { + method.invoke(testCase); + } + } + } + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + // Thread.currentThread().setContextClassLoader(tccl); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finaltccl = tccl; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finaltccl); + return null; + } + }); + } + } + + /** + * Invoke the specified method + */ + private void execute(String methodName) { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + try { + // Thread.currentThread().setContextClassLoader(classLoader); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finalClassLoader = classLoader; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finalClassLoader); + return null; + } + }); + Method setUpMethod = testCaseClass.getDeclaredMethod(methodName); + setUpMethod.setAccessible(true); + setUpMethod.invoke(testCase); + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + // Thread.currentThread().setContextClassLoader(tccl); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finaltccl = tccl; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finaltccl); + return null; + } + }); + } + } + +} + diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java new file mode 100644 index 0000000000..769aad1940 --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java @@ -0,0 +1,105 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package itest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import itest.nodes.Helloworld; + +import java.io.File; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.apache.tuscany.sca.node.configuration.NodeConfiguration; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.oasisopen.sca.client.SCAClient; + +/** + * This shows how to test the Calculator service component. + */ +public class TwoNodesTestCase { + + private static Node serviceNode; + private static Node clientNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + System.setProperty("org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint.enabled", + "false"); + NodeFactory factory = NodeFactory.newInstance(); + NodeConfiguration configuration1 = + factory.createNodeConfiguration().setURI("serviceNode") + .addContribution("service", getJar("../helloworld-service/target")); + serviceNode = factory.createNode(configuration1).start(); + + NodeConfiguration configuration2 = + factory.createNodeConfiguration().setURI("clientNode") + .addContribution("client", getJar("../helloworld-client/target")); + clientNode = factory.createNode(configuration2).start(); + } + + /** + * Get the jar in the target folder without being dependent on the version name to + * make tuscany releases easier + */ + private static String getJar(String targetDirectory) { + File f = new File(targetDirectory); + for (File file : f.listFiles()) { + if (file.getName().endsWith(".jar")) { + return file.toURI().toString(); + } + } + throw new IllegalStateException("Can't find jar in: " + targetDirectory); + } + + @Test + public void testCalculator() throws Exception { + Helloworld service = serviceNode.getService(Helloworld.class, "HelloworldService"); + assertNotNull(service); + assertEquals("Hello Petra", service.sayHello("Petra")); + + Helloworld client = clientNode.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + } + + @Test + public void testCalculatorClientAPI() throws Exception { + Helloworld service = SCAClient.getService(Helloworld.class, "HelloworldService"); + assertNotNull(service); + assertEquals("Hello Petra", service.sayHello("Petra")); + + Helloworld client = SCAClient.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (serviceNode != null) { + serviceNode.stop(); + } + if (clientNode != null) { + clientNode.stop(); + } + } +} diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/build.xml b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/build.xml new file mode 100644 index 0000000000..933aec2636 --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/build.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/client-config.xml b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/client-config.xml new file mode 100644 index 0000000000..c2aa76ef37 --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/client-config.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/client.xml b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/client.xml new file mode 100644 index 0000000000..bb65805144 --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/client.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/pom.xml b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/pom.xml new file mode 100644 index 0000000000..34eadae505 --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/pom.xml @@ -0,0 +1,117 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4-SNAPSHOT + ../pom.xml + + itest-nodes-two-nodes-two-vms-test + Apache Tuscany SCA iTest Nodes Two Nodes Two VMs Test + + + + org.apache.tuscany.sca + tuscany-endpoint-tribes + 2.0-M4-SNAPSHOT + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0-M4-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-node-launcher + 2.0-M4-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-sca-client-impl + 2.0-M4-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-binding-sca-axis2-runtime + 2.0-M4-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-M4-SNAPSHOT + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.3 + + + + ant + ant-trax + 1.6.5 + + + + sun.jdk + tools + 1.6 + system + ${java.home}/../lib/tools.jar + + + + + + run-samples + verify + + run + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/server-config.xml b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/server-config.xml new file mode 100644 index 0000000000..14a48f507a --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/server-config.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/server.xml b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/server.xml new file mode 100644 index 0000000000..7b6d206b7f --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/server.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/TwoNodesTestCase.java b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/TwoNodesTestCase.java new file mode 100644 index 0000000000..b27d16a562 --- /dev/null +++ b/sca-java-2.x/branches/sca-java-2.0-M4/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/TwoNodesTestCase.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package itest; + +import java.io.File; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * This shows how to test the Calculator service component. + */ +public class TwoNodesTestCase { + + private static Node serviceNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + NodeFactory factory = NodeFactory.newInstance(); + + serviceNode = factory.createNode(new File("server-config.xml").toURI().toURL()); + serviceNode.start(); + + } + + @Test + public void testNothing() throws Exception { + + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (serviceNode != null) { + serviceNode.stop(); + } + } +} -- cgit v1.2.3