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:23:58 UTC

svn commit: r658039 - in /incubator/tuscany/java/sca/vtest/java-api: annotations/oneway/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/ annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/...

Author: kwilliams
Date: Mon May 19 16:23:57 2008
New Revision: 658039

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

Modified:
    incubator/tuscany/java/sca/vtest/java-api/annotations/oneway/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/OneWayAnnotationTestCase.java
    incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java
    incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java
    incubator/tuscany/java/sca/vtest/java-api/annotations/scope/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/ScopeAnnotationTestCase.java
    incubator/tuscany/java/sca/vtest/java-api/annotations/service/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/ServiceAnnotationTestCase.java
    incubator/tuscany/java/sca/vtest/java-api/apis/callablereference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/CallableReferenceTestCase.java
    incubator/tuscany/java/sca/vtest/java-api/apis/componentcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/ComponentContextTestCase.java

Modified: incubator/tuscany/java/sca/vtest/java-api/annotations/oneway/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/OneWayAnnotationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/oneway/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/OneWayAnnotationTestCase.java?rev=658039&r1=658038&r2=658039&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/annotations/oneway/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/OneWayAnnotationTestCase.java (original)
+++ incubator/tuscany/java/sca/vtest/java-api/annotations/oneway/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/oneway/OneWayAnnotationTestCase.java Mon May 19 16:23:57 2008
@@ -19,10 +19,6 @@
 
 package org.apache.tuscany.sca.vtest.javaapi.annotations.oneway;
 
-import static org.junit.Assert.fail;
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
 import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;

Modified: incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java?rev=658039&r1=658038&r2=658039&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java (original)
+++ incubator/tuscany/java/sca/vtest/java-api/annotations/property/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/property/PropertyAnnotationTestCase.java Mon May 19 16:23:57 2008
@@ -22,14 +22,11 @@
 import static org.junit.Assert.fail;
 import junit.framework.Assert;
 
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.property.AService;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.property.CService;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.property.AnotherAService;
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
-import org.junit.Test;
 import org.junit.Ignore;
+import org.junit.Test;
 
 /**
  * This test class tests the Property annotation described in section 1.2.3
@@ -37,7 +34,6 @@
  */
 public class PropertyAnnotationTestCase {
 
-    protected static SCADomain domain;
     protected static String compositeName = "property.composite";
     protected static AService aService = null;
     protected static CService cService1 = null;
@@ -52,15 +48,15 @@
     public static void init() throws Exception {
         try {
             System.out.println("Setting up");
-            domain = SCADomain.newInstance(compositeName);
-            aService = domain.getService(AService.class, "AComponent");
-            cService1 = domain.getService(CService.class, "CComponent1");
-            cService2 = domain.getService(CService.class, "CComponent2");
-            cService3 = domain.getService(CService.class, "CComponent3");
-            cService4 = domain.getService(CService.class, "CComponent4");
-            cService5 = domain.getService(CService.class, "CComponent5");
-            cService6 = domain.getService(CService.class, "CComponent6");
-            anotherAService = domain.getService(AnotherAService.class, "AnotherAComponent");
+            ServiceFinder.init(compositeName);
+            aService = ServiceFinder.getService(AService.class, "AComponent");
+            cService1 = ServiceFinder.getService(CService.class, "CComponent1");
+            cService2 = ServiceFinder.getService(CService.class, "CComponent2");
+            cService3 = ServiceFinder.getService(CService.class, "CComponent3");
+            cService4 = ServiceFinder.getService(CService.class, "CComponent4");
+            cService5 = ServiceFinder.getService(CService.class, "CComponent5");
+            cService6 = ServiceFinder.getService(CService.class, "CComponent6");
+            anotherAService = ServiceFinder.getService(AnotherAService.class, "AnotherAComponent");
         } catch (Exception ex) {
             ex.printStackTrace();
         }
@@ -70,30 +66,29 @@
     public static void destroy() throws Exception {
 
         System.out.println("Cleaning up");
-        if (domain != null)
-            domain.close();
+        ServiceFinder.cleanup();
 
     }
 
     /**
      * Lines 1343 to 1348:<br>
-     * The "@Property" annotation type is used to annotate a Java class field
-     * or a setter method that is used to inject an SCA property value. The
-     * type of the property injected, which can be a simple Java type or a
-     * complex Java type, is defined by the type of the Java class field or
-     * the type of the setter method input argument.<br>
-     * The "@Property" annotation may be used on protected or public fields
-     * and on setter methods or on a constructor method.<br>
+     * The "@Property" annotation type is used to annotate a Java class field or
+     * a setter method that is used to inject an SCA property value. The type of
+     * the property injected, which can be a simple Java type or a complex Java
+     * type, is defined by the type of the Java class field or the type of the
+     * setter method input argument.<br>
+     * The "@Property" annotation may be used on protected or public fields and
+     * on setter methods or on a constructor method.<br>
      * <p>
-     * p1  - simple Java type injected via field<br>
-     * p2  - simple Java type injected via field<br>
-     * p3  - simple Java type injected via setter<br>
-     * p4  - simple Java type injected via setter and required=true<br>
-     * p5  - simple Java type injected via constructor parameter<br>
-     * p6  - simple Java type injected via constructor parameter<br>
-     * p7  - complex Java type injected via field and required=true<br>
-     * p8  - complex Java type injected via field<br>
-     * p9  - complex Java type injected via setter<br>
+     * p1 - simple Java type injected via field<br>
+     * p2 - simple Java type injected via field<br>
+     * p3 - simple Java type injected via setter<br>
+     * p4 - simple Java type injected via setter and required=true<br>
+     * p5 - simple Java type injected via constructor parameter<br>
+     * p6 - simple Java type injected via constructor parameter<br>
+     * p7 - complex Java type injected via field and required=true<br>
+     * p8 - complex Java type injected via field<br>
+     * p9 - complex Java type injected via setter<br>
      * p10 - complex Java type injected via setter<br>
      * p11 - complex Java type injected via constructor parameter<br>
      * p12 - complex Java type injected via constructor parameter<br>
@@ -119,16 +114,19 @@
         Assert.assertEquals("p12.aString", aService.getP12AString());
         Assert.assertEquals(12, aService.getP12BInt());
     }
-    
+
     /**
      * Lines 1349 to 1352:<br>
      * Properties may also be injected via public setter methods even when the
-     * "@Property" annotation is not present. However, the @Property annotation
-     * must be used in order to inject a property onto a non-public field. In
-     * the case where there is no "@Property" annotation, the name of the
-     * property is the same as the name of the field or setter.<br>
-     * <p>
-     * p13 is an un-annotated public field which should be injected via field<br>
+     * "@Property" annotation is not present. However, the
+     * 
+     * @Property annotation must be used in order to inject a property onto a
+     *           non-public field. In the case where there is no "@Property"
+     *           annotation, the name of the property is the same as the name of
+     *           the field or setter.<br>
+     *           <p>
+     *           p13 is an un-annotated public field which should be injected
+     *           via field<br>
      */
     @Test
     public void atProperty2() throws Exception {
@@ -140,14 +138,15 @@
      * Where there is both a setter method and a field for a property, the
      * setter method is used.<br>
      * <p>
-     * p14 is an un-annotated public field, it should be injected via public setter<br>
+     * p14 is an un-annotated public field, it should be injected via public
+     * setter<br>
      */
     @Test
     public void atProperty3() throws Exception {
         Assert.assertEquals("p14", anotherAService.getP14());
         Assert.assertTrue(anotherAService.getP14SetterIsCalled());
     }
-    
+
     /**
      * Lines 1355 to 1357:<br>
      * The "@Property" annotation has the following attributes:<br>
@@ -161,24 +160,23 @@
      * p17 - injected via field but not defined in composite<br>
      * p18 - injected via setter but not defined in composite<br>
      * 
-     * @TODO - Need to test required=true but not defined in composite
-     *         (The specification does not describe the proper behaviour
-     *          in this situation.)
-     *          
+     * @TODO - Need to test required=true but not defined in composite (The
+     *       specification does not describe the proper behaviour in this
+     *       situation.)
      */
     @Test
     public void atProperty4() throws Exception {
-    	Assert.assertEquals("p15", aService.getP15());
-    	Assert.assertEquals("p16", aService.getP16());
-    	Assert.assertNull(aService.getP17());
-    	Assert.assertNull(aService.getP18());
+        Assert.assertEquals("p15", aService.getP15());
+        Assert.assertEquals("p16", aService.getP16());
+        Assert.assertNull(aService.getP17());
+        Assert.assertNull(aService.getP18());
     }
-    
+
     /**
      * Lines 1369 to 1370:<br>
-     * If the property is defined as an array or as a java.util.Collection,
-     * then the implied component type has a property with a many attribute
-     * set to true.<br>
+     * If the property is defined as an array or as a java.util.Collection, then
+     * the implied component type has a property with a many attribute set to
+     * true.<br>
      * <p>
      * p19 - a List and injected via field with no element<br>
      * p20 - a List and injected via setter<br>
@@ -186,72 +184,71 @@
      */
     @Test
     public void atProperty5() throws Exception {
-    	Assert.assertEquals(0, aService.getP19Size());
-    	Assert.assertEquals(1, aService.getP20Size());
-    	Assert.assertEquals("p20", aService.getP20(0));
-    	Assert.assertEquals(3, aService.getP21Size());
-    	Assert.assertEquals(2, aService.getP21(0));
-    	Assert.assertEquals(1, aService.getP21(1));
-    	Assert.assertEquals(21, aService.getP21(2));
+        Assert.assertEquals(0, aService.getP19Size());
+        Assert.assertEquals(1, aService.getP20Size());
+        Assert.assertEquals("p20", aService.getP20(0));
+        Assert.assertEquals(3, aService.getP21Size());
+        Assert.assertEquals(2, aService.getP21(0));
+        Assert.assertEquals(1, aService.getP21(1));
+        Assert.assertEquals(21, aService.getP21(2));
     }
-    
+
     /**
      * Lines 1141 to 1162:<br>
      * 1.8.5. "@Constructor"<br>
      * ...<br>
-     * The "@Constructor" annotation is used to mark a particular constructor
-     * to use when instantiating a Java component implementation.<br>
+     * The "@Constructor" annotation is used to mark a particular constructor to
+     * use when instantiating a Java component implementation.<br>
      * The "@Constructor" annotation has the following attribute:<br>
-     * <li>value (optional) – identifies the property/reference names that 
+     * <li>value (optional) – identifies the property/reference names that
      * correspond to each of the constructor arguments. The position in the
      * array determines which of the arguments are being named.</li>
      * <p>
      * cService1 - "@Constructor" without value and constructor arguments<br>
-     * cService2 - "@Constructor" without value but with constructor
-     *             arguments<br>
+     * cService2 - "@Constructor" without value but with constructor arguments<br>
      * cService3 - "@Constructor" with values and constructor arguments<br>
-     * cService4 - "@Constructor" with values and constructor arguments 
-     *             where value, property and parameter names are same<br>
-     * cService5 - "@Constructor" with switched values and constructor
-     *             arguments<br>
+     * cService4 - "@Constructor" with values and constructor arguments where
+     * value, property and parameter names are same<br>
+     * cService5 - "@Constructor" with switched values and constructor arguments<br>
      * cService6 - "@Constructor" with wrong values<br>
      */
     @Test
     public void atProperty6() throws Exception {
-    	Assert.assertNull(cService1.getB1Name());
-    	Assert.assertNull(cService1.getP2());
-    	Assert.assertEquals(0, cService1.getP3());
-    	Assert.assertNull(cService1.getP4());
-    	Assert.assertEquals("NoArgument", cService1.getConstructor());
-
-    	Assert.assertEquals("BService", cService2.getB1Name());
-    	Assert.assertEquals("p2", cService2.getP2());
-    	Assert.assertEquals(3, cService2.getP3());
-    	Assert.assertEquals("p4", cService2.getP4());
-    	Assert.assertEquals("AllArguments", cService2.getConstructor());
-
-    	Assert.assertEquals("BService", cService3.getB1Name());
-    	Assert.assertEquals("p2", cService3.getP2());
-    	Assert.assertEquals(3, cService3.getP3());
-    	Assert.assertEquals("p4", cService3.getP4());
-    	Assert.assertEquals("AllArguments", cService3.getConstructor());
-
-    	Assert.assertEquals("BService", cService4.getB1Name());
-    	Assert.assertEquals("p2", cService4.getP2());
-    	Assert.assertEquals(3, cService4.getP3());
-    	Assert.assertEquals("p4", cService4.getP4());
-    	Assert.assertEquals("AllArguments", cService4.getConstructor());
-
-    	Assert.assertEquals("BService", cService5.getB1Name());
-    	Assert.assertEquals("p4", cService5.getP2());
-    	Assert.assertEquals(3, cService5.getP3());
-    	Assert.assertEquals("p2", cService5.getP4());
-    	Assert.assertEquals("SwitchedValues", cService5.getConstructor());
-    	
-    	try {
-    		System.out.println(cService6.getB1Name());
-    		fail("Should have failed to call this service");
-    	} catch (Throwable t) {}
+        Assert.assertNull(cService1.getB1Name());
+        Assert.assertNull(cService1.getP2());
+        Assert.assertEquals(0, cService1.getP3());
+        Assert.assertNull(cService1.getP4());
+        Assert.assertEquals("NoArgument", cService1.getConstructor());
+
+        Assert.assertEquals("BService", cService2.getB1Name());
+        Assert.assertEquals("p2", cService2.getP2());
+        Assert.assertEquals(3, cService2.getP3());
+        Assert.assertEquals("p4", cService2.getP4());
+        Assert.assertEquals("AllArguments", cService2.getConstructor());
+
+        Assert.assertEquals("BService", cService3.getB1Name());
+        Assert.assertEquals("p2", cService3.getP2());
+        Assert.assertEquals(3, cService3.getP3());
+        Assert.assertEquals("p4", cService3.getP4());
+        Assert.assertEquals("AllArguments", cService3.getConstructor());
+
+        Assert.assertEquals("BService", cService4.getB1Name());
+        Assert.assertEquals("p2", cService4.getP2());
+        Assert.assertEquals(3, cService4.getP3());
+        Assert.assertEquals("p4", cService4.getP4());
+        Assert.assertEquals("AllArguments", cService4.getConstructor());
+
+        Assert.assertEquals("BService", cService5.getB1Name());
+        Assert.assertEquals("p4", cService5.getP2());
+        Assert.assertEquals(3, cService5.getP3());
+        Assert.assertEquals("p2", cService5.getP4());
+        Assert.assertEquals("SwitchedValues", cService5.getConstructor());
+
+        try {
+            System.out.println(cService6.getB1Name());
+            fail("Should have failed to call this service");
+        } catch (Throwable t) {
+        }
 
     }
 
@@ -259,13 +256,14 @@
      * Lines 1349 to 1352:<br>
      * 1.8.13. "@Property"<br>
      * ...<br>
-     * Properties may also be injected via public setter methods even when the "@Property" annotation is not
-     * present. However, the "@Property" annotation must be used in order to inject a property onto a non-public
-     * field. In the case where there is no "@Property" annotation, the name of the property is the same as the
-     * name of the field or setter.
+     * Properties may also be injected via public setter methods even when the
+     * "@Property" annotation is not present. However, the "@Property"
+     * annotation must be used in order to inject a property onto a non-public
+     * field. In the case where there is no "@Property" annotation, the name of
+     * the property is the same as the name of the field or setter.
      * <p>
-     * p22 is unannotated protected field which should not be injected
-     * p23 is un-annotated protected which should not be injected via protected setter<br> 
+     * p22 is unannotated protected field which should not be injected p23 is
+     * un-annotated protected which should not be injected via protected setter<br>
      */
     @Test
     @Ignore
@@ -275,18 +273,21 @@
         Assert.assertNull(anotherAService.getP23());
         Assert.assertFalse(anotherAService.getP23SetterIsCalled());
     }
-    
+
     /**
      * Lines 1349 to 1352:<br>
      * 1.8.13. "@Property"<br>
      * ...<br>
-     * Properties may also be injected via public setter methods even when the "@Property" annotation is not
-     * present. However, the "@Property" annotation must be used in order to inject a property onto a non-public
-     * field. In the case where there is no "@Property" annotation, the name of the property is the same as the
-     * name of the field or setter.
+     * Properties may also be injected via public setter methods even when the
+     * "@Property" annotation is not present. However, the "@Property"
+     * annotation must be used in order to inject a property onto a non-public
+     * field. In the case where there is no "@Property" annotation, the name of
+     * the property is the same as the name of the field or setter.
      * <p>
-     * p24 is un-annotated protected field which should be injected via public setter<br>
-     * p25 is un-annotated private field which should be injected via public setter<br>
+     * p24 is un-annotated protected field which should be injected via public
+     * setter<br>
+     * p25 is un-annotated private field which should be injected via public
+     * setter<br>
      */
     @Test
     public void atProperty8() throws Exception {
@@ -295,5 +296,5 @@
         Assert.assertEquals("p25", anotherAService.getP25());
         Assert.assertTrue(anotherAService.getP25SetterIsCalled());
     }
-    
+
 }

Modified: incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java?rev=658039&r1=658038&r2=658039&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java (original)
+++ incubator/tuscany/java/sca/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java Mon May 19 16:23:57 2008
@@ -23,18 +23,17 @@
 import junit.framework.Assert;
 
 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.Ignore;
 import org.junit.Test;
 
 /**
- * This test class tests the "@Reference" annotation described in section
- * 1.8.14
+ * This test class tests the "@Reference" annotation described in section 1.8.14
  */
 public class ReferenceAnnotationTestCase {
 
-    protected static SCADomain domain;
     protected static String compositeName = "ab.composite";
     protected static AService a;
 
@@ -42,9 +41,9 @@
     public static void init() throws Exception {
         try {
             System.out.println("Setting up");
-            domain = SCADomain.newInstance(compositeName);
-            a = domain.getService(AService.class, "AComponent");
-            
+            ServiceFinder.init(compositeName);
+            a = ServiceFinder.getService(AService.class, "AComponent");
+
         } catch (Exception ex) {
             ex.printStackTrace();
         }
@@ -54,9 +53,7 @@
     public static void destroy() throws Exception {
 
         System.out.println("Cleaning up");
-        if (domain != null)
-            domain.close();
-
+        ServiceFinder.cleanup();
     }
 
     /**
@@ -115,7 +112,7 @@
      */
     @Test
     public void atReference2() throws Exception {
-        AService anotherA = domain.getService(AService.class, "AnotherAComponent");
+        AService anotherA = ServiceFinder.getService(AService.class, "AnotherAComponent");
         Assert.assertEquals("BService", anotherA.getB4Name());
         try {
             anotherA.getB5Name();
@@ -159,14 +156,14 @@
     /**
      * Lines 1457 to 1459<br>
      * If the reference is not an array or collection, then the implied
-     * component type has a reference with a multiplicity of either 0..1 or
-     * 1..1 depending on the value of the @Reference required attribute –
-     * 1..1 applies if required=true.<br>
-     * <p>
-     * B10 is field injected, required=false, and multiplicity="0..1"<br>
-     * B11 is field injected, required=false, and multiplicity="1..1"<br>
-     * B12 is setter injected, required=true, and multiplicity="1..1"
-
+     * component type has a reference with a multiplicity of either 0..1 or 1..1
+     * depending on the value of the
+     * 
+     * @Reference required attribute – 1..1 applies if required=true.<br>
+     *            <p>
+     *            B10 is field injected, required=false, and multiplicity="0..1"<br>
+     *            B11 is field injected, required=false, and multiplicity="1..1"<br>
+     *            B12 is setter injected, required=true, and multiplicity="1..1"
      */
     @Test
     public void atReference5() throws Exception {
@@ -183,9 +180,12 @@
      * "@Reference" annotation is set to true or false – 1..n applies if
      * required=true.<br>
      * <p>
-     * B13 is a java.util.List, field injected, required=false, multiplicity="0..n", and no target<br>
-     * B14 is a java.util.List, setter injected, required=true, multiplicity="1..n", and one target<br>
-     * B15 is an array, field injected, required=true, multiplicity="1..n", and two targets
+     * B13 is a java.util.List, field injected, required=false,
+     * multiplicity="0..n", and no target<br>
+     * B14 is a java.util.List, setter injected, required=true,
+     * multiplicity="1..n", and one target<br>
+     * B15 is an array, field injected, required=true, multiplicity="1..n", and
+     * two targets
      */
     @Test
     public void atReference6() throws Exception {
@@ -196,14 +196,14 @@
         Assert.assertEquals("BService", a.getB15Name(1));
         Assert.assertEquals(2, a.getB15Size());
     }
-    
+
     /**
      * Lines 1415 <br>
      * required (optional) - whether injection of service or services is
      * required. Defaults to true.
      * <p>
-     * b16 and b17 is defined as "@Reference(required=false)" and
-     * AComponent does not define reference for them
+     * b16 and b17 is defined as "@Reference(required=false)" and AComponent
+     * does not define reference for them
      */
     @Test
     public void atReference7() throws Exception {

Modified: incubator/tuscany/java/sca/vtest/java-api/annotations/scope/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/ScopeAnnotationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/scope/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/ScopeAnnotationTestCase.java?rev=658039&r1=658038&r2=658039&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/annotations/scope/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/ScopeAnnotationTestCase.java (original)
+++ incubator/tuscany/java/sca/vtest/java-api/annotations/scope/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/scope/ScopeAnnotationTestCase.java Mon May 19 16:23:57 2008
@@ -22,15 +22,8 @@
 import java.util.ArrayList;
 
 import junit.framework.Assert;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.BService;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.CService;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.DService;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.FService;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.GService;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.HService;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.JService;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.scope.MService;
+
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
@@ -49,7 +42,6 @@
  */
 public class ScopeAnnotationTestCase {
 
-    protected static SCADomain domain;
     protected static String compositeName = "scope.composite";
 
     protected static int numDThread = 5;
@@ -60,7 +52,7 @@
     public static void init() throws Exception {
         try {
             System.out.println("Setting up");
-            domain = SCADomain.newInstance(compositeName);
+            ServiceFinder.init(compositeName);
         } catch (Exception ex) {
             ex.printStackTrace();
         }
@@ -70,9 +62,7 @@
     public static void destroy() throws Exception {
 
         System.out.println("Cleaning up");
-        if (domain != null)
-            domain.close();
-
+        ServiceFinder.cleanup();
     }
     
     /**
@@ -163,7 +153,7 @@
     @Test
     public void atScope3() throws Exception {
         System.out.println("atScope3");
-        FService fService = domain.getService(FService.class, "FComponent");
+        FService fService = ServiceFinder.getService(FService.class, "FComponent");
         String serviceName = fService.getName();
         boolean isInitReady   = fService.isInitReady();
 
@@ -206,7 +196,7 @@
     public void atScope4() throws Exception {
         System.out.println("atScope4");
 
-        GService gService = domain.getService(GService.class, "GComponent");
+        GService gService = ServiceFinder.getService(GService.class, "GComponent");
         int initCalledCounter    = gService.getInitCalledCounter();
         int destroyCalledCounter = gService.getDestroyCalledCounter();
         
@@ -245,7 +235,7 @@
         for (int i = 0; i < numHThread; i++)
         	g.get(i).join();
         
-        HService hService = domain.getService(HService.class, "HComponent");
+        HService hService = ServiceFinder.getService(HService.class, "HComponent");
         String failedReason = hService.testCounters(numHThread);
         System.out.println("");
 
@@ -275,7 +265,7 @@
     public void atScope6() throws Exception {
         System.out.println("atScope6");
 
-        JService jService = domain.getService(JService.class, "JComponent");
+        JService jService = ServiceFinder.getService(JService.class, "JComponent");
 		jService.getName();
 		Thread.sleep(2000);
 		String failedReason = jService.getFailedReason();
@@ -293,7 +283,7 @@
     public void atScope7() throws Exception {
         System.out.println("atScope7");
 
-        MService mService = domain.getService(MService.class, "MComponent");
+        MService mService = ServiceFinder.getService(MService.class, "MComponent");
         mService.getName();
 		Thread.sleep(6000);
 		String failedReason = mService.getFailedReason();
@@ -314,7 +304,7 @@
     	
     	@Override
     	public void run() {
-    		BService bService = domain.getService(BService.class, "BComponent");
+    		BService bService = ServiceFinder.getService(BService.class, "BComponent");
     		bService.setCurrentState(name + "-state-1");
     		System.out.println(name + "->" + bService.getName());
     		if (!bService.isInitReady()) {
@@ -356,7 +346,7 @@
     	
     	@Override
     	public void run() {
-    		CService cService = domain.getService(CService.class, "CComponent");
+    		CService cService = ServiceFinder.getService(CService.class, "CComponent");
     		cService.setCurrentState(name + "-state-1");
     		System.out.println(name + "->" + cService.getName());
     		if (!cService.isInitReady()) {
@@ -399,7 +389,7 @@
     	
     	@Override
     	public void run() {
-    		DService dService = domain.getService(DService.class, "DComponent");
+    		DService dService = ServiceFinder.getService(DService.class, "DComponent");
     		String serviceName = dService.getName();
     		System.out.println(name + "->" + serviceName);
     		
@@ -455,7 +445,7 @@
     	
     	@Override
     	public void run() {
-    		FService fService = domain.getService(FService.class, "FComponent");
+    		FService fService = ServiceFinder.getService(FService.class, "FComponent");
     		serviceName = fService.getName();
     		System.out.println(name + "->" + serviceName);
 
@@ -478,7 +468,7 @@
     	
     	@Override
     	public void run() {
-    		HService hService = domain.getService(HService.class, "HComponent");
+    		HService hService = ServiceFinder.getService(HService.class, "HComponent");
     		failedReason = hService.test();
         }
     }

Modified: incubator/tuscany/java/sca/vtest/java-api/annotations/service/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/ServiceAnnotationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/annotations/service/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/ServiceAnnotationTestCase.java?rev=658039&r1=658038&r2=658039&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/annotations/service/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/ServiceAnnotationTestCase.java (original)
+++ incubator/tuscany/java/sca/vtest/java-api/annotations/service/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/service/ServiceAnnotationTestCase.java Mon May 19 16:23:57 2008
@@ -22,25 +22,13 @@
 import static org.junit.Assert.fail;
 import junit.framework.Assert;
 
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.service.AService;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.service.BService;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.service.CService;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.service.DService1;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.service.DService2;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.service.DService3;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.service.EService;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.service.FService;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.service.GService1;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.service.GService2;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.service.HService;
-import org.apache.tuscany.sca.vtest.javaapi.annotations.service.IService;
 import org.apache.tuscany.sca.vtest.javaapi.annotations.service.impl.AObject;
 import org.apache.tuscany.sca.vtest.javaapi.annotations.service.impl.FServiceImpl2;
+import org.apache.tuscany.sca.vtest.utilities.ServiceFinder;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
-import org.junit.Test;
 import org.junit.Ignore;
+import org.junit.Test;
 
 /**
  * This test class tests the Service annotation described in section 1.2.1
@@ -50,7 +38,6 @@
  */
 public class ServiceAnnotationTestCase {
 
-    protected static SCADomain domain;
     protected static String compositeName = "service.composite";
     protected static AService aService = null;
     protected static BService bService = null;
@@ -62,12 +49,12 @@
     public static void init() throws Exception {
         try {
             System.out.println("Setting up");
-            domain = SCADomain.newInstance(compositeName);
-            aService = domain.getService(AService.class, "AComponent");
-            bService = domain.getService(BService.class, "BComponent");
-            bService1 = domain.getService(BService.class, "BComponent1");
-            hService = domain.getService(HService.class, "HComponent");
-            iService = domain.getService(IService.class, "IComponent");
+            ServiceFinder.init(compositeName);
+            aService = ServiceFinder.getService(AService.class, "AComponent");
+            bService = ServiceFinder.getService(BService.class, "BComponent");
+            bService1 = ServiceFinder.getService(BService.class, "BComponent1");
+            hService = ServiceFinder.getService(HService.class, "HComponent");
+            iService = ServiceFinder.getService(IService.class, "IComponent");
         } catch (Exception ex) {
             ex.printStackTrace();
         }
@@ -77,8 +64,7 @@
     public static void destroy() throws Exception {
 
         System.out.println("Cleaning up");
-        if (domain != null)
-            domain.close();
+        ServiceFinder.cleanup();
 
     }
 
@@ -145,8 +131,8 @@
      * the composite that contains it or from another component in the same
      * composite, the data exchange semantics are by-value.<br>
      * Implementations of remotable services may modify input data during or
-     * after an invocation and may modify return data after the invocation. If
-     * a remotable service is called locally or remotely, the SCA container is
+     * after an invocation and may modify return data after the invocation. If a
+     * remotable service is called locally or remotely, the SCA container is
      * responsible for making sure that no modification of input data or
      * post-invocation modifications to return data are seen by the caller.<br>
      * <p>
@@ -162,35 +148,35 @@
         AObject b = new AObject();
         Assert.assertEquals("BService", bService.setAObject(b));
         Assert.assertEquals("BService", b.aString);
-        
+
         AObject h1 = new AObject();
         Assert.assertEquals("HService", hService.setAObject1(h1));
         Assert.assertEquals("HService", h1.aString);
         h1.aString = "atService4";
         Assert.assertEquals("atService4", hService.getAObject1String());
-        
+
         AObject h2 = new AObject();
         Assert.assertEquals("HService", hService.setAObject2(h2));
         Assert.assertNull(h2.aString);
         h2.aString = "atService4";
         Assert.assertEquals("HService", hService.getAObject2String());
-        
+
         AObject h3 = hService.getAObject3();
         h3.aString = "atService4";
         Assert.assertEquals("HService", hService.getAObject3String());
-        
+
         AObject i1 = new AObject();
         Assert.assertEquals("IService", iService.setAObject1(i1));
         Assert.assertEquals("IService", i1.aString);
         i1.aString = "atService4";
         Assert.assertEquals("atService4", iService.getAObject1String());
-        
+
         AObject i2 = new AObject();
         Assert.assertEquals("IService", iService.setAObject2(i2));
         Assert.assertEquals("IService", i2.aString);
         i2.aString = "atService4";
         Assert.assertEquals("atService4", iService.getAObject2String());
-        
+
         AObject i3 = iService.getAObject3();
         i3.aString = "atService4";
         Assert.assertEquals("atService4", iService.getAObject3String());
@@ -206,7 +192,7 @@
      */
     @Test
     public void atService5() throws Exception {
-        CService cService = domain.getService(CService.class, "CComponent");
+        CService cService = ServiceFinder.getService(CService.class, "CComponent");
         Assert.assertEquals("CService", cService.getName());
     }
 
@@ -222,12 +208,12 @@
      */
     @Test
     public void atService6() throws Exception {
-        DService1 dService1 = domain.getService(DService1.class, "DComponent/DService1");
+        DService1 dService1 = ServiceFinder.getService(DService1.class, "DComponent/DService1");
         Assert.assertEquals("DService1", dService1.getName1());
-        DService2 dService2 = domain.getService(DService2.class, "DComponent/DService2");
+        DService2 dService2 = ServiceFinder.getService(DService2.class, "DComponent/DService2");
         Assert.assertEquals("DService2", dService2.getName2());
         try {
-            domain.getService(DService3.class, "DComponent/DService3");
+            ServiceFinder.getService(DService3.class, "DComponent/DService3");
             fail("Should have failed to get this service");
         } catch (Exception e) {
             // Expect an exception
@@ -236,15 +222,15 @@
 
     /**
      * Line 1635 to 1636:<br>
-     * A "@Service" annotation with no attributes is meaningless, it is the
-     * same as not having the annotation there at all.<br>
+     * A "@Service" annotation with no attributes is meaningless, it is the same
+     * as not having the annotation there at all.<br>
      */
     @Test
     @Ignore
     // Tuscany-2191. To run this test you must also un-comment the empty
     // @Service Annotation in EServiceImpl
     public void atService7() throws Exception {
-        EService eService = domain.getService(EService.class, "EComponent");
+        EService eService = ServiceFinder.getService(EService.class, "EComponent");
         Assert.assertEquals("EService", eService.getName());
     }
 
@@ -255,11 +241,11 @@
      */
     @Test
     public void atService8() throws Exception {
-        FService fService = domain.getService(FService.class, "FComponent");
+        FService fService = ServiceFinder.getService(FService.class, "FComponent");
         Assert.assertEquals("FService", fService.getName());
-        FServiceImpl2 fServiceImpl2 = domain.getService(FServiceImpl2.class, "FComponent2");
+        FServiceImpl2 fServiceImpl2 = ServiceFinder.getService(FServiceImpl2.class, "FComponent2");
         Assert.assertEquals("FServiceImpl2", fServiceImpl2.getName());
-        fService = domain.getService(FService.class, "FComponent2");
+        fService = ServiceFinder.getService(FService.class, "FComponent2");
         Assert.assertEquals("FServiceImpl2", fService.getName());
     }
 
@@ -272,14 +258,14 @@
      */
     @Test
     public void atService9() throws Exception {
-        GService1 gService1 = domain.getService(GService1.class, "GComponent/GService1");
-        GService2 gService2 = domain.getService(GService2.class, "GComponent/GService2");
+        GService1 gService1 = ServiceFinder.getService(GService1.class, "GComponent/GService1");
+        GService2 gService2 = ServiceFinder.getService(GService2.class, "GComponent/GService2");
         Assert.assertEquals("GService", gService1.getName());
         Assert.assertEquals("GService1", gService1.getServiceName());
         Assert.assertEquals("GService", gService2.getName());
         Assert.assertEquals("GService2", gService2.getServiceName());
     }
-    
+
     /**
      * Lines 227 to 242:<br>
      * A local service can only be called by clients that are deployed within
@@ -295,22 +281,24 @@
      * the composite that contains it or from another component in the same
      * composite, the data exchange semantics are by-value.<br>
      * Implementations of remotable services may modify input data during or
-     * after an invocation and may modify return data after the invocation. If
-     * a remotable service is called locally or remotely, the SCA container is
+     * after an invocation and may modify return data after the invocation. If a
+     * remotable service is called locally or remotely, the SCA container is
      * responsible for making sure that no modification of input data or
      * post-invocation modifications to return data are seen by the caller.<br>
      * <p>
      * Test under SCA <-> SCA<br>
      * <li>AService is remotable service to test by value</li>
      * <li>CService is local service to test by-reference</li>
-     * <li>HService is remotable service to test "@AllowsPassByReference" at method level</li>
-     * <li>IService is remotable service to test "@AllowsPassByReference" at class level</li>
+     * <li>HService is remotable service to test "@AllowsPassByReference" at
+     * method level</li>
+     * <li>IService is remotable service to test "@AllowsPassByReference" at
+     * class level</li>
      */
     @Test
     public void atService10() throws Exception {
         Assert.assertEquals("None", bService1.testServices());
     }
-    
+
     /**
      * Lines 1095 to 1124:<br>
      * 1.8.3. "@ComponentName"<br>
@@ -321,17 +309,17 @@
      */
     @Test
     public void atService11() throws Exception {
-    	Assert.assertEquals("HComponent", hService.getComponentName());
-    	Assert.assertNull(iService.getComponentName1());
-    	Assert.assertEquals("IComponent", iService.getComponentName2());
+        Assert.assertEquals("HComponent", hService.getComponentName());
+        Assert.assertNull(iService.getComponentName1());
+        Assert.assertEquals("IComponent", iService.getComponentName2());
     }
-    
+
     /**
      * Lines 1164 to 1187:<br>
      * 1.8.6. "@Context"<br>
      * ...<br>
-     * The "@Context" annotation type is used to annotate a Java class field
-     * or a setter method that is used to inject a composite context for the
+     * The "@Context" annotation type is used to annotate a Java class field or
+     * a setter method that is used to inject a composite context for the
      * component. The type of context to be injected is defined by the type of
      * the Java class field or type of the setter method input argument, the
      * type is either ComponentContext or RequestContext.<br>
@@ -343,9 +331,9 @@
      */
     @Test
     public void atService12() throws Exception {
-    	Assert.assertEquals("HService", hService.getServiceName1());
-    	Assert.assertEquals("HService", hService.getServiceName2());
-    	Assert.assertEquals("IService", iService.getServiceName1());
-    	Assert.assertEquals("IService", iService.getServiceName2());
+        Assert.assertEquals("HService", hService.getServiceName1());
+        Assert.assertEquals("HService", hService.getServiceName2());
+        Assert.assertEquals("IService", iService.getServiceName1());
+        Assert.assertEquals("IService", iService.getServiceName2());
     }
 }

Modified: incubator/tuscany/java/sca/vtest/java-api/apis/callablereference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/CallableReferenceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/callablereference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/CallableReferenceTestCase.java?rev=658039&r1=658038&r2=658039&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/callablereference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/CallableReferenceTestCase.java (original)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/callablereference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/callablereference/CallableReferenceTestCase.java Mon May 19 16:23:57 2008
@@ -19,18 +19,18 @@
 
 package org.apache.tuscany.sca.vtest.javaapi.apis.callablereference;
 
-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;
 import org.junit.Test;
 
 /**
- * This test class tests the CallableReference interface described in 1.7.3 of the SCA Java Annotations & APIs Specification 1.0.
+ * This test class tests the CallableReference interface described in 1.7.3 of
+ * the SCA Java Annotations & APIs Specification 1.0.
  */
 public class CallableReferenceTestCase {
 
-    protected static SCADomain domain;
     protected static String compositeName = "callablereference.composite";
     protected static AComponent a;
     protected static BComponent b;
@@ -39,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();
         }
@@ -50,16 +50,15 @@
     @AfterClass
     public static void destroy() throws Exception {
         System.out.println("Cleaning up");
-        if (domain != null) {
-            domain.close();
-        }
+        ServiceFinder.cleanup();
     }
 
     /**
      * L884 <br>
-     * getService() - Returns a type-safe reference to the target of this reference.
-     * The instance returned is guaranteed to implement the business interface for this reference.
-     * The value returned is a proxy to the target that implements the business interface associated with this reference.
+     * getService() - Returns a type-safe reference to the target of this
+     * reference. The instance returned is guaranteed to implement the business
+     * interface for this reference. The value returned is a proxy to the target
+     * that implements the business interface associated with this reference.
      * 
      * @throws Exception
      */
@@ -70,7 +69,8 @@
 
     /**
      * L885 <br>
-     * getBusinessInterface() – Returns the Java class for the business interface associated with this reference.
+     * getBusinessInterface() – Returns the Java class for the business
+     * interface associated with this reference.
      * 
      * @throws Exception
      */
@@ -92,7 +92,8 @@
 
     /**
      * L887 <br>
-     * getConversation() – Returns the conversation associated with this reference. Returns null if no conversation is currently active.
+     * getConversation() – Returns the conversation associated with this
+     * reference. Returns null if no conversation is currently active.
      * 
      * @throws Exception
      */
@@ -110,7 +111,7 @@
      */
     @Test
     public void testGetCallbackID() throws Exception {
-        // Actual test is in BComponentImpl.  Below is an extra test.
+        // Actual test is in BComponentImpl. Below is an extra test.
         Assert.assertEquals("CallBackFromB", a.getCallbackResult());
     }
 

Modified: incubator/tuscany/java/sca/vtest/java-api/apis/componentcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/ComponentContextTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/vtest/java-api/apis/componentcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/ComponentContextTestCase.java?rev=658039&r1=658038&r2=658039&view=diff
==============================================================================
--- incubator/tuscany/java/sca/vtest/java-api/apis/componentcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/ComponentContextTestCase.java (original)
+++ incubator/tuscany/java/sca/vtest/java-api/apis/componentcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/ComponentContextTestCase.java Mon May 19 16:23:57 2008
@@ -19,7 +19,7 @@
 
 package org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext;
 
-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,12 +27,12 @@
 import org.junit.Test;
 
 /**
- * This test class tests the ComponentContext interface described in 1.7.1 of the SCA Java Annotations & APIs Specification 1.0.
- * Relevant sections of 1.4 will also be covered here.
+ * This test class tests the ComponentContext interface described in 1.7.1 of
+ * the SCA Java Annotations & APIs Specification 1.0. Relevant sections of 1.4
+ * will also be covered here.
  */
 public class ComponentContextTestCase {
 
-    protected static SCADomain domain;
     protected static String compositeName = "ab.composite";
     protected static AComponent a;
     protected static BService b;
@@ -41,9 +41,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(BService.class, "BComponent/BService");
+            ServiceFinder.init(compositeName);
+            a = ServiceFinder.getService(AComponent.class, "AComponent");
+            b = ServiceFinder.getService(BService.class, "BComponent/BService");
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -52,14 +52,13 @@
     @AfterClass
     public static void destroy() throws Exception {
         System.out.println("Cleaning up");
-        if (domain != null) {
-            domain.close();
-        }
+        ServiceFinder.cleanup();
     }
 
     /**
      * L776 <br>
-     * getURI() - Returns the absolute URI of the component within the SCA domain.
+     * getURI() - Returns the absolute URI of the component within the SCA
+     * domain.
      * 
      * @throws Exception
      */
@@ -70,7 +69,8 @@
 
     /**
      * L778 <br>
-     * getService(Class&lt;B&gt; businessInterface, String referenceName) ? Returns a proxy for the reference defined by the current component.
+     * getService(Class&lt;B&gt; businessInterface, String referenceName) ?
+     * Returns a proxy for the reference defined by the current component.
      * 
      * @throws Exception
      */
@@ -81,7 +81,9 @@
 
     /**
      * L780 <br>
-     * getServiceReference(Class&lt;B&gt; businessInterface, String referenceName) ? Returns a ServiceReference defined by the current component.
+     * getServiceReference(Class&lt;B&gt; businessInterface, String
+     * referenceName) ? Returns a ServiceReference defined by the current
+     * component.
      * 
      * @throws Exception
      */
@@ -92,8 +94,9 @@
 
     /**
      * L783 <br>
-     * createSelfReference(Class&lt;B&gt; businessInterface) ?
-     * Returns a ServiceReference that can be used to invoke this component over the designated service.
+     * createSelfReference(Class&lt;B&gt; businessInterface) ? Returns a
+     * ServiceReference that can be used to invoke this component over the
+     * designated service.
      * 
      * @throws Exception
      */
@@ -105,8 +108,9 @@
     /**
      * L785 <br>
      * getSelfReference(Class&lt;B&gt; businessInterface, String serviceName) -
-     * Returns a ServiceReference that can be used to invoke this component over the designated service.
-     * Service name explicitly declares the service name to invoke.
+     * Returns a ServiceReference that can be used to invoke this component over
+     * the designated service. Service name explicitly declares the service name
+     * to invoke.
      * 
      * @throws Exception
      */
@@ -117,7 +121,8 @@
 
     /**
      * L788 <br>
-     * getProperty (Class&lt;B&gt; type, String propertyName) - Returns the value of an SCA property defined by this component.
+     * getProperty (Class&lt;B&gt; type, String propertyName) - Returns the
+     * value of an SCA property defined by this component.
      * 
      * @throws Exception
      */
@@ -128,12 +133,12 @@
 
     /**
      * L793 <br>
-     * getRequestContext() -
-     * Returns the context for the current SCA service request, or null if there is no current request or if the context is unavailable.
-     * 
-     * @throws Exception
+     * getRequestContext() - Returns the context for the current SCA service
+     * request, or null if there is no current request or if the context is
+     * unavailable.
      * 
-     * TODO: fails for me so I've added @Ignore
+     * @throws Exception TODO: fails for me so I've added
+     * @Ignore
      */
     @Test
     @Ignore
@@ -164,8 +169,9 @@
 
     /**
      * L342-344 <br>
-     * When a component implementation needs access to a service where the reference to the service is not known at compile time,
-     * the reference can be located using the component?s ComponentContext.
+     * When a component implementation needs access to a service where the
+     * reference to the service is not known at compile time, the reference can
+     * be located using the component?s ComponentContext.
      * 
      * @throws Exception
      */