diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-10 14:19:41 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-10 14:19:41 +0000 |
commit | 81db250c8905290b5342d50d72a4f4c28d907200 (patch) | |
tree | 46230c27581c550918754ebbc1981724543da7a8 /sca-java-2.x/trunk/itest | |
parent | d6a3aa52332425e7037baeb8f1518f6842e21364 (diff) |
Add a test that just uses the SCAClient to talk to the remote SCA node. I.e. it doesn't start up a full SCA application
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@908511 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/itest')
4 files changed, 74 insertions, 20 deletions
diff --git a/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/build.xml b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/build.xml index 92f3069596..acc0dcb591 100644 --- a/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/build.xml +++ b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/build.xml @@ -29,6 +29,7 @@ <sequential>
<sleep seconds="4"/>
<ant antfile="client.xml"/>
+ <ant antfile="scaclient.xml"/>
</sequential>
</parallel>
diff --git a/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/client.xml b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/client.xml index d5c5793520..b7a0e63a48 100644 --- a/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/client.xml +++ b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/client.xml @@ -21,11 +21,11 @@ <!--echo>${runtime_classpath}</echo-->
<target name="run">
- <java classpath="${runtime_classpath};./target/test-classes"
+ <java classpath="${runtime_classpath};./target/test-classes"
classname="itest.Client"
fork="true"
failonerror="true">
- </java>
+ </java>
</target>
diff --git a/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/scaclient.xml b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/scaclient.xml new file mode 100644 index 0000000000..b85d1a7915 --- /dev/null +++ b/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/scaclient.xml @@ -0,0 +1,54 @@ +<!-- + * 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. +--> +<project name="scaclient" default="run"> + + <!--echo>${runtime_classpath}</echo--> + + <target name="run"> + <java classpath="${runtime_classpath};./target/test-classes" + classname="itest.SCAClient" + fork="true" + failonerror="true"> + </java> + </target> + + <target name="run-cmdline"> + <java classpath="../../../distribution/all/target/apache-tuscany-sca-all-2.0-SNAPSHOT.dir/tuscany-sca-2.0-SNAPSHOT/features/tuscany-sca-manifest.jar:./target/test-classes:../helloworld-iface/target/classes" + classname="itest.SCAClient" + fork="true" + failonerror="true"> + </java> + </target> + + <target name="run-cmdline-seq"> + <sequential> + <antcall target="run-cmdline"/> + <antcall target="run-cmdline"/> + <antcall target="run-cmdline"/> + </sequential> + </target> + + <target name="run-cmdline-par"> + <parallel> + <antcall target="run-cmdline"/> + <antcall target="run-cmdline"/> + <antcall target="run-cmdline"/> + </parallel> + </target> +</project>
\ No newline at end of file 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 e30c468d75..cf6d34348e 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,39 +23,38 @@ import itest.nodes.Helloworld; import java.net.URI; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; +import org.apache.tuscany.sca.node.NodeFactory; import org.oasisopen.sca.client.SCAClientFactory; public class SCAClient { - @BeforeClass - public static void setUpBeforeClass() throws Exception { - // do nothing - } - - @Test public void testSCAClient() throws Exception { // The configuration required when running with sca-client-rmi and endpoint-hazelcast-rmi - // Helloworld service = SCAClientFactory.newInstance(URI.create("tuscany:default?remotes=192.168.247.1:14820")).getService(Helloworld.class, "HelloworldService"); + //SCAClientFactory factory = SCAClientFactory.newInstance(URI.create("tuscanyclient:default?remotes=192.168.247.1:14820")); // The configuration required when running with sca-client-impl and endpoint-hazelcast - Helloworld service = SCAClientFactory.newInstance(URI.create("tuscany:default")).getService(Helloworld.class, "HelloworldService"); + SCAClientFactory factory = SCAClientFactory.newInstance(URI.create("tuscany:default")); + + Helloworld service = factory.getService(Helloworld.class, "HelloworldService"); String response = service.sayHello("test"); if (response == null || !response.equals("Hello test")){ throw new Exception("Test failed - expecting 'Hello test' got " + response); } else { - System.out.println(response); + System.out.println("Test success - " + response); } + + //TODO - When using the hazelcast registry (or client) it causes the + // JVM to hang on shutdown as it created non-daemon threads + // So destroy the node factory here which should bring down + // the runtime and hence hazelcast. + // There's currently no interface on the client factory + // for doing this so we may need to talk to OASIS about adding one + // or just rely on the runtime hosting the classes using the SCAClient + // when it's on its way down + NodeFactory.getInstance().destroy(); } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - // do nothing - } - + public static void main(String[] args) throws Exception { SCAClient client = new SCAClient(); client.testSCAClient(); |