summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/testing/itest/lifecycle
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-06-06 10:26:44 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-06-06 10:26:44 +0000
commit835a2194bfbd177374e79fa43825d01eb537822f (patch)
tree26348bce4637f75a30102c3f588b5388c58cd4ef /sca-java-2.x/trunk/testing/itest/lifecycle
parent1305be42ad1ae54e4aff090467432bb5f30f450e (diff)
TUSCANY-3867 - Take account of different scopes and eager init
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1132579 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/testing/itest/lifecycle')
-rw-r--r--sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplC.java (renamed from sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImpl.java)24
-rw-r--r--sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplCE.java80
-rw-r--r--sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplS.java78
-rw-r--r--sca-java-2.x/trunk/testing/itest/lifecycle/src/main/resources/lifecycle.composite21
-rw-r--r--sca-java-2.x/trunk/testing/itest/lifecycle/src/test/java/org/apache/tuscany/sca/itest/lifecycle/LifecycleTestCase.java641
5 files changed, 766 insertions, 78 deletions
diff --git a/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImpl.java b/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplC.java
index d8a56eacde..931e61677d 100644
--- a/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImpl.java
+++ b/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplC.java
@@ -20,15 +20,18 @@
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;
-@EagerInit
+/*
+ * C = a composite scoped component that throws exceptions
+ */
+
@Scope("COMPOSITE")
-public class HelloworldClientImpl implements Helloworld {
+public class HelloworldClientImplC implements Helloworld {
+ public static boolean throwTestExceptionOnConstruction = false;
public static boolean throwTestExceptionOnInit = false;
public static boolean throwTestExceptionOnDestroy = false;
@@ -36,25 +39,32 @@ public class HelloworldClientImpl implements Helloworld {
@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", "HelloworldClientImpl");
+ StatusImpl.appendStatus("Exception on init", "HelloworldClientImplC");
throw new Exception("Exception on init");
}
- StatusImpl.appendStatus("Init", "HelloworldClientImpl");
+ StatusImpl.appendStatus("Init", "HelloworldClientImplC");
System.out.println(">>>>>> " + sayHello("init"));
}
@Destroy
public void destroy() throws Exception{
if (throwTestExceptionOnDestroy) {
- StatusImpl.appendStatus("Exception on destroy", "HelloworldClientImpl");
+ StatusImpl.appendStatus("Exception on destroy", "HelloworldClientImplC");
throw new Exception("Exception on destroy");
}
- StatusImpl.appendStatus("Destroy", "HelloworldClientImpl");
+ StatusImpl.appendStatus("Destroy", "HelloworldClientImplC");
}
public String sayHello(String name) throws Exception {
diff --git a/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplCE.java b/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplCE.java
new file mode 100644
index 0000000000..af97452ee9
--- /dev/null
+++ b/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplCE.java
@@ -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");
+ }
+
+}
diff --git a/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplS.java b/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplS.java
new file mode 100644
index 0000000000..493ccca972
--- /dev/null
+++ b/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplS.java
@@ -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");
+ }
+
+}
diff --git a/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/resources/lifecycle.composite b/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/resources/lifecycle.composite
index c959749c03..f08f6fe57b 100644
--- a/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/resources/lifecycle.composite
+++ b/sca-java-2.x/trunk/testing/itest/lifecycle/src/main/resources/lifecycle.composite
@@ -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>
diff --git a/sca-java-2.x/trunk/testing/itest/lifecycle/src/test/java/org/apache/tuscany/sca/itest/lifecycle/LifecycleTestCase.java b/sca-java-2.x/trunk/testing/itest/lifecycle/src/test/java/org/apache/tuscany/sca/itest/lifecycle/LifecycleTestCase.java
index 01180b86bb..a5efeb1d17 100644
--- a/sca-java-2.x/trunk/testing/itest/lifecycle/src/test/java/org/apache/tuscany/sca/itest/lifecycle/LifecycleTestCase.java
+++ b/sca-java-2.x/trunk/testing/itest/lifecycle/src/test/java/org/apache/tuscany/sca/itest/lifecycle/LifecycleTestCase.java
@@ -21,7 +21,9 @@ package org.apache.tuscany.sca.itest.lifecycle;
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);
}