tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r1132579 - in /tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src: main/java/helloworld/ main/resources/ test/java/org/apache/tuscany/sca/itest/lifecycle/
Date Mon, 06 Jun 2011 10:26:45 GMT
Author: slaws
Date: Mon Jun  6 10:26:44 2011
New Revision: 1132579

URL: http://svn.apache.org/viewvc?rev=1132579&view=rev
Log:
TUSCANY-3867 - Take account of different scopes and eager init

Added:
    tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplC.java
    tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplCE.java
    tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplS.java
Removed:
    tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImpl.java
Modified:
    tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/resources/lifecycle.composite
    tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/test/java/org/apache/tuscany/sca/itest/lifecycle/LifecycleTestCase.java

Added: tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplC.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplC.java?rev=1132579&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplC.java (added)
+++ tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplC.java Mon Jun  6 10:26:44 2011
@@ -0,0 +1,78 @@
+/*
+ * 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 helloworld;
+
+import org.oasisopen.sca.annotation.Destroy;
+import org.oasisopen.sca.annotation.Init;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Scope;
+
+/* 
+ * C = a composite scoped component that throws exceptions
+ */
+
+@Scope("COMPOSITE")
+public class HelloworldClientImplC implements Helloworld {
+    
+    public static boolean throwTestExceptionOnConstruction = false;
+    public static boolean throwTestExceptionOnInit = false;
+    public static boolean throwTestExceptionOnDestroy = false;
+    
+
+    @Reference
+    public Helloworld service;
+    
+    public HelloworldClientImplC() throws Exception {
+        if(throwTestExceptionOnConstruction){
+            StatusImpl.appendStatus("Exception on construction", "HelloworldClientImplC");
+            throw new Exception("Exception on construction");
+        }
+    }     
+    
+    @Init
+    public void initialize() throws Exception{
+        if (throwTestExceptionOnInit) {
+            StatusImpl.appendStatus("Exception on init", "HelloworldClientImplC");
+            throw new Exception("Exception on init");
+        }
+        
+        StatusImpl.appendStatus("Init", "HelloworldClientImplC");
+    	System.out.println(">>>>>> " + sayHello("init"));
+    }
+    
+    @Destroy
+    public void destroy() throws Exception{
+        if (throwTestExceptionOnDestroy) {
+            StatusImpl.appendStatus("Exception on destroy", "HelloworldClientImplC");
+            throw new Exception("Exception on destroy");
+        }
+        
+        StatusImpl.appendStatus("Destroy", "HelloworldClientImplC");
+    }    
+    
+    public String sayHello(String name) throws Exception {
+        return "Hi " + service.sayHello(name);
+    }
+    
+    public String throwException(String name) throws Exception {
+        throw new Exception("test exception");
+    }
+
+}

Added: tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplCE.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplCE.java?rev=1132579&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplCE.java (added)
+++ tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplCE.java Mon Jun  6 10:26:44 2011
@@ -0,0 +1,80 @@
+/*
+ * 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 helloworld;
+
+import org.oasisopen.sca.annotation.Destroy;
+import org.oasisopen.sca.annotation.EagerInit;
+import org.oasisopen.sca.annotation.Init;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Scope;
+
+/* 
+ * CE = a composite scoped component with EagerInit that throws exceptions
+ */
+
+@EagerInit
+@Scope("COMPOSITE")
+public class HelloworldClientImplCE implements Helloworld {
+    
+    public static boolean throwTestExceptionOnConstruction = false;
+    public static boolean throwTestExceptionOnInit = false;
+    public static boolean throwTestExceptionOnDestroy = false;
+    
+
+    @Reference
+    public Helloworld service;
+    
+    public HelloworldClientImplCE() throws Exception {
+        if(throwTestExceptionOnConstruction){
+            StatusImpl.appendStatus("Exception on construction", "HelloworldClientImplCE");
+            throw new Exception("Exception on construction");
+        }
+    }    
+    
+    @Init
+    public void initialize() throws Exception{
+        if (throwTestExceptionOnInit) {
+            StatusImpl.appendStatus("Exception on init", "HelloworldClientImplCE");
+            throw new Exception("Exception on init");
+        }
+        
+        StatusImpl.appendStatus("Init", "HelloworldClientImplCE");
+    	System.out.println(">>>>>> " + sayHello("init"));
+    }
+    
+    @Destroy
+    public void destroy() throws Exception{
+        if (throwTestExceptionOnDestroy) {
+            StatusImpl.appendStatus("Exception on destroy", "HelloworldClientImplCE");
+            throw new Exception("Exception on destroy");
+        }
+        
+        StatusImpl.appendStatus("Destroy", "HelloworldClientImplCE");
+    }    
+    
+    public String sayHello(String name) throws Exception {
+        return "Hi " + service.sayHello(name);
+    }
+    
+    public String throwException(String name) throws Exception {
+        throw new Exception("test exception");
+    }
+
+}

Added: tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplS.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplS.java?rev=1132579&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplS.java (added)
+++ tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplS.java Mon Jun  6 10:26:44 2011
@@ -0,0 +1,78 @@
+/*
+ * 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 helloworld;
+
+import org.oasisopen.sca.annotation.Destroy;
+import org.oasisopen.sca.annotation.Init;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.Scope;
+
+/* 
+ * S = a stateless scoped component that throws exceptions
+ */
+
+@Scope("STATELESS")
+public class HelloworldClientImplS implements Helloworld {
+    
+    public static boolean throwTestExceptionOnConstruction = false;
+    public static boolean throwTestExceptionOnInit = false;
+    public static boolean throwTestExceptionOnDestroy = false;
+    
+
+    @Reference
+    public Helloworld service;
+    
+    public HelloworldClientImplS() throws Exception {
+        if(throwTestExceptionOnConstruction){
+            StatusImpl.appendStatus("Exception on construction", "HelloworldClientImplS");
+            throw new Exception("Exception on construction");
+        }
+    }
+    
+    @Init
+    public void initialize() throws Exception{
+        if (throwTestExceptionOnInit) {
+            StatusImpl.appendStatus("Exception on init", "HelloworldClientImplS");
+            throw new Exception("Exception on init");
+        }
+        
+        StatusImpl.appendStatus("Init", "HelloworldClientImplS");
+    	System.out.println(">>>>>> " + sayHello("init"));
+    }
+    
+    @Destroy
+    public void destroy() throws Exception{
+        if (throwTestExceptionOnDestroy) {
+            StatusImpl.appendStatus("Exception on destroy", "HelloworldClientImplS");
+            throw new Exception("Exception on destroy");
+        }
+        
+        StatusImpl.appendStatus("Destroy", "HelloworldClientImplS");
+    }    
+    
+    public String sayHello(String name) throws Exception {
+        return "Hi " + service.sayHello(name);
+    }
+    
+    public String throwException(String name) throws Exception {
+        throw new Exception("test exception");
+    }
+
+}

Modified: tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/resources/lifecycle.composite
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/resources/lifecycle.composite?rev=1132579&r1=1132578&r2=1132579&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/resources/lifecycle.composite (original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/resources/lifecycle.composite Mon Jun  6 10:26:44 2011
@@ -22,23 +22,34 @@
            targetNamespace="http://sample"
            name="lifecycle">
            
-    <component name="HelloworldService1">
+    <component name="HelloworldService">
        <implementation.java class="helloworld.HelloworldServiceImpl"/>
        <service name="Helloworld">
            <tuscany:binding.lifecycle name="lifecycle"/>
        </service>
     </component>  
+             
     
-    <component name="HelloworldService2">
+    <component name="HelloworldServiceTestImpl">
        <tuscany:implementation.lifecycle class="helloworld.HelloworldServiceImpl"/>
        <service name="Helloworld">
            <tuscany:binding.lifecycle name="lifecycle"/>
        </service>
     </component>               
 
-    <component name="HelloworldClient">
-       <implementation.java class="helloworld.HelloworldClientImpl"/>
-       <reference name="service" target="HelloworldService1"/>       
+    <component name="HelloworldClientC">
+       <implementation.java class="helloworld.HelloworldClientImplC"/>
+       <reference name="service" target="HelloworldService"/>       
+    </component>
+    
+    <component name="HelloworldClientCE">
+       <implementation.java class="helloworld.HelloworldClientImplCE"/>
+       <reference name="service" target="HelloworldService"/>       
     </component> 
+    
+    <component name="HelloworldClientS">
+       <implementation.java class="helloworld.HelloworldClientImplS"/>
+       <reference name="service" target="HelloworldService"/>       
+    </component>
 
 </composite>

Modified: tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/test/java/org/apache/tuscany/sca/itest/lifecycle/LifecycleTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/test/java/org/apache/tuscany/sca/itest/lifecycle/LifecycleTestCase.java?rev=1132579&r1=1132578&r2=1132579&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/test/java/org/apache/tuscany/sca/itest/lifecycle/LifecycleTestCase.java (original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/lifecycle/src/test/java/org/apache/tuscany/sca/itest/lifecycle/LifecycleTestCase.java Mon Jun  6 10:26:44 2011
@@ -21,7 +21,9 @@ package org.apache.tuscany.sca.itest.lif
 
 
 import helloworld.Helloworld;
-import helloworld.HelloworldClientImpl;
+import helloworld.HelloworldClientImplC;
+import helloworld.HelloworldClientImplCE;
+import helloworld.HelloworldClientImplS;
 import helloworld.StatusImpl;
 import junit.framework.Assert;
 
@@ -47,8 +49,12 @@ public class LifecycleTestCase {
 
     }
 
+    /*
+     * Start up the composite and don't send any messages. No exception
+     * should be thrown.
+     */
     @Test
-    public void testNormalShutdownNoMessage() throws Exception{
+    public void testNoExceptionNoMessageShutdown() throws Exception{
         
         StatusImpl.statusString = "";
         
@@ -63,6 +69,8 @@ public class LifecycleTestCase {
         // start a composite
         node.startComposite("HelloworldContrib", "lifecycle.composite");
         
+        // we don't send any messages in this case and just shut down directly
+        
         // stop a composite
         node.stopComposite("HelloworldContrib", "lifecycle.composite");
         
@@ -77,21 +85,25 @@ public class LifecycleTestCase {
         
         // see what happened
         System.out.println(StatusImpl.statusString);
-        Assert.assertEquals("Service binding start - Endpoint:  URI = HelloworldService1#service-binding(Helloworld/lifecycle)\n" + 
-                            "Implementation start - HelloworldService2\n" +
-                            "Service binding start - Endpoint:  URI = HelloworldService2#service-binding(Helloworld/lifecycle)\n" +
-                            "Init - HelloworldClientImpl\n" +
-                            "Reference binding start - EndpointReference:  URI = HelloworldClient#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService1#service-binding(Helloworld/lifecycle)\n" + 
-                            "Service binding stop - Endpoint:  URI = HelloworldService1#service-binding(Helloworld/lifecycle)\n" + 
-                            "Service binding stop - Endpoint:  URI = HelloworldService2#service-binding(Helloworld/lifecycle)\n" + 
-                            "Implementation stop - HelloworldService2\n" +
-                            "Reference binding stop - EndpointReference:  URI = HelloworldClient#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService1#service-binding(Helloworld/lifecycle)\n" +
-                            "Destroy - HelloworldClientImpl\n", 
+        Assert.assertEquals("Service binding start - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" + 
+                            "Implementation start - HelloworldServiceTestImpl\n" +
+                            "Service binding start - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" +
+                            "Init - HelloworldClientImplCE\n" +
+                            "Reference binding start - EndpointReference:  URI = HelloworldClientCE#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Service binding stop - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" + 
+                            "Service binding stop - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" + 
+                            "Implementation stop - HelloworldServiceTestImpl\n" +
+                            "Reference binding stop - EndpointReference:  URI = HelloworldClientCE#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Destroy - HelloworldClientImplCE\n",
                             StatusImpl.statusString);
     }
     
+    /*
+     * Start up the composite and send a message. No exception
+     * should be thrown.
+     */    
     @Test
-    public void testNormalShutdownAfterMessage() throws Exception{
+    public void testNoExceptionMessageShutdown() throws Exception{
         
         TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();
 
@@ -104,9 +116,13 @@ public class LifecycleTestCase {
         // start a composite
         node.startComposite("HelloworldContrib", "lifecycle.composite");
         
-        // send a message
-        Helloworld hw = node.getService(Helloworld.class, "HelloworldService1");
-        System.out.println(hw.sayHello("name"));
+        // send a message to each client
+        Helloworld hwCE = node.getService(Helloworld.class, "HelloworldClientCE");
+        System.out.println(hwCE.sayHello("name"));
+        Helloworld hwC = node.getService(Helloworld.class, "HelloworldClientC");
+        System.out.println(hwC.sayHello("name"));
+        Helloworld hwS = node.getService(Helloworld.class, "HelloworldClientC");
+        System.out.println(hwS.sayHello("name"));        
         
         // stop a composite
         node.stopComposite("HelloworldContrib", "lifecycle.composite");
@@ -122,26 +138,347 @@ public class LifecycleTestCase {
         
         // see what happened
         System.out.println(StatusImpl.statusString);
-        Assert.assertEquals("Service binding start - Endpoint:  URI = HelloworldService1#service-binding(Helloworld/lifecycle)\n" + 
-                            "Implementation start - HelloworldService2\n" +
-                            "Service binding start - Endpoint:  URI = HelloworldService2#service-binding(Helloworld/lifecycle)\n" +
-                            "Init - HelloworldClientImpl\n" +
-                            "Reference binding start - EndpointReference:  URI = HelloworldClient#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService1#service-binding(Helloworld/lifecycle)\n" +
-                            /*extra ref start for getService reference*/
-                            "Reference binding start - EndpointReference:  URI = HelloworldService1#reference-binding($self$.Helloworld/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService1#service-binding(Helloworld/lifecycle)\n" +
-                            "Service binding stop - Endpoint:  URI = HelloworldService1#service-binding(Helloworld/lifecycle)\n" + 
-                            "Service binding stop - Endpoint:  URI = HelloworldService2#service-binding(Helloworld/lifecycle)\n" + 
-                            "Implementation stop - HelloworldService2\n" +
-                            "Reference binding stop - EndpointReference:  URI = HelloworldClient#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService1#service-binding(Helloworld/lifecycle)\n" +
-                            /*$self$ reference is not stopped */
-                            "Destroy - HelloworldClientImpl\n", 
+        Assert.assertEquals("Service binding start - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" + 
+                            "Implementation start - HelloworldServiceTestImpl\n" +
+                            "Service binding start - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" +
+                            "Init - HelloworldClientImplCE\n" +
+                            "Reference binding start - EndpointReference:  URI = HelloworldClientCE#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Init - HelloworldClientImplC\n" +
+                            "Reference binding start - EndpointReference:  URI = HelloworldClientC#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Service binding stop - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Service binding stop - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" +
+                            "Implementation stop - HelloworldServiceTestImpl\n" +
+                            "Reference binding stop - EndpointReference:  URI = HelloworldClientC#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Destroy - HelloworldClientImplC\n" +                            
+                            "Reference binding stop - EndpointReference:  URI = HelloworldClientCE#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Destroy - HelloworldClientImplCE\n",
                             StatusImpl.statusString);
-    }    
+        
+        /*$self$ reference is not stopped here - should it be? */
+    } 
+    
+    /*
+     * Start up the composite. Exception thrown in constructor of composite 
+     * scoped component with eager init set 
+     */    
+    @Test
+    public void testConstructorExceptionShutdownCE() throws Exception{
+        
+        HelloworldClientImplCE.throwTestExceptionOnConstruction = true;
+        
+        TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();
+
+        // create a Tuscany node
+        node = tuscanyRuntime.createNode();
+        
+        // install a contribution
+        node.installContribution("HelloworldContrib", "target/classes", null, null);
+        
+        // start a composite
+        try {
+            node.startComposite("HelloworldContrib", "lifecycle.composite");
+        } catch (Exception exception) {
+            // it's thrown from the HelloworldClientImpl @Init method
+        }
+        
+        // don't need to send a message as eager init ensures that 
+        // the component instance is created at start time
+        
+        // stop a composite
+        try {
+            node.stopComposite("HelloworldContrib", "lifecycle.composite");
+        } catch (Exception exception) {
+            // it will complain about the composite not being started
+        }            
+        
+        // uninstall a constribution
+        node.uninstallContribution("HelloworldContrib");
+        
+        // stop a Tuscany node
+        node.stop();
+        
+        // stop the runtime
+        tuscanyRuntime.stop();
+        
+        // see what happened
+        System.out.println(StatusImpl.statusString);
+        Assert.assertEquals("Service binding start - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Implementation start - HelloworldServiceTestImpl\n" +
+                            "Service binding start - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" +
+                            "Exception on construction - HelloworldClientImplCE\n" +
+                            "Service binding stop - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Service binding stop - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" +
+                            "Implementation stop - HelloworldServiceTestImpl\n",
+                            StatusImpl.statusString);
+        
+        HelloworldClientImplCE.throwTestExceptionOnConstruction = false;
+    } 
+    
+    /*
+     * Start up the composite. Exception thrown in constructor of composite 
+     * scoped component
+     */    
+    @Test
+    public void testConstructorExceptionShutdownC() throws Exception{
+        
+        HelloworldClientImplC.throwTestExceptionOnConstruction = true;
+        
+        TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();
+
+        // create a Tuscany node
+        node = tuscanyRuntime.createNode();
+        
+        // install a contribution
+        node.installContribution("HelloworldContrib", "target/classes", null, null);
+        
+        // start a composite
+        try {
+            node.startComposite("HelloworldContrib", "lifecycle.composite");
+        } catch (Exception exception) {
+            // it's thrown from the HelloworldClientImpl @Init method
+        }
+        
+        // send a message to the appropriate client
+        try {
+            Helloworld hwCE = node.getService(Helloworld.class, "HelloworldClientC");
+            System.out.println(hwCE.sayHello("name"));
+        } catch (Exception exception) {
+            // the component throws an error on construction
+        }
+        
+        // stop a composite
+        try {
+            node.stopComposite("HelloworldContrib", "lifecycle.composite");
+        } catch (Exception exception) {
+            // it will complain about the composite not being started
+        }            
+        
+        // uninstall a constribution
+        node.uninstallContribution("HelloworldContrib");
+        
+        // stop a Tuscany node
+        node.stop();
+        
+        // stop the runtime
+        tuscanyRuntime.stop();
+        
+        // see what happened
+        System.out.println(StatusImpl.statusString);
+        Assert.assertEquals("Service binding start - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Implementation start - HelloworldServiceTestImpl\n" +
+                            "Service binding start - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" +
+                            "Init - HelloworldClientImplCE\n" +
+                            "Reference binding start - EndpointReference:  URI = HelloworldClientCE#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Exception on construction - HelloworldClientImplC\n" +
+                            "Service binding stop - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Service binding stop - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" +
+                            "Implementation stop - HelloworldServiceTestImpl\n" +
+                            "Reference binding stop - EndpointReference:  URI = HelloworldClientCE#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Destroy - HelloworldClientImplCE\n", 
+                            StatusImpl.statusString);
+        
+        HelloworldClientImplC.throwTestExceptionOnConstruction = false;
+    }   
+    
+    /*
+     * Start up the composite. Exception thrown in constructor of stateless 
+     * scoped component
+     */     
+    @Test
+    public void testConstructorExceptionShutdownS() throws Exception{
+        
+        HelloworldClientImplS.throwTestExceptionOnConstruction = true;
+        
+        TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();
+
+        // create a Tuscany node
+        node = tuscanyRuntime.createNode();
+        
+        // install a contribution
+        node.installContribution("HelloworldContrib", "target/classes", null, null);
+        
+        // start a composite
+        try {
+            node.startComposite("HelloworldContrib", "lifecycle.composite");
+        } catch (Exception exception) {
+            // it's thrown from the HelloworldClientImpl @Init method
+        }
+        
+        // send a message to the appropriate client
+        try {
+            Helloworld hwCE = node.getService(Helloworld.class, "HelloworldClientS");
+            System.out.println(hwCE.sayHello("name"));
+        } catch (Exception exception) {
+            // the component throws an error on construction
+        }        
+        
+        // stop a composite
+        try {
+            node.stopComposite("HelloworldContrib", "lifecycle.composite");
+        } catch (Exception exception) {
+            // it will complain about the composite not being started
+        }            
+        
+        // uninstall a constribution
+        node.uninstallContribution("HelloworldContrib");
+        
+        // stop a Tuscany node
+        node.stop();
+        
+        // stop the runtime
+        tuscanyRuntime.stop();
+        
+        // see what happened
+        System.out.println(StatusImpl.statusString);
+        Assert.assertEquals("Service binding start - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Implementation start - HelloworldServiceTestImpl\n" +
+                            "Service binding start - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" +
+                            "Init - HelloworldClientImplCE\n" +
+                            "Reference binding start - EndpointReference:  URI = HelloworldClientCE#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Exception on construction - HelloworldClientImplS\n" +
+                            "Service binding stop - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Service binding stop - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" +
+                            "Implementation stop - HelloworldServiceTestImpl\n" +
+                            "Reference binding stop - EndpointReference:  URI = HelloworldClientCE#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Destroy - HelloworldClientImplCE\n",
+                            StatusImpl.statusString);
+        
+        HelloworldClientImplS.throwTestExceptionOnConstruction = false;
+    } 
+      
+    /*
+     * Start up the composite. Exception thrown in init of composite 
+     * scoped component with eager init
+     */       
+    @Test
+    public void testInitExceptionShutdownCE() throws Exception{
+        
+        HelloworldClientImplCE.throwTestExceptionOnInit = true;
+        
+        TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();
+
+        // create a Tuscany node
+        node = tuscanyRuntime.createNode();
+        
+        // install a contribution
+        node.installContribution("HelloworldContrib", "target/classes", null, null);
+        
+        // start a composite
+        try {
+            node.startComposite("HelloworldContrib", "lifecycle.composite");
+        } catch (Exception exception) {
+            // it's thrown from the HelloworldClientImpl @Init method
+        }
+        
+        // don't need to send a message as eager init ensures that 
+        // the component instance is created and inited at start time        
+        
+        // stop a composite
+        try {
+            node.stopComposite("HelloworldContrib", "lifecycle.composite");
+        } catch (Exception exception) {
+            // it will complain about the composite not being started
+        }            
+        
+        // uninstall a constribution
+        node.uninstallContribution("HelloworldContrib");
+        
+        // stop a Tuscany node
+        node.stop();
+        
+        // stop the runtime
+        tuscanyRuntime.stop();
+        
+        // see what happened
+        System.out.println(StatusImpl.statusString);
+        Assert.assertEquals("Service binding start - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n"+
+                            "Implementation start - HelloworldServiceTestImpl\n"+
+                            "Service binding start - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n"+
+                            "Exception on init - HelloworldClientImplCE\n"+
+                            "Destroy - HelloworldClientImplCE\n"+
+                            "Service binding stop - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n"+
+                            "Service binding stop - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n"+
+                            "Implementation stop - HelloworldServiceTestImpl\n", 
+                            StatusImpl.statusString);
+        
+        HelloworldClientImplCE.throwTestExceptionOnInit = false;
+    } 
+    
+    /*
+     * Start up the composite. Exception thrown in init of composite 
+     * scoped component
+     */       
+    @Test
+    public void testInitExceptionShutdownC() throws Exception{
+        
+        HelloworldClientImplC.throwTestExceptionOnInit = true;
+        
+        TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();
+
+        // create a Tuscany node
+        node = tuscanyRuntime.createNode();
+        
+        // install a contribution
+        node.installContribution("HelloworldContrib", "target/classes", null, null);
+        
+        // start a composite
+        try {
+            node.startComposite("HelloworldContrib", "lifecycle.composite");
+        } catch (Exception exception) {
+            // it's thrown from the HelloworldClientImpl @Init method
+        }
+        
+        // send a message to the appropriate client
+        try {
+            Helloworld hwCE = node.getService(Helloworld.class, "HelloworldClientC");
+            System.out.println(hwCE.sayHello("name"));
+        } catch (Exception exception) {
+            // the component throws an error on init
+        }        
+        
+        // stop a composite
+        try {
+            node.stopComposite("HelloworldContrib", "lifecycle.composite");
+        } catch (Exception exception) {
+            // it will complain about the composite not being started
+        }            
+        
+        // uninstall a constribution
+        node.uninstallContribution("HelloworldContrib");
+        
+        // stop a Tuscany node
+        node.stop();
+        
+        // stop the runtime
+        tuscanyRuntime.stop();
+        
+        // see what happened
+        System.out.println(StatusImpl.statusString);
+        Assert.assertEquals("Service binding start - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Implementation start - HelloworldServiceTestImpl\n" +
+                            "Service binding start - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" +
+                            "Init - HelloworldClientImplCE\n" +
+                            "Reference binding start - EndpointReference:  URI = HelloworldClientCE#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Exception on init - HelloworldClientImplC\n" +
+                            "Destroy - HelloworldClientImplC\n" +
+                            "Service binding stop - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Service binding stop - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" +
+                            "Implementation stop - HelloworldServiceTestImpl\n" +
+                            "Reference binding stop - EndpointReference:  URI = HelloworldClientCE#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Destroy - HelloworldClientImplCE\n",
+                            StatusImpl.statusString);
+        
+        HelloworldClientImplC.throwTestExceptionOnInit = false;
+    }   
     
+    /*
+     * Start up the composite. Exception thrown in init of stateless 
+     * scoped component
+     */      
     @Test
-    public void testInitExceptionShutdown() throws Exception{
+    public void testInitExceptionShutdownS() throws Exception{
         
-        HelloworldClientImpl.throwTestExceptionOnInit = true;
+        HelloworldClientImplS.throwTestExceptionOnInit = true;
         
         TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();
 
@@ -158,6 +495,14 @@ public class LifecycleTestCase {
             // it's thrown from the HelloworldClientImpl @Init method
         }
         
+        // send a message to the appropriate client
+        try {
+            Helloworld hwCE = node.getService(Helloworld.class, "HelloworldClientS");
+            System.out.println(hwCE.sayHello("name"));
+        } catch (Exception exception) {
+            // the component throws an error on init
+        }         
+        
         // stop a composite
         try {
             node.stopComposite("HelloworldContrib", "lifecycle.composite");
@@ -176,24 +521,31 @@ public class LifecycleTestCase {
         
         // see what happened
         System.out.println(StatusImpl.statusString);
-        Assert.assertEquals("Service binding start - Endpoint:  URI = HelloworldService1#service-binding(Helloworld/lifecycle)\n" + 
-                            "Implementation start - HelloworldService2\n" +
-                            "Service binding start - Endpoint:  URI = HelloworldService2#service-binding(Helloworld/lifecycle)\n" +
-                            "Exception on init - HelloworldClientImpl\n" + 
-                            /* is it right that the destroy happens directly?*/
-                            "Destroy - HelloworldClientImpl\n" +
-                            "Service binding stop - Endpoint:  URI = HelloworldService1#service-binding(Helloworld/lifecycle)\n" + 
-                            "Service binding stop - Endpoint:  URI = HelloworldService2#service-binding(Helloworld/lifecycle)\n" + 
-                            "Implementation stop - HelloworldService2\n", 
+        Assert.assertEquals("Service binding start - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Implementation start - HelloworldServiceTestImpl\n" +
+                            "Service binding start - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" +
+                            "Init - HelloworldClientImplCE\n" +
+                            "Reference binding start - EndpointReference:  URI = HelloworldClientCE#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Exception on init - HelloworldClientImplS\n" +
+                            "Destroy - HelloworldClientImplS\n" +
+                            "Service binding stop - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Service binding stop - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" +
+                            "Implementation stop - HelloworldServiceTestImpl\n" +
+                            "Reference binding stop - EndpointReference:  URI = HelloworldClientCE#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Destroy - HelloworldClientImplCE\n",
                             StatusImpl.statusString);
         
-        HelloworldClientImpl.throwTestExceptionOnInit = false;
+        HelloworldClientImplS.throwTestExceptionOnInit = false;
     }    
     
+    /*
+     * Start up the composite and then stop it. Exception thrown in destory of composite 
+     * scoped component with eager init set
+     */  
     @Test
-    public void testDestroyExceptionShutdown() throws Exception{
+    public void testDestroyExceptionShutdownCE() throws Exception{
         
-        HelloworldClientImpl.throwTestExceptionOnDestroy = true;
+        HelloworldClientImplCE.throwTestExceptionOnDestroy = true;
         
         TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();
 
@@ -210,6 +562,143 @@ public class LifecycleTestCase {
             // it's thrown from the HelloworldClientImpl @Destroy method
         }
         
+        // don't need to send a message as eager init ensures that 
+        // the component instance is created start time and hence should
+        // be destroyed
+        
+        // stop a composite
+        try {
+            node.stopComposite("HelloworldContrib", "lifecycle.composite");
+        } catch (Exception exception) {
+            // it will complain about the composite not being started
+        }   
+        
+        // uninstall a constribution
+        node.uninstallContribution("HelloworldContrib");
+        
+        // stop a Tuscany node
+        node.stop();
+        
+        // stop the runtime
+        tuscanyRuntime.stop();
+        
+        // see what happened
+        System.out.println(StatusImpl.statusString);
+        Assert.assertEquals("Service binding start - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Implementation start - HelloworldServiceTestImpl\n" +
+                            "Service binding start - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" +
+                            "Init - HelloworldClientImplCE\n" +
+                            "Reference binding start - EndpointReference:  URI = HelloworldClientCE#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Service binding stop - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Service binding stop - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" +
+                            "Implementation stop - HelloworldServiceTestImpl\n" +
+                            "Reference binding stop - EndpointReference:  URI = HelloworldClientCE#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Exception on destroy - HelloworldClientImplCE\n",
+                            StatusImpl.statusString);
+        
+        HelloworldClientImplCE.throwTestExceptionOnDestroy = false;
+    }  
+  
+    /*
+     * Start up the composite and then stop it. Exception thrown in destory of composite 
+     * scoped component
+     */      
+    @Test
+    public void testDestroyExceptionShutdownC() throws Exception{
+        
+        HelloworldClientImplC.throwTestExceptionOnDestroy = true;
+        
+        TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();
+
+        // create a Tuscany node
+        node = tuscanyRuntime.createNode();
+        
+        // install a contribution
+        node.installContribution("HelloworldContrib", "target/classes", null, null);
+        
+        // start a composite
+        try {
+            node.startComposite("HelloworldContrib", "lifecycle.composite");
+        } catch (Exception exception) {
+            // it's thrown from the HelloworldClientImpl @Destroy method
+        }
+        
+        // send a message to the appropriate client
+        Helloworld hwCE = node.getService(Helloworld.class, "HelloworldClientC");
+        System.out.println(hwCE.sayHello("name"));  
+        // don't need to catch exception here as it component instance won't
+        // be destroyed until shutdown
+        
+        // stop a composite
+        try {
+            node.stopComposite("HelloworldContrib", "lifecycle.composite");
+        } catch (Exception exception) {
+            // it will complain about the composite not being started
+        }   
+        
+        // uninstall a constribution
+        node.uninstallContribution("HelloworldContrib");
+        
+        // stop a Tuscany node
+        node.stop();
+        
+        // stop the runtime
+        tuscanyRuntime.stop();
+        
+        // see what happened
+        System.out.println(StatusImpl.statusString);
+        Assert.assertEquals("Service binding start - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Implementation start - HelloworldServiceTestImpl\n" +
+                            "Service binding start - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" +
+                            "Init - HelloworldClientImplCE\n" +
+                            "Reference binding start - EndpointReference:  URI = HelloworldClientCE#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Init - HelloworldClientImplC\n" +
+                            "Reference binding start - EndpointReference:  URI = HelloworldClientC#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Service binding stop - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Service binding stop - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" +
+                            "Implementation stop - HelloworldServiceTestImpl\n" +
+                            "Reference binding stop - EndpointReference:  URI = HelloworldClientC#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Exception on destroy - HelloworldClientImplC\n" +
+                            "Reference binding stop - EndpointReference:  URI = HelloworldClientCE#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Destroy - HelloworldClientImplCE\n",
+                            StatusImpl.statusString);
+        
+        HelloworldClientImplC.throwTestExceptionOnDestroy = false;
+    }  
+    
+    /*
+     * Start up the composite and then stop it. Exception thrown in destory of stateless 
+     * scoped component
+     */     
+    @Test
+    public void testDestroyExceptionShutdownS() throws Exception{
+        
+        HelloworldClientImplS.throwTestExceptionOnDestroy = true;
+        
+        TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();
+
+        // create a Tuscany node
+        node = tuscanyRuntime.createNode();
+        
+        // install a contribution
+        node.installContribution("HelloworldContrib", "target/classes", null, null);
+        
+        // start a composite
+        try {
+            node.startComposite("HelloworldContrib", "lifecycle.composite");
+        } catch (Exception exception) {
+            // it's thrown from the HelloworldClientImpl @Destroy method
+        }
+        
+        // send a message to the appropriate client
+        try {
+            Helloworld hwCE = node.getService(Helloworld.class, "HelloworldClientS");
+            System.out.println(hwCE.sayHello("name")); 
+        } catch (Exception exception) {
+            // exception will be thown when component instance is discarded
+            // after the message has been processed
+        }              
+        
         // stop a composite
         try {
             node.stopComposite("HelloworldContrib", "lifecycle.composite");
@@ -228,21 +717,30 @@ public class LifecycleTestCase {
         
         // see what happened
         System.out.println(StatusImpl.statusString);
-        Assert.assertEquals("Service binding start - Endpoint:  URI = HelloworldService1#service-binding(Helloworld/lifecycle)\n" + 
-                            "Implementation start - HelloworldService2\n" +
-                            "Service binding start - Endpoint:  URI = HelloworldService2#service-binding(Helloworld/lifecycle)\n" +
-                            "Init - HelloworldClientImpl\n" +
-                            "Reference binding start - EndpointReference:  URI = HelloworldClient#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService1#service-binding(Helloworld/lifecycle)\n" + 
-                            "Service binding stop - Endpoint:  URI = HelloworldService1#service-binding(Helloworld/lifecycle)\n" + 
-                            "Service binding stop - Endpoint:  URI = HelloworldService2#service-binding(Helloworld/lifecycle)\n" + 
-                            "Implementation stop - HelloworldService2\n" +
-                            "Reference binding stop - EndpointReference:  URI = HelloworldClient#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService1#service-binding(Helloworld/lifecycle)\n" +
-                            "Exception on destroy - HelloworldClientImpl\n",  
+        Assert.assertEquals("Service binding start - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Implementation start - HelloworldServiceTestImpl\n" +
+                            "Service binding start - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" +
+                            "Init - HelloworldClientImplCE\n" +
+                            "Reference binding start - EndpointReference:  URI = HelloworldClientCE#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Init - HelloworldClientImplS\n" +
+                            "Reference binding start - EndpointReference:  URI = HelloworldClientS#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Exception on destroy - HelloworldClientImplS\n" +
+                            "Service binding stop - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Service binding stop - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" +
+                            "Implementation stop - HelloworldServiceTestImpl\n" +
+                            "Reference binding stop - EndpointReference:  URI = HelloworldClientCE#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Destroy - HelloworldClientImplCE\n" +
+                            "Reference binding stop - EndpointReference:  URI = HelloworldClientS#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n", 
                             StatusImpl.statusString);
         
-        HelloworldClientImpl.throwTestExceptionOnDestroy = false;
+        HelloworldClientImplS.throwTestExceptionOnDestroy = false;
     }     
     
+    /*
+     * Start up the composite. Send a message where the processing sends an
+     * exception. App exception has no material affect and the scenario is the
+     * same as just sending normal messages and stopping the runtime
+     */  
     @Test
     public void testAppExceptionShutdown() throws Exception{
         
@@ -257,8 +755,15 @@ public class LifecycleTestCase {
         // start a composite
         node.startComposite("HelloworldContrib", "lifecycle.composite");
         
+        // send a message to each client. The last one throws and exception
+        Helloworld hwCE = node.getService(Helloworld.class, "HelloworldClientCE");
+        System.out.println(hwCE.sayHello("name"));
+        Helloworld hwC = node.getService(Helloworld.class, "HelloworldClientC");
+        System.out.println(hwC.sayHello("name"));
+        Helloworld hwS = node.getService(Helloworld.class, "HelloworldClientC");
+        System.out.println(hwS.sayHello("name"));   
         try {
-            Helloworld hw = node.getService(Helloworld.class, "Helloworld1");
+            Helloworld hw = node.getService(Helloworld.class, "HelloworldC");
             hw.throwException("name");
         } catch (Exception ex) {
             // do nothing
@@ -278,16 +783,20 @@ public class LifecycleTestCase {
         
         // see what happened
         System.out.println(StatusImpl.statusString);
-        Assert.assertEquals("Service binding start - Endpoint:  URI = HelloworldService1#service-binding(Helloworld/lifecycle)\n" + 
-                            "Implementation start - HelloworldService2\n" +
-                            "Service binding start - Endpoint:  URI = HelloworldService2#service-binding(Helloworld/lifecycle)\n" +
-                            "Init - HelloworldClientImpl\n" +
-                            "Reference binding start - EndpointReference:  URI = HelloworldClient#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService1#service-binding(Helloworld/lifecycle)\n" + 
-                            "Service binding stop - Endpoint:  URI = HelloworldService1#service-binding(Helloworld/lifecycle)\n" + 
-                            "Service binding stop - Endpoint:  URI = HelloworldService2#service-binding(Helloworld/lifecycle)\n" + 
-                            "Implementation stop - HelloworldService2\n" +
-                            "Reference binding stop - EndpointReference:  URI = HelloworldClient#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService1#service-binding(Helloworld/lifecycle)\n" +
-                            "Destroy - HelloworldClientImpl\n",  
+        Assert.assertEquals("Service binding start - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Implementation start - HelloworldServiceTestImpl\n" +
+                            "Service binding start - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" +
+                            "Init - HelloworldClientImplCE\n" +
+                            "Reference binding start - EndpointReference:  URI = HelloworldClientCE#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Init - HelloworldClientImplC\n" +
+                            "Reference binding start - EndpointReference:  URI = HelloworldClientC#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Service binding stop - Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Service binding stop - Endpoint:  URI = HelloworldServiceTestImpl#service-binding(Helloworld/lifecycle)\n" +
+                            "Implementation stop - HelloworldServiceTestImpl\n" +
+                            "Reference binding stop - EndpointReference:  URI = HelloworldClientC#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Destroy - HelloworldClientImplC\n" +
+                            "Reference binding stop - EndpointReference:  URI = HelloworldClientCE#reference-binding(service/lifecycle) WIRED_TARGET_FOUND_AND_MATCHED Target = Endpoint:  URI = HelloworldService#service-binding(Helloworld/lifecycle)\n" +
+                            "Destroy - HelloworldClientImplCE\n",
                             StatusImpl.statusString);
     }    
     



Mime
View raw message