From e5b7380c874745c989d1816b8f552504f038e1bc Mon Sep 17 00:00:00 2001 From: lresende Date: Thu, 26 Sep 2013 20:33:20 +0000 Subject: 2.0 branch for possible maintenance release git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1526672 13f79535-47bb-0310-9956-ffa450edef68 --- .../itest/nodes/binding-sca-hazelcast/pom.xml | 74 +++++ .../tuscany/sca/itest/bindingsca/Client.java | 29 ++ .../tuscany/sca/itest/bindingsca/ClientImpl.java | 53 ++++ .../tuscany/sca/itest/bindingsca/Customer.java | 70 +++++ .../bindingsca/CustomerNotFoundException.java | 64 ++++ .../apache/tuscany/sca/itest/bindingsca/Local.java | 27 ++ .../sca/itest/bindingsca/LocalServiceImpl.java | 38 +++ .../tuscany/sca/itest/bindingsca/Remote.java | 36 +++ .../sca/itest/bindingsca/RemoteServiceImpl.java | 66 +++++ .../sca/itest/bindingsca/SCAClientImpl.java | 57 ++++ .../tuscany/sca/itest/bindingsca/Client.composite | 30 ++ .../tuscany/sca/itest/bindingsca/Service.composite | 31 ++ .../sca/binding/sca/axis2/AsynchTestCase.java | 79 +++++ .../sca/binding/sca/axis2/CallbackTestCase.java | 83 ++++++ .../sca/binding/sca/axis2/PromotionTestCase.java | 74 +++++ .../sca/binding/sca/axis2/SimpleTestCase.java | 110 +++++++ .../axis2/helloworld/HelloWorldCallbackRemote.java | 30 ++ .../sca/axis2/helloworld/HelloWorldClient.java | 27 ++ .../HelloWorldServiceCallbackOnewayRemote.java | 33 +++ .../HelloWorldServiceCallbackRemote.java | 31 ++ .../axis2/helloworld/HelloWorldServiceLocal.java | 27 ++ .../axis2/helloworld/HelloWorldServiceRemote.java | 29 ++ .../axis2/helloworld/HelloWorldServiceRemote2.java | 29 ++ .../HelloWorldClientCallbackOnewayRemoteImpl.java | 43 +++ .../impl/HelloWorldClientCallbackRemoteImpl.java | 42 +++ .../helloworld/impl/HelloWorldClientLocalImpl.java | 35 +++ .../impl/HelloWorldClientRemote2Impl.java | 35 +++ .../impl/HelloWorldClientRemoteImpl.java | 35 +++ .../HelloWorldServiceCallbackOnewayRemoteImpl.java | 35 +++ .../impl/HelloWorldServiceCallbackRemoteImpl.java | 39 +++ .../impl/HelloWorldServiceLocalImpl.java | 30 ++ .../HelloWorldServiceMultipleServicesImpl.java | 41 +++ .../impl/HelloWorldServiceRemoteImpl.java | 30 ++ .../sca/binding/sca/rmi/AsynchTestCase.java | 79 +++++ .../sca/binding/sca/rmi/CallbackTestCase.java | 84 ++++++ .../sca/binding/sca/rmi/PromotionTestCase.java | 76 +++++ .../sca/binding/sca/rmi/SimpleTestCase.java | 116 ++++++++ .../rmi/helloworld/HelloWorldCallbackRemote.java | 30 ++ .../sca/rmi/helloworld/HelloWorldClient.java | 27 ++ .../HelloWorldServiceCallbackOnewayRemote.java | 33 +++ .../HelloWorldServiceCallbackRemote.java | 31 ++ .../sca/rmi/helloworld/HelloWorldServiceLocal.java | 27 ++ .../rmi/helloworld/HelloWorldServiceRemote.java | 29 ++ .../rmi/helloworld/HelloWorldServiceRemote2.java | 29 ++ .../HelloWorldClientCallbackOnewayRemoteImpl.java | 43 +++ .../impl/HelloWorldClientCallbackRemoteImpl.java | 42 +++ .../helloworld/impl/HelloWorldClientLocalImpl.java | 35 +++ .../impl/HelloWorldClientRemote2Impl.java | 35 +++ .../impl/HelloWorldClientRemoteImpl.java | 35 +++ .../HelloWorldServiceCallbackOnewayRemoteImpl.java | 35 +++ .../impl/HelloWorldServiceCallbackRemoteImpl.java | 39 +++ .../impl/HelloWorldServiceLocalImpl.java | 30 ++ .../HelloWorldServiceMultipleServicesImpl.java | 41 +++ .../impl/HelloWorldServiceRemoteImpl.java | 30 ++ .../sca/itest/bindingsca/BindingSCATestCase.java | 170 +++++++++++ .../ClientNodeSharedCustomerTestCase.java | 62 ++++ .../bindingsca/ClientNodeSharedLocalTestCase.java | 62 ++++ .../bindingsca/ClientSharedCustomerTestCase.java | 54 ++++ .../bindingsca/ClientSharedLocalTestCase.java | 63 ++++ .../tuscany/sca/itest/bindingsca/ServiceNode.java | 48 +++ .../sca/itest/bindingsca/TestCaseRunner.java | 329 +++++++++++++++++++++ .../rmi/asynchReference/HelloWorld.composite | 36 +++ .../asynchReference/META-INF/sca-contribution.xml | 23 ++ .../rmi/asynchService/HelloWorld.composite | 38 +++ .../asynchService/META-INF/sca-contribution.xml | 23 ++ .../rmi/callbackReference/HelloWorld.composite | 36 +++ .../META-INF/sca-contribution.xml | 23 ++ .../rmi/callbackService/HelloWorld.composite | 43 +++ .../callbackService/META-INF/sca-contribution.xml | 23 ++ .../rmi/promotionReference/HelloWorld.composite | 33 +++ .../HelloWorldComponent.composite | 37 +++ .../META-INF/sca-contribution.xml | 23 ++ .../rmi/promotionService/HelloWorld.composite | 35 +++ .../promotionService/HelloWorldComponent.composite | 37 +++ .../promotionService/META-INF/sca-contribution.xml | 23 ++ .../rmi/simpleReference/HelloWorld.composite | 67 +++++ .../simpleReference/META-INF/sca-contribution.xml | 23 ++ .../rmi/simpleService/HelloWorld.composite | 85 ++++++ .../simpleService/META-INF/sca-contribution.xml | 23 ++ .../ws/asynchReference/HelloWorld.composite | 36 +++ .../asynchReference/META-INF/sca-contribution.xml | 23 ++ .../ws/asynchService/HelloWorld.composite | 38 +++ .../ws/asynchService/META-INF/sca-contribution.xml | 23 ++ .../ws/callbackReference/HelloWorld.composite | 36 +++ .../META-INF/sca-contribution.xml | 23 ++ .../ws/callbackService/HelloWorld.composite | 43 +++ .../callbackService/META-INF/sca-contribution.xml | 23 ++ .../ws/promotionReference/HelloWorld.composite | 33 +++ .../HelloWorldComponent.composite | 37 +++ .../META-INF/sca-contribution.xml | 23 ++ .../ws/promotionService/HelloWorld.composite | 35 +++ .../promotionService/HelloWorldComponent.composite | 37 +++ .../promotionService/META-INF/sca-contribution.xml | 23 ++ .../ws/simpleReference/HelloWorld.composite | 67 +++++ .../simpleReference/META-INF/sca-contribution.xml | 23 ++ .../ws/simpleService/HelloWorld.composite | 84 ++++++ .../ws/simpleService/META-INF/sca-contribution.xml | 23 ++ .../testing/itest/nodes/binding-sca-tribes/pom.xml | 70 +++++ .../tuscany/sca/itest/bindingsca/Client.java | 29 ++ .../tuscany/sca/itest/bindingsca/ClientImpl.java | 53 ++++ .../tuscany/sca/itest/bindingsca/Customer.java | 70 +++++ .../bindingsca/CustomerNotFoundException.java | 64 ++++ .../apache/tuscany/sca/itest/bindingsca/Local.java | 27 ++ .../sca/itest/bindingsca/LocalServiceImpl.java | 38 +++ .../tuscany/sca/itest/bindingsca/Remote.java | 36 +++ .../sca/itest/bindingsca/RemoteServiceImpl.java | 66 +++++ .../sca/itest/bindingsca/SCAClientImpl.java | 57 ++++ .../tuscany/sca/itest/bindingsca/Client.composite | 30 ++ .../tuscany/sca/itest/bindingsca/Service.composite | 31 ++ .../sca/binding/sca/axis2/AsynchTestCase.java | 79 +++++ .../sca/binding/sca/axis2/CallbackTestCase.java | 83 ++++++ .../sca/binding/sca/axis2/PromotionTestCase.java | 74 +++++ .../sca/binding/sca/axis2/SimpleTestCase.java | 110 +++++++ .../axis2/helloworld/HelloWorldCallbackRemote.java | 30 ++ .../sca/axis2/helloworld/HelloWorldClient.java | 27 ++ .../HelloWorldServiceCallbackOnewayRemote.java | 33 +++ .../HelloWorldServiceCallbackRemote.java | 31 ++ .../axis2/helloworld/HelloWorldServiceLocal.java | 27 ++ .../axis2/helloworld/HelloWorldServiceRemote.java | 29 ++ .../axis2/helloworld/HelloWorldServiceRemote2.java | 29 ++ .../HelloWorldClientCallbackOnewayRemoteImpl.java | 43 +++ .../impl/HelloWorldClientCallbackRemoteImpl.java | 42 +++ .../helloworld/impl/HelloWorldClientLocalImpl.java | 35 +++ .../impl/HelloWorldClientRemote2Impl.java | 35 +++ .../impl/HelloWorldClientRemoteImpl.java | 35 +++ .../HelloWorldServiceCallbackOnewayRemoteImpl.java | 35 +++ .../impl/HelloWorldServiceCallbackRemoteImpl.java | 39 +++ .../impl/HelloWorldServiceLocalImpl.java | 30 ++ .../HelloWorldServiceMultipleServicesImpl.java | 41 +++ .../impl/HelloWorldServiceRemoteImpl.java | 30 ++ .../sca/binding/sca/rmi/AsynchTestCase.java | 79 +++++ .../sca/binding/sca/rmi/CallbackTestCase.java | 84 ++++++ .../sca/binding/sca/rmi/PromotionTestCase.java | 76 +++++ .../sca/binding/sca/rmi/SimpleTestCase.java | 116 ++++++++ .../rmi/helloworld/HelloWorldCallbackRemote.java | 30 ++ .../sca/rmi/helloworld/HelloWorldClient.java | 27 ++ .../HelloWorldServiceCallbackOnewayRemote.java | 33 +++ .../HelloWorldServiceCallbackRemote.java | 31 ++ .../sca/rmi/helloworld/HelloWorldServiceLocal.java | 27 ++ .../rmi/helloworld/HelloWorldServiceRemote.java | 29 ++ .../rmi/helloworld/HelloWorldServiceRemote2.java | 29 ++ .../HelloWorldClientCallbackOnewayRemoteImpl.java | 43 +++ .../impl/HelloWorldClientCallbackRemoteImpl.java | 42 +++ .../helloworld/impl/HelloWorldClientLocalImpl.java | 35 +++ .../impl/HelloWorldClientRemote2Impl.java | 35 +++ .../impl/HelloWorldClientRemoteImpl.java | 35 +++ .../HelloWorldServiceCallbackOnewayRemoteImpl.java | 35 +++ .../impl/HelloWorldServiceCallbackRemoteImpl.java | 39 +++ .../impl/HelloWorldServiceLocalImpl.java | 30 ++ .../HelloWorldServiceMultipleServicesImpl.java | 41 +++ .../impl/HelloWorldServiceRemoteImpl.java | 30 ++ .../sca/itest/bindingsca/BindingSCATestCase.java | 170 +++++++++++ .../ClientNodeSharedCustomerTestCase.java | 62 ++++ .../bindingsca/ClientNodeSharedLocalTestCase.java | 62 ++++ .../bindingsca/ClientSharedCustomerTestCase.java | 54 ++++ .../bindingsca/ClientSharedLocalTestCase.java | 63 ++++ .../tuscany/sca/itest/bindingsca/ServiceNode.java | 48 +++ .../sca/itest/bindingsca/TestCaseRunner.java | 329 +++++++++++++++++++++ .../rmi/asynchReference/HelloWorld.composite | 36 +++ .../asynchReference/META-INF/sca-contribution.xml | 23 ++ .../rmi/asynchService/HelloWorld.composite | 38 +++ .../asynchService/META-INF/sca-contribution.xml | 23 ++ .../rmi/callbackReference/HelloWorld.composite | 36 +++ .../META-INF/sca-contribution.xml | 23 ++ .../rmi/callbackService/HelloWorld.composite | 43 +++ .../callbackService/META-INF/sca-contribution.xml | 23 ++ .../rmi/promotionReference/HelloWorld.composite | 33 +++ .../HelloWorldComponent.composite | 37 +++ .../META-INF/sca-contribution.xml | 23 ++ .../rmi/promotionService/HelloWorld.composite | 35 +++ .../promotionService/HelloWorldComponent.composite | 37 +++ .../promotionService/META-INF/sca-contribution.xml | 23 ++ .../rmi/simpleReference/HelloWorld.composite | 67 +++++ .../simpleReference/META-INF/sca-contribution.xml | 23 ++ .../rmi/simpleService/HelloWorld.composite | 85 ++++++ .../simpleService/META-INF/sca-contribution.xml | 23 ++ .../ws/asynchReference/HelloWorld.composite | 36 +++ .../asynchReference/META-INF/sca-contribution.xml | 23 ++ .../ws/asynchService/HelloWorld.composite | 38 +++ .../ws/asynchService/META-INF/sca-contribution.xml | 23 ++ .../ws/callbackReference/HelloWorld.composite | 36 +++ .../META-INF/sca-contribution.xml | 23 ++ .../ws/callbackService/HelloWorld.composite | 43 +++ .../callbackService/META-INF/sca-contribution.xml | 23 ++ .../ws/promotionReference/HelloWorld.composite | 33 +++ .../HelloWorldComponent.composite | 37 +++ .../META-INF/sca-contribution.xml | 23 ++ .../ws/promotionService/HelloWorld.composite | 35 +++ .../promotionService/HelloWorldComponent.composite | 37 +++ .../promotionService/META-INF/sca-contribution.xml | 23 ++ .../ws/simpleReference/HelloWorld.composite | 67 +++++ .../simpleReference/META-INF/sca-contribution.xml | 23 ++ .../ws/simpleService/HelloWorld.composite | 84 ++++++ .../ws/simpleService/META-INF/sca-contribution.xml | 23 ++ .../2.0/testing/itest/nodes/domain-node/pom.xml | 59 ++++ .../main/java/helloworld/HelloWorldClientImpl.java | 37 +++ .../src/main/java/helloworld/HelloWorldImpl.java | 32 ++ .../main/java/helloworld/HelloWorldService.java | 33 +++ .../main/resources/META-INF/sca-contribution.xml | 23 ++ .../src/main/resources/helloworld.composite | 47 +++ .../test/java/helloworld/DomainNodeTestCase.java | 90 ++++++ .../testing/itest/nodes/helloworld-client/pom.xml | 44 +++ .../src/main/java/itest/nodes/HelloworldImpl.java | 43 +++ .../main/resources/META-INF/sca-contribution.xml | 24 ++ .../src/main/resources/helloworld-client.composite | 29 ++ .../testing/itest/nodes/helloworld-iface/pom.xml | 39 +++ .../src/main/java/itest/nodes/Helloworld.java | 29 ++ .../main/resources/META-INF/sca-contribution.xml | 23 ++ .../itest/nodes/helloworld-service-a/pom.xml | 44 +++ .../src/main/java/itest/nodes/HelloworldImpl.java | 43 +++ .../main/resources/META-INF/sca-contribution.xml | 23 ++ .../src/main/resources/service-a.composite | 29 ++ .../nodes/helloworld-service-and-client/pom.xml | 39 +++ .../src/main/java/itest/nodes/sac/Helloworld.java | 29 ++ .../java/itest/nodes/sac/HelloworldClientImpl.java | 34 +++ .../itest/nodes/sac/HelloworldServiceImpl.java | 30 ++ .../main/resources/META-INF/sca-contribution.xml | 23 ++ .../main/resources/helloworld-service.composite | 33 +++ .../itest/nodes/helloworld-service-b/pom.xml | 49 +++ .../src/main/java/itest/nodes/HelloworldImpl.java | 33 +++ .../main/resources/META-INF/sca-contribution.xml | 23 ++ .../src/main/resources/service-b.composite | 29 ++ .../itest/nodes/helloworld-service-c/pom.xml | 49 +++ .../src/main/java/itest/nodes/HelloworldImpl.java | 28 ++ .../main/resources/META-INF/sca-contribution.xml | 23 ++ .../src/main/resources/service-c.composite | 28 ++ .../testing/itest/nodes/helloworld-service/pom.xml | 43 +++ .../src/main/java/itest/nodes/HelloworldImpl.java | 30 ++ .../main/resources/META-INF/sca-contribution.xml | 24 ++ .../main/resources/helloworld-service.composite | 28 ++ .../itest/nodes/one-jvm-hazelcast-client/pom.xml | 51 ++++ .../src/test/java/itest/ClientTestCase.java | 112 +++++++ .../testing/itest/nodes/one-jvm-hazelcast/pom.xml | 54 ++++ .../java/itest/OneNodeOneContributionTestCase.java | 64 ++++ .../src/test/java/itest/OneNodeTestCase.java | 76 +++++ .../src/test/java/itest/TwoNodeTestCase.java | 82 +++++ .../test/java/itest/TwoRemoteNodesTestCase.java | 89 ++++++ .../2.0/testing/itest/nodes/one-jvm-tribes/pom.xml | 82 +++++ .../src/test/java/itest/OneNodeTestCase.java | 76 +++++ .../src/test/java/itest/TwoNodeTestCase.java | 82 +++++ .../test/java/itest/TwoRemoteNodesTestCase.java | 83 ++++++ .../2.0/testing/itest/nodes/one-jvm/pom.xml | 53 ++++ .../src/test/java/itest/OneNodeTestCase.java | 76 +++++ .../src/test/java/itest/TwoNodeTestCase.java | 82 +++++ .../2.0/testing/itest/nodes/one-node-test/pom.xml | 48 +++ .../src/test/java/itest/OneNodeTestCase.java | 88 ++++++ .../branches/2.0/testing/itest/nodes/pom.xml | 64 ++++ .../testing/itest/nodes/remote-stop-start/pom.xml | 71 +++++ .../src/main/java/itest/HelloworldService.java | 28 ++ .../src/main/java/itest/HelloworldServiceImpl.java | 38 +++ .../main/java/itest/RemoteHelloworldService.java | 28 ++ .../src/main/resources/Helloworld.composite | 29 ++ .../main/resources/META-INF/sca-contribution.xml | 23 ++ .../java/test/scaclient/StopStartTestCase.java | 62 ++++ .../nodes/three-nodes-three-vms-test/build.xml | 38 +++ .../nodes/three-nodes-three-vms-test/client.xml | 31 ++ .../itest/nodes/three-nodes-three-vms-test/pom.xml | 104 +++++++ .../nodes/three-nodes-three-vms-test/server.xml | 30 ++ .../service-a-config.xml | 39 +++ .../service-b-config.xml | 39 +++ .../service-c-config.xml | 39 +++ .../src/test/java/itest/ServiceA.java | 65 ++++ .../src/test/java/itest/ServiceB.java | 55 ++++ .../src/test/java/itest/ServiceC.java | 55 ++++ .../itest/nodes/two-jvm-hazelcast/build.xml | 54 ++++ .../testing/itest/nodes/two-jvm-hazelcast/pom.xml | 98 ++++++ .../java/org/apache/tuscany/sca/impl/Tuscany.java | 138 +++++++++ .../helloworld-client-contribution.jar | Bin 0 -> 9625 bytes .../helloworld-iface-contribution.jar | Bin 0 -> 8212 bytes .../helloworld-service-contribution.jar | Bin 0 -> 9432 bytes .../domain-domain1/node-nodeClient/node.xml | 39 +++ .../domain-domain1/node-nodeService/node.xml | 39 +++ .../2.0/testing/itest/nodes/two-nodes-test/pom.xml | 59 ++++ .../src/test/java/itest/ClientNode.java | 93 ++++++ .../src/test/java/itest/ServiceNode.java | 58 ++++ .../test/java/itest/StopStartNodesTestCase.java | 103 +++++++ .../src/test/java/itest/TestCaseRunner.java | 292 ++++++++++++++++++ .../src/test/java/itest/TwoNodesTestCase.java | 106 +++++++ .../itest/nodes/two-nodes-two-vms-test/build.xml | 38 +++ .../nodes/two-nodes-two-vms-test/client-config.xml | 39 +++ .../itest/nodes/two-nodes-two-vms-test/client.xml | 31 ++ .../itest/nodes/two-nodes-two-vms-test/pom.xml | 104 +++++++ .../nodes/two-nodes-two-vms-test/server-config.xml | 39 +++ .../itest/nodes/two-nodes-two-vms-test/server.xml | 33 +++ .../src/test/java/itest/Client.java | 69 +++++ .../src/test/java/itest/Service.java | 61 ++++ 286 files changed, 13725 insertions(+) create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Client.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/ClientImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Customer.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/CustomerNotFoundException.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Local.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/LocalServiceImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Remote.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/RemoteServiceImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/SCAClientImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/resources/org/apache/tuscany/sca/itest/bindingsca/Client.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/resources/org/apache/tuscany/sca/itest/bindingsca/Service.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldCallbackRemote.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldClient.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackOnewayRemote.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackRemote.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceLocal.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote2.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientLocalImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemote2Impl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceLocalImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/AsynchTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/CallbackTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/PromotionTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/SimpleTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldCallbackRemote.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldClient.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceCallbackOnewayRemote.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceCallbackRemote.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceLocal.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceRemote.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceRemote2.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientLocalImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientRemote2Impl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceLocalImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/BindingSCATestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientNodeSharedCustomerTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientNodeSharedLocalTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientSharedCustomerTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientSharedLocalTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ServiceNode.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/TestCaseRunner.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/asynchReference/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/asynchReference/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/asynchService/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/asynchService/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/callbackReference/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/callbackReference/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/callbackService/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/callbackService/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionReference/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionReference/HelloWorldComponent.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionReference/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionService/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionService/HelloWorldComponent.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionService/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/simpleReference/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/simpleReference/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/simpleService/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/simpleService/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/asynchReference/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/asynchReference/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/asynchService/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/asynchService/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/callbackReference/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/callbackReference/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/callbackService/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/callbackService/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionReference/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionReference/HelloWorldComponent.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionReference/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionService/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionService/HelloWorldComponent.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionService/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/simpleReference/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/simpleReference/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/simpleService/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/simpleService/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Client.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/ClientImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Customer.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/CustomerNotFoundException.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Local.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/LocalServiceImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Remote.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/RemoteServiceImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/SCAClientImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/resources/org/apache/tuscany/sca/itest/bindingsca/Client.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/resources/org/apache/tuscany/sca/itest/bindingsca/Service.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldCallbackRemote.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldClient.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackOnewayRemote.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackRemote.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceLocal.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote2.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientLocalImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemote2Impl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceLocalImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/AsynchTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/CallbackTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/PromotionTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/SimpleTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldCallbackRemote.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldClient.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceCallbackOnewayRemote.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceCallbackRemote.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceLocal.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceRemote.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceRemote2.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientLocalImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientRemote2Impl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceLocalImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceRemoteImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/BindingSCATestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientNodeSharedCustomerTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientNodeSharedLocalTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientSharedCustomerTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientSharedLocalTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ServiceNode.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/TestCaseRunner.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/asynchReference/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/asynchReference/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/asynchService/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/asynchService/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/callbackReference/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/callbackReference/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/callbackService/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/callbackService/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionReference/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionReference/HelloWorldComponent.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionReference/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionService/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionService/HelloWorldComponent.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionService/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/simpleReference/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/simpleReference/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/simpleService/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/simpleService/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/asynchReference/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/asynchReference/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/asynchService/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/asynchService/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/callbackReference/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/callbackReference/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/callbackService/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/callbackService/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionReference/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionReference/HelloWorldComponent.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionReference/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionService/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionService/HelloWorldComponent.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionService/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/simpleReference/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/simpleReference/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/simpleService/HelloWorld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/simpleService/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldClientImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldService.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/resources/helloworld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/test/java/helloworld/DomainNodeTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-client/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-client/src/main/java/itest/nodes/HelloworldImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-client/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-client/src/main/resources/helloworld-client.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-iface/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-iface/src/main/java/itest/nodes/Helloworld.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-iface/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-a/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-a/src/main/java/itest/nodes/HelloworldImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-a/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-a/src/main/resources/service-a.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/src/main/java/itest/nodes/sac/Helloworld.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/src/main/java/itest/nodes/sac/HelloworldClientImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/src/main/java/itest/nodes/sac/HelloworldServiceImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/src/main/resources/helloworld-service.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-b/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-b/src/main/java/itest/nodes/HelloworldImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-b/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-b/src/main/resources/service-b.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-c/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-c/src/main/java/itest/nodes/HelloworldImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-c/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-c/src/main/resources/service-c.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service/src/main/java/itest/nodes/HelloworldImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service/src/main/resources/helloworld-service.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast-client/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast-client/src/test/java/itest/ClientTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast/src/test/java/itest/OneNodeOneContributionTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast/src/test/java/itest/OneNodeTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast/src/test/java/itest/TwoNodeTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast/src/test/java/itest/TwoRemoteNodesTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-tribes/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-tribes/src/test/java/itest/OneNodeTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-tribes/src/test/java/itest/TwoNodeTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-tribes/src/test/java/itest/TwoRemoteNodesTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm/src/test/java/itest/OneNodeTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm/src/test/java/itest/TwoNodeTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/one-node-test/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/main/java/itest/HelloworldService.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/main/java/itest/HelloworldServiceImpl.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/main/java/itest/RemoteHelloworldService.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/main/resources/Helloworld.composite create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/test/java/test/scaclient/StopStartTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/build.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/client.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/server.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/service-a-config.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/service-b-config.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/service-c-config.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/src/test/java/itest/ServiceA.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/src/test/java/itest/ServiceB.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/src/test/java/itest/ServiceC.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/build.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/main/java/org/apache/tuscany/sca/impl/Tuscany.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/test/resources/domain-domain1/helloworld-client-contribution.jar create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/test/resources/domain-domain1/helloworld-iface-contribution.jar create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/test/resources/domain-domain1/helloworld-service-contribution.jar create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/test/resources/domain-domain1/node-nodeClient/node.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/test/resources/domain-domain1/node-nodeService/node.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/src/test/java/itest/ClientNode.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/src/test/java/itest/ServiceNode.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/src/test/java/itest/StopStartNodesTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/src/test/java/itest/TestCaseRunner.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/build.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/client-config.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/client.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/pom.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/server-config.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/server.xml create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/Client.java create mode 100644 sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/Service.java (limited to 'sca-java-2.x/branches/2.0/testing/itest/nodes') diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/pom.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/pom.xml new file mode 100644 index 0000000000..90ee8b3bc6 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/pom.xml @@ -0,0 +1,74 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-nodes + 2.0 + ../pom.xml + + itest-nodes-binding-sca-hazelcast + Apache Tuscany SCA iTest Nodes binding.sca Using Hazelcast Registry + + + + org.apache.tuscany.sca + tuscany-base-runtime-pom + pom + 2.0 + + + org.apache.tuscany.sca + tuscany-domain-hazelcast + 2.0 + + + org.apache.tuscany.sca + tuscany-binding-ws-runtime-axis2 + 2.0 + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0 + runtime + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.5 + + + **/*TestCase.java + + brief + true + once + -ea -Xmx256m + off + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Client.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Client.java new file mode 100644 index 0000000000..ef2565b750 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Client.java @@ -0,0 +1,29 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +/** + * + */ +public interface Client { + String getName(String id); + + String create(String name); +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/ClientImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/ClientImpl.java new file mode 100644 index 0000000000..96a0f2dadd --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/ClientImpl.java @@ -0,0 +1,53 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * + */ +@Service(Client.class) +public class ClientImpl implements Client { + @Reference + protected Local local; + + @Reference + protected Remote remote; + + public String getName(String id) { + Customer customer = null; + try { + customer = remote.getCustomer(id); + } catch (CustomerNotFoundException e) { + return null; + } + customer.dump("Client.getName()"); + return local.getName(customer); + } + + public String create(String name) { + String id = remote.generateId(); + Customer customer = remote.createCustomer(id, name); + customer.dump("Client.create()"); + return remote.getId(customer); + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Customer.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Customer.java new file mode 100644 index 0000000000..f2b7b1e41d --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Customer.java @@ -0,0 +1,70 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +/** + * + */ +public class Customer { + private String id; + private String name; + + public Customer() { + } + + /** + * @param id + * @param name + */ + public Customer(String id, String name) { + super(); + this.id = id; + this.name = name; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public String toString() { + return "Customer [id=" + id + ", name=" + name + "]"; + } + + public void dump(String prefix) { + System.out.print(prefix); + System.out.print(": "); + System.out.print(toString()); + System.out.println(" @" + System.identityHashCode(this)); + System.out.println(getClass().getClassLoader()); + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/CustomerNotFoundException.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/CustomerNotFoundException.java new file mode 100644 index 0000000000..a6e80c9eca --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/CustomerNotFoundException.java @@ -0,0 +1,64 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +/** + * + */ +public class CustomerNotFoundException extends Exception { + private String customerId; + + /** + * + */ + public CustomerNotFoundException() { + } + + /** + * @param message + */ + public CustomerNotFoundException(String message) { + super(message); + } + + /** + * @param cause + */ + public CustomerNotFoundException(Throwable cause) { + super(cause); + } + + /** + * @param message + * @param cause + */ + public CustomerNotFoundException(String message, Throwable cause) { + super(message, cause); + } + + public String getCustomerId() { + return customerId; + } + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Local.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Local.java new file mode 100644 index 0000000000..0fe30c9d53 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Local.java @@ -0,0 +1,27 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +/** + * + */ +public interface Local { + String getName(Customer customer); +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/LocalServiceImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/LocalServiceImpl.java new file mode 100644 index 0000000000..8783808334 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/LocalServiceImpl.java @@ -0,0 +1,38 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import org.oasisopen.sca.annotation.Service; + +/** + * + */ +@Service(Local.class) +public class LocalServiceImpl implements Local { + + public String getName(Customer customer) { + if (customer == null) { + return null; + } + customer.dump("Local.getName()"); + return customer.getName(); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Remote.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Remote.java new file mode 100644 index 0000000000..050d35007b --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Remote.java @@ -0,0 +1,36 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * + */ +@Remotable +public interface Remote { + String generateId(); + + String getId(Customer customer); + + Customer getCustomer(String id) throws CustomerNotFoundException; + + Customer createCustomer(String id, String name); +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/RemoteServiceImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/RemoteServiceImpl.java new file mode 100644 index 0000000000..6c432a500a --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/RemoteServiceImpl.java @@ -0,0 +1,66 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.oasisopen.sca.annotation.AllowsPassByReference; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +/** + * + */ +@Service(Remote.class) +@Scope("COMPOSITE") +public class RemoteServiceImpl implements Remote { + private Map customers = new HashMap(); + + public String generateId() { + return UUID.randomUUID().toString(); + } + + @AllowsPassByReference + public String getId(Customer customer) { + customer.dump("Remote.getId()"); + return customer.getId(); + } + + public Customer getCustomer(String id) throws CustomerNotFoundException { + Customer customer = customers.get(id); + if (customer == null) { + CustomerNotFoundException ex = new CustomerNotFoundException("Customer not found"); + ex.setCustomerId(id); + throw ex; + } + customer.dump("Remote.getCustomer()"); + return customer; + } + + public Customer createCustomer(String id, String name) { + Customer customer = new Customer(id, name); + customer.dump("Remote.createCustomer()"); + customers.put(id, customer); + return customer; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/SCAClientImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/SCAClientImpl.java new file mode 100644 index 0000000000..3573eea978 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/java/org/apache/tuscany/sca/itest/bindingsca/SCAClientImpl.java @@ -0,0 +1,57 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import java.net.URI; + +import org.oasisopen.sca.client.SCAClientFactory; + +/** + * + */ +public class SCAClientImpl implements Client { + private Local local; + private Remote remote; + + public SCAClientImpl(String domainURI) throws Exception { + SCAClientFactory factory = SCAClientFactory.newInstance(URI.create(domainURI)); + local = factory.getService(Local.class, "LocalComponent/Local"); + remote = factory.getService(Remote.class, "RemoteComponent/Remote"); + } + + public String getName(String id) { + Customer customer = null; + try { + customer = remote.getCustomer(id); + } catch (CustomerNotFoundException e) { + return null; + } + customer.dump("Client.getName()"); + return local.getName(customer); + } + + public String create(String name) { + String id = remote.generateId(); + Customer customer = remote.createCustomer(id, name); + customer.dump("Client.create()"); + return remote.getId(customer); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/resources/org/apache/tuscany/sca/itest/bindingsca/Client.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/resources/org/apache/tuscany/sca/itest/bindingsca/Client.composite new file mode 100644 index 0000000000..b04cc33023 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/resources/org/apache/tuscany/sca/itest/bindingsca/Client.composite @@ -0,0 +1,30 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/resources/org/apache/tuscany/sca/itest/bindingsca/Service.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/resources/org/apache/tuscany/sca/itest/bindingsca/Service.composite new file mode 100644 index 0000000000..fe282d291c --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/main/resources/org/apache/tuscany/sca/itest/bindingsca/Service.composite @@ -0,0 +1,31 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java new file mode 100644 index 0000000000..9efa1a99ec --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java @@ -0,0 +1,79 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2; + + +import junit.framework.Assert; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientCallbackOnewayRemoteImpl; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +// @Ignore("TUSCANY-3138") +public class AsynchTestCase { + + public static Node nodeA; + public static Node nodeB; + + @BeforeClass + public static void init() throws Exception { + System.out.println("Setting up nodes"); + + try { + // create and start nodes + Contribution contrib = new Contribution("asynch", "./target/test-classes/ws/asynchReference"); + nodeA = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeA.start(); + + contrib = new Contribution("asynch", "./target/test-classes/ws/asynchService"); + nodeB = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeB.start(); + + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + throw ex; + } + } + + @AfterClass + public static void destroy() throws Exception { + nodeA.stop(); + nodeB.stop(); + } + + @Test + public void testHelloWorldAsynch() throws Exception { + HelloWorldClient helloWorldClientB; + helloWorldClientB = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote"); + helloWorldClientB.getGreetings("fred"); + System.out.println("Sleeping ..."); + Thread.sleep(2000); + System.out.println("... Done"); + Assert.assertEquals("callback fred", HelloWorldClientCallbackOnewayRemoteImpl.result ); + + } + + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java new file mode 100644 index 0000000000..efa84e92a5 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java @@ -0,0 +1,83 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +// @Ignore("TUSCANY-3138") +public class CallbackTestCase { + + public static Node nodeA; + public static Node nodeB; + + @BeforeClass + public static void init() throws Exception { + System.out.println("Setting up nodes"); + + try { + // create and start nodes + Contribution contrib = new Contribution("reference", "./target/test-classes/ws/callbackReference"); + nodeA = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeA.start(); + + contrib = new Contribution("service", "./target/test-classes/ws/callbackService"); + nodeB = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeB.start(); + + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + throw ex; + } + } + + @AfterClass + public static void destroy() throws Exception { + nodeA.stop(); + nodeB.stop(); + } + + //@Test + public void testKeepServerRunning() throws Exception { + System.out.println("press enter to continue"); + System.in.read(); + } + + @Test + public void testHelloWorldCallbackLocal() throws Exception { + HelloWorldClient helloWorldClientB; + helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientCallbackLocal"); + Assert.assertEquals("Hello callback fred", helloWorldClientB.getGreetings("fred")); + } + + @Test + public void testHelloWorldCallbackRemote() throws Exception { + HelloWorldClient helloWorldClientA; + helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote"); + Assert.assertEquals("Hello callback fred", helloWorldClientA.getGreetings("fred")); + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java new file mode 100644 index 0000000000..45d28140b4 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java @@ -0,0 +1,74 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +public class PromotionTestCase { + + + public static Node nodeA; + public static Node nodeB; + + @BeforeClass + public static void init() throws Exception { + System.out.println("Setting up nodes"); + + try { + // create and start nodes + Contribution contrib = new Contribution("reference", "./target/test-classes/ws/promotionReference"); + nodeA = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeA.start(); + + contrib = new Contribution("service", "./target/test-classes/ws/promotionService"); + nodeB = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeB.start(); + + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + throw ex; + } + } + + @AfterClass + public static void destroy() throws Exception { + nodeA.stop(); + nodeB.stop(); + } + + @Test + @Ignore + public void testHelloWorldPromotion() throws Exception { + HelloWorldClient helloWorldClientA; + helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientRemotePromotion"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java new file mode 100644 index 0000000000..a5d6529895 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java @@ -0,0 +1,110 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.oasisopen.sca.ServiceUnavailableException; + +public class SimpleTestCase { + + public static Node nodeA; + public static Node nodeB; + + @BeforeClass + public static void init() throws Exception { + System.out.println("Setting up nodes"); + + try { + // create and start nodes + Contribution contrib = new Contribution("reference", "./target/test-classes/ws/simpleReference"); + nodeA = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeA.start(); + + contrib = new Contribution("service", "./target/test-classes/ws/simpleService"); + nodeB = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeB.start(); + + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + throw ex; + } + } + + @AfterClass + public static void destroy() throws Exception { + nodeA.stop(); + nodeB.stop(); + } + + @Test + public void testHelloWorldLocal() throws Exception { + HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientLocal"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + + } + + @Test + public void testHelloWorldRemote() throws Exception { + + HelloWorldClient helloWorldClientA; + helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientRemote"); + + try { + helloWorldClientA.getGreetings("fred"); + } catch (ServiceUnavailableException ex){ + Assert.fail(); + } + } + + @Test + public void testHelloWorldLocalAndRemote() throws Exception { + HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientLocalAndRemote"); + HelloWorldClient helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientLocalAndRemote"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + Assert.assertEquals(helloWorldClientB.getGreetings("fred"), "Hello fred"); + } + + @Test + public void testHelloWorldMultipleServices() throws Exception { + HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleServices"); + HelloWorldClient helloWorldClientA2 = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleServices2"); + HelloWorldClient helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientMultipleServices"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + Assert.assertEquals(helloWorldClientA2.getGreetings("fred"), "Hello fred"); + Assert.assertEquals(helloWorldClientB.getGreetings("fred"), "Hello fred"); + } + + @Test + public void testHelloWorldMultipleBindings() throws Exception { + HelloWorldClient helloWorldClientA; + helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleBindings"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldCallbackRemote.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldCallbackRemote.java new file mode 100644 index 0000000000..f7ab3dfe98 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldCallbackRemote.java @@ -0,0 +1,30 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + + +@Remotable +public interface HelloWorldCallbackRemote { + + String getGreetingsCallbackRemote(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldClient.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..3d25d37708 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldClient.java @@ -0,0 +1,27 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld; + + +public interface HelloWorldClient { + + String getGreetings(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackOnewayRemote.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackOnewayRemote.java new file mode 100644 index 0000000000..a469d197d6 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackOnewayRemote.java @@ -0,0 +1,33 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +@Callback(HelloWorldCallbackRemote.class) +public interface HelloWorldServiceCallbackOnewayRemote { + + @OneWay + void getGreetingsRemote(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackRemote.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackRemote.java new file mode 100644 index 0000000000..3f5a21fddd --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackRemote.java @@ -0,0 +1,31 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +@Callback(HelloWorldCallbackRemote.class) +public interface HelloWorldServiceCallbackRemote { + + String getGreetingsRemote(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceLocal.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceLocal.java new file mode 100644 index 0000000000..49e5232b31 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceLocal.java @@ -0,0 +1,27 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld; + + +public interface HelloWorldServiceLocal { + + String getGreetingsLocal(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote.java new file mode 100644 index 0000000000..ccc77c142b --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote.java @@ -0,0 +1,29 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloWorldServiceRemote { + + String getGreetingsRemote(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote2.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote2.java new file mode 100644 index 0000000000..c2be798d1a --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote2.java @@ -0,0 +1,29 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloWorldServiceRemote2 { + + String getGreetingsRemote2(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java new file mode 100644 index 0000000000..9355aece1f --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java @@ -0,0 +1,43 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceCallbackOnewayRemote; +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClientCallbackOnewayRemoteImpl implements HelloWorldClient { + + public static String result; + + @Reference + public HelloWorldServiceCallbackOnewayRemote helloWorldService; + + public String getGreetings(String s) { + helloWorldService.getGreetingsRemote(s); + return null; + } + + public String getGreetingsCallbackRemote(String s) { + result = "callback " + s; + return result; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java new file mode 100644 index 0000000000..efc47aa94d --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java @@ -0,0 +1,42 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceCallbackRemote; +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClientCallbackRemoteImpl implements HelloWorldClient { + + public static String result; + + @Reference + public HelloWorldServiceCallbackRemote helloWorldService; + + public String getGreetings(String s) { + return helloWorldService.getGreetingsRemote(s); + } + + public String getGreetingsCallbackRemote(String s) { + result = "callback " + s; + return result; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientLocalImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientLocalImpl.java new file mode 100644 index 0000000000..6ed813ff0a --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientLocalImpl.java @@ -0,0 +1,35 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceLocal; +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClientLocalImpl implements HelloWorldClient { + + @Reference + public HelloWorldServiceLocal helloWorldService; + + public String getGreetings(String s) { + return helloWorldService.getGreetingsLocal(s); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemote2Impl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemote2Impl.java new file mode 100644 index 0000000000..ba70573efb --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemote2Impl.java @@ -0,0 +1,35 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote2; +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClientRemote2Impl implements HelloWorldClient { + + @Reference + public HelloWorldServiceRemote2 helloWorldService; + + public String getGreetings(String s) { + return helloWorldService.getGreetingsRemote2(s); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemoteImpl.java new file mode 100644 index 0000000000..a87d6eb49a --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemoteImpl.java @@ -0,0 +1,35 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote; +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClientRemoteImpl implements HelloWorldClient { + + @Reference + public HelloWorldServiceRemote helloWorldService; + + public String getGreetings(String s) { + return helloWorldService.getGreetingsRemote(s); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java new file mode 100644 index 0000000000..3dc0b12b82 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java @@ -0,0 +1,35 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldCallbackRemote; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceCallbackOnewayRemote; +import org.oasisopen.sca.annotation.Callback; + +public class HelloWorldServiceCallbackOnewayRemoteImpl implements HelloWorldServiceCallbackOnewayRemote { + + @Callback + protected HelloWorldCallbackRemote theCallback; + + public void getGreetingsRemote(String s) { + theCallback.getGreetingsCallbackRemote(s); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java new file mode 100644 index 0000000000..b15d6dea80 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java @@ -0,0 +1,39 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldCallbackRemote; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceCallbackRemote; +import org.oasisopen.sca.annotation.Callback; + +public class HelloWorldServiceCallbackRemoteImpl implements HelloWorldServiceCallbackRemote { + + @Callback + protected HelloWorldCallbackRemote theCallback; + + public HelloWorldServiceCallbackRemoteImpl() { + System.out.println("Constructor"); + } + + public String getGreetingsRemote(String s) { + return "Hello " + theCallback.getGreetingsCallbackRemote(s); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceLocalImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceLocalImpl.java new file mode 100644 index 0000000000..c4347b084a --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceLocalImpl.java @@ -0,0 +1,30 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceLocal; + +public class HelloWorldServiceLocalImpl implements HelloWorldServiceLocal { + + public String getGreetingsLocal(String s) { + return "Hello " + s; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java new file mode 100644 index 0000000000..846bff02e1 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java @@ -0,0 +1,41 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceLocal; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote2; +import org.oasisopen.sca.annotation.Service; + +@Service({HelloWorldServiceRemote.class, HelloWorldServiceRemote2.class, HelloWorldServiceLocal.class} ) +public class HelloWorldServiceMultipleServicesImpl implements HelloWorldServiceLocal, HelloWorldServiceRemote, HelloWorldServiceRemote2 { + + public String getGreetingsLocal(String s) { + return "Hello " + s; + } + + public String getGreetingsRemote(String s) { + return "Hello " + s; + } + + public String getGreetingsRemote2(String s) { + return "Hello " + s; + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceRemoteImpl.java new file mode 100644 index 0000000000..d69f442879 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceRemoteImpl.java @@ -0,0 +1,30 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote; + +public class HelloWorldServiceRemoteImpl implements HelloWorldServiceRemote { + + public String getGreetingsRemote(String s) { + return "Hello " + s; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/AsynchTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/AsynchTestCase.java new file mode 100644 index 0000000000..cbcc06056a --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/AsynchTestCase.java @@ -0,0 +1,79 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi; + + +import junit.framework.Assert; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl.HelloWorldClientCallbackOnewayRemoteImpl; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class AsynchTestCase { + + public static Node nodeA; + public static Node nodeB; + + @BeforeClass + public static void init() throws Exception { + System.out.println("Setting up nodes"); + // System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", RMIBinding.TYPE.toString()); + try { + // create and start nodes + Contribution contrib = new Contribution("asynch", "./target/test-classes/rmi/asynchReference"); + nodeA = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeA.start(); + + contrib = new Contribution("asynch", "./target/test-classes/rmi/asynchService"); + nodeB = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeB.start(); + + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + throw ex; + } + } + + @AfterClass + public static void destroy() throws Exception { + nodeA.stop(); + nodeB.stop(); + // System.clearProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding"); + } + + @Test + public void testHelloWorldAsynch() throws Exception { + HelloWorldClient helloWorldClientB; + helloWorldClientB = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote"); + helloWorldClientB.getGreetings("fred"); + System.out.println("Sleeping ..."); + Thread.sleep(2000); + System.out.println("... Done"); + Assert.assertEquals("callback fred", HelloWorldClientCallbackOnewayRemoteImpl.result ); + + } + + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/CallbackTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/CallbackTestCase.java new file mode 100644 index 0000000000..dccd2dace8 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/CallbackTestCase.java @@ -0,0 +1,84 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class CallbackTestCase { + + public static Node nodeA; + public static Node nodeB; + + @BeforeClass + public static void init() throws Exception { + System.out.println("Setting up nodes"); + // System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", RMIBinding.TYPE.toString()); + + try { + // create and start nodes + Contribution contrib = new Contribution("reference", "./target/test-classes/rmi/callbackReference"); + nodeA = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeA.start(); + + contrib = new Contribution("service", "./target/test-classes/rmi/callbackService"); + nodeB = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeB.start(); + + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + throw ex; + } + } + + @AfterClass + public static void destroy() throws Exception { + nodeA.stop(); + nodeB.stop(); + // System.clearProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding"); + } + + //@Test + public void testKeepServerRunning() throws Exception { + System.out.println("press enter to continue"); + System.in.read(); + } + + @Test + public void testHelloWorldCallbackLocal() throws Exception { + HelloWorldClient helloWorldClientB; + helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientCallbackLocal"); + Assert.assertEquals("Hello callback fred", helloWorldClientB.getGreetings("fred")); + } + + @Test + public void testHelloWorldCallbackRemote() throws Exception { + HelloWorldClient helloWorldClientA; + helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote"); + Assert.assertEquals("Hello callback fred", helloWorldClientA.getGreetings("fred")); + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/PromotionTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/PromotionTestCase.java new file mode 100644 index 0000000000..7aac95a8ff --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/PromotionTestCase.java @@ -0,0 +1,76 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class PromotionTestCase { + + + public static Node nodeA; + public static Node nodeB; + + @BeforeClass + public static void init() throws Exception { + System.out.println("Setting up nodes"); + System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", + "{http://tuscany.apache.org/xmlns/sca/1.1}binding.rmi"); + + try { + // create and start nodes + Contribution contrib = new Contribution("reference", "./target/test-classes/rmi/promotionReference"); + nodeA = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeA.start(); + + contrib = new Contribution("service", "./target/test-classes/rmi/promotionService"); + nodeB = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeB.start(); + + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + throw ex; + } + } + + @AfterClass + public static void destroy() throws Exception { + nodeA.stop(); + nodeB.stop(); + System.clearProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding"); + + } + + @Test + public void testHelloWorldPromotion() throws Exception { + HelloWorldClient helloWorldClientA; + helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientRemotePromotion"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/SimpleTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/SimpleTestCase.java new file mode 100644 index 0000000000..f748beb6cb --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/SimpleTestCase.java @@ -0,0 +1,116 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.oasisopen.sca.ServiceUnavailableException; + +public class SimpleTestCase { + + private static NodeFactory factory; + public static Node nodeA; + public static Node nodeB; + + @BeforeClass + public static void init() throws Exception { + System.out.println("Setting up nodes"); + System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", + "{http://tuscany.apache.org/xmlns/sca/1.1}binding.rmi"); + + try { + factory = NodeFactory.getInstance(); + // create and start nodes + Contribution contrib = new Contribution("reference", "./target/test-classes/rmi/simpleReference"); + nodeA = factory.createNode("HelloWorld.composite", contrib); + nodeA.start(); + + contrib = new Contribution("service", "./target/test-classes/rmi/simpleService"); + nodeB = factory.createNode("HelloWorld.composite", contrib); + nodeB.start(); + + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + throw ex; + } + } + + @AfterClass + public static void destroy() throws Exception { + nodeA.stop(); + nodeB.stop(); + factory.destroy(); + System.clearProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding"); + } + + @Test + public void testHelloWorldLocal() throws Exception { + HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientLocal"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + + } + + @Test + public void testHelloWorldRemote() throws Exception { + + HelloWorldClient helloWorldClientA; + helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientRemote"); + + try { + helloWorldClientA.getGreetings("fred"); + } catch (ServiceUnavailableException ex){ + Assert.fail(); + } + } + + @Test + public void testHelloWorldLocalAndRemote() throws Exception { + HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientLocalAndRemote"); + HelloWorldClient helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientLocalAndRemote"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + Assert.assertEquals(helloWorldClientB.getGreetings("fred"), "Hello fred"); + } + + @Test + public void testHelloWorldMultipleServices() throws Exception { + HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleServices"); + HelloWorldClient helloWorldClientA2 = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleServices2"); + HelloWorldClient helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientMultipleServices"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + Assert.assertEquals(helloWorldClientA2.getGreetings("fred"), "Hello fred"); + Assert.assertEquals(helloWorldClientB.getGreetings("fred"), "Hello fred"); + } + + @Test + public void testHelloWorldMultipleBindings() throws Exception { + HelloWorldClient helloWorldClientA; + helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleBindings"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldCallbackRemote.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldCallbackRemote.java new file mode 100644 index 0000000000..7c4cf4b0b7 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldCallbackRemote.java @@ -0,0 +1,30 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + + +@Remotable +public interface HelloWorldCallbackRemote { + + String getGreetingsCallbackRemote(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldClient.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..017acee582 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldClient.java @@ -0,0 +1,27 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld; + + +public interface HelloWorldClient { + + String getGreetings(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceCallbackOnewayRemote.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceCallbackOnewayRemote.java new file mode 100644 index 0000000000..86f984e61a --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceCallbackOnewayRemote.java @@ -0,0 +1,33 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +@Callback(HelloWorldCallbackRemote.class) +public interface HelloWorldServiceCallbackOnewayRemote { + + @OneWay + void getGreetingsRemote(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceCallbackRemote.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceCallbackRemote.java new file mode 100644 index 0000000000..8e19fd7382 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceCallbackRemote.java @@ -0,0 +1,31 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +@Callback(HelloWorldCallbackRemote.class) +public interface HelloWorldServiceCallbackRemote { + + String getGreetingsRemote(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceLocal.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceLocal.java new file mode 100644 index 0000000000..b0d623e2e4 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceLocal.java @@ -0,0 +1,27 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld; + + +public interface HelloWorldServiceLocal { + + String getGreetingsLocal(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceRemote.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceRemote.java new file mode 100644 index 0000000000..ccb44694d9 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceRemote.java @@ -0,0 +1,29 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloWorldServiceRemote { + + String getGreetingsRemote(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceRemote2.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceRemote2.java new file mode 100644 index 0000000000..5c8bb13f43 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceRemote2.java @@ -0,0 +1,29 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloWorldServiceRemote2 { + + String getGreetingsRemote2(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java new file mode 100644 index 0000000000..1ff1792bb7 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java @@ -0,0 +1,43 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceCallbackOnewayRemote; +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClientCallbackOnewayRemoteImpl implements HelloWorldClient { + + public static String result; + + @Reference + public HelloWorldServiceCallbackOnewayRemote helloWorldService; + + public String getGreetings(String s) { + helloWorldService.getGreetingsRemote(s); + return null; + } + + public String getGreetingsCallbackRemote(String s) { + result = "callback " + s; + return result; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java new file mode 100644 index 0000000000..b17d8e2016 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java @@ -0,0 +1,42 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceCallbackRemote; +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClientCallbackRemoteImpl implements HelloWorldClient { + + public static String result; + + @Reference + public HelloWorldServiceCallbackRemote helloWorldService; + + public String getGreetings(String s) { + return helloWorldService.getGreetingsRemote(s); + } + + public String getGreetingsCallbackRemote(String s) { + result = "callback " + s; + return result; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientLocalImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientLocalImpl.java new file mode 100644 index 0000000000..e230326f5f --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientLocalImpl.java @@ -0,0 +1,35 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceLocal; +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClientLocalImpl implements HelloWorldClient { + + @Reference + public HelloWorldServiceLocal helloWorldService; + + public String getGreetings(String s) { + return helloWorldService.getGreetingsLocal(s); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientRemote2Impl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientRemote2Impl.java new file mode 100644 index 0000000000..77df8c2c39 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientRemote2Impl.java @@ -0,0 +1,35 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceRemote2; +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClientRemote2Impl implements HelloWorldClient { + + @Reference + public HelloWorldServiceRemote2 helloWorldService; + + public String getGreetings(String s) { + return helloWorldService.getGreetingsRemote2(s); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientRemoteImpl.java new file mode 100644 index 0000000000..8effa3ac36 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientRemoteImpl.java @@ -0,0 +1,35 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceRemote; +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClientRemoteImpl implements HelloWorldClient { + + @Reference + public HelloWorldServiceRemote helloWorldService; + + public String getGreetings(String s) { + return helloWorldService.getGreetingsRemote(s); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java new file mode 100644 index 0000000000..2467ddab88 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java @@ -0,0 +1,35 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldCallbackRemote; +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceCallbackOnewayRemote; +import org.oasisopen.sca.annotation.Callback; + +public class HelloWorldServiceCallbackOnewayRemoteImpl implements HelloWorldServiceCallbackOnewayRemote { + + @Callback + protected HelloWorldCallbackRemote theCallback; + + public void getGreetingsRemote(String s) { + theCallback.getGreetingsCallbackRemote(s); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java new file mode 100644 index 0000000000..d1b75d0a2c --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java @@ -0,0 +1,39 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldCallbackRemote; +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceCallbackRemote; +import org.oasisopen.sca.annotation.Callback; + +public class HelloWorldServiceCallbackRemoteImpl implements HelloWorldServiceCallbackRemote { + + @Callback + protected HelloWorldCallbackRemote theCallback; + + public HelloWorldServiceCallbackRemoteImpl() { + System.out.println("Constructor"); + } + + public String getGreetingsRemote(String s) { + return "Hello " + theCallback.getGreetingsCallbackRemote(s); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceLocalImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceLocalImpl.java new file mode 100644 index 0000000000..44e7efc668 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceLocalImpl.java @@ -0,0 +1,30 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceLocal; + +public class HelloWorldServiceLocalImpl implements HelloWorldServiceLocal { + + public String getGreetingsLocal(String s) { + return "Hello " + s; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java new file mode 100644 index 0000000000..88440de023 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java @@ -0,0 +1,41 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceLocal; +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceRemote; +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceRemote2; +import org.oasisopen.sca.annotation.Service; + +@Service({HelloWorldServiceRemote.class, HelloWorldServiceRemote2.class, HelloWorldServiceLocal.class} ) +public class HelloWorldServiceMultipleServicesImpl implements HelloWorldServiceLocal, HelloWorldServiceRemote, HelloWorldServiceRemote2 { + + public String getGreetingsLocal(String s) { + return "Hello " + s; + } + + public String getGreetingsRemote(String s) { + return "Hello " + s; + } + + public String getGreetingsRemote2(String s) { + return "Hello " + s; + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceRemoteImpl.java new file mode 100644 index 0000000000..06dc2c3f79 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceRemoteImpl.java @@ -0,0 +1,30 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceRemote; + +public class HelloWorldServiceRemoteImpl implements HelloWorldServiceRemote { + + public String getGreetingsRemote(String s) { + return "Hello " + s; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/BindingSCATestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/BindingSCATestCase.java new file mode 100644 index 0000000000..fcd0d39162 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/BindingSCATestCase.java @@ -0,0 +1,170 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import java.io.File; + +import org.apache.tuscany.sca.assembly.SCABinding; +import org.apache.tuscany.sca.binding.ws.WebServiceBinding; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.apache.tuscany.sca.node.configuration.NodeConfiguration; +import org.junit.Assert; +import org.junit.Test; +import org.oasisopen.sca.ServiceRuntimeException; + +/** + * Test binding.sca in the same classloader + */ +public class BindingSCATestCase { + static final String DOMAIN_URI = "my-domain"; + private static final String REGISTRY_URI = "tuscany:bindingScaTestDomain"; + private static final String PKG = "org/apache/tuscany/sca/itest/bindingsca/"; + private static final String CLIENT = "Client.composite"; + private static final String SERVICE = "Service.composite"; + private static final String ROOT = new File("target/classes/" + PKG).toURI().toString(); + + /** + * One NodeFactory and two nodes + */ + @Test + public void testOneFactoryTwoNodes() { + NodeFactory factory1 = NodeFactory.getInstance(); + Node node1 = createClientNode(factory1); + Node node2 = createServiceNode(factory1); + node1.start(); + node2.start(); + try { + runClient(node1); + } finally { + node2.stop(); + node1.stop(); + factory1.destroy(); + } + } + + /** + * Create the service node + * @param factory + * @return + */ + static Node createServiceNode(NodeFactory factory) { + NodeConfiguration config2 = + factory.createNodeConfiguration().setDomainURI(DOMAIN_URI).setURI("node2").addContribution("c2", ROOT) + .addDeploymentComposite("c2", SERVICE).setDomainRegistryURI(REGISTRY_URI) + .addBinding(WebServiceBinding.TYPE, "http://localhost:8085/").addBinding(SCABinding.TYPE, + "http://localhost:8085/"); + + Node node2 = factory.createNode(config2); + return node2; + } + + /** + * Create the client node + * @param factory + * @return + */ + static Node createClientNode(NodeFactory factory) { + NodeConfiguration config1 = + factory.createNodeConfiguration().setDomainURI(DOMAIN_URI).setURI("node1").addContribution("c1", ROOT) + .addDeploymentComposite("c1", CLIENT).setDomainRegistryURI(REGISTRY_URI) + .addBinding(WebServiceBinding.TYPE, "http://localhost:8085/").addBinding(SCABinding.TYPE, + "http://localhost:8085/"); + Node node1 = factory.createNode(config1); + return node1; + } + + /** + * Two node factories and two nodes + */ + @Test + public void testTwoFactoriesTwoNodes() throws Exception { + NodeFactory factory1 = NodeFactory.newInstance(); + Node node1 = createClientNode(factory1); + NodeFactory factory2 = NodeFactory.newInstance(); + Node node2 = createServiceNode(factory2); + node1.start(); + node2.start(); + Thread.sleep(1000); + try { + // This call doesn't require the Local service, it should be successful + createCustomer(node1); + try { + runClient(node1); + // We cannot make local call to remote endpoints + Assert.fail("ServiceRuntimeException should have been thrown."); + } catch (ServiceRuntimeException e) { + // ignore + } + } finally { + node2.stop(); + node1.stop(); + factory2.destroy(); + factory1.destroy(); + } + } + + /** + * Run the client + * @param node + */ + static void runClient(Node node) { + Client client = node.getService(Client.class, "ClientComponent/Client"); + runClient(client); + } + + static void runClient(Client client) { + String id = client.create("Ray"); + Assert.assertEquals("Ray", client.getName(id)); + } + + static void runClientNotFound(Client client) { + String id = "not-there"; + Assert.assertNull(client.getName(id)); + } + + static String createCustomer(Node node) { + Client client = node.getService(Client.class, "ClientComponent/Client"); + String id = client.create("John"); + Assert.assertNotNull(id); + return id; + } + + /** + * One node factory and one node for both composites + */ + @Test + public void testOneFactoryOneNode() { + NodeFactory factory = NodeFactory.getInstance(); + NodeConfiguration config1 = + factory.createNodeConfiguration().setDomainURI(DOMAIN_URI).setURI("node1").addContribution("c1", ROOT) + .addDeploymentComposite("c1", CLIENT).addDeploymentComposite("c1", SERVICE); + + Node node1 = factory.createNode(config1); + node1.start(); + try { + runClient(node1); + } finally { + node1.stop(); + factory.destroy(); + } + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientNodeSharedCustomerTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientNodeSharedCustomerTestCase.java new file mode 100644 index 0000000000..7255697d4b --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientNodeSharedCustomerTestCase.java @@ -0,0 +1,62 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Running the client node and service node with two different classloaders that share the Customer class + */ +public class ClientNodeSharedCustomerTestCase { + private static Node clientNode; + private static TestCaseRunner runner; + private static NodeFactory factory; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + runner = new TestCaseRunner(ServiceNode.class, Remote.class.getName(), RemoteServiceImpl.class.getName()); + runner.beforeClass(); + factory = NodeFactory.getInstance(); + clientNode = BindingSCATestCase.createClientNode(factory).start(); + Thread.sleep(1000); + } + + @Test + public void testClient() throws Exception { + BindingSCATestCase.runClient(clientNode); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (clientNode != null) { + clientNode.stop(); + } + if (runner != null) { + runner.afterClass(); + } + if (factory != null) { + factory.destroy(); + } + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientNodeSharedLocalTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientNodeSharedLocalTestCase.java new file mode 100644 index 0000000000..51fafae32c --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientNodeSharedLocalTestCase.java @@ -0,0 +1,62 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Running the client node and service node with two different classloaders that share the Local class + * (but not Customer) + */ +public class ClientNodeSharedLocalTestCase { + private static Node clientNode; + private static TestCaseRunner runner; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + runner = + new TestCaseRunner(ServiceNode.class, Remote.class.getName(), RemoteServiceImpl.class.getName(), + Customer.class.getName()); + runner.beforeClass(); + NodeFactory factory = NodeFactory.getInstance(); + clientNode = BindingSCATestCase.createClientNode(factory).start(); + Thread.sleep(1000); + } + + @Test + public void testClient() throws Exception { + BindingSCATestCase.runClient(clientNode); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (clientNode != null) { + clientNode.stop(); + } + if (runner != null) { + runner.afterClass(); + } + NodeFactory.getInstance().destroy(); + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientSharedCustomerTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientSharedCustomerTestCase.java new file mode 100644 index 0000000000..b8ff0c58ba --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientSharedCustomerTestCase.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.itest.bindingsca; + +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Running the client api and service node with two different classloaders that share the Customer class + */ +public class ClientSharedCustomerTestCase { + private static Client client; + private static TestCaseRunner runner; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + runner = new TestCaseRunner(ServiceNode.class, Remote.class.getName(), RemoteServiceImpl.class.getName()); + runner.beforeClass(); + client = new SCAClientImpl(BindingSCATestCase.DOMAIN_URI); + Thread.sleep(1000); + } + + @Test + public void testClient() throws Exception { + BindingSCATestCase.runClient(client); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (runner != null) { + runner.afterClass(); + } + NodeFactory.getInstance().destroy(); + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientSharedLocalTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientSharedLocalTestCase.java new file mode 100644 index 0000000000..633e1a767c --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientSharedLocalTestCase.java @@ -0,0 +1,63 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Running the client api and service node with two different classloaders that share the Local class + * (but not Customer) + */ +public class ClientSharedLocalTestCase { + private static Client client; + private static TestCaseRunner runner; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + runner = + new TestCaseRunner(ServiceNode.class, Remote.class.getName(), RemoteServiceImpl.class.getName(), + Customer.class.getName(), CustomerNotFoundException.class.getName()); + runner.beforeClass(); + client = new SCAClientImpl(BindingSCATestCase.DOMAIN_URI); + Thread.sleep(1000); + } + + @Test + public void testClient() throws Exception { + BindingSCATestCase.runClient(client); + } + + @Test + public void testClientNotFound() throws Exception { + BindingSCATestCase.runClientNotFound(client); + } + + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (runner != null) { + runner.afterClass(); + } + NodeFactory.getInstance().destroy(); + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ServiceNode.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ServiceNode.java new file mode 100644 index 0000000000..1cba2b57c2 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ServiceNode.java @@ -0,0 +1,48 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; + +/** + * This shows how to test the Calculator service component. + */ +public class ServiceNode { + private static Node serviceNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + /* System.setProperty("org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint.enabled", + "false"); + */ + NodeFactory factory = NodeFactory.getInstance(); + serviceNode = BindingSCATestCase.createServiceNode(factory).start(); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (serviceNode != null) { + serviceNode.stop(); + } + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/TestCaseRunner.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/TestCaseRunner.java new file mode 100644 index 0000000000..c0960ffe95 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/java/org/apache/tuscany/sca/itest/bindingsca/TestCaseRunner.java @@ -0,0 +1,329 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * A helper class that can be used to run an SCA JUnit test case. The test case will run in an isolated class loader. + * + * @version $Rev$ $Date$ + */ +public class TestCaseRunner { + + private ClassLoader classLoader; + private Class testSuiteClass; + private Object testSuite; + private Class testResultClass; + private Class testCaseClass; + private Object testCase; + + private Class beforeAnnotation; + private Class beforeClassAnnotation; + private Class afterAnnotation; + private Class afterClassAnnotation; + private Class junit4AdapterClass; + private Class junit3TestCaseClass; + + /** + * Constructs a new TestCase runner. + * + * @param testClass + */ + public TestCaseRunner(Class testClass, String... isolatedClasses) { + try { + ClassLoader tccl = setupClassLoader(testClass, isolatedClasses); + + try { + // Thread.currentThread().setContextClassLoader(classLoader); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finalClassLoader = classLoader; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finalClassLoader); + return null; + } + }); + + testCaseClass = Class.forName(testClass.getName(), true, classLoader); + testCase = testCaseClass.newInstance(); + ClassLoader testClassLoader = testCaseClass.getClassLoader(); + + junit3TestCaseClass = Class.forName("junit.framework.TestCase", true, testClassLoader); + + testSuiteClass = Class.forName("junit.framework.TestSuite", true, testClassLoader); + Constructor testSuiteConstructor = testSuiteClass.getConstructor(Class.class); + testSuite = testSuiteConstructor.newInstance(testCaseClass); + + testResultClass = Class.forName("junit.framework.TestResult", true, testClassLoader); + + try { + beforeAnnotation = Class.forName("org.junit.Before", true, testClassLoader); + afterAnnotation = Class.forName("org.junit.After", true, testClassLoader); + beforeClassAnnotation = Class.forName("org.junit.BeforeClass", true, testClassLoader); + afterClassAnnotation = Class.forName("org.junit.AfterClass", true, testClassLoader); + junit4AdapterClass = Class.forName("junit.framework.JUnit4TestAdapter", true, testClassLoader); + } catch (Exception e) { + // Unexpected + throw new AssertionError(e); + } + } catch (Throwable e) { + e.printStackTrace(); + } finally { + // Thread.currentThread().setContextClassLoader(tccl); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finaltccl = tccl; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finaltccl); + return null; + } + }); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private ClassLoader setupClassLoader(Class testClass, String... isolatedClasses) { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + classLoader = testClass.getClassLoader(); + if (classLoader instanceof URLClassLoader) { + URL[] urls = ((URLClassLoader)classLoader).getURLs(); + classLoader = new ClassLoaderImpl(urls, classLoader, isolatedClasses); + } else if (classLoader == tccl || classLoader.getParent() == tccl) { + classLoader = new URLClassLoader(new URL[0], classLoader); + } else { + classLoader = tccl; + } + return tccl; + } + + /** + * Run the test case + */ + public void run() { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + try { + // Thread.currentThread().setContextClassLoader(classLoader); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finalClassLoader = classLoader; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finalClassLoader); + return null; + } + }); + + if (junit3TestCaseClass.isAssignableFrom(testCaseClass)) { + Object testResult = testResultClass.newInstance(); + Method runMethod = testSuiteClass.getMethod("run", testResultClass); + runMethod.invoke(testSuite, testResult); + } else { + Object junit4Adapter = junit4AdapterClass.getConstructor(Class.class).newInstance(testCaseClass); + Object testResult = testResultClass.newInstance(); + Method runMethod = junit4AdapterClass.getMethod("run", testResultClass); + runMethod.invoke(junit4Adapter, testResult); + } + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + // Thread.currentThread().setContextClassLoader(tccl); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finaltccl = tccl; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finaltccl); + return null; + } + }); + } + } + + /** + * Invoke the setUp method + */ + public void setUp() { + execute("setUp"); + } + + /** + * Invoke the before methods + */ + public void before() { + execute(beforeAnnotation); + } + + /** + * Invoke the beforeClass methods + */ + public void beforeClass() { + execute(beforeClassAnnotation); + } + + /** + * Invoke the tearDown method + */ + public void tearDown() { + execute("tearDown"); + } + + /** + * Invoke the after methods + */ + public void after() { + execute(afterAnnotation); + } + + /** + * Invoke the afterClass methods + */ + public void afterClass() { + execute(afterClassAnnotation); + } + + /** + * Invoke the specified test method. + */ + public void run(String methodName) { + execute(methodName); + } + + /** + * Invoke the methods annotated with the specified annotation. + */ + private void execute(Class annotationClass) { + if (annotationClass == null) { + throw new RuntimeException(new NoSuchMethodException()); + } + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + try { + // Thread.currentThread().setContextClassLoader(classLoader); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finalClassLoader = classLoader; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finalClassLoader); + return null; + } + }); + + for (Method method : testCaseClass.getDeclaredMethods()) { + for (Annotation annotation : method.getAnnotations()) { + if (annotation.annotationType() == annotationClass) { + method.invoke(testCase); + } + } + } + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + // Thread.currentThread().setContextClassLoader(tccl); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finaltccl = tccl; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finaltccl); + return null; + } + }); + } + } + + /** + * Invoke the specified method + */ + private void execute(String methodName) { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + try { + // Thread.currentThread().setContextClassLoader(classLoader); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finalClassLoader = classLoader; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finalClassLoader); + return null; + } + }); + Method setUpMethod = testCaseClass.getDeclaredMethod(methodName); + setUpMethod.setAccessible(true); + setUpMethod.invoke(testCase); + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + // Thread.currentThread().setContextClassLoader(tccl); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finaltccl = tccl; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finaltccl); + return null; + } + }); + } + } + + public static class ClassLoaderImpl extends URLClassLoader { + private Set isolatedClasses = new HashSet(); + + /** + * @param urls + * @param parent + */ + public ClassLoaderImpl(URL[] urls, ClassLoader parent, String... sharedClasses) { + super(urls, parent); + this.isolatedClasses.addAll(Arrays.asList(sharedClasses)); + } + + @Override + protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { + if (!isolatedClasses.contains(name)) { + return super.loadClass(name, resolve); + } else { + Class cls = findLoadedClass(name); + if (cls == null) { + cls = findClass(name); + } + if (resolve) { + resolveClass(cls); + } + return cls; + } + } + + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/asynchReference/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/asynchReference/HelloWorld.composite new file mode 100644 index 0000000000..8c825ca805 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/asynchReference/HelloWorld.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/asynchReference/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/asynchReference/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ab75f7d225 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/asynchReference/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/asynchService/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/asynchService/HelloWorld.composite new file mode 100644 index 0000000000..79b1a5d794 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/asynchService/HelloWorld.composite @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/asynchService/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/asynchService/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ab75f7d225 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/asynchService/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/callbackReference/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/callbackReference/HelloWorld.composite new file mode 100644 index 0000000000..e8924d2728 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/callbackReference/HelloWorld.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/callbackReference/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/callbackReference/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ab75f7d225 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/callbackReference/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/callbackService/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/callbackService/HelloWorld.composite new file mode 100644 index 0000000000..4edc8df5cd --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/callbackService/HelloWorld.composite @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/callbackService/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/callbackService/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ab75f7d225 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/callbackService/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionReference/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionReference/HelloWorld.composite new file mode 100644 index 0000000000..823cab4f56 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionReference/HelloWorld.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionReference/HelloWorldComponent.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionReference/HelloWorldComponent.composite new file mode 100644 index 0000000000..088fd616f4 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionReference/HelloWorldComponent.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionReference/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionReference/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ab75f7d225 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionReference/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionService/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionService/HelloWorld.composite new file mode 100644 index 0000000000..454e9c55cf --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionService/HelloWorld.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionService/HelloWorldComponent.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionService/HelloWorldComponent.composite new file mode 100644 index 0000000000..a313fb8f68 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionService/HelloWorldComponent.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionService/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionService/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ab75f7d225 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/promotionService/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/simpleReference/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/simpleReference/HelloWorld.composite new file mode 100644 index 0000000000..4151749523 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/simpleReference/HelloWorld.composite @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/simpleReference/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/simpleReference/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ab75f7d225 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/simpleReference/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/simpleService/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/simpleService/HelloWorld.composite new file mode 100644 index 0000000000..37af7625ff --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/simpleService/HelloWorld.composite @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/simpleService/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/simpleService/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ab75f7d225 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/rmi/simpleService/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/asynchReference/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/asynchReference/HelloWorld.composite new file mode 100644 index 0000000000..e797a0aa9c --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/asynchReference/HelloWorld.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/asynchReference/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/asynchReference/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e6ccae5c73 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/asynchReference/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/asynchService/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/asynchService/HelloWorld.composite new file mode 100644 index 0000000000..079ee49380 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/asynchService/HelloWorld.composite @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/asynchService/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/asynchService/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e6ccae5c73 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/asynchService/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/callbackReference/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/callbackReference/HelloWorld.composite new file mode 100644 index 0000000000..1d5630f3d0 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/callbackReference/HelloWorld.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/callbackReference/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/callbackReference/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e6ccae5c73 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/callbackReference/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/callbackService/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/callbackService/HelloWorld.composite new file mode 100644 index 0000000000..ded3766d49 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/callbackService/HelloWorld.composite @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/callbackService/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/callbackService/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e6ccae5c73 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/callbackService/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionReference/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionReference/HelloWorld.composite new file mode 100644 index 0000000000..4513f21acf --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionReference/HelloWorld.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionReference/HelloWorldComponent.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionReference/HelloWorldComponent.composite new file mode 100644 index 0000000000..22c20ff94a --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionReference/HelloWorldComponent.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionReference/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionReference/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e6ccae5c73 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionReference/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionService/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionService/HelloWorld.composite new file mode 100644 index 0000000000..e6a7d776c9 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionService/HelloWorld.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionService/HelloWorldComponent.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionService/HelloWorldComponent.composite new file mode 100644 index 0000000000..0393280625 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionService/HelloWorldComponent.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionService/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionService/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e6ccae5c73 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/promotionService/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/simpleReference/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/simpleReference/HelloWorld.composite new file mode 100644 index 0000000000..f4d2789ff7 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/simpleReference/HelloWorld.composite @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/simpleReference/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/simpleReference/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e6ccae5c73 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/simpleReference/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/simpleService/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/simpleService/HelloWorld.composite new file mode 100644 index 0000000000..7e6311a22d --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/simpleService/HelloWorld.composite @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/simpleService/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/simpleService/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e6ccae5c73 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-hazelcast/src/test/resources/ws/simpleService/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/pom.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/pom.xml new file mode 100644 index 0000000000..46721f6f82 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/pom.xml @@ -0,0 +1,70 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0 + ../pom.xml + + itest-nodes-binding-sca-tribes + Apache Tuscany SCA iTest Nodes binding.sca Using Tribes Registry + + + + org.apache.tuscany.sca + tuscany-sca-client-impl + 2.0 + + + org.apache.tuscany.sca + tuscany-endpoint-tribes + 2.0 + + + org.apache.tuscany.sca + tuscany-binding-ws-runtime-axis2 + 2.0 + + + org.apache.tuscany.sca + tuscany-binding-rmi-runtime + 2.0 + + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0 + runtime + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0 + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0 + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Client.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Client.java new file mode 100644 index 0000000000..ef2565b750 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Client.java @@ -0,0 +1,29 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +/** + * + */ +public interface Client { + String getName(String id); + + String create(String name); +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/ClientImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/ClientImpl.java new file mode 100644 index 0000000000..96a0f2dadd --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/ClientImpl.java @@ -0,0 +1,53 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * + */ +@Service(Client.class) +public class ClientImpl implements Client { + @Reference + protected Local local; + + @Reference + protected Remote remote; + + public String getName(String id) { + Customer customer = null; + try { + customer = remote.getCustomer(id); + } catch (CustomerNotFoundException e) { + return null; + } + customer.dump("Client.getName()"); + return local.getName(customer); + } + + public String create(String name) { + String id = remote.generateId(); + Customer customer = remote.createCustomer(id, name); + customer.dump("Client.create()"); + return remote.getId(customer); + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Customer.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Customer.java new file mode 100644 index 0000000000..f2b7b1e41d --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Customer.java @@ -0,0 +1,70 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +/** + * + */ +public class Customer { + private String id; + private String name; + + public Customer() { + } + + /** + * @param id + * @param name + */ + public Customer(String id, String name) { + super(); + this.id = id; + this.name = name; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public String toString() { + return "Customer [id=" + id + ", name=" + name + "]"; + } + + public void dump(String prefix) { + System.out.print(prefix); + System.out.print(": "); + System.out.print(toString()); + System.out.println(" @" + System.identityHashCode(this)); + System.out.println(getClass().getClassLoader()); + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/CustomerNotFoundException.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/CustomerNotFoundException.java new file mode 100644 index 0000000000..a6e80c9eca --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/CustomerNotFoundException.java @@ -0,0 +1,64 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +/** + * + */ +public class CustomerNotFoundException extends Exception { + private String customerId; + + /** + * + */ + public CustomerNotFoundException() { + } + + /** + * @param message + */ + public CustomerNotFoundException(String message) { + super(message); + } + + /** + * @param cause + */ + public CustomerNotFoundException(Throwable cause) { + super(cause); + } + + /** + * @param message + * @param cause + */ + public CustomerNotFoundException(String message, Throwable cause) { + super(message, cause); + } + + public String getCustomerId() { + return customerId; + } + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Local.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Local.java new file mode 100644 index 0000000000..0fe30c9d53 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Local.java @@ -0,0 +1,27 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +/** + * + */ +public interface Local { + String getName(Customer customer); +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/LocalServiceImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/LocalServiceImpl.java new file mode 100644 index 0000000000..8783808334 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/LocalServiceImpl.java @@ -0,0 +1,38 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import org.oasisopen.sca.annotation.Service; + +/** + * + */ +@Service(Local.class) +public class LocalServiceImpl implements Local { + + public String getName(Customer customer) { + if (customer == null) { + return null; + } + customer.dump("Local.getName()"); + return customer.getName(); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Remote.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Remote.java new file mode 100644 index 0000000000..050d35007b --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/Remote.java @@ -0,0 +1,36 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * + */ +@Remotable +public interface Remote { + String generateId(); + + String getId(Customer customer); + + Customer getCustomer(String id) throws CustomerNotFoundException; + + Customer createCustomer(String id, String name); +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/RemoteServiceImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/RemoteServiceImpl.java new file mode 100644 index 0000000000..6c432a500a --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/RemoteServiceImpl.java @@ -0,0 +1,66 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.oasisopen.sca.annotation.AllowsPassByReference; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +/** + * + */ +@Service(Remote.class) +@Scope("COMPOSITE") +public class RemoteServiceImpl implements Remote { + private Map customers = new HashMap(); + + public String generateId() { + return UUID.randomUUID().toString(); + } + + @AllowsPassByReference + public String getId(Customer customer) { + customer.dump("Remote.getId()"); + return customer.getId(); + } + + public Customer getCustomer(String id) throws CustomerNotFoundException { + Customer customer = customers.get(id); + if (customer == null) { + CustomerNotFoundException ex = new CustomerNotFoundException("Customer not found"); + ex.setCustomerId(id); + throw ex; + } + customer.dump("Remote.getCustomer()"); + return customer; + } + + public Customer createCustomer(String id, String name) { + Customer customer = new Customer(id, name); + customer.dump("Remote.createCustomer()"); + customers.put(id, customer); + return customer; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/SCAClientImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/SCAClientImpl.java new file mode 100644 index 0000000000..3573eea978 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/java/org/apache/tuscany/sca/itest/bindingsca/SCAClientImpl.java @@ -0,0 +1,57 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import java.net.URI; + +import org.oasisopen.sca.client.SCAClientFactory; + +/** + * + */ +public class SCAClientImpl implements Client { + private Local local; + private Remote remote; + + public SCAClientImpl(String domainURI) throws Exception { + SCAClientFactory factory = SCAClientFactory.newInstance(URI.create(domainURI)); + local = factory.getService(Local.class, "LocalComponent/Local"); + remote = factory.getService(Remote.class, "RemoteComponent/Remote"); + } + + public String getName(String id) { + Customer customer = null; + try { + customer = remote.getCustomer(id); + } catch (CustomerNotFoundException e) { + return null; + } + customer.dump("Client.getName()"); + return local.getName(customer); + } + + public String create(String name) { + String id = remote.generateId(); + Customer customer = remote.createCustomer(id, name); + customer.dump("Client.create()"); + return remote.getId(customer); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/resources/org/apache/tuscany/sca/itest/bindingsca/Client.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/resources/org/apache/tuscany/sca/itest/bindingsca/Client.composite new file mode 100644 index 0000000000..b04cc33023 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/resources/org/apache/tuscany/sca/itest/bindingsca/Client.composite @@ -0,0 +1,30 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/resources/org/apache/tuscany/sca/itest/bindingsca/Service.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/resources/org/apache/tuscany/sca/itest/bindingsca/Service.composite new file mode 100644 index 0000000000..fe282d291c --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/main/resources/org/apache/tuscany/sca/itest/bindingsca/Service.composite @@ -0,0 +1,31 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java new file mode 100644 index 0000000000..9efa1a99ec --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java @@ -0,0 +1,79 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2; + + +import junit.framework.Assert; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientCallbackOnewayRemoteImpl; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +// @Ignore("TUSCANY-3138") +public class AsynchTestCase { + + public static Node nodeA; + public static Node nodeB; + + @BeforeClass + public static void init() throws Exception { + System.out.println("Setting up nodes"); + + try { + // create and start nodes + Contribution contrib = new Contribution("asynch", "./target/test-classes/ws/asynchReference"); + nodeA = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeA.start(); + + contrib = new Contribution("asynch", "./target/test-classes/ws/asynchService"); + nodeB = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeB.start(); + + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + throw ex; + } + } + + @AfterClass + public static void destroy() throws Exception { + nodeA.stop(); + nodeB.stop(); + } + + @Test + public void testHelloWorldAsynch() throws Exception { + HelloWorldClient helloWorldClientB; + helloWorldClientB = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote"); + helloWorldClientB.getGreetings("fred"); + System.out.println("Sleeping ..."); + Thread.sleep(2000); + System.out.println("... Done"); + Assert.assertEquals("callback fred", HelloWorldClientCallbackOnewayRemoteImpl.result ); + + } + + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java new file mode 100644 index 0000000000..efa84e92a5 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java @@ -0,0 +1,83 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +// @Ignore("TUSCANY-3138") +public class CallbackTestCase { + + public static Node nodeA; + public static Node nodeB; + + @BeforeClass + public static void init() throws Exception { + System.out.println("Setting up nodes"); + + try { + // create and start nodes + Contribution contrib = new Contribution("reference", "./target/test-classes/ws/callbackReference"); + nodeA = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeA.start(); + + contrib = new Contribution("service", "./target/test-classes/ws/callbackService"); + nodeB = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeB.start(); + + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + throw ex; + } + } + + @AfterClass + public static void destroy() throws Exception { + nodeA.stop(); + nodeB.stop(); + } + + //@Test + public void testKeepServerRunning() throws Exception { + System.out.println("press enter to continue"); + System.in.read(); + } + + @Test + public void testHelloWorldCallbackLocal() throws Exception { + HelloWorldClient helloWorldClientB; + helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientCallbackLocal"); + Assert.assertEquals("Hello callback fred", helloWorldClientB.getGreetings("fred")); + } + + @Test + public void testHelloWorldCallbackRemote() throws Exception { + HelloWorldClient helloWorldClientA; + helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote"); + Assert.assertEquals("Hello callback fred", helloWorldClientA.getGreetings("fred")); + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java new file mode 100644 index 0000000000..45d28140b4 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java @@ -0,0 +1,74 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +public class PromotionTestCase { + + + public static Node nodeA; + public static Node nodeB; + + @BeforeClass + public static void init() throws Exception { + System.out.println("Setting up nodes"); + + try { + // create and start nodes + Contribution contrib = new Contribution("reference", "./target/test-classes/ws/promotionReference"); + nodeA = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeA.start(); + + contrib = new Contribution("service", "./target/test-classes/ws/promotionService"); + nodeB = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeB.start(); + + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + throw ex; + } + } + + @AfterClass + public static void destroy() throws Exception { + nodeA.stop(); + nodeB.stop(); + } + + @Test + @Ignore + public void testHelloWorldPromotion() throws Exception { + HelloWorldClient helloWorldClientA; + helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientRemotePromotion"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java new file mode 100644 index 0000000000..a5d6529895 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java @@ -0,0 +1,110 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.oasisopen.sca.ServiceUnavailableException; + +public class SimpleTestCase { + + public static Node nodeA; + public static Node nodeB; + + @BeforeClass + public static void init() throws Exception { + System.out.println("Setting up nodes"); + + try { + // create and start nodes + Contribution contrib = new Contribution("reference", "./target/test-classes/ws/simpleReference"); + nodeA = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeA.start(); + + contrib = new Contribution("service", "./target/test-classes/ws/simpleService"); + nodeB = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeB.start(); + + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + throw ex; + } + } + + @AfterClass + public static void destroy() throws Exception { + nodeA.stop(); + nodeB.stop(); + } + + @Test + public void testHelloWorldLocal() throws Exception { + HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientLocal"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + + } + + @Test + public void testHelloWorldRemote() throws Exception { + + HelloWorldClient helloWorldClientA; + helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientRemote"); + + try { + helloWorldClientA.getGreetings("fred"); + } catch (ServiceUnavailableException ex){ + Assert.fail(); + } + } + + @Test + public void testHelloWorldLocalAndRemote() throws Exception { + HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientLocalAndRemote"); + HelloWorldClient helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientLocalAndRemote"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + Assert.assertEquals(helloWorldClientB.getGreetings("fred"), "Hello fred"); + } + + @Test + public void testHelloWorldMultipleServices() throws Exception { + HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleServices"); + HelloWorldClient helloWorldClientA2 = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleServices2"); + HelloWorldClient helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientMultipleServices"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + Assert.assertEquals(helloWorldClientA2.getGreetings("fred"), "Hello fred"); + Assert.assertEquals(helloWorldClientB.getGreetings("fred"), "Hello fred"); + } + + @Test + public void testHelloWorldMultipleBindings() throws Exception { + HelloWorldClient helloWorldClientA; + helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleBindings"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldCallbackRemote.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldCallbackRemote.java new file mode 100644 index 0000000000..f7ab3dfe98 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldCallbackRemote.java @@ -0,0 +1,30 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + + +@Remotable +public interface HelloWorldCallbackRemote { + + String getGreetingsCallbackRemote(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldClient.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..3d25d37708 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldClient.java @@ -0,0 +1,27 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld; + + +public interface HelloWorldClient { + + String getGreetings(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackOnewayRemote.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackOnewayRemote.java new file mode 100644 index 0000000000..a469d197d6 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackOnewayRemote.java @@ -0,0 +1,33 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +@Callback(HelloWorldCallbackRemote.class) +public interface HelloWorldServiceCallbackOnewayRemote { + + @OneWay + void getGreetingsRemote(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackRemote.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackRemote.java new file mode 100644 index 0000000000..3f5a21fddd --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackRemote.java @@ -0,0 +1,31 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +@Callback(HelloWorldCallbackRemote.class) +public interface HelloWorldServiceCallbackRemote { + + String getGreetingsRemote(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceLocal.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceLocal.java new file mode 100644 index 0000000000..49e5232b31 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceLocal.java @@ -0,0 +1,27 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld; + + +public interface HelloWorldServiceLocal { + + String getGreetingsLocal(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote.java new file mode 100644 index 0000000000..ccc77c142b --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote.java @@ -0,0 +1,29 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloWorldServiceRemote { + + String getGreetingsRemote(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote2.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote2.java new file mode 100644 index 0000000000..c2be798d1a --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote2.java @@ -0,0 +1,29 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloWorldServiceRemote2 { + + String getGreetingsRemote2(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java new file mode 100644 index 0000000000..9355aece1f --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java @@ -0,0 +1,43 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceCallbackOnewayRemote; +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClientCallbackOnewayRemoteImpl implements HelloWorldClient { + + public static String result; + + @Reference + public HelloWorldServiceCallbackOnewayRemote helloWorldService; + + public String getGreetings(String s) { + helloWorldService.getGreetingsRemote(s); + return null; + } + + public String getGreetingsCallbackRemote(String s) { + result = "callback " + s; + return result; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java new file mode 100644 index 0000000000..efc47aa94d --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java @@ -0,0 +1,42 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceCallbackRemote; +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClientCallbackRemoteImpl implements HelloWorldClient { + + public static String result; + + @Reference + public HelloWorldServiceCallbackRemote helloWorldService; + + public String getGreetings(String s) { + return helloWorldService.getGreetingsRemote(s); + } + + public String getGreetingsCallbackRemote(String s) { + result = "callback " + s; + return result; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientLocalImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientLocalImpl.java new file mode 100644 index 0000000000..6ed813ff0a --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientLocalImpl.java @@ -0,0 +1,35 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceLocal; +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClientLocalImpl implements HelloWorldClient { + + @Reference + public HelloWorldServiceLocal helloWorldService; + + public String getGreetings(String s) { + return helloWorldService.getGreetingsLocal(s); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemote2Impl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemote2Impl.java new file mode 100644 index 0000000000..ba70573efb --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemote2Impl.java @@ -0,0 +1,35 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote2; +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClientRemote2Impl implements HelloWorldClient { + + @Reference + public HelloWorldServiceRemote2 helloWorldService; + + public String getGreetings(String s) { + return helloWorldService.getGreetingsRemote2(s); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemoteImpl.java new file mode 100644 index 0000000000..a87d6eb49a --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemoteImpl.java @@ -0,0 +1,35 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote; +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClientRemoteImpl implements HelloWorldClient { + + @Reference + public HelloWorldServiceRemote helloWorldService; + + public String getGreetings(String s) { + return helloWorldService.getGreetingsRemote(s); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java new file mode 100644 index 0000000000..3dc0b12b82 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java @@ -0,0 +1,35 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldCallbackRemote; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceCallbackOnewayRemote; +import org.oasisopen.sca.annotation.Callback; + +public class HelloWorldServiceCallbackOnewayRemoteImpl implements HelloWorldServiceCallbackOnewayRemote { + + @Callback + protected HelloWorldCallbackRemote theCallback; + + public void getGreetingsRemote(String s) { + theCallback.getGreetingsCallbackRemote(s); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java new file mode 100644 index 0000000000..b15d6dea80 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java @@ -0,0 +1,39 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldCallbackRemote; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceCallbackRemote; +import org.oasisopen.sca.annotation.Callback; + +public class HelloWorldServiceCallbackRemoteImpl implements HelloWorldServiceCallbackRemote { + + @Callback + protected HelloWorldCallbackRemote theCallback; + + public HelloWorldServiceCallbackRemoteImpl() { + System.out.println("Constructor"); + } + + public String getGreetingsRemote(String s) { + return "Hello " + theCallback.getGreetingsCallbackRemote(s); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceLocalImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceLocalImpl.java new file mode 100644 index 0000000000..c4347b084a --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceLocalImpl.java @@ -0,0 +1,30 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceLocal; + +public class HelloWorldServiceLocalImpl implements HelloWorldServiceLocal { + + public String getGreetingsLocal(String s) { + return "Hello " + s; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java new file mode 100644 index 0000000000..846bff02e1 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java @@ -0,0 +1,41 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceLocal; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote; +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote2; +import org.oasisopen.sca.annotation.Service; + +@Service({HelloWorldServiceRemote.class, HelloWorldServiceRemote2.class, HelloWorldServiceLocal.class} ) +public class HelloWorldServiceMultipleServicesImpl implements HelloWorldServiceLocal, HelloWorldServiceRemote, HelloWorldServiceRemote2 { + + public String getGreetingsLocal(String s) { + return "Hello " + s; + } + + public String getGreetingsRemote(String s) { + return "Hello " + s; + } + + public String getGreetingsRemote2(String s) { + return "Hello " + s; + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceRemoteImpl.java new file mode 100644 index 0000000000..d69f442879 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceRemoteImpl.java @@ -0,0 +1,30 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote; + +public class HelloWorldServiceRemoteImpl implements HelloWorldServiceRemote { + + public String getGreetingsRemote(String s) { + return "Hello " + s; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/AsynchTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/AsynchTestCase.java new file mode 100644 index 0000000000..cbcc06056a --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/AsynchTestCase.java @@ -0,0 +1,79 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi; + + +import junit.framework.Assert; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl.HelloWorldClientCallbackOnewayRemoteImpl; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class AsynchTestCase { + + public static Node nodeA; + public static Node nodeB; + + @BeforeClass + public static void init() throws Exception { + System.out.println("Setting up nodes"); + // System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", RMIBinding.TYPE.toString()); + try { + // create and start nodes + Contribution contrib = new Contribution("asynch", "./target/test-classes/rmi/asynchReference"); + nodeA = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeA.start(); + + contrib = new Contribution("asynch", "./target/test-classes/rmi/asynchService"); + nodeB = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeB.start(); + + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + throw ex; + } + } + + @AfterClass + public static void destroy() throws Exception { + nodeA.stop(); + nodeB.stop(); + // System.clearProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding"); + } + + @Test + public void testHelloWorldAsynch() throws Exception { + HelloWorldClient helloWorldClientB; + helloWorldClientB = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote"); + helloWorldClientB.getGreetings("fred"); + System.out.println("Sleeping ..."); + Thread.sleep(2000); + System.out.println("... Done"); + Assert.assertEquals("callback fred", HelloWorldClientCallbackOnewayRemoteImpl.result ); + + } + + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/CallbackTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/CallbackTestCase.java new file mode 100644 index 0000000000..dccd2dace8 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/CallbackTestCase.java @@ -0,0 +1,84 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class CallbackTestCase { + + public static Node nodeA; + public static Node nodeB; + + @BeforeClass + public static void init() throws Exception { + System.out.println("Setting up nodes"); + // System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", RMIBinding.TYPE.toString()); + + try { + // create and start nodes + Contribution contrib = new Contribution("reference", "./target/test-classes/rmi/callbackReference"); + nodeA = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeA.start(); + + contrib = new Contribution("service", "./target/test-classes/rmi/callbackService"); + nodeB = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeB.start(); + + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + throw ex; + } + } + + @AfterClass + public static void destroy() throws Exception { + nodeA.stop(); + nodeB.stop(); + // System.clearProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding"); + } + + //@Test + public void testKeepServerRunning() throws Exception { + System.out.println("press enter to continue"); + System.in.read(); + } + + @Test + public void testHelloWorldCallbackLocal() throws Exception { + HelloWorldClient helloWorldClientB; + helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientCallbackLocal"); + Assert.assertEquals("Hello callback fred", helloWorldClientB.getGreetings("fred")); + } + + @Test + public void testHelloWorldCallbackRemote() throws Exception { + HelloWorldClient helloWorldClientA; + helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote"); + Assert.assertEquals("Hello callback fred", helloWorldClientA.getGreetings("fred")); + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/PromotionTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/PromotionTestCase.java new file mode 100644 index 0000000000..7aac95a8ff --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/PromotionTestCase.java @@ -0,0 +1,76 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class PromotionTestCase { + + + public static Node nodeA; + public static Node nodeB; + + @BeforeClass + public static void init() throws Exception { + System.out.println("Setting up nodes"); + System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", + "{http://tuscany.apache.org/xmlns/sca/1.1}binding.rmi"); + + try { + // create and start nodes + Contribution contrib = new Contribution("reference", "./target/test-classes/rmi/promotionReference"); + nodeA = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeA.start(); + + contrib = new Contribution("service", "./target/test-classes/rmi/promotionService"); + nodeB = NodeFactory.getInstance().createNode("HelloWorld.composite", contrib); + nodeB.start(); + + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + throw ex; + } + } + + @AfterClass + public static void destroy() throws Exception { + nodeA.stop(); + nodeB.stop(); + System.clearProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding"); + + } + + @Test + public void testHelloWorldPromotion() throws Exception { + HelloWorldClient helloWorldClientA; + helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientRemotePromotion"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/SimpleTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/SimpleTestCase.java new file mode 100644 index 0000000000..f748beb6cb --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/SimpleTestCase.java @@ -0,0 +1,116 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.oasisopen.sca.ServiceUnavailableException; + +public class SimpleTestCase { + + private static NodeFactory factory; + public static Node nodeA; + public static Node nodeB; + + @BeforeClass + public static void init() throws Exception { + System.out.println("Setting up nodes"); + System.setProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding", + "{http://tuscany.apache.org/xmlns/sca/1.1}binding.rmi"); + + try { + factory = NodeFactory.getInstance(); + // create and start nodes + Contribution contrib = new Contribution("reference", "./target/test-classes/rmi/simpleReference"); + nodeA = factory.createNode("HelloWorld.composite", contrib); + nodeA.start(); + + contrib = new Contribution("service", "./target/test-classes/rmi/simpleService"); + nodeB = factory.createNode("HelloWorld.composite", contrib); + nodeB.start(); + + } catch (Exception ex) { + System.err.println("Exception when creating domain " + ex.getMessage()); + ex.printStackTrace(System.err); + throw ex; + } + } + + @AfterClass + public static void destroy() throws Exception { + nodeA.stop(); + nodeB.stop(); + factory.destroy(); + System.clearProperty("org.apache.tuscany.sca.binding.sca.provider.SCABindingMapper.mappedBinding"); + } + + @Test + public void testHelloWorldLocal() throws Exception { + HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientLocal"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + + } + + @Test + public void testHelloWorldRemote() throws Exception { + + HelloWorldClient helloWorldClientA; + helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientRemote"); + + try { + helloWorldClientA.getGreetings("fred"); + } catch (ServiceUnavailableException ex){ + Assert.fail(); + } + } + + @Test + public void testHelloWorldLocalAndRemote() throws Exception { + HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientLocalAndRemote"); + HelloWorldClient helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientLocalAndRemote"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + Assert.assertEquals(helloWorldClientB.getGreetings("fred"), "Hello fred"); + } + + @Test + public void testHelloWorldMultipleServices() throws Exception { + HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleServices"); + HelloWorldClient helloWorldClientA2 = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleServices2"); + HelloWorldClient helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientMultipleServices"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + Assert.assertEquals(helloWorldClientA2.getGreetings("fred"), "Hello fred"); + Assert.assertEquals(helloWorldClientB.getGreetings("fred"), "Hello fred"); + } + + @Test + public void testHelloWorldMultipleBindings() throws Exception { + HelloWorldClient helloWorldClientA; + helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleBindings"); + Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred"); + + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldCallbackRemote.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldCallbackRemote.java new file mode 100644 index 0000000000..7c4cf4b0b7 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldCallbackRemote.java @@ -0,0 +1,30 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + + +@Remotable +public interface HelloWorldCallbackRemote { + + String getGreetingsCallbackRemote(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldClient.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..017acee582 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldClient.java @@ -0,0 +1,27 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld; + + +public interface HelloWorldClient { + + String getGreetings(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceCallbackOnewayRemote.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceCallbackOnewayRemote.java new file mode 100644 index 0000000000..86f984e61a --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceCallbackOnewayRemote.java @@ -0,0 +1,33 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +@Callback(HelloWorldCallbackRemote.class) +public interface HelloWorldServiceCallbackOnewayRemote { + + @OneWay + void getGreetingsRemote(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceCallbackRemote.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceCallbackRemote.java new file mode 100644 index 0000000000..8e19fd7382 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceCallbackRemote.java @@ -0,0 +1,31 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +@Callback(HelloWorldCallbackRemote.class) +public interface HelloWorldServiceCallbackRemote { + + String getGreetingsRemote(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceLocal.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceLocal.java new file mode 100644 index 0000000000..b0d623e2e4 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceLocal.java @@ -0,0 +1,27 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld; + + +public interface HelloWorldServiceLocal { + + String getGreetingsLocal(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceRemote.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceRemote.java new file mode 100644 index 0000000000..ccb44694d9 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceRemote.java @@ -0,0 +1,29 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloWorldServiceRemote { + + String getGreetingsRemote(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceRemote2.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceRemote2.java new file mode 100644 index 0000000000..5c8bb13f43 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/HelloWorldServiceRemote2.java @@ -0,0 +1,29 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloWorldServiceRemote2 { + + String getGreetingsRemote2(String s); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java new file mode 100644 index 0000000000..1ff1792bb7 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java @@ -0,0 +1,43 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceCallbackOnewayRemote; +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClientCallbackOnewayRemoteImpl implements HelloWorldClient { + + public static String result; + + @Reference + public HelloWorldServiceCallbackOnewayRemote helloWorldService; + + public String getGreetings(String s) { + helloWorldService.getGreetingsRemote(s); + return null; + } + + public String getGreetingsCallbackRemote(String s) { + result = "callback " + s; + return result; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java new file mode 100644 index 0000000000..b17d8e2016 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java @@ -0,0 +1,42 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceCallbackRemote; +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClientCallbackRemoteImpl implements HelloWorldClient { + + public static String result; + + @Reference + public HelloWorldServiceCallbackRemote helloWorldService; + + public String getGreetings(String s) { + return helloWorldService.getGreetingsRemote(s); + } + + public String getGreetingsCallbackRemote(String s) { + result = "callback " + s; + return result; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientLocalImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientLocalImpl.java new file mode 100644 index 0000000000..e230326f5f --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientLocalImpl.java @@ -0,0 +1,35 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceLocal; +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClientLocalImpl implements HelloWorldClient { + + @Reference + public HelloWorldServiceLocal helloWorldService; + + public String getGreetings(String s) { + return helloWorldService.getGreetingsLocal(s); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientRemote2Impl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientRemote2Impl.java new file mode 100644 index 0000000000..77df8c2c39 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientRemote2Impl.java @@ -0,0 +1,35 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceRemote2; +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClientRemote2Impl implements HelloWorldClient { + + @Reference + public HelloWorldServiceRemote2 helloWorldService; + + public String getGreetings(String s) { + return helloWorldService.getGreetingsRemote2(s); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientRemoteImpl.java new file mode 100644 index 0000000000..8effa3ac36 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldClientRemoteImpl.java @@ -0,0 +1,35 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldClient; +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceRemote; +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldClientRemoteImpl implements HelloWorldClient { + + @Reference + public HelloWorldServiceRemote helloWorldService; + + public String getGreetings(String s) { + return helloWorldService.getGreetingsRemote(s); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java new file mode 100644 index 0000000000..2467ddab88 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java @@ -0,0 +1,35 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldCallbackRemote; +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceCallbackOnewayRemote; +import org.oasisopen.sca.annotation.Callback; + +public class HelloWorldServiceCallbackOnewayRemoteImpl implements HelloWorldServiceCallbackOnewayRemote { + + @Callback + protected HelloWorldCallbackRemote theCallback; + + public void getGreetingsRemote(String s) { + theCallback.getGreetingsCallbackRemote(s); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java new file mode 100644 index 0000000000..d1b75d0a2c --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java @@ -0,0 +1,39 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldCallbackRemote; +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceCallbackRemote; +import org.oasisopen.sca.annotation.Callback; + +public class HelloWorldServiceCallbackRemoteImpl implements HelloWorldServiceCallbackRemote { + + @Callback + protected HelloWorldCallbackRemote theCallback; + + public HelloWorldServiceCallbackRemoteImpl() { + System.out.println("Constructor"); + } + + public String getGreetingsRemote(String s) { + return "Hello " + theCallback.getGreetingsCallbackRemote(s); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceLocalImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceLocalImpl.java new file mode 100644 index 0000000000..44e7efc668 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceLocalImpl.java @@ -0,0 +1,30 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceLocal; + +public class HelloWorldServiceLocalImpl implements HelloWorldServiceLocal { + + public String getGreetingsLocal(String s) { + return "Hello " + s; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java new file mode 100644 index 0000000000..88440de023 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java @@ -0,0 +1,41 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceLocal; +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceRemote; +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceRemote2; +import org.oasisopen.sca.annotation.Service; + +@Service({HelloWorldServiceRemote.class, HelloWorldServiceRemote2.class, HelloWorldServiceLocal.class} ) +public class HelloWorldServiceMultipleServicesImpl implements HelloWorldServiceLocal, HelloWorldServiceRemote, HelloWorldServiceRemote2 { + + public String getGreetingsLocal(String s) { + return "Hello " + s; + } + + public String getGreetingsRemote(String s) { + return "Hello " + s; + } + + public String getGreetingsRemote2(String s) { + return "Hello " + s; + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceRemoteImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceRemoteImpl.java new file mode 100644 index 0000000000..06dc2c3f79 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/binding/sca/rmi/helloworld/impl/HelloWorldServiceRemoteImpl.java @@ -0,0 +1,30 @@ +/* + * 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 org.apache.tuscany.sca.binding.sca.rmi.helloworld.impl; + +import org.apache.tuscany.sca.binding.sca.rmi.helloworld.HelloWorldServiceRemote; + +public class HelloWorldServiceRemoteImpl implements HelloWorldServiceRemote { + + public String getGreetingsRemote(String s) { + return "Hello " + s; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/BindingSCATestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/BindingSCATestCase.java new file mode 100644 index 0000000000..05a8c3455c --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/BindingSCATestCase.java @@ -0,0 +1,170 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import java.io.File; + +import org.apache.tuscany.sca.assembly.SCABinding; +import org.apache.tuscany.sca.binding.ws.WebServiceBinding; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.apache.tuscany.sca.node.configuration.NodeConfiguration; +import org.junit.Assert; +import org.junit.Test; +import org.oasisopen.sca.ServiceRuntimeException; + +/** + * Test binding.sca in the same classloader + */ +public class BindingSCATestCase { + static final String DOMAIN_URI = "my-domain"; + private static final String REGISTRY_URI = "tribes://228.0.0.100:50000"; + private static final String PKG = "org/apache/tuscany/sca/itest/bindingsca/"; + private static final String CLIENT = "Client.composite"; + private static final String SERVICE = "Service.composite"; + private static final String ROOT = new File("target/classes/" + PKG).toURI().toString(); + + /** + * One NodeFactory and two nodes + */ + @Test + public void testOneFactoryTwoNodes() { + NodeFactory factory1 = NodeFactory.getInstance(); + Node node1 = createClientNode(factory1); + Node node2 = createServiceNode(factory1); + node1.start(); + node2.start(); + try { + runClient(node1); + } finally { + node2.stop(); + node1.stop(); + factory1.destroy(); + } + } + + /** + * Create the service node + * @param factory + * @return + */ + static Node createServiceNode(NodeFactory factory) { + NodeConfiguration config2 = + factory.createNodeConfiguration().setDomainURI(DOMAIN_URI).setURI("node2").addContribution("c2", ROOT) + .addDeploymentComposite("c2", SERVICE).setDomainRegistryURI(REGISTRY_URI) + .addBinding(WebServiceBinding.TYPE, "http://localhost:8085/").addBinding(SCABinding.TYPE, + "http://localhost:8085/"); + + Node node2 = factory.createNode(config2); + return node2; + } + + /** + * Create the client node + * @param factory + * @return + */ + static Node createClientNode(NodeFactory factory) { + NodeConfiguration config1 = + factory.createNodeConfiguration().setDomainURI(DOMAIN_URI).setURI("node1").addContribution("c1", ROOT) + .addDeploymentComposite("c1", CLIENT).setDomainRegistryURI(REGISTRY_URI) + .addBinding(WebServiceBinding.TYPE, "http://localhost:8085/").addBinding(SCABinding.TYPE, + "http://localhost:8085/"); + Node node1 = factory.createNode(config1); + return node1; + } + + /** + * Two node factories and two nodes + */ + @Test + public void testTwoFactoriesTwoNodes() throws Exception { + NodeFactory factory1 = NodeFactory.newInstance(); + Node node1 = createClientNode(factory1); + NodeFactory factory2 = NodeFactory.newInstance(); + Node node2 = createServiceNode(factory2); + node1.start(); + node2.start(); + Thread.sleep(1000); + try { + // This call doesn't require the Local service, it should be successful + createCustomer(node1); + try { + runClient(node1); + // We cannot make local call to remote endpoints + Assert.fail("ServiceRuntimeException should have been thrown."); + } catch (ServiceRuntimeException e) { + // ignore + } + } finally { + node2.stop(); + node1.stop(); + factory2.destroy(); + factory1.destroy(); + } + } + + /** + * Run the client + * @param node + */ + static void runClient(Node node) { + Client client = node.getService(Client.class, "ClientComponent/Client"); + runClient(client); + } + + static void runClient(Client client) { + String id = client.create("Ray"); + Assert.assertEquals("Ray", client.getName(id)); + } + + static void runClientNotFound(Client client) { + String id = "not-there"; + Assert.assertNull(client.getName(id)); + } + + static String createCustomer(Node node) { + Client client = node.getService(Client.class, "ClientComponent/Client"); + String id = client.create("John"); + Assert.assertNotNull(id); + return id; + } + + /** + * One node factory and one node for both composites + */ + @Test + public void testOneFactoryOneNode() { + NodeFactory factory = NodeFactory.getInstance(); + NodeConfiguration config1 = + factory.createNodeConfiguration().setDomainURI(DOMAIN_URI).setURI("node1").addContribution("c1", ROOT) + .addDeploymentComposite("c1", CLIENT).addDeploymentComposite("c1", SERVICE); + + Node node1 = factory.createNode(config1); + node1.start(); + try { + runClient(node1); + } finally { + node1.stop(); + factory.destroy(); + } + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientNodeSharedCustomerTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientNodeSharedCustomerTestCase.java new file mode 100644 index 0000000000..7255697d4b --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientNodeSharedCustomerTestCase.java @@ -0,0 +1,62 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Running the client node and service node with two different classloaders that share the Customer class + */ +public class ClientNodeSharedCustomerTestCase { + private static Node clientNode; + private static TestCaseRunner runner; + private static NodeFactory factory; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + runner = new TestCaseRunner(ServiceNode.class, Remote.class.getName(), RemoteServiceImpl.class.getName()); + runner.beforeClass(); + factory = NodeFactory.getInstance(); + clientNode = BindingSCATestCase.createClientNode(factory).start(); + Thread.sleep(1000); + } + + @Test + public void testClient() throws Exception { + BindingSCATestCase.runClient(clientNode); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (clientNode != null) { + clientNode.stop(); + } + if (runner != null) { + runner.afterClass(); + } + if (factory != null) { + factory.destroy(); + } + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientNodeSharedLocalTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientNodeSharedLocalTestCase.java new file mode 100644 index 0000000000..51fafae32c --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientNodeSharedLocalTestCase.java @@ -0,0 +1,62 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Running the client node and service node with two different classloaders that share the Local class + * (but not Customer) + */ +public class ClientNodeSharedLocalTestCase { + private static Node clientNode; + private static TestCaseRunner runner; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + runner = + new TestCaseRunner(ServiceNode.class, Remote.class.getName(), RemoteServiceImpl.class.getName(), + Customer.class.getName()); + runner.beforeClass(); + NodeFactory factory = NodeFactory.getInstance(); + clientNode = BindingSCATestCase.createClientNode(factory).start(); + Thread.sleep(1000); + } + + @Test + public void testClient() throws Exception { + BindingSCATestCase.runClient(clientNode); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (clientNode != null) { + clientNode.stop(); + } + if (runner != null) { + runner.afterClass(); + } + NodeFactory.getInstance().destroy(); + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientSharedCustomerTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientSharedCustomerTestCase.java new file mode 100644 index 0000000000..b8ff0c58ba --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientSharedCustomerTestCase.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.itest.bindingsca; + +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Running the client api and service node with two different classloaders that share the Customer class + */ +public class ClientSharedCustomerTestCase { + private static Client client; + private static TestCaseRunner runner; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + runner = new TestCaseRunner(ServiceNode.class, Remote.class.getName(), RemoteServiceImpl.class.getName()); + runner.beforeClass(); + client = new SCAClientImpl(BindingSCATestCase.DOMAIN_URI); + Thread.sleep(1000); + } + + @Test + public void testClient() throws Exception { + BindingSCATestCase.runClient(client); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (runner != null) { + runner.afterClass(); + } + NodeFactory.getInstance().destroy(); + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientSharedLocalTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientSharedLocalTestCase.java new file mode 100644 index 0000000000..633e1a767c --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ClientSharedLocalTestCase.java @@ -0,0 +1,63 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Running the client api and service node with two different classloaders that share the Local class + * (but not Customer) + */ +public class ClientSharedLocalTestCase { + private static Client client; + private static TestCaseRunner runner; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + runner = + new TestCaseRunner(ServiceNode.class, Remote.class.getName(), RemoteServiceImpl.class.getName(), + Customer.class.getName(), CustomerNotFoundException.class.getName()); + runner.beforeClass(); + client = new SCAClientImpl(BindingSCATestCase.DOMAIN_URI); + Thread.sleep(1000); + } + + @Test + public void testClient() throws Exception { + BindingSCATestCase.runClient(client); + } + + @Test + public void testClientNotFound() throws Exception { + BindingSCATestCase.runClientNotFound(client); + } + + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (runner != null) { + runner.afterClass(); + } + NodeFactory.getInstance().destroy(); + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ServiceNode.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ServiceNode.java new file mode 100644 index 0000000000..1cba2b57c2 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/ServiceNode.java @@ -0,0 +1,48 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; + +/** + * This shows how to test the Calculator service component. + */ +public class ServiceNode { + private static Node serviceNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + /* System.setProperty("org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint.enabled", + "false"); + */ + NodeFactory factory = NodeFactory.getInstance(); + serviceNode = BindingSCATestCase.createServiceNode(factory).start(); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (serviceNode != null) { + serviceNode.stop(); + } + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/TestCaseRunner.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/TestCaseRunner.java new file mode 100644 index 0000000000..c0960ffe95 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/java/org/apache/tuscany/sca/itest/bindingsca/TestCaseRunner.java @@ -0,0 +1,329 @@ +/* + * 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 org.apache.tuscany.sca.itest.bindingsca; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * A helper class that can be used to run an SCA JUnit test case. The test case will run in an isolated class loader. + * + * @version $Rev$ $Date$ + */ +public class TestCaseRunner { + + private ClassLoader classLoader; + private Class testSuiteClass; + private Object testSuite; + private Class testResultClass; + private Class testCaseClass; + private Object testCase; + + private Class beforeAnnotation; + private Class beforeClassAnnotation; + private Class afterAnnotation; + private Class afterClassAnnotation; + private Class junit4AdapterClass; + private Class junit3TestCaseClass; + + /** + * Constructs a new TestCase runner. + * + * @param testClass + */ + public TestCaseRunner(Class testClass, String... isolatedClasses) { + try { + ClassLoader tccl = setupClassLoader(testClass, isolatedClasses); + + try { + // Thread.currentThread().setContextClassLoader(classLoader); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finalClassLoader = classLoader; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finalClassLoader); + return null; + } + }); + + testCaseClass = Class.forName(testClass.getName(), true, classLoader); + testCase = testCaseClass.newInstance(); + ClassLoader testClassLoader = testCaseClass.getClassLoader(); + + junit3TestCaseClass = Class.forName("junit.framework.TestCase", true, testClassLoader); + + testSuiteClass = Class.forName("junit.framework.TestSuite", true, testClassLoader); + Constructor testSuiteConstructor = testSuiteClass.getConstructor(Class.class); + testSuite = testSuiteConstructor.newInstance(testCaseClass); + + testResultClass = Class.forName("junit.framework.TestResult", true, testClassLoader); + + try { + beforeAnnotation = Class.forName("org.junit.Before", true, testClassLoader); + afterAnnotation = Class.forName("org.junit.After", true, testClassLoader); + beforeClassAnnotation = Class.forName("org.junit.BeforeClass", true, testClassLoader); + afterClassAnnotation = Class.forName("org.junit.AfterClass", true, testClassLoader); + junit4AdapterClass = Class.forName("junit.framework.JUnit4TestAdapter", true, testClassLoader); + } catch (Exception e) { + // Unexpected + throw new AssertionError(e); + } + } catch (Throwable e) { + e.printStackTrace(); + } finally { + // Thread.currentThread().setContextClassLoader(tccl); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finaltccl = tccl; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finaltccl); + return null; + } + }); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private ClassLoader setupClassLoader(Class testClass, String... isolatedClasses) { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + classLoader = testClass.getClassLoader(); + if (classLoader instanceof URLClassLoader) { + URL[] urls = ((URLClassLoader)classLoader).getURLs(); + classLoader = new ClassLoaderImpl(urls, classLoader, isolatedClasses); + } else if (classLoader == tccl || classLoader.getParent() == tccl) { + classLoader = new URLClassLoader(new URL[0], classLoader); + } else { + classLoader = tccl; + } + return tccl; + } + + /** + * Run the test case + */ + public void run() { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + try { + // Thread.currentThread().setContextClassLoader(classLoader); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finalClassLoader = classLoader; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finalClassLoader); + return null; + } + }); + + if (junit3TestCaseClass.isAssignableFrom(testCaseClass)) { + Object testResult = testResultClass.newInstance(); + Method runMethod = testSuiteClass.getMethod("run", testResultClass); + runMethod.invoke(testSuite, testResult); + } else { + Object junit4Adapter = junit4AdapterClass.getConstructor(Class.class).newInstance(testCaseClass); + Object testResult = testResultClass.newInstance(); + Method runMethod = junit4AdapterClass.getMethod("run", testResultClass); + runMethod.invoke(junit4Adapter, testResult); + } + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + // Thread.currentThread().setContextClassLoader(tccl); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finaltccl = tccl; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finaltccl); + return null; + } + }); + } + } + + /** + * Invoke the setUp method + */ + public void setUp() { + execute("setUp"); + } + + /** + * Invoke the before methods + */ + public void before() { + execute(beforeAnnotation); + } + + /** + * Invoke the beforeClass methods + */ + public void beforeClass() { + execute(beforeClassAnnotation); + } + + /** + * Invoke the tearDown method + */ + public void tearDown() { + execute("tearDown"); + } + + /** + * Invoke the after methods + */ + public void after() { + execute(afterAnnotation); + } + + /** + * Invoke the afterClass methods + */ + public void afterClass() { + execute(afterClassAnnotation); + } + + /** + * Invoke the specified test method. + */ + public void run(String methodName) { + execute(methodName); + } + + /** + * Invoke the methods annotated with the specified annotation. + */ + private void execute(Class annotationClass) { + if (annotationClass == null) { + throw new RuntimeException(new NoSuchMethodException()); + } + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + try { + // Thread.currentThread().setContextClassLoader(classLoader); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finalClassLoader = classLoader; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finalClassLoader); + return null; + } + }); + + for (Method method : testCaseClass.getDeclaredMethods()) { + for (Annotation annotation : method.getAnnotations()) { + if (annotation.annotationType() == annotationClass) { + method.invoke(testCase); + } + } + } + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + // Thread.currentThread().setContextClassLoader(tccl); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finaltccl = tccl; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finaltccl); + return null; + } + }); + } + } + + /** + * Invoke the specified method + */ + private void execute(String methodName) { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + try { + // Thread.currentThread().setContextClassLoader(classLoader); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finalClassLoader = classLoader; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finalClassLoader); + return null; + } + }); + Method setUpMethod = testCaseClass.getDeclaredMethod(methodName); + setUpMethod.setAccessible(true); + setUpMethod.invoke(testCase); + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + // Thread.currentThread().setContextClassLoader(tccl); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finaltccl = tccl; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finaltccl); + return null; + } + }); + } + } + + public static class ClassLoaderImpl extends URLClassLoader { + private Set isolatedClasses = new HashSet(); + + /** + * @param urls + * @param parent + */ + public ClassLoaderImpl(URL[] urls, ClassLoader parent, String... sharedClasses) { + super(urls, parent); + this.isolatedClasses.addAll(Arrays.asList(sharedClasses)); + } + + @Override + protected synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException { + if (!isolatedClasses.contains(name)) { + return super.loadClass(name, resolve); + } else { + Class cls = findLoadedClass(name); + if (cls == null) { + cls = findClass(name); + } + if (resolve) { + resolveClass(cls); + } + return cls; + } + } + + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/asynchReference/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/asynchReference/HelloWorld.composite new file mode 100644 index 0000000000..8c825ca805 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/asynchReference/HelloWorld.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/asynchReference/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/asynchReference/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ab75f7d225 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/asynchReference/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/asynchService/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/asynchService/HelloWorld.composite new file mode 100644 index 0000000000..79b1a5d794 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/asynchService/HelloWorld.composite @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/asynchService/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/asynchService/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ab75f7d225 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/asynchService/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/callbackReference/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/callbackReference/HelloWorld.composite new file mode 100644 index 0000000000..e8924d2728 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/callbackReference/HelloWorld.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/callbackReference/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/callbackReference/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ab75f7d225 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/callbackReference/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/callbackService/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/callbackService/HelloWorld.composite new file mode 100644 index 0000000000..4edc8df5cd --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/callbackService/HelloWorld.composite @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/callbackService/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/callbackService/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ab75f7d225 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/callbackService/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionReference/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionReference/HelloWorld.composite new file mode 100644 index 0000000000..823cab4f56 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionReference/HelloWorld.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionReference/HelloWorldComponent.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionReference/HelloWorldComponent.composite new file mode 100644 index 0000000000..54fb359ba0 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionReference/HelloWorldComponent.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionReference/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionReference/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ab75f7d225 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionReference/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionService/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionService/HelloWorld.composite new file mode 100644 index 0000000000..454e9c55cf --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionService/HelloWorld.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionService/HelloWorldComponent.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionService/HelloWorldComponent.composite new file mode 100644 index 0000000000..a313fb8f68 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionService/HelloWorldComponent.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionService/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionService/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ab75f7d225 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/promotionService/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/simpleReference/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/simpleReference/HelloWorld.composite new file mode 100644 index 0000000000..4151749523 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/simpleReference/HelloWorld.composite @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/simpleReference/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/simpleReference/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ab75f7d225 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/simpleReference/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/simpleService/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/simpleService/HelloWorld.composite new file mode 100644 index 0000000000..37af7625ff --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/simpleService/HelloWorld.composite @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/simpleService/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/simpleService/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ab75f7d225 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/rmi/simpleService/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/asynchReference/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/asynchReference/HelloWorld.composite new file mode 100644 index 0000000000..e797a0aa9c --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/asynchReference/HelloWorld.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/asynchReference/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/asynchReference/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e6ccae5c73 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/asynchReference/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/asynchService/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/asynchService/HelloWorld.composite new file mode 100644 index 0000000000..079ee49380 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/asynchService/HelloWorld.composite @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/asynchService/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/asynchService/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e6ccae5c73 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/asynchService/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/callbackReference/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/callbackReference/HelloWorld.composite new file mode 100644 index 0000000000..1d5630f3d0 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/callbackReference/HelloWorld.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/callbackReference/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/callbackReference/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e6ccae5c73 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/callbackReference/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/callbackService/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/callbackService/HelloWorld.composite new file mode 100644 index 0000000000..ded3766d49 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/callbackService/HelloWorld.composite @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/callbackService/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/callbackService/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e6ccae5c73 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/callbackService/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionReference/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionReference/HelloWorld.composite new file mode 100644 index 0000000000..4513f21acf --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionReference/HelloWorld.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionReference/HelloWorldComponent.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionReference/HelloWorldComponent.composite new file mode 100644 index 0000000000..22c20ff94a --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionReference/HelloWorldComponent.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionReference/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionReference/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e6ccae5c73 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionReference/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionService/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionService/HelloWorld.composite new file mode 100644 index 0000000000..e6a7d776c9 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionService/HelloWorld.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionService/HelloWorldComponent.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionService/HelloWorldComponent.composite new file mode 100644 index 0000000000..0393280625 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionService/HelloWorldComponent.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionService/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionService/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e6ccae5c73 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/promotionService/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/simpleReference/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/simpleReference/HelloWorld.composite new file mode 100644 index 0000000000..f4d2789ff7 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/simpleReference/HelloWorld.composite @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/simpleReference/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/simpleReference/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e6ccae5c73 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/simpleReference/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/simpleService/HelloWorld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/simpleService/HelloWorld.composite new file mode 100644 index 0000000000..7e6311a22d --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/simpleService/HelloWorld.composite @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/simpleService/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/simpleService/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e6ccae5c73 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/binding-sca-tribes/src/test/resources/ws/simpleService/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/pom.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/pom.xml new file mode 100644 index 0000000000..129c79f53e --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/pom.xml @@ -0,0 +1,59 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-nodes + 2.0 + ../pom.xml + + itest-node-domain-node + Apache Tuscany SCA iTest Node DomainNode + + + + + org.apache.tuscany.sca + tuscany-base-runtime-pom + pom + 2.0 + + + + org.apache.tuscany.sca + tuscany-binding-rmi-runtime + 2.0 + + + + + + + ${project.artifactId} + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldClientImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldClientImpl.java new file mode 100644 index 0000000000..021a653c36 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldClientImpl.java @@ -0,0 +1,37 @@ +/* + * 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.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldClientImpl implements HelloWorldService { + + @Reference + protected HelloWorldService hwService; + + public String getGreetings(String name) { + return "Hello " + hwService.getGreetings(name); + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..636f7699ed --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,32 @@ +/* + * 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.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hello " + name; + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldService.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..32c2d0b907 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,33 @@ +/* + * 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 javax.jws.WebService; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public String getGreetings(String name); +} + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..34da25216d --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/resources/helloworld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/resources/helloworld.composite new file mode 100644 index 0000000000..fae44b642d --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/main/resources/helloworld.composite @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/test/java/helloworld/DomainNodeTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/test/java/helloworld/DomainNodeTestCase.java new file mode 100644 index 0000000000..028db4cf33 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/domain-node/src/test/java/helloworld/DomainNodeTestCase.java @@ -0,0 +1,90 @@ +/* + * 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 static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertNotNull; + +import java.io.IOException; +import java.util.List; + +import org.apache.tuscany.sca.Node; +import org.apache.tuscany.sca.TuscanyRuntime; +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.oasisopen.sca.NoSuchServiceException; + + +/** + * Tests that the helloworld server is available + */ +public class DomainNodeTestCase{ + + private Node node; + + @Before + public void startServer() throws Exception { + node = TuscanyRuntime.newInstance().createNode("default"); + node.installContribution("helloworld", "target/classes", null, null); + try { + node.startComposite("helloworld", "helloworld.composite"); + } catch (Exception ex) { + System.out.println("Caught exception on composite start : " + ex); + } + } + + @Ignore + @Test + public void testWaitForInput() { + System.out.println("Press a key to end"); + try { + System.in.read(); + } catch (Exception ex) { + } + System.out.println("Shutting down"); + } + + @Test + public void testContributionUninstall() throws IOException, NoSuchServiceException { + List installedContributions = node.getInstalledContributionURIs(); + System.out.println(installedContributions); + + assertEquals(1, installedContributions.size()); + + try { + node.stopCompositeAndUninstallUnused("helloworld", "helloworld.composite"); + } catch (Exception ex) { + System.out.println("Caught exception on composite stop : " + ex); + } + + installedContributions = node.getInstalledContributionURIs(); + assertEquals(0, installedContributions.size()); + } + + + @After + public void stopServer() throws Exception { + if (node != null) { + node.stop(); + } + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-client/pom.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-client/pom.xml new file mode 100644 index 0000000000..a4d031d523 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-client/pom.xml @@ -0,0 +1,44 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-nodes + 2.0 + ../pom.xml + + itest-nodes-helloworld-client + Apache Tuscany SCA iTest Nodes Helloworld Client + + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0 + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0 + provided + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-client/src/main/java/itest/nodes/HelloworldImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-client/src/main/java/itest/nodes/HelloworldImpl.java new file mode 100644 index 0000000000..2619dc269b --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-client/src/main/java/itest/nodes/HelloworldImpl.java @@ -0,0 +1,43 @@ +/* + * 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 itest.nodes; + +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 +@Scope("COMPOSITE") +public class HelloworldImpl implements Helloworld { + + @Reference + public Helloworld service; + + @Init + public void initialize() throws Exception{ + System.out.println(">>>>>> " + sayHello("init")); + } + + public String sayHello(String name) throws Exception { + return "Hi " + service.sayHello(name); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-client/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-client/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e295015a40 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-client/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-client/src/main/resources/helloworld-client.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-client/src/main/resources/helloworld-client.composite new file mode 100644 index 0000000000..3c4ed03448 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-client/src/main/resources/helloworld-client.composite @@ -0,0 +1,29 @@ + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-iface/pom.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-iface/pom.xml new file mode 100644 index 0000000000..7d31afe600 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-iface/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-nodes + 2.0 + ../pom.xml + + itest-nodes-helloworld-iface + Apache Tuscany SCA iTest Nodes Helloworld IFaces + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0 + provided + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-iface/src/main/java/itest/nodes/Helloworld.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-iface/src/main/java/itest/nodes/Helloworld.java new file mode 100644 index 0000000000..a0710281c9 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-iface/src/main/java/itest/nodes/Helloworld.java @@ -0,0 +1,29 @@ +/* + * 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 itest.nodes; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface Helloworld { + + String sayHello(String name) throws Exception; + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-iface/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-iface/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..2205b4e8fe --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-iface/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-a/pom.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-a/pom.xml new file mode 100644 index 0000000000..49c183cc3b --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-a/pom.xml @@ -0,0 +1,44 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0 + ../pom.xml + + itest-nodes-helloworld-service-a + Apache Tuscany SCA iTest Nodes Helloworld Service A + + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0 + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0 + provided + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-a/src/main/java/itest/nodes/HelloworldImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-a/src/main/java/itest/nodes/HelloworldImpl.java new file mode 100644 index 0000000000..2619dc269b --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-a/src/main/java/itest/nodes/HelloworldImpl.java @@ -0,0 +1,43 @@ +/* + * 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 itest.nodes; + +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 +@Scope("COMPOSITE") +public class HelloworldImpl implements Helloworld { + + @Reference + public Helloworld service; + + @Init + public void initialize() throws Exception{ + System.out.println(">>>>>> " + sayHello("init")); + } + + public String sayHello(String name) throws Exception { + return "Hi " + service.sayHello(name); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-a/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-a/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..bba92e6ca3 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-a/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-a/src/main/resources/service-a.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-a/src/main/resources/service-a.composite new file mode 100644 index 0000000000..55122d2d6c --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-a/src/main/resources/service-a.composite @@ -0,0 +1,29 @@ + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/pom.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/pom.xml new file mode 100644 index 0000000000..3bdf08370f --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-nodes + 2.0 + ../pom.xml + + itest-nodes-helloworld-service-and-client + Apache Tuscany SCA iTest Nodes Helloworld Service and Client + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0 + provided + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/src/main/java/itest/nodes/sac/Helloworld.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/src/main/java/itest/nodes/sac/Helloworld.java new file mode 100644 index 0000000000..f08412d4bf --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/src/main/java/itest/nodes/sac/Helloworld.java @@ -0,0 +1,29 @@ +/* + * 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 itest.nodes.sac; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface Helloworld { + + String sayHello(String name) throws Exception; + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/src/main/java/itest/nodes/sac/HelloworldClientImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/src/main/java/itest/nodes/sac/HelloworldClientImpl.java new file mode 100644 index 0000000000..d64536a998 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/src/main/java/itest/nodes/sac/HelloworldClientImpl.java @@ -0,0 +1,34 @@ +/* + * 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 itest.nodes.sac; + +import org.oasisopen.sca.annotation.Reference; + +public class HelloworldClientImpl implements Helloworld { + + @Reference + public Helloworld service; + + + public String sayHello(String name) throws Exception { + return "Hi " + service.sayHello(name); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/src/main/java/itest/nodes/sac/HelloworldServiceImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/src/main/java/itest/nodes/sac/HelloworldServiceImpl.java new file mode 100644 index 0000000000..728804b08c --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/src/main/java/itest/nodes/sac/HelloworldServiceImpl.java @@ -0,0 +1,30 @@ +/* + * 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 itest.nodes.sac; + +public class HelloworldServiceImpl implements Helloworld { + + public String sayHello(String name) { + String response = "Hello " + name; + System.out.println("At service - " + response); + return response; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..555824a94e --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/src/main/resources/helloworld-service.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/src/main/resources/helloworld-service.composite new file mode 100644 index 0000000000..38ac479275 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-and-client/src/main/resources/helloworld-service.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-b/pom.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-b/pom.xml new file mode 100644 index 0000000000..06ed6ca62b --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-b/pom.xml @@ -0,0 +1,49 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0 + ../pom.xml + + itest-nodes-helloworld-service-b + Apache Tuscany SCA iTest Nodes Helloworld Service B + + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0 + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0 + provided + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0 + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-b/src/main/java/itest/nodes/HelloworldImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-b/src/main/java/itest/nodes/HelloworldImpl.java new file mode 100644 index 0000000000..b1d5a8235a --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-b/src/main/java/itest/nodes/HelloworldImpl.java @@ -0,0 +1,33 @@ +/* + * 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 itest.nodes; + +import org.oasisopen.sca.annotation.Reference; + +public class HelloworldImpl implements Helloworld { + + @Reference + protected Helloworld service; + + public String sayHello(String name) throws Exception { + return service.sayHello(name); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-b/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-b/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..4405cca18e --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-b/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-b/src/main/resources/service-b.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-b/src/main/resources/service-b.composite new file mode 100644 index 0000000000..02cff882a7 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-b/src/main/resources/service-b.composite @@ -0,0 +1,29 @@ + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-c/pom.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-c/pom.xml new file mode 100644 index 0000000000..44b4a2a984 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-c/pom.xml @@ -0,0 +1,49 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0 + ../pom.xml + + itest-nodes-helloworld-Serivce-c + Apache Tuscany SCA iTest Nodes Helloworld Service C + + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0 + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0 + provided + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0 + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-c/src/main/java/itest/nodes/HelloworldImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-c/src/main/java/itest/nodes/HelloworldImpl.java new file mode 100644 index 0000000000..81f7e1747d --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-c/src/main/java/itest/nodes/HelloworldImpl.java @@ -0,0 +1,28 @@ +/* + * 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 itest.nodes; + +public class HelloworldImpl implements Helloworld { + + public String sayHello(String name) { + return "Hello " + name; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-c/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-c/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..3ff86f946b --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-c/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-c/src/main/resources/service-c.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-c/src/main/resources/service-c.composite new file mode 100644 index 0000000000..d88db09b43 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service-c/src/main/resources/service-c.composite @@ -0,0 +1,28 @@ + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service/pom.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service/pom.xml new file mode 100644 index 0000000000..8d5189642d --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service/pom.xml @@ -0,0 +1,43 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-nodes + 2.0 + ../pom.xml + + itest-nodes-helloworld-service + Apache Tuscany SCA iTest Nodes Helloworld Service + + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0 + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0 + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service/src/main/java/itest/nodes/HelloworldImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service/src/main/java/itest/nodes/HelloworldImpl.java new file mode 100644 index 0000000000..a27e752fd7 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service/src/main/java/itest/nodes/HelloworldImpl.java @@ -0,0 +1,30 @@ +/* + * 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 itest.nodes; + +public class HelloworldImpl implements Helloworld { + + public String sayHello(String name) { + String response = "Hello " + name; + System.out.println("At service - " + response); + return response; + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b02141ef26 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service/src/main/resources/helloworld-service.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service/src/main/resources/helloworld-service.composite new file mode 100644 index 0000000000..5334caeb55 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/helloworld-service/src/main/resources/helloworld-service.composite @@ -0,0 +1,28 @@ + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast-client/pom.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast-client/pom.xml new file mode 100644 index 0000000000..2478a4a3b5 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast-client/pom.xml @@ -0,0 +1,51 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-nodes + 2.0 + ../pom.xml + + itest-nodes-one-jvm-hazelcast-client + Apache Tuscany SCA iTest Nodes One JVM Using Hazelcast and client + + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0 + + + org.apache.tuscany.sca + tuscany-base-runtime-pom + pom + 2.0 + + + org.apache.tuscany.sca + tuscany-domain-hazelcast + 2.0 + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast-client/src/test/java/itest/ClientTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast-client/src/test/java/itest/ClientTestCase.java new file mode 100644 index 0000000000..1e59e3e34e --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast-client/src/test/java/itest/ClientTestCase.java @@ -0,0 +1,112 @@ +/* + * 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 itest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.apache.tuscany.sca.Node; +import org.apache.tuscany.sca.TuscanyRuntime; +import org.apache.tuscany.sca.core.assembly.impl.RuntimeEndpointImpl; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.hazelcast.client.HazelcastClient; +import com.hazelcast.core.IMap; + +/** + */ +public class ClientTestCase{ + + private static String domainURI = "uri:OneNodeTestCase?bind=127.0.0.1:14829"; + private static Node node; + private static HazelcastClient client; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + node = TuscanyRuntime.newInstance().createNode(domainURI); + node.installContribution("../helloworld-iface/target/classes"); + String c1 = node.installContribution("../helloworld-service/target/classes"); + String c2 = node.installContribution("../helloworld-client/target/classes"); + node.startDeployables(c1); + node.startDeployables(c2); + } + + @Test + public void testNode() throws Exception { + + client = HazelcastClient.newHazelcastClient("OneNodeTestCase", "tuscany", "127.0.0.1:14829"); + IMap map = client.getMap("OneNodeTestCase/Endpoints"); + + assertNotNull(map); + assertEquals(2, map.size()); + Object ep1 = map.get("HelloworldService#service-binding(Helloworld/Helloworld)"); +// System.out.println((RuntimeEndpointImpl)ep1); + assertNotNull(ep1); + assertTrue(ep1 instanceof RuntimeEndpointImpl); + Object ep2 = map.get("HelloworldClient#service-binding(Helloworld/Helloworld)"); + assertNotNull(ep2); + } + + //@Test + public void testTime() throws Exception { + long start = System.currentTimeMillis(); + long count = 100; + for (int i=0; i + + + 4.0.0 + + org.apache.tuscany.sca + itest-nodes + 2.0 + ../pom.xml + + itest-nodes-one-jvm-hazelcast + Apache Tuscany SCA iTest Nodes One JVM Using Hazelcast Registry + + + + org.apache.tuscany.sca + itest-nodes-helloworld-service-and-client + 2.0 + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0 + + + org.apache.tuscany.sca + tuscany-base-runtime-pom + pom + 2.0 + + + org.apache.tuscany.sca + tuscany-domain-hazelcast + 2.0 + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast/src/test/java/itest/OneNodeOneContributionTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast/src/test/java/itest/OneNodeOneContributionTestCase.java new file mode 100644 index 0000000000..3755d0b365 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast/src/test/java/itest/OneNodeOneContributionTestCase.java @@ -0,0 +1,64 @@ +/* + * 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 itest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import itest.nodes.sac.Helloworld; + +import java.net.URI; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.oasisopen.sca.client.SCAClientFactory; + +/** + * This shows how to test the Calculator service component. + */ +public class OneNodeOneContributionTestCase{ + + private static URI domainURI = URI.create("tuscany:OneNodeTestCase"); + private static Node node; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + node = NodeFactory.getInstance().createNode(domainURI, "../helloworld-service-and-client/target/classes"); + node.start(); + } + + @Test + public void testNode() throws Exception { + + Helloworld client = node.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (node != null) { + node.stop(); + } + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast/src/test/java/itest/OneNodeTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast/src/test/java/itest/OneNodeTestCase.java new file mode 100644 index 0000000000..c8ae6f3762 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast/src/test/java/itest/OneNodeTestCase.java @@ -0,0 +1,76 @@ +/* + * 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 itest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import itest.nodes.Helloworld; + +import java.net.URI; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.oasisopen.sca.client.SCAClientFactory; + +/** + * This shows how to test the Calculator service component. + */ +public class OneNodeTestCase{ + + private static URI domainURI = URI.create("OneNodeTestCase"); + private static Node node; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + node = NodeFactory.getInstance().createNode(domainURI, "../helloworld-service/target/classes", "../helloworld-client/target/classes", "../helloworld-iface/target/classes"); + node.start(); + } + + @Test + public void testNode() throws Exception { + + Helloworld service = node.getService(Helloworld.class, "HelloworldService"); + assertNotNull(service); + assertEquals("Hello Petra", service.sayHello("Petra")); + + Helloworld client = node.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + + Helloworld scaClientService = SCAClientFactory.newInstance(domainURI).getService(Helloworld.class, "HelloworldService"); + assertNotNull(scaClientService); + assertEquals("Hello Petra", scaClientService.sayHello("Petra")); + + Helloworld scaClientClient = SCAClientFactory.newInstance(domainURI).getService(Helloworld.class, "HelloworldClient"); + assertNotNull(scaClientClient); + assertEquals("Hi Hello Petra", scaClientClient.sayHello("Petra")); + + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (node != null) { + node.stop(); + } + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast/src/test/java/itest/TwoNodeTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast/src/test/java/itest/TwoNodeTestCase.java new file mode 100644 index 0000000000..23c4a62916 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast/src/test/java/itest/TwoNodeTestCase.java @@ -0,0 +1,82 @@ +/* + * 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 itest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import itest.nodes.Helloworld; + +import java.net.URI; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.oasisopen.sca.client.SCAClientFactory; + +/** + * This shows how to test the Calculator service component. + */ +public class TwoNodeTestCase{ + + private static URI domainURI = URI.create("TwoNodeTestCase"); + private static Node serviceNode; + private static Node clientNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + serviceNode = NodeFactory.getInstance().createNode(domainURI, "../helloworld-service/target/classes", "../helloworld-iface/target/classes"); + serviceNode.start(); + clientNode = NodeFactory.getInstance().createNode(domainURI, "../helloworld-client/target/classes", "../helloworld-iface/target/classes"); + clientNode.start(); + } + + @Test + public void testNode() throws Exception { + + Helloworld service = serviceNode.getService(Helloworld.class, "HelloworldService"); + assertNotNull(service); + assertEquals("Hello Petra", service.sayHello("Petra")); + + Helloworld client = clientNode.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + + Helloworld scaClientService = SCAClientFactory.newInstance(domainURI).getService(Helloworld.class, "HelloworldService"); + assertNotNull(scaClientService); + assertEquals("Hello Petra", scaClientService.sayHello("Petra")); + + Helloworld scaClientClient = SCAClientFactory.newInstance(domainURI).getService(Helloworld.class, "HelloworldClient"); + assertNotNull(scaClientClient); + assertEquals("Hi Hello Petra", scaClientClient.sayHello("Petra")); + + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (serviceNode != null) { + serviceNode.stop(); + } + if (clientNode != null) { + clientNode.stop(); + } + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast/src/test/java/itest/TwoRemoteNodesTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast/src/test/java/itest/TwoRemoteNodesTestCase.java new file mode 100644 index 0000000000..a7e2bcf1c1 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-hazelcast/src/test/java/itest/TwoRemoteNodesTestCase.java @@ -0,0 +1,89 @@ +/* + * 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 itest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import itest.nodes.Helloworld; + +import java.net.URI; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import org.oasisopen.sca.client.SCAClientFactory; + +/** + * This shows how to test the Calculator service component. + */ +public class TwoRemoteNodesTestCase{ + + private static Node serviceNode; + private static Node clientNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + serviceNode = NodeFactory.newInstance().createNode(URI.create("tuscany:TwoRemoteNodesTestCase"), "../helloworld-service/target/classes", "../helloworld-iface/target/classes"); + serviceNode.start(); + + clientNode = NodeFactory.getInstance().createNode(URI.create("tuscany:TwoRemoteNodesTestCase"), "../helloworld-client/target/classes", "../helloworld-iface/target/classes"); + clientNode.start(); + } + + @Test + public void testNode() throws Exception { + + Helloworld service = serviceNode.getService(Helloworld.class, "HelloworldService"); + assertNotNull(service); + assertEquals("Hello Petra", service.sayHello("Petra")); + + Helloworld client = clientNode.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + + Helloworld scaClientService = SCAClientFactory.newInstance(URI.create("TwoRemoteNodesTestCase")).getService(Helloworld.class, "HelloworldService"); + assertNotNull(scaClientService); + assertEquals("Hello Petra", scaClientService.sayHello("Petra")); + + } + + @Ignore // Fails with Hazelcast 1.9.2.2, investigating... + @Test + public void testRemoteClient() throws Exception { + + Helloworld scaClientClient = SCAClientFactory.newInstance(URI.create("TwoRemoteNodesTestCase")).getService(Helloworld.class, "HelloworldClient"); + assertNotNull(scaClientClient); + assertEquals("Hi Hello Petra", scaClientClient.sayHello("Petra")); + + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (serviceNode != null) { + serviceNode.stop(); + } + if (clientNode != null) { + clientNode.stop(); + } + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-tribes/pom.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-tribes/pom.xml new file mode 100644 index 0000000000..d68e6cc69a --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-tribes/pom.xml @@ -0,0 +1,82 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-nodes + 2.0 + ../pom.xml + + itest-nodes-one-jvm-tribes + Apache Tuscany SCA iTest Nodes One JVM Using Tribes Registry + + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0 + + + org.apache.tuscany.sca + tuscany-sca-client-impl + 2.0 + + + org.apache.tuscany.sca + tuscany-endpoint-tribes + 2.0 + + + org.apache.tuscany.sca + tuscany-binding-rmi-runtime + 2.0 + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0 + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0 + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.5 + + + **/*TestCase.java + + brief + false + once + -ea -Xmx256m + off + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-tribes/src/test/java/itest/OneNodeTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-tribes/src/test/java/itest/OneNodeTestCase.java new file mode 100644 index 0000000000..e55e8f63e4 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-tribes/src/test/java/itest/OneNodeTestCase.java @@ -0,0 +1,76 @@ +/* + * 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 itest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import itest.nodes.Helloworld; + +import java.net.URI; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.oasisopen.sca.client.SCAClientFactory; + +/** + * This shows how to test the Calculator service component. + */ +public class OneNodeTestCase{ + + private static URI domainURI = URI.create("OneNodeTestCase"); + private static Node node; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + node = NodeFactory.getInstance().createNode(domainURI, "../helloworld-service/target/classes", "../helloworld-client/target/classes"); + node.start(); + } + + @Test + public void testNode() throws Exception { + + Helloworld service = node.getService(Helloworld.class, "HelloworldService"); + assertNotNull(service); + assertEquals("Hello Petra", service.sayHello("Petra")); + + Helloworld client = node.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + + Helloworld scaClientService = SCAClientFactory.newInstance(domainURI).getService(Helloworld.class, "HelloworldService"); + assertNotNull(scaClientService); + assertEquals("Hello Petra", scaClientService.sayHello("Petra")); + + Helloworld scaClientClient = SCAClientFactory.newInstance(domainURI).getService(Helloworld.class, "HelloworldClient"); + assertNotNull(scaClientClient); + assertEquals("Hi Hello Petra", scaClientClient.sayHello("Petra")); + + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (node != null) { + node.stop(); + } + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-tribes/src/test/java/itest/TwoNodeTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-tribes/src/test/java/itest/TwoNodeTestCase.java new file mode 100644 index 0000000000..2d920c340a --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-tribes/src/test/java/itest/TwoNodeTestCase.java @@ -0,0 +1,82 @@ +/* + * 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 itest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import itest.nodes.Helloworld; + +import java.net.URI; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.oasisopen.sca.client.SCAClientFactory; + +/** + * This shows how to test the Calculator service component. + */ +public class TwoNodeTestCase{ + + private static URI domainURI = URI.create("TwoNodeTestCase"); + private static Node serviceNode; + private static Node clientNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + serviceNode = NodeFactory.getInstance().createNode(domainURI, "../helloworld-service/target/classes"); + serviceNode.start(); + clientNode = NodeFactory.getInstance().createNode(domainURI, "../helloworld-client/target/classes"); + clientNode.start(); + } + + @Test + public void testNode() throws Exception { + + Helloworld service = serviceNode.getService(Helloworld.class, "HelloworldService"); + assertNotNull(service); + assertEquals("Hello Petra", service.sayHello("Petra")); + + Helloworld client = clientNode.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + + Helloworld scaClientService = SCAClientFactory.newInstance(domainURI).getService(Helloworld.class, "HelloworldService"); + assertNotNull(scaClientService); + assertEquals("Hello Petra", scaClientService.sayHello("Petra")); + + Helloworld scaClientClient = SCAClientFactory.newInstance(domainURI).getService(Helloworld.class, "HelloworldClient"); + assertNotNull(scaClientClient); + assertEquals("Hi Hello Petra", scaClientClient.sayHello("Petra")); + + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (serviceNode != null) { + serviceNode.stop(); + } + if (clientNode != null) { + clientNode.stop(); + } + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-tribes/src/test/java/itest/TwoRemoteNodesTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-tribes/src/test/java/itest/TwoRemoteNodesTestCase.java new file mode 100644 index 0000000000..888b4df156 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm-tribes/src/test/java/itest/TwoRemoteNodesTestCase.java @@ -0,0 +1,83 @@ +/* + * 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 itest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import itest.nodes.Helloworld; + +import java.net.URI; + +import org.apache.tuscany.sca.binding.rmi.RMIBinding; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.oasisopen.sca.client.SCAClientFactory; + +/** + * This shows how to test the Calculator service component. + */ +public class TwoRemoteNodesTestCase{ + + private static Node serviceNode; + private static Node clientNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + serviceNode = NodeFactory.newInstance().createNode(URI.create("tuscany:TwoRemoteNodesTestCase"), "../helloworld-service/target/classes"); + serviceNode.start(); + + clientNode = NodeFactory.getInstance().createNode(URI.create("tuscany:TwoRemoteNodesTestCase"), "../helloworld-client/target/classes"); + clientNode.start(); + } + + @Test + public void testNode() throws Exception { + + Helloworld service = serviceNode.getService(Helloworld.class, "HelloworldService"); + assertNotNull(service); + assertEquals("Hello Petra", service.sayHello("Petra")); + + Helloworld client = clientNode.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + +// Helloworld scaClientService = SCAClientFactory.newInstance(URI.create("TwoRemoteNodesTestCase")).getService(Helloworld.class, "HelloworldService"); +// assertNotNull(scaClientService); +// assertEquals("Hello Petra", scaClientService.sayHello("Petra")); + + Helloworld scaClientClient = SCAClientFactory.newInstance(URI.create("TwoRemoteNodesTestCase")).getService(Helloworld.class, "HelloworldClient"); + assertNotNull(scaClientClient); + assertEquals("Hi Hello Petra", scaClientClient.sayHello("Petra")); + + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (serviceNode != null) { + serviceNode.stop(); + } + if (clientNode != null) { + clientNode.stop(); + } + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm/pom.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm/pom.xml new file mode 100644 index 0000000000..f55a3a3f1b --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm/pom.xml @@ -0,0 +1,53 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-nodes + 2.0 + ../pom.xml + + itest-nodes-one-jvm + Apache Tuscany SCA iTest Nodes One JVM + + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0 + + + org.apache.tuscany.sca + tuscany-sca-client-impl + 2.0 + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0 + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0 + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm/src/test/java/itest/OneNodeTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm/src/test/java/itest/OneNodeTestCase.java new file mode 100644 index 0000000000..c8ae6f3762 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm/src/test/java/itest/OneNodeTestCase.java @@ -0,0 +1,76 @@ +/* + * 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 itest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import itest.nodes.Helloworld; + +import java.net.URI; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.oasisopen.sca.client.SCAClientFactory; + +/** + * This shows how to test the Calculator service component. + */ +public class OneNodeTestCase{ + + private static URI domainURI = URI.create("OneNodeTestCase"); + private static Node node; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + node = NodeFactory.getInstance().createNode(domainURI, "../helloworld-service/target/classes", "../helloworld-client/target/classes", "../helloworld-iface/target/classes"); + node.start(); + } + + @Test + public void testNode() throws Exception { + + Helloworld service = node.getService(Helloworld.class, "HelloworldService"); + assertNotNull(service); + assertEquals("Hello Petra", service.sayHello("Petra")); + + Helloworld client = node.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + + Helloworld scaClientService = SCAClientFactory.newInstance(domainURI).getService(Helloworld.class, "HelloworldService"); + assertNotNull(scaClientService); + assertEquals("Hello Petra", scaClientService.sayHello("Petra")); + + Helloworld scaClientClient = SCAClientFactory.newInstance(domainURI).getService(Helloworld.class, "HelloworldClient"); + assertNotNull(scaClientClient); + assertEquals("Hi Hello Petra", scaClientClient.sayHello("Petra")); + + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (node != null) { + node.stop(); + } + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm/src/test/java/itest/TwoNodeTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm/src/test/java/itest/TwoNodeTestCase.java new file mode 100644 index 0000000000..23c4a62916 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-jvm/src/test/java/itest/TwoNodeTestCase.java @@ -0,0 +1,82 @@ +/* + * 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 itest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import itest.nodes.Helloworld; + +import java.net.URI; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.oasisopen.sca.client.SCAClientFactory; + +/** + * This shows how to test the Calculator service component. + */ +public class TwoNodeTestCase{ + + private static URI domainURI = URI.create("TwoNodeTestCase"); + private static Node serviceNode; + private static Node clientNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + serviceNode = NodeFactory.getInstance().createNode(domainURI, "../helloworld-service/target/classes", "../helloworld-iface/target/classes"); + serviceNode.start(); + clientNode = NodeFactory.getInstance().createNode(domainURI, "../helloworld-client/target/classes", "../helloworld-iface/target/classes"); + clientNode.start(); + } + + @Test + public void testNode() throws Exception { + + Helloworld service = serviceNode.getService(Helloworld.class, "HelloworldService"); + assertNotNull(service); + assertEquals("Hello Petra", service.sayHello("Petra")); + + Helloworld client = clientNode.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + + Helloworld scaClientService = SCAClientFactory.newInstance(domainURI).getService(Helloworld.class, "HelloworldService"); + assertNotNull(scaClientService); + assertEquals("Hello Petra", scaClientService.sayHello("Petra")); + + Helloworld scaClientClient = SCAClientFactory.newInstance(domainURI).getService(Helloworld.class, "HelloworldClient"); + assertNotNull(scaClientClient); + assertEquals("Hi Hello Petra", scaClientClient.sayHello("Petra")); + + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (serviceNode != null) { + serviceNode.stop(); + } + if (clientNode != null) { + clientNode.stop(); + } + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/one-node-test/pom.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-node-test/pom.xml new file mode 100644 index 0000000000..98f1e446ea --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-node-test/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-nodes + 2.0 + ../pom.xml + + itest-nodes-one-node-test + Apache Tuscany SCA iTest Nodes One Node Test + + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0 + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0 + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0 + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java new file mode 100644 index 0000000000..93f5863010 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java @@ -0,0 +1,88 @@ +/* + * 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 itest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.io.File; + +import itest.nodes.Helloworld; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * This shows how to test the Calculator service component. + */ +public class OneNodeTestCase{ + + private static Node node; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + System.setProperty("org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint.enabled", "false"); + NodeFactory factory = NodeFactory.newInstance(); + node = factory.createNode( + new Contribution("iface", getJar("../helloworld-iface/target")), + new Contribution("service", getJar("../helloworld-service/target")), + new Contribution("client", getJar("../helloworld-client/target"))); + node.start(); + } + + /** + * Get the jar in the target folder without being dependent on the version name to + * make tuscany releases easier + */ + private static String getJar(String targetDirectory) { + File f = new File(targetDirectory); + for (File file : f.listFiles()) { + if (file.getName().endsWith(".jar")) { + return file.toURI().toString(); + } + } + throw new IllegalStateException("Can't find jar in: " + targetDirectory); + } + + @Test + public void testCalculator() throws Exception { + + // Ideally this would use the SCAClient API but leaving that tillwe have the basics working + + Helloworld service = node.getService(Helloworld.class, "HelloworldService"); + assertNotNull(service); + assertEquals("Hello Petra", service.sayHello("Petra")); + + Helloworld client = node.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (node != null) { + node.stop(); + } + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/pom.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/pom.xml new file mode 100644 index 0000000000..0417a8ba4d --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/pom.xml @@ -0,0 +1,64 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0 + ../pom.xml + + pom + itest-nodes + Apache Tuscany SCA iTest Nodes + + + install + + + + helloworld-iface + helloworld-service + helloworld-client + helloworld-service-and-client + + one-jvm + one-jvm-hazelcast + one-jvm-hazelcast-client + one-jvm-tribes + binding-sca-hazelcast + + one-node-test + + + + domain-node + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/pom.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/pom.xml new file mode 100644 index 0000000000..696bb19c0d --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/pom.xml @@ -0,0 +1,71 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-nodes + 2.0 + ../pom.xml + + itest-remote-stop-start + Apache Tuscany SCA iTest Remote Stop Start + + + + org.apache.tuscany.sca + tuscany-base-runtime + 2.0 + + + org.apache.tuscany.sca + tuscany-domain-hazelcast + 2.0 + + + + + + + org.apache.tuscany.sca + tuscany-maven-plugin + 2.0 + + uri:StartStopTestCase?bind=127.0.0.1:9876 + + + + process-test-classes + + start + + + + stop + prepare-package + + stop + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/main/java/itest/HelloworldService.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/main/java/itest/HelloworldService.java new file mode 100644 index 0000000000..f97d2c3a83 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/main/java/itest/HelloworldService.java @@ -0,0 +1,28 @@ +/* + * 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 itest; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloworldService { + + String sayHello(String name); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/main/java/itest/HelloworldServiceImpl.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/main/java/itest/HelloworldServiceImpl.java new file mode 100644 index 0000000000..4fd909af82 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/main/java/itest/HelloworldServiceImpl.java @@ -0,0 +1,38 @@ +/* + * 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 itest; + +import org.oasisopen.sca.annotation.EagerInit; +import org.oasisopen.sca.annotation.Init; +import org.oasisopen.sca.annotation.Scope; + +@EagerInit +@Scope("COMPOSITE") +public class HelloworldServiceImpl implements HelloworldService { + + public String sayHello(String name) { + return "Hello " + name; + } + + @Init + public void init() { + System.out.println("init: " + sayHello("world")); + } + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/main/java/itest/RemoteHelloworldService.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/main/java/itest/RemoteHelloworldService.java new file mode 100644 index 0000000000..d5b9dcf311 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/main/java/itest/RemoteHelloworldService.java @@ -0,0 +1,28 @@ +/* + * 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 itest; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface RemoteHelloworldService { + + String sayHelloRemote(String name); + +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/main/resources/Helloworld.composite b/sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/main/resources/Helloworld.composite new file mode 100644 index 0000000000..d37c93857d --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/main/resources/Helloworld.composite @@ -0,0 +1,29 @@ + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e178823296 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/test/java/test/scaclient/StopStartTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/test/java/test/scaclient/StopStartTestCase.java new file mode 100644 index 0000000000..933b9f1bea --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/remote-stop-start/src/test/java/test/scaclient/StopStartTestCase.java @@ -0,0 +1,62 @@ +/* + * 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 test.scaclient; + +import itest.HelloworldService; + +import java.util.List; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.Node; +import org.apache.tuscany.sca.TuscanyRuntime; +import org.apache.tuscany.sca.contribution.processor.ContributionReadException; +import org.apache.tuscany.sca.monitor.ValidationException; +import org.apache.tuscany.sca.runtime.ActivationException; +import org.junit.Test; +import org.oasisopen.sca.NoSuchDomainException; +import org.oasisopen.sca.NoSuchServiceException; + +public class StopStartTestCase { + + @Test + public void startStopInstall() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException { + TuscanyRuntime runtime = TuscanyRuntime.newInstance(); + Node node1 = runtime.createNode("uri:StartStopTestCase?wka=127.0.0.1:9876"); + Assert.assertEquals("Hello Amelia", node1.getService(HelloworldService.class, "HelloworldComponent").sayHello("Amelia")); + + String curi = node1.getInstalledContributionURIs().get(0); + + node1.stopComposite(curi, "Helloworld.composite"); + try { + node1.getService(HelloworldService.class, "HelloworldComponent").sayHello("Amelia"); + Assert.fail(); + } catch (NoSuchServiceException e) { + // expected + } + + List nodes = node1.getNodeNames(); + nodes.remove(node1.getLocalNodeName()); + String remoteNode = nodes.get(0); + node1.startComposite(curi, "Helloworld.composite", remoteNode); + +// TUSCANY-3870: this next invoke doesn't work: +// Assert.assertEquals("Hello Amelia", node1.getService(HelloworldService.class, "HelloworldComponent").sayHello("Amelia")); + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/build.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/build.xml new file mode 100644 index 0000000000..3d77230541 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/build.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/client.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/client.xml new file mode 100644 index 0000000000..8e7c744940 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/client.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/pom.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/pom.xml new file mode 100644 index 0000000000..4bbc06e6b4 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/pom.xml @@ -0,0 +1,104 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0 + ../pom.xml + + itest-nodes-three-nodes-three-vms-test + Apache Tuscany SCA iTest Nodes Three Nodes Three VMs Test + + + + org.apache.tuscany.sca + tuscany-domain-node + 2.0 + + + org.apache.tuscany.sca + tuscany-endpoint-tribes + 2.0 + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0 + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0 + + + org.apache.tuscany.sca + tuscany-node-launcher + 2.0 + + + org.apache.tuscany.sca + tuscany-sca-client-impl + 2.0 + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0 + + + org.apache.tuscany.sca + tuscany-binding-sca-runtime-rmi + 2.0 + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0 + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + run-samples + test + + run + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/server.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/server.xml new file mode 100644 index 0000000000..dc18cc8ce0 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/server.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/service-a-config.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/service-a-config.xml new file mode 100644 index 0000000000..d4c8909126 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/service-a-config.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/service-b-config.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/service-b-config.xml new file mode 100644 index 0000000000..d557a31b64 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/service-b-config.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/service-c-config.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/service-c-config.xml new file mode 100644 index 0000000000..ba642c5ed0 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/service-c-config.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/src/test/java/itest/ServiceA.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/src/test/java/itest/ServiceA.java new file mode 100644 index 0000000000..6ef30fe43f --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/src/test/java/itest/ServiceA.java @@ -0,0 +1,65 @@ +/* + * 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 itest; + +import java.io.File; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + + +public class ServiceA { + + private static Node sericeNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + NodeFactory factory = NodeFactory.newInstance(); + + sericeNode = factory.createNode(new File("service-a-config.xml").toURI().toURL()); + + try { + sericeNode.start(); + } catch (Exception ex){ + ex.printStackTrace(); + throw ex; + } + } + + @Test + public void testNothing() throws Exception { + + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (sericeNode != null) { + sericeNode.stop(); + } + } + + public static void main(String[] args) throws Exception { + ServiceA.setUpBeforeClass(); + ServiceA.tearDownAfterClass(); + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/src/test/java/itest/ServiceB.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/src/test/java/itest/ServiceB.java new file mode 100644 index 0000000000..67a8e5d92e --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/src/test/java/itest/ServiceB.java @@ -0,0 +1,55 @@ +/* + * 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 itest; + +import java.io.File; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class ServiceB { + + private static Node serviceNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + NodeFactory factory = NodeFactory.newInstance(); + + serviceNode = factory.createNode(new File("service-b-config.xml").toURI().toURL()); + serviceNode.start(); + } + + @Test + public void testNothing() throws Exception { + synchronized (this) { + this.wait(); + } + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (serviceNode != null) { + serviceNode.stop(); + } + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/src/test/java/itest/ServiceC.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/src/test/java/itest/ServiceC.java new file mode 100644 index 0000000000..d716b5cd98 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/three-nodes-three-vms-test/src/test/java/itest/ServiceC.java @@ -0,0 +1,55 @@ +/* + * 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 itest; + +import java.io.File; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class ServiceC { + + private static Node serviceNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + NodeFactory factory = NodeFactory.newInstance(); + + serviceNode = factory.createNode(new File("service-c-config.xml").toURI().toURL()); + serviceNode.start(); + } + + @Test + public void testNothing() throws Exception { + synchronized (this) { + this.wait(); + } + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (serviceNode != null) { + serviceNode.stop(); + } + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/build.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/build.xml new file mode 100644 index 0000000000..7e83ff658e --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/build.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/pom.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/pom.xml new file mode 100644 index 0000000000..9abace8f58 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/pom.xml @@ -0,0 +1,98 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0 + ../pom.xml + + itest-nodes-two-jvm-hazelcast + Apache Tuscany SCA iTest Nodes Two JVM using Hazelcast registry + + + + + org.apache.tuscany.sca + tuscany-base-runtime-pom + pom + 2.0 + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0 + + + org.apache.tuscany.sca + tuscany-binding-sca-runtime + 2.0 + + + org.apache.tuscany.sca + tuscany-binding-ws-runtime-axis2 + 2.0 + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0 + + + org.apache.tuscany.sca + tuscany-domain-hazelcast + 2.0 + + + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0 + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + run-samples + test + + run + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/main/java/org/apache/tuscany/sca/impl/Tuscany.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/main/java/org/apache/tuscany/sca/impl/Tuscany.java new file mode 100644 index 0000000000..5c6ca7476e --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/main/java/org/apache/tuscany/sca/impl/Tuscany.java @@ -0,0 +1,138 @@ +/* + * 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 org.apache.tuscany.sca.impl; + +import java.io.File; +import java.io.FilenameFilter; +import java.io.IOException; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.URL; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; + +/** + * Main class for Tuscany. Just looking at what it means to read config from a directory structure. + * + */ +public class Tuscany { + + public static void main(String[] args) throws Exception { + String domainName = args[0]; + String nodeName = args[1]; + int deamonPort = -1; + + if (args.length > 2){ + deamonPort = Integer.parseInt(args[2]); + } + + // find the domain directory + File currentDirectory = new File("."); + File domainDirectory = findDirectory(currentDirectory, domainName); + System.out.println("Domain: " + domainDirectory.getPath()); + + // find a sub directory that ends in nodeName + File nodeDirectory = findDirectory(currentDirectory, nodeName); + System.out.println("Node: " + nodeDirectory.getPath()); + + // start a node with the node configuration +/* don't know how to start the node using the following + TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance(); + Node node = tuscanyRuntime.createNodeFromXML(nodeDirectory.getPath() + + File.separator + + "node.xml"); +*/ + NodeFactory nodeFactory = NodeFactory.newInstance(); + + URL nodeConfigURL = nodeDirectory.toURI().resolve("node.xml").toURL(); + Node node = nodeFactory.createNode(nodeConfigURL); + + try { + node.start(); + + // for testing we're going to set up a deamon that listens for + // a shutdown message on a specified port (well it actually just + // waits for a client to connect to the port as that's all we need + // for now). If no port is specified then just stop straight away + + if (deamonPort >= 0){ + // Its a runtime that has to act as a deamon + ServerSocket serverSocket = null; + + try { + serverSocket = new ServerSocket(deamonPort); + } catch (IOException e) { + System.out.println("Can't create a ServerSocket on port: " + deamonPort); + return; + } + + // all we're doing here is waiting for a connection. If we wanted to implement + // a real deamon we should perhaps listen to what's coming in over the resulting socket + // and see if a shutdown has been requested + Socket clientSocket = null; + try { + clientSocket = serverSocket.accept(); + } catch (IOException e) { + System.out.println("Accept failed on port: " + deamonPort); + return; + } + } + + } finally { + node.stop(); + } + } + + /** + * Just walks down the tree (depth first) looking for a directory ending in the + * name. + */ + private static File findDirectory(File currentDirectory, String name){ + File directory = null; + + if (currentDirectory.getPath().endsWith(name)){ + directory = currentDirectory; + } else { + File[] subDirectories = currentDirectory.listFiles(new DirectoryFilter()); + for (File aDirectory : subDirectories) { + directory = findDirectory(aDirectory, name); + + if (directory != null){ + break; + } + } + } + + return directory; + } + + private static class DirectoryFilter implements FilenameFilter { + + public boolean accept(File dir, String name) { + if(new File(dir, name).isDirectory()) { + return true; + } + + return false; + } + } + +} \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/test/resources/domain-domain1/helloworld-client-contribution.jar b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/test/resources/domain-domain1/helloworld-client-contribution.jar new file mode 100644 index 0000000000..c98214fc83 Binary files /dev/null and b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/test/resources/domain-domain1/helloworld-client-contribution.jar differ diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/test/resources/domain-domain1/helloworld-iface-contribution.jar b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/test/resources/domain-domain1/helloworld-iface-contribution.jar new file mode 100644 index 0000000000..455de9c58a Binary files /dev/null and b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/test/resources/domain-domain1/helloworld-iface-contribution.jar differ diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/test/resources/domain-domain1/helloworld-service-contribution.jar b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/test/resources/domain-domain1/helloworld-service-contribution.jar new file mode 100644 index 0000000000..28e3e680e9 Binary files /dev/null and b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/test/resources/domain-domain1/helloworld-service-contribution.jar differ diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/test/resources/domain-domain1/node-nodeClient/node.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/test/resources/domain-domain1/node-nodeClient/node.xml new file mode 100644 index 0000000000..81f82a9590 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/test/resources/domain-domain1/node-nodeClient/node.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/test/resources/domain-domain1/node-nodeService/node.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/test/resources/domain-domain1/node-nodeService/node.xml new file mode 100644 index 0000000000..5d8620498a --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-jvm-hazelcast/src/test/resources/domain-domain1/node-nodeService/node.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/pom.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/pom.xml new file mode 100644 index 0000000000..68e6e8b437 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/pom.xml @@ -0,0 +1,59 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0 + ../pom.xml + + itest-nodes-two-nodes-test + Apache Tuscany SCA iTest Nodes Two Nodes Test + + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0 + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0 + + + org.apache.tuscany.sca + tuscany-sca-client-impl + 2.0 + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0 + + + org.apache.tuscany.sca + tuscany-binding-ws-runtime-axis2 + 2.0 + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/src/test/java/itest/ClientNode.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/src/test/java/itest/ClientNode.java new file mode 100644 index 0000000000..6da4c1f7e1 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/src/test/java/itest/ClientNode.java @@ -0,0 +1,93 @@ +/* + * 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 itest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import itest.nodes.Helloworld; + +import java.io.File; +import java.net.URI; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.apache.tuscany.sca.node.configuration.NodeConfiguration; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import org.oasisopen.sca.client.SCAClientFactory; + +/** + * This shows how to test the Calculator service component. + */ +public class ClientNode { + private final static String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200912"; + private static Node clientNode; + private static TestCaseRunner runner; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + runner = new TestCaseRunner(ServiceNode.class); + runner.beforeClass(); + System.setProperty("org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint.enabled", + "false"); + NodeFactory factory = NodeFactory.newInstance(); + NodeConfiguration conf = + factory.createNodeConfiguration().setURI("clientNode"). + addBinding(new QName(SCA11_NS, "binding.sca"), "http://localhost:8085/sca https://localhost:9085/sca") + .addBinding(new QName(SCA11_NS, "binding.ws"), "http://localhost:8086/ws") + .addContribution("client", new File("../helloworld-client/target/classes").toURI().toString()); + clientNode = factory.createNode(conf).start(); + Thread.sleep(1000); + } + + @Test + public void testCalculator() throws Exception { + + Helloworld client = clientNode.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + } + + @Test + @Ignore("SCAClient needs to leverage the EndpointRegistry to invoke services that are not hosted on the local node") + public void testCalculatorClientAPI() throws Exception { + Helloworld service = SCAClientFactory.newInstance(URI.create("default")).getService(Helloworld.class, "HelloworldService"); + assertNotNull(service); + assertEquals("Hello Petra", service.sayHello("Petra")); + + Helloworld client = SCAClientFactory.newInstance(URI.create("default")).getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (clientNode != null) { + clientNode.stop(); + } + if (runner != null) { + runner.afterClass(); + } + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/src/test/java/itest/ServiceNode.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/src/test/java/itest/ServiceNode.java new file mode 100644 index 0000000000..4b034d89e0 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/src/test/java/itest/ServiceNode.java @@ -0,0 +1,58 @@ +/* + * 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 itest; + +import java.io.File; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.apache.tuscany.sca.node.configuration.NodeConfiguration; +import org.junit.AfterClass; +import org.junit.BeforeClass; + +/** + * This shows how to test the Calculator service component. + */ +public class ServiceNode { + private final static String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200912"; + private static Node serviceNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + System.setProperty("org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint.enabled", + "false"); + NodeFactory factory = NodeFactory.newInstance(); + NodeConfiguration conf = + factory.createNodeConfiguration().setURI("serviceNode") + .addBinding(new QName(SCA11_NS, "binding.sca"), "http://localhost:8087/sca") + .addBinding(new QName(SCA11_NS, "binding.ws"), "http://localhost:8088/ws") + .addContribution("service", new File("../helloworld-service/target/classes").toURI().toString()); + serviceNode = factory.createNode(conf).start(); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (serviceNode != null) { + serviceNode.stop(); + } + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/src/test/java/itest/StopStartNodesTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/src/test/java/itest/StopStartNodesTestCase.java new file mode 100644 index 0000000000..998492734b --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/src/test/java/itest/StopStartNodesTestCase.java @@ -0,0 +1,103 @@ +/* + * 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 itest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; +import itest.nodes.Helloworld; + +import java.io.File; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.Test; + +/** + * Tests using two nodes and stopping and restarting a service node. + */ +public class StopStartNodesTestCase { + + private static Node serviceNode; + private static Node clientNode; + + @Test + public void testCalculator() throws Exception { + NodeFactory factory = NodeFactory.newInstance(); + serviceNode = factory.createNode(new Contribution("service", getJar("../helloworld-service/target"))); + serviceNode.start(); + clientNode = factory.createNode(new Contribution("client", getJar("../helloworld-client/target"))); + clientNode.start(); + + Helloworld service = serviceNode.getService(Helloworld.class, "HelloworldService"); + assertNotNull(service); + assertEquals("Hello Petra", service.sayHello("Petra")); + + Helloworld client = clientNode.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + + serviceNode.stop(); + + client = clientNode.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + + try { + client.sayHello("Petra"); + fail(); + } catch (Exception e) { + // expected + // TODO: better exception than NPE + } + + serviceNode = factory.createNode(new Contribution("service", getJar("../helloworld-service/target"))); + serviceNode.start(); + + client = clientNode.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + } + + /** + * Get the jar in the target folder without being dependent on the version name to + * make tuscany releases easier + */ + private static String getJar(String targetDirectory) { + File f = new File(targetDirectory); + for (File file : f.listFiles()) { + if (file.getName().endsWith(".jar")) { + return file.toURI().toString(); + } + } + throw new IllegalStateException("Can't find jar in: " + targetDirectory); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (serviceNode != null) { + serviceNode.stop(); + } + if (clientNode != null) { + clientNode.stop(); + } + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/src/test/java/itest/TestCaseRunner.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/src/test/java/itest/TestCaseRunner.java new file mode 100644 index 0000000000..7dfa6e66cc --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/src/test/java/itest/TestCaseRunner.java @@ -0,0 +1,292 @@ +/* + * 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 itest; + +import java.lang.annotation.Annotation; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.security.AccessController; +import java.security.PrivilegedAction; + +/** + * A helper class that can be used to run an SCA JUnit test case. The test case will run in an isolated class loader. + * + * @version $Rev$ $Date$ + */ +public class TestCaseRunner { + + private ClassLoader classLoader; + private Class testSuiteClass; + private Object testSuite; + private Class testResultClass; + private Class testCaseClass; + private Object testCase; + + private Class beforeAnnotation; + private Class beforeClassAnnotation; + private Class afterAnnotation; + private Class afterClassAnnotation; + private Class junit4AdapterClass; + private Class junit3TestCaseClass; + + /** + * Constructs a new TestCase runner. + * + * @param testClass + */ + public TestCaseRunner(Class testClass) { + try { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + classLoader = testClass.getClassLoader(); + if (classLoader instanceof URLClassLoader) { + URL[] urls = ((URLClassLoader)classLoader).getURLs(); + classLoader = new URLClassLoader(urls, classLoader.getParent()); + } else if (classLoader == tccl || classLoader.getParent() == tccl) { + classLoader = new URLClassLoader(new URL[0], classLoader); + } else { + classLoader = tccl; + } + + try { + // Thread.currentThread().setContextClassLoader(classLoader); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finalClassLoader = classLoader; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finalClassLoader); + return null; + } + }); + + testCaseClass = Class.forName(testClass.getName(), true, classLoader); + testCase = testCaseClass.newInstance(); + ClassLoader testClassLoader = testCaseClass.getClassLoader(); + + junit3TestCaseClass = Class.forName("junit.framework.TestCase", true, testClassLoader); + + testSuiteClass = Class.forName("junit.framework.TestSuite", true, testClassLoader); + Constructor testSuiteConstructor = testSuiteClass.getConstructor(Class.class); + testSuite = testSuiteConstructor.newInstance(testCaseClass); + + testResultClass = Class.forName("junit.framework.TestResult", true, testClassLoader); + + try { + beforeAnnotation = Class.forName("org.junit.Before", true, testClassLoader); + afterAnnotation = Class.forName("org.junit.After", true, testClassLoader); + beforeClassAnnotation = Class.forName("org.junit.BeforeClass", true, testClassLoader); + afterClassAnnotation = Class.forName("org.junit.AfterClass", true, testClassLoader); + junit4AdapterClass = Class.forName("junit.framework.JUnit4TestAdapter", true, testClassLoader); + } catch (Exception e) { + // Unexpected + throw new AssertionError(e); + } + } catch (Throwable e) { + e.printStackTrace(); + } finally { + // Thread.currentThread().setContextClassLoader(tccl); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finaltccl = tccl; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finaltccl); + return null; + } + }); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * Run the test case + */ + public void run() { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + try { + // Thread.currentThread().setContextClassLoader(classLoader); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finalClassLoader = classLoader; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finalClassLoader); + return null; + } + }); + + if (junit3TestCaseClass.isAssignableFrom(testCaseClass)) { + Object testResult = testResultClass.newInstance(); + Method runMethod = testSuiteClass.getMethod("run", testResultClass); + runMethod.invoke(testSuite, testResult); + } else { + Object junit4Adapter = junit4AdapterClass.getConstructor(Class.class).newInstance(testCaseClass); + Object testResult = testResultClass.newInstance(); + Method runMethod = junit4AdapterClass.getMethod("run", testResultClass); + runMethod.invoke(junit4Adapter, testResult); + } + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + // Thread.currentThread().setContextClassLoader(tccl); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finaltccl = tccl; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finaltccl); + return null; + } + }); + } + } + + /** + * Invoke the setUp method + */ + public void setUp() { + execute("setUp"); + } + + /** + * Invoke the before methods + */ + public void before() { + execute(beforeAnnotation); + } + + /** + * Invoke the beforeClass methods + */ + public void beforeClass() { + execute(beforeClassAnnotation); + } + + /** + * Invoke the tearDown method + */ + public void tearDown() { + execute("tearDown"); + } + + /** + * Invoke the after methods + */ + public void after() { + execute(afterAnnotation); + } + + /** + * Invoke the afterClass methods + */ + public void afterClass() { + execute(afterClassAnnotation); + } + + /** + * Invoke the specified test method. + */ + public void run(String methodName) { + execute(methodName); + } + + /** + * Invoke the methods annotated with the specified annotation. + */ + private void execute(Class annotationClass) { + if (annotationClass == null) { + throw new RuntimeException(new NoSuchMethodException()); + } + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + try { + // Thread.currentThread().setContextClassLoader(classLoader); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finalClassLoader = classLoader; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finalClassLoader); + return null; + } + }); + + for (Method method : testCaseClass.getDeclaredMethods()) { + for (Annotation annotation : method.getAnnotations()) { + if (annotation.annotationType() == annotationClass) { + method.invoke(testCase); + } + } + } + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + // Thread.currentThread().setContextClassLoader(tccl); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finaltccl = tccl; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finaltccl); + return null; + } + }); + } + } + + /** + * Invoke the specified method + */ + private void execute(String methodName) { + ClassLoader tccl = Thread.currentThread().getContextClassLoader(); + try { + // Thread.currentThread().setContextClassLoader(classLoader); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finalClassLoader = classLoader; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finalClassLoader); + return null; + } + }); + Method setUpMethod = testCaseClass.getDeclaredMethod(methodName); + setUpMethod.setAccessible(true); + setUpMethod.invoke(testCase); + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + // Thread.currentThread().setContextClassLoader(tccl); + // Allow privileged access to set class loader. Requires RuntimePermission + // setContextClassLoader in security policy. + final ClassLoader finaltccl = tccl; + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + Thread.currentThread().setContextClassLoader(finaltccl); + return null; + } + }); + } + } + +} + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java new file mode 100644 index 0000000000..80c36e5ee9 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java @@ -0,0 +1,106 @@ +/* + * 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 itest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import itest.nodes.Helloworld; + +import java.io.File; +import java.net.URI; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.apache.tuscany.sca.node.configuration.NodeConfiguration; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.oasisopen.sca.client.SCAClientFactory; + +/** + * This shows how to test the Calculator service component. + */ +public class TwoNodesTestCase { + + private static Node serviceNode; + private static Node clientNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + System.setProperty("org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint.enabled", + "false"); + NodeFactory factory = NodeFactory.getInstance(); + NodeConfiguration configuration1 = + factory.createNodeConfiguration().setURI("serviceNode") + .addContribution("service", getJar("../helloworld-service/target")); + serviceNode = factory.createNode(configuration1).start(); + + NodeConfiguration configuration2 = + factory.createNodeConfiguration().setURI("clientNode") + .addContribution("client", getJar("../helloworld-client/target")); + clientNode = factory.createNode(configuration2).start(); + } + + /** + * Get the jar in the target folder without being dependent on the version name to + * make tuscany releases easier + */ + private static String getJar(String targetDirectory) { + File f = new File(targetDirectory); + for (File file : f.listFiles()) { + if (file.getName().endsWith(".jar")) { + return file.toURI().toString(); + } + } + throw new IllegalStateException("Can't find jar in: " + targetDirectory); + } + + @Test + public void testCalculator() throws Exception { + Helloworld service = serviceNode.getService(Helloworld.class, "HelloworldService"); + assertNotNull(service); + assertEquals("Hello Petra", service.sayHello("Petra")); + + Helloworld client = clientNode.getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + } + + @Test + public void testCalculatorClientAPI() throws Exception { + Helloworld service = SCAClientFactory.newInstance(URI.create("default")).getService(Helloworld.class, "HelloworldService"); + assertNotNull(service); + assertEquals("Hello Petra", service.sayHello("Petra")); + + Helloworld client = SCAClientFactory.newInstance(URI.create("default")).getService(Helloworld.class, "HelloworldClient"); + assertNotNull(client); + assertEquals("Hi Hello Petra", client.sayHello("Petra")); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (serviceNode != null) { + serviceNode.stop(); + } + if (clientNode != null) { + clientNode.stop(); + } + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/build.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/build.xml new file mode 100644 index 0000000000..fa7e963e87 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/build.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/client-config.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/client-config.xml new file mode 100644 index 0000000000..3800a5e338 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/client-config.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/client.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/client.xml new file mode 100644 index 0000000000..8e7c744940 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/client.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/pom.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/pom.xml new file mode 100644 index 0000000000..ee07242a58 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/pom.xml @@ -0,0 +1,104 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0 + ../pom.xml + + itest-nodes-two-nodes-two-vms-test + Apache Tuscany SCA iTest Nodes Two Nodes Two VMs Test + + + + org.apache.tuscany.sca + tuscany-domain-node + 2.0 + + + org.apache.tuscany.sca + tuscany-endpoint-tribes + 2.0 + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0 + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0 + + + org.apache.tuscany.sca + tuscany-node-launcher + 2.0 + + + org.apache.tuscany.sca + tuscany-sca-client-impl + 2.0 + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0 + + + org.apache.tuscany.sca + tuscany-binding-rmi-runtime + 2.0 + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0 + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + run-samples + test + + run + + + + + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/server-config.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/server-config.xml new file mode 100644 index 0000000000..590cf3bddb --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/server-config.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/server.xml b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/server.xml new file mode 100644 index 0000000000..05a5aa16e9 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/server.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/Client.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/Client.java new file mode 100644 index 0000000000..eef3362c10 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/Client.java @@ -0,0 +1,69 @@ +/* + * 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 itest; + +import java.io.File; + +import org.apache.tuscany.sca.binding.rmi.RMIBinding; +import org.apache.tuscany.sca.domain.node.DomainNode; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class Client { + + private static Node clientNode; +// private static DomainNode clientNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + NodeFactory factory = NodeFactory.newInstance(); + + clientNode = factory.createNode(new File("client-config.xml").toURI().toURL()); + + try { + clientNode.start(); + } catch (Exception ex){ + ex.printStackTrace(); + throw ex; + } + +// clientNode = new DomainNode("tribes:default", new String []{"../helloworld-client/target/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar"}); + } + + @Test + public void testNothing() throws Exception { + + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (clientNode != null) { + clientNode.stop(); + } + } + + public static void main(String[] args) throws Exception { + Client.setUpBeforeClass(); + Client.tearDownAfterClass(); + } +} diff --git a/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/Service.java b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/Service.java new file mode 100644 index 0000000000..7323c2c122 --- /dev/null +++ b/sca-java-2.x/branches/2.0/testing/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/Service.java @@ -0,0 +1,61 @@ +/* + * 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 itest; + +import java.io.File; + +import org.apache.tuscany.sca.binding.rmi.RMIBinding; +import org.apache.tuscany.sca.domain.node.DomainNode; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class Service { + + private static Node serviceNode; +// private static DomainNode serviceNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + NodeFactory factory = NodeFactory.newInstance(); + + serviceNode = factory.createNode(new File("server-config.xml").toURI().toURL()); + serviceNode.start(); + +// serviceNode = new DomainNode("tribes:default", new String[]{"../helloworld-service/target/classes"}); + + } + + @Test + public void testNothing() throws Exception { + synchronized (this) { + this.wait(); + } + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (serviceNode != null) { + serviceNode.stop(); + } + } +} -- cgit v1.2.3