Author: slaws
Date: Wed Feb 10 14:19:41 2010
New Revision: 908511

URL: http://svn.apache.org/viewvc?rev=908511&view=rev
Log:
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

Added:
    
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/scaclient.xml
   (with props)
Modified:
    tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/build.xml
    
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/client.xml
    
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/src/test/java/itest/SCAClient.java

Modified: 
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/build.xml
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/build.xml?rev=908511&r1=908510&r2=908511&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/build.xml 
(original)
+++ 
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/build.xml 
Wed Feb 10 14:19:41 2010
@@ -29,6 +29,7 @@
             <sequential>
                 <sleep seconds="4"/>
                 <ant antfile="client.xml"/>
+               <ant antfile="scaclient.xml"/>
             </sequential>
 
        </parallel>     

Modified: 
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/client.xml
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/client.xml?rev=908511&r1=908510&r2=908511&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/client.xml 
(original)
+++ 
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/client.xml 
Wed Feb 10 14:19:41 2010
@@ -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>
 
        

Added: 
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/scaclient.xml
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/scaclient.xml?rev=908511&view=auto
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/scaclient.xml
 (added)
+++ 
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/scaclient.xml
 Wed Feb 10 14:19:41 2010
@@ -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

Propchange: 
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/scaclient.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/scaclient.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/scaclient.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: 
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/src/test/java/itest/SCAClient.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/src/test/java/itest/SCAClient.java?rev=908511&r1=908510&r2=908511&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/src/test/java/itest/SCAClient.java
 (original)
+++ 
tuscany/sca-java-2.x/trunk/itest/nodes/two-nodes-two-vms-hazelcast/src/test/java/itest/SCAClient.java
 Wed Feb 10 14:19:41 2010
@@ -23,39 +23,38 @@
 
 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();


Reply via email to