You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by kw...@apache.org on 2008/05/20 01:35:55 UTC

svn commit: r658041 - in /incubator/tuscany/java/sca/vtest/java-api: apis/conversation/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/ apis/requestcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/ api...

Author: kwilliams
Date: Mon May 19 16:35:54 2008
New Revision: 658041

URL: http://svn.apache.org/viewvc?rev=658041&view=rev
Log:
More refactoring

Modified:
    incubator/tuscany/java/sca/vtest/java-api/apis/conversation/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/ConversationTestCase.java
    incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/RequestContextTestCase.java
    incubator/tuscany/java/sca/vtest/java-api/apis/servicereference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/ServiceReferenceTestCase.java
    incubator/tuscany/java/sca/vtest/java-api/conversation/callback/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/CallbackTestCase.java

Modified: incubator/tuscany/java/sca/vtest/java-api/apis/conversation/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/ConversationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/conversation/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/ConversationTestCase.java?rev=658041&r1=658040&r2=658041&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/conversation/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/ConversationTestCase.java (original)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/conversation/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/conversation/ConversationTestCase.java Mon May 19 16:35:54 2008
@@ -19,17 +19,17 @@
 
 package org.apache.tuscany.sca.vtest.javaapi.apis.conversation;
 
-import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
 /**
- * This test class tests the Conversation interface described in 1.7.5 of the SCA Java Annotations & APIs Specification 1.0.
+ * This test class tests the Conversation interface described in 1.7.5 of the
+ * SCA Java Annotations & APIs Specification 1.0.
  */
 public class ConversationTestCase {
 
-    protected static SCADomain domain;
     protected static String compositeName = "conversation.composite";
     protected static AComponent a;
     protected static BComponent b;
@@ -38,9 +38,9 @@
     public static void init() throws Exception {
         try {
             System.out.println("Setting up");
-            domain = SCADomain.newInstance(compositeName);
-            a = domain.getService(AComponent.class, "AComponent");
-            b = domain.getService(BComponent.class, "BComponent");
+            ServiceFinder.init(compositeName);
+            a = ServiceFinder.getService(AComponent.class, "AComponent");
+            b = ServiceFinder.getService(BComponent.class, "BComponent");
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -49,18 +49,15 @@
     @AfterClass
     public static void destroy() throws Exception {
         System.out.println("Cleaning up");
-        if (domain != null) {
-            domain.close();
-        }
+        ServiceFinder.cleanup();
     }
 
     /**
      * L941, L942 <br>
-     * 
-     * getConversationID() – Returns the identifier for this conversation.
-     * If a user-defined identity had been supplied for this reference then its value will be returned;
-     * otherwise the identity generated by the system when the conversation was initiated will be returned. <br>
-     * 
+     * getConversationID() – Returns the identifier for this conversation. If a
+     * user-defined identity had been supplied for this reference then its value
+     * will be returned; otherwise the identity generated by the system when the
+     * conversation was initiated will be returned. <br>
      * end() – Ends this conversation.
      * 
      * @throws Exception

Modified: incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/RequestContextTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/RequestContextTestCase.java?rev=658041&r1=658040&r2=658041&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/RequestContextTestCase.java (original)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/requestcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/requestcontext/RequestContextTestCase.java Mon May 19 16:35:54 2008
@@ -19,7 +19,7 @@
 
 package org.apache.tuscany.sca.vtest.javaapi.apis.requestcontext;
 
-import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
@@ -27,11 +27,11 @@
 import org.junit.Test;
 
 /**
- * This test class tests the RequestContext interface described in 1.7.2 of the SCA Java Annotations & APIs Specification 1.0.
+ * This test class tests the RequestContext interface described in 1.7.2 of the
+ * SCA Java Annotations & APIs Specification 1.0.
  */
 public class RequestContextTestCase {
 
-    protected static SCADomain domain;
     protected static String compositeName = "requestcontext.composite";
     protected static AComponent a;
     protected static BComponent b;
@@ -40,9 +40,9 @@
     public static void init() throws Exception {
         try {
             System.out.println("Setting up");
-            domain = SCADomain.newInstance(compositeName);
-            a = domain.getService(AComponent.class, "AComponent");
-            b = domain.getService(BComponent.class, "BComponent");
+            ServiceFinder.init(compositeName);
+            a = ServiceFinder.getService(AComponent.class, "AComponent");
+            b = ServiceFinder.getService(BComponent.class, "BComponent");
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -51,9 +51,7 @@
     @AfterClass
     public static void destroy() throws Exception {
         System.out.println("Cleaning up");
-        if (domain != null) {
-            domain.close();
-        }
+        ServiceFinder.cleanup();
     }
 
     /**
@@ -69,7 +67,8 @@
 
     /**
      * L860 <br>
-     * getServiceName() – Returns the name of the service on the Java implementation the request came in on.
+     * getServiceName() – Returns the name of the service on the Java
+     * implementation the request came in on.
      * 
      * @throws Exception
      */
@@ -80,8 +79,9 @@
 
     /**
      * L861, L862 <br>
-     * getCallbackReference() – Returns a callable reference to the callback as specified by the caller.
-     * getCallback() – Returns a proxy for the callback as specified by the caller.
+     * getCallbackReference() – Returns a callable reference to the callback as
+     * specified by the caller. getCallback() – Returns a proxy for the callback
+     * as specified by the caller.
      * 
      * @throws Exception
      */
@@ -92,9 +92,10 @@
 
     /**
      * L863 <br>
-     * getServiceReference() – When invoked during the execution of a service operation,
-     * this API MUST return a CallableReference that represents the service.  When invoked during the execution of a callback operation,
-     * this API MUST return a CallableReference that represents the callback service.
+     * getServiceReference() – When invoked during the execution of a service
+     * operation, this API MUST return a CallableReference that represents the
+     * service. When invoked during the execution of a callback operation, this
+     * API MUST return a CallableReference that represents the callback service.
      * 
      * @throws Exception
      */

Modified: incubator/tuscany/java/sca/vtest/java-api/apis/servicereference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/ServiceReferenceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/servicereference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/ServiceReferenceTestCase.java?rev=658041&r1=658040&r2=658041&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/servicereference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/ServiceReferenceTestCase.java (original)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/servicereference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/servicereference/ServiceReferenceTestCase.java Mon May 19 16:35:54 2008
@@ -19,20 +19,18 @@
 
 package org.apache.tuscany.sca.vtest.javaapi.apis.servicereference;
 
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.apache.tuscany.sca.vtest.javaapi.apis.servicereference.AComponent;
-import org.apache.tuscany.sca.vtest.javaapi.apis.servicereference.BComponent;
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
 /**
- * This test class tests the ServiceReference interface described in 1.7.4 of the SCA Java Annotations & APIs Specification 1.0.
+ * This test class tests the ServiceReference interface described in 1.7.4 of
+ * the SCA Java Annotations & APIs Specification 1.0.
  */
 public class ServiceReferenceTestCase {
 
-    protected static SCADomain domain;
     protected static String compositeName = "servicereference.composite";
     protected static AComponent a;
     protected static BComponent b;
@@ -41,9 +39,9 @@
     public static void init() throws Exception {
         try {
             System.out.println("Setting up");
-            domain = SCADomain.newInstance(compositeName);
-            a = domain.getService(AComponent.class, "AComponent");
-            b = domain.getService(BComponent.class, "BComponent");
+            ServiceFinder.init(compositeName);
+            a = ServiceFinder.getService(AComponent.class, "AComponent");
+            b = ServiceFinder.getService(BComponent.class, "BComponent");
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -52,19 +50,18 @@
     @AfterClass
     public static void destroy() throws Exception {
         System.out.println("Cleaning up");
-        if (domain != null) {
-            domain.close();
-        }
+        ServiceFinder.cleanup();
     }
 
     /**
      * L915, L916 <br>
-     * 
-     * getConversationID() - Returns the id supplied by the user that will be associated with conversations initiated through this reference. <br>
-     * 
-     * setConversationID(Object conversationId) – Set the id to associate with any conversation started through this reference.
-     * If the value supplied is null then the id will be generated by the implementation.
-     * Throws an IllegalStateException if a conversation is currently associated with this reference.
+     * getConversationID() - Returns the id supplied by the user that will be
+     * associated with conversations initiated through this reference. <br>
+     * setConversationID(Object conversationId) – Set the id to associate with
+     * any conversation started through this reference. If the value supplied is
+     * null then the id will be generated by the implementation. Throws an
+     * IllegalStateException if a conversation is currently associated with this
+     * reference.
      * 
      * @throws Exception
      */

Modified: incubator/tuscany/java/sca/vtest/java-api/conversation/callback/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/CallbackTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/conversation/callback/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/CallbackTestCase.java?rev=658041&r1=658040&r2=658041&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/conversation/callback/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/CallbackTestCase.java (original)
+++ incubator/tuscany/java/sca/vtest/java-api/conversation/callback/src/test/java/org/apache/tuscany/sca/vtest/javaapi/conversation/callback/CallbackTestCase.java Mon May 19 16:35:54 2008
@@ -19,7 +19,7 @@
 
 package org.apache.tuscany.sca.vtest.javaapi.conversation.callback;
 
-import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
@@ -31,7 +31,6 @@
  */
 public class CallbackTestCase {
 
-    protected static SCADomain domain;
     protected static AService aService = null;
 
     @Before
@@ -47,9 +46,7 @@
     public void destroy() throws Exception {
 
         System.out.println("Cleaning up");
-        if (domain != null)
-            domain.close();
-
+        ServiceFinder.cleanup();
     }
 
     /**
@@ -109,8 +106,8 @@
     @Test
     public void statefulCallback() throws Exception {
         System.out.println("Setting up for callback tests");
-        domain = SCADomain.newInstance("callback.composite");
-        aService = domain.getService(AService.class, "AComponent");
+        ServiceFinder.init("callback.composite");
+        aService = ServiceFinder.getService(AService.class, "AComponent");
         aService.testCallback();
     }
 
@@ -171,8 +168,8 @@
     @Test
     public void localstatefulCallback() throws Exception {
         System.out.println("Setting up for local callback tests");
-        domain = SCADomain.newInstance("callback-local.composite");
-        aService = domain.getService(AService.class, "AComponent");
+        ServiceFinder.init("callback-local.composite");
+        aService = ServiceFinder.getService(AService.class, "AComponent");
         aService.testCallback();
     }
 
@@ -190,8 +187,8 @@
     @Ignore("TUSCANY-2291")
     public void statefulMixedCallback() throws Exception {
         System.out.println("Setting up for mixed local/remote callback tests");
-        domain = SCADomain.newInstance("callback-mixed.composite");
-        aService = domain.getService(AService.class, "AComponent");
+        ServiceFinder.init("callback-mixed.composite");
+        aService = ServiceFinder.getService(AService.class, "AComponent");
         aService.testCallback();
     }
 
@@ -211,8 +208,8 @@
     @Test
     public void statelessCallback() throws Exception {
         System.out.println("Setting up for stateless callback tests");
-        domain = SCADomain.newInstance("callback-stateless.composite");
-        aService = domain.getService(AService.class, "AComponent");
+        ServiceFinder.init("callback-stateless.composite");
+        aService = ServiceFinder.getService(AService.class, "AComponent");
         aService.testCallback();
     }
 
@@ -250,8 +247,8 @@
     @Test
     public void statelessCallback2() throws Exception {
         System.out.println("Setting up for stateless callback id tests");
-        domain = SCADomain.newInstance("callback-stateless-callbackid.composite");
-        aService = domain.getService(AService.class, "AComponent");
+        ServiceFinder.init("callback-stateless-callbackid.composite");
+        aService = ServiceFinder.getService(AService.class, "AComponent");
         aService.testCallback();
 
     }
@@ -272,8 +269,8 @@
     // @Ignore("TUSCANY-2306")
     public void statelessCallback3() throws Exception {
         System.out.println("Setting up for stateless callback ref null tests");
-        domain = SCADomain.newInstance("callback-stateless-callbackfieldnull.composite");
-        aService = domain.getService(AService.class, "AComponent");
+        ServiceFinder.init("callback-stateless-callbackfieldnull.composite");
+        aService = ServiceFinder.getService(AService.class, "AComponent");
         aService.testCallback();
 
     }
@@ -298,8 +295,8 @@
     @Ignore("TUSCANY-2311")
     public void statefulMultiBidirectional() throws Exception {
         System.out.println("Setting up for multi-bidirectional interfaces tests");
-        domain = SCADomain.newInstance("callback-multi.composite");
-        aService = domain.getService(AService.class, "AComponent");
+        ServiceFinder.init("callback-multi.composite");
+        aService = ServiceFinder.getService(AService.class, "AComponent");
         aService.testCallback();
         aService.testCallback2(); // Includes test for 670,671
 
@@ -328,8 +325,8 @@
     @Test
     public void accessingCallbacks() throws Exception {
         System.out.println("Setting up for callback accessing tests");
-        domain = SCADomain.newInstance("callback-accessing.composite");
-        aService = domain.getService(AService.class, "AComponent");
+        ServiceFinder.init("callback-accessing.composite");
+        aService = ServiceFinder.getService(AService.class, "AComponent");
         aService.testCallback();
         aService.testCallback2(); // Lines 695-696
 
@@ -352,8 +349,8 @@
     @Test
     public void callbackId() throws Exception {
         System.out.println("Setting up for callback id tests");
-        domain = SCADomain.newInstance("callback-id.composite");
-        aService = domain.getService(AService.class, "AComponent");
+        ServiceFinder.init("callback-id.composite");
+        aService = ServiceFinder.getService(AService.class, "AComponent");
         aService.testCallback();
 
     }
@@ -367,15 +364,16 @@
      * method. The object passed as the callback should implement the interface
      * defined for the callback, including any additional SCA semantics on that
      * interface such as its scope and whether or not it is remotable.
+     * <p>
      * TODO - Need to complete testing of 1.6.7.5 after resolution of t-2312
      */
     @Test
-    @Ignore("TUSCANY-2312") 
+    @Ignore("TUSCANY-2312")
     public void customCallback() throws Exception {
         System.out.println("Setting up for custom callback tests; create domain instance");
-        domain = SCADomain.newInstance("callback-custom.composite");
-        System.out.println("Setting up for custom callback tests; get AService handle");  
-        aService = domain.getService(AService.class, "AComponent");
+        ServiceFinder.init("callback-custom.composite");
+        System.out.println("Setting up for custom callback tests; get AService handle");
+        aService = ServiceFinder.getService(AService.class, "AComponent");
         aService.testCallback();
 
     }