From a2c3f4546c0c32c3d40c52c81b5fd5131ba19145 Mon Sep 17 00:00:00 2001 From: antelder Date: Tue, 3 Nov 2009 08:26:19 +0000 Subject: Tag 2.0 M4 RC2 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@832340 13f79535-47bb-0310-9956-ffa450edef68 --- .../itest/bpel/helloworld-reference/pom.xml | 288 +++++++ .../src/test/java/greetings/GreetingsService.java | 31 + .../test/java/greetings/GreetingsServiceImpl.java | 33 + .../src/test/java/greetings/GreetingsTestCase.java | 65 ++ .../test/java/helloworld/HelloWorldService.java | 29 + .../java/helloworld/HelloWorldServiceImpl.java | 47 ++ .../test/java/helloworld/HelloWorldTestCase.java | 64 ++ .../test/resources/greetings/greetings.composite | 32 + .../src/test/resources/greetings/greetings.wsdl | 87 ++ .../src/test/resources/helloworld/helloworld.bpel | 84 ++ .../test/resources/helloworld/helloworld.composite | 36 + .../src/test/resources/helloworld/helloworld.wsdl | 94 +++ .../src/test/resources/log4j.properties | 36 + .../2.0-M4-RC2/itest/bpel/helloworld-ws/pom.xml | 178 ++++ .../src/test/java/helloworld/HelloWorld.java | 45 + .../test/java/helloworld/HelloWorldTestCase.java | 71 ++ .../src/test/resources/helloworld/helloworld.bpel | 66 ++ .../test/resources/helloworld/helloworld.composite | 32 + .../src/test/resources/helloworld/helloworld.wsdl | 82 ++ .../src/test/resources/log4j.properties | 36 + .../sca/2.0-M4-RC2/itest/bpel/helloworld/pom.xml | 270 ++++++ .../src/test/java/helloworld/HelloWorld.java | 45 + .../test/java/helloworld/HelloWorldTestCase.java | 73 ++ .../src/test/resources/helloworld/helloworld.bpel | 78 ++ .../test/resources/helloworld/helloworld.composite | 36 + .../src/test/resources/helloworld/helloworld.wsdl | 94 +++ .../helloworld/src/test/resources/log4j.properties | 36 + tags/java/sca/2.0-M4-RC2/itest/bpel/pom.xml | 39 + tags/java/sca/2.0-M4-RC2/itest/builder/pom.xml | 119 +++ .../tuscany/sca/itest/builder/ComponentDImpl.java | 43 + .../ComponentDReferenceMultiplicityImpl.java | 48 ++ .../tuscany/sca/itest/builder/ComponentEImpl.java | 36 + .../tuscany/sca/itest/builder/ComponentFImpl.java | 36 + .../apache/tuscany/sca/itest/builder/Service3.java | 34 + .../tuscany/sca/itest/builder/Service3a.java | 34 + .../scenario1/META-INF/sca-contribution.xml | 23 + .../main/resources/scenario1/scenario1.composite | 45 + .../main/resources/scenario1/scenario1a.composite | 47 ++ .../scenario10/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario10/scenario10.composite | 62 ++ .../resources/scenario10/scenario10a.composite | 61 ++ .../src/main/resources/scenario10/service3.wsdl | 63 ++ .../scenario11/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario11/scenario11.composite | 59 ++ .../resources/scenario11/scenario11a.composite | 64 ++ .../src/main/resources/scenario11/service3.wsdl | 63 ++ .../scenario12/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario12/scenario12.composite | 58 ++ .../resources/scenario12/scenario12a.composite | 64 ++ .../scenario13/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario13/scenario13.composite | 58 ++ .../resources/scenario13/scenario13a.composite | 64 ++ .../scenario2/META-INF/sca-contribution.xml | 23 + .../main/resources/scenario2/scenario2.composite | 45 + .../main/resources/scenario2/scenario2a.composite | 47 ++ .../scenario3/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario3/scenario3.composite | 44 + .../main/resources/scenario3/scenario3a.composite | 48 ++ .../scenario4/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario4/scenario4.composite | 44 + .../main/resources/scenario4/scenario4a.composite | 48 ++ .../scenario5/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario5/scenario5.composite | 46 ++ .../main/resources/scenario5/scenario5a.composite | 47 ++ .../src/main/resources/scenario5/scenarios.wsdl | 63 ++ .../scenario6/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario6/scenario6.composite | 47 ++ .../main/resources/scenario6/scenario6a.composite | 47 ++ .../src/main/resources/scenario6/scenarios.wsdl | 63 ++ .../scenario7/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario7/scenario7.composite | 45 + .../main/resources/scenario7/scenario7a.composite | 49 ++ .../src/main/resources/scenario7/scenarios.wsdl | 63 ++ .../scenario8/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario8/scenario8.composite | 44 + .../main/resources/scenario8/scenario8a.composite | 50 ++ .../src/main/resources/scenario8/scenarios.wsdl | 63 ++ .../scenario9/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario9/scenario9.composite | 60 ++ .../main/resources/scenario9/scenario9a.composite | 61 ++ .../tuscany/sca/itest/builder/BuilderTestCase.java | 814 +++++++++++++++++++ .../sca/itest/builder/CustomCompositeBuilder.java | 99 +++ .../tuscany/sca/itest/builder/TestUtils.java | 319 ++++++++ .../java/sca/2.0-M4-RC2/itest/callback-api/pom.xml | 58 ++ .../tuscany/sca/test/CallBackApiCallBack.java | 38 + .../apache/tuscany/sca/test/CallBackApiClient.java | 30 + .../tuscany/sca/test/CallBackApiClientImpl.java | 201 +++++ .../tuscany/sca/test/CallBackApiService.java | 50 ++ .../tuscany/sca/test/CallBackApiServiceImpl.java | 113 +++ .../src/main/resources/CallBackApiTest.composite | 33 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../tuscany/sca/test/CallBackApiTestCase.java | 70 ++ .../sca/2.0-M4-RC2/itest/callback-basic-ws/pom.xml | 78 ++ .../tuscany/sca/test/CallBackBasicCallBack.java | 33 + .../tuscany/sca/test/CallBackBasicClient.java | 28 + .../tuscany/sca/test/CallBackBasicClientImpl.java | 129 +++ .../tuscany/sca/test/CallBackBasicService.java | 37 + .../tuscany/sca/test/CallBackBasicServiceImpl.java | 56 ++ .../src/main/resources/CallBackBasicTest.composite | 40 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../tuscany/sca/test/CallBackBasicTestCase.java | 56 ++ .../sca/2.0-M4-RC2/itest/callback-basic/pom.xml | 58 ++ .../tuscany/sca/test/CallBackBasicCallBack.java | 33 + .../tuscany/sca/test/CallBackBasicClient.java | 28 + .../tuscany/sca/test/CallBackBasicClientImpl.java | 129 +++ .../tuscany/sca/test/CallBackBasicService.java | 37 + .../tuscany/sca/test/CallBackBasicServiceImpl.java | 56 ++ .../src/main/resources/CallBackBasicTest.composite | 33 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../tuscany/sca/test/CallBackBasicTestCase.java | 56 ++ .../2.0-M4-RC2/itest/callback-complex-type/pom.xml | 53 ++ .../tuscany/sca/test/CallBackCTypeCallBack.java | 33 + .../tuscany/sca/test/CallBackCTypeClient.java | 28 + .../tuscany/sca/test/CallBackCTypeClientImpl.java | 138 ++++ .../tuscany/sca/test/CallBackCTypeService.java | 37 + .../tuscany/sca/test/CallBackCTypeServiceImpl.java | 59 ++ .../main/resources/CallBackCTypeClient.composite | 33 + .../test/CallBackCTypeServiceImpl.componentType | 28 + .../tuscany/sca/test/CallBackCTypeTestCase.java | 54 ++ .../itest/callback-multiple-wires/pom.xml | 53 ++ .../apache/tuscany/sca/test/callback/MyClient.java | 27 + .../tuscany/sca/test/callback/MyClientImpl1.java | 49 ++ .../tuscany/sca/test/callback/MyClientImpl2.java | 49 ++ .../tuscany/sca/test/callback/MyService.java | 32 + .../sca/test/callback/MyServiceCallback.java | 27 + .../tuscany/sca/test/callback/MyServiceImpl.java | 45 + .../main/resources/CallbackMultiWireTest.composite | 38 + .../test/callback/CallbackMultiWireTestCase.java | 64 ++ .../itest/callback-separatethread/pom.xml | 53 ++ .../sca/itest/CallBackSeparateThreadClient.java | 34 + .../itest/CallBackSeparateThreadClientImpl.java | 186 +++++ .../tuscany/sca/itest/EventProcessorCallBack.java | 37 + .../tuscany/sca/itest/EventProcessorService.java | 45 + .../sca/itest/EventProcessorServiceImpl.java | 195 +++++ .../resources/CallBackSeparateThreadTest.composite | 31 + .../sca/itest/CallBackSeparateThreadTestCase.java | 73 ++ .../sca/2.0-M4-RC2/itest/component-type/pom.xml | 53 ++ .../src/main/java/calculator/AddService.java | 28 + .../src/main/java/calculator/AddServiceImpl.java | 30 + .../src/main/java/calculator/CalculatorClient.java | 49 ++ .../main/java/calculator/CalculatorService.java | 34 + .../java/calculator/CalculatorServiceImpl.java | 63 ++ .../src/main/java/calculator/DivideService.java | 28 + .../main/java/calculator/DivideServiceImpl.java | 30 + .../src/main/java/calculator/MultiplyService.java | 28 + .../main/java/calculator/MultiplyServiceImpl.java | 30 + .../src/main/java/calculator/SubtractService.java | 28 + .../main/java/calculator/SubtractServiceImpl.java | 30 + .../src/main/resources/Calculator.composite | 49 ++ .../calculator/AddServiceImpl.componentType | 27 + .../calculator/CalculatorServiceImpl.componentType | 43 + .../calculator/DivideServiceImpl.componentType | 27 + .../calculator/MultiplyServiceImpl.componentType | 27 + .../calculator/SubtractServiceImpl.componentType | 27 + .../test/java/calculator/CalculatorTestCase.java | 60 ++ .../2.0-M4-RC2/itest/contribution-folder/pom.xml | 46 ++ .../test/java/calculator/CalculatorService.java | 31 + .../test/java/test/ContributionFolderTestCase.java | 55 ++ .../repository/folderWithJars/Calculator.composite | 49 ++ .../folderWithJars/META-INF/sca-contribution.xml | 23 + .../repository/folderWithJars/service.jar | Bin 0 -> 2380 bytes .../repository/folderWithJars/serviceImpl.jar | Bin 0 -> 4655 bytes .../test/resources/repository3/contribution.zip | Bin 0 -> 5478 bytes .../export-composite/pom.xml | 67 ++ .../src/main/java/hello/Hello.java | 30 + .../src/main/java/hello/HelloImpl.java | 33 + .../main/resources/META-INF/sca-contribution.xml | 25 + .../src/main/resources/hello.composite | 31 + .../sca/test/contribution/HelloTestCase.java | 91 +++ .../contribution-import-export/export-java/pom.xml | 67 ++ .../main/java/helloworld/HelloWorldService.java | 30 + .../main/resources/META-INF/sca-contribution.xml | 24 + .../helloworld/HelloWorldImpl.componentType | 30 + .../export-resource/pom.xml | 31 + .../main/resources/META-INF/sca-contribution.xml | 24 + .../src/main/resources/ufservices/store.html | 27 + .../contribution-import-export/export-wsdl/pom.xml | 31 + .../main/resources/META-INF/sca-contribution.xml | 24 + .../export-wsdl/src/main/resources/helloworld.wsdl | 76 ++ .../export-wsdl/src/main/resources/helloworld.xsd | 35 + .../import-composite/pom.xml | 73 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 38 + .../src/main/java/helloworld/HelloWorldServer.java | 46 ++ .../main/java/helloworld/HelloWorldService.java | 30 + .../main/resources/META-INF/sca-contribution.xml | 27 + .../src/main/resources/helloworld.wsdl | 76 ++ .../src/main/resources/helloworld.xsd | 35 + .../src/main/resources/helloworldws.composite | 39 + .../contribution/HelloWorldServerTestCase.java | 126 +++ .../contribution-import-export/import-java/pom.xml | 73 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 + .../main/resources/META-INF/sca-contribution.xml | 25 + .../src/main/resources/helloworldws.composite | 29 + .../contribution/HelloWorldServerTestCase.java | 127 +++ .../import-resource/pom.xml | 102 +++ .../main/resources/META-INF/sca-contribution.xml | 25 + .../src/main/resources/store.composite | 33 + .../sca/test/contribution/StoreTestCase.java | 129 +++ .../contribution-import-export/import-wsdl/pom.xml | 73 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 + .../src/main/java/helloworld/HelloWorldServer.java | 46 ++ .../main/java/helloworld/HelloWorldService.java | 30 + .../main/resources/META-INF/sca-contribution.xml | 25 + .../src/main/resources/helloworldws.composite | 33 + .../contribution/HelloWorldServerTestCase.java | 137 ++++ .../itest/contribution-import-export/pom.xml | 56 ++ .../sca/2.0-M4-RC2/itest/contribution-zip/pom.xml | 45 + .../test/java/calculator/CalculatorService.java | 31 + .../contribution/zip/ContributionZIPTestCase.java | 56 ++ .../src/test/resources/repository/contribution.zip | Bin 0 -> 6395 bytes .../itest/distribution/bin-distro-unzip/build.xml | 24 + .../itest/distribution/bin-distro-unzip/pom.xml | 138 ++++ .../distribution/binding-ws-calculator/build.xml | 40 + .../distribution/binding-ws-calculator/pom.xml | 82 ++ .../itest/distribution/calculator-rmi/build.xml | 51 ++ .../itest/distribution/calculator-rmi/pom.xml | 81 ++ .../implementation-java-calculator/build.xml | 40 + .../implementation-java-calculator/pom.xml | 82 ++ .../itest/distribution/legal-checks/pom.xml | 42 + .../src/test/java/itest/JarsInLICENSETestCase.java | 162 ++++ .../java/sca/2.0-M4-RC2/itest/distribution/pom.xml | 49 ++ .../distribution/webapp-helloworld-bpel/pom.xml | 124 +++ .../src/test/java/itest/HelloworldTestCase.java | 50 ++ .../distribution/webapp-helloworld-jms/pom.xml | 216 +++++ .../src/test/java/itest/HelloworldTestCase.java | 51 ++ .../webapp-helloworld-js-client/pom.xml | 188 +++++ .../src/test/java/itest/HelloworldTestCase.java | 75 ++ .../distribution/webapp-helloworld-jsf/pom.xml | 130 +++ .../test/java/itest/HelloworldTestCaseFIXME.java | 71 ++ .../distribution/webapp-helloworld-jsp/pom.xml | 188 +++++ .../src/test/java/itest/HelloworldTestCase.java | 50 ++ .../distribution/webapp-helloworld-stripes/pom.xml | 124 +++ .../src/test/java/itest/HelloworldTestCase.java | 53 ++ .../itest/distribution/webapp-helloworld/pom.xml | 121 +++ tags/java/sca/2.0-M4-RC2/itest/endpoints/pom.xml | 68 ++ .../src/test/java/helloworld/HelloWorldImpl.java | 28 + .../test/java/helloworld/HelloWorldService.java | 28 + .../src/test/java/test/EndpointsTestCase.java | 110 +++ .../test/java/test/NestedEndpointsTestCase.java | 110 +++ .../itest/endpoints/src/test/java/test/Utils.java | 70 ++ .../src/test/resources/helloworld.composite | 116 +++ .../endpoints/src/test/resources/nested.composite | 30 + tags/java/sca/2.0-M4-RC2/itest/exceptions/pom.xml | 53 ++ .../tuscany/sca/test/exceptions/Checked.java | 57 ++ .../sca/test/exceptions/ExceptionHandler.java | 32 + .../test/exceptions/ExceptionRemoteThrower.java | 30 + .../sca/test/exceptions/ExceptionThrower.java | 37 + .../tuscany/sca/test/exceptions/UnChecked.java | 57 ++ .../test/exceptions/impl/ExceptionHandlerImpl.java | 115 +++ .../impl/ExceptionRemoteThrowerImpl.java | 44 + .../test/exceptions/impl/ExceptionThrowerImpl.java | 45 + .../impl/RemoteExceptionHandlerImpl.java | 116 +++ .../src/main/resources/ExceptionTest.composite | 41 + .../sca/test/exceptions/ExceptionsTestCase.java | 85 ++ .../2.0-M4-RC2/itest/implementation-spring/pom.xml | 80 ++ .../java/bigbank/stockquote/StockQuoteImpl.java | 38 + .../java/bigbank/stockquote/StockQuoteService.java | 30 + .../src/main/java/calculator/AddService.java | 28 + .../src/main/java/calculator/AddServiceImpl.java | 35 + .../main/java/calculator/CalculatorService.java | 37 + .../java/calculator/CalculatorServiceImpl.java | 79 ++ .../src/main/java/calculator/DivideService.java | 28 + .../main/java/calculator/DivideServiceImpl.java | 35 + .../src/main/java/calculator/MultiplyService.java | 28 + .../main/java/calculator/MultiplyServiceImpl.java | 35 + .../src/main/java/calculator/SubtractService.java | 28 + .../main/java/calculator/SubtractServiceImpl.java | 35 + .../security/CalculatorCallbackHandler.java | 50 ++ .../java/calculator/security/JaasLoginModule.java | 178 ++++ .../java/calculator/security/UserPrincipal.java | 66 ++ .../access/SCAApplicationContextProvider.java | 37 + .../src/main/java/helloworld/HelloWorld.java | 35 + .../src/main/java/helloworld/HelloWorldImpl.java | 38 + .../src/main/java/helloworld/HelloWorldProxy.java | 42 + .../src/main/java/mock/TestBean.java | 31 + .../src/main/java/mock/TestBeanImpl.java | 42 + .../src/main/java/mock/TestHelloWorldBean.java | 39 + .../src/main/java/mock/TestReference.java | 27 + .../src/main/java/mock/TestReferenceBean.java | 57 ++ .../src/main/java/mock/TestSCAPropertyBean.java | 55 ++ .../spring/annotations/CalculatorServiceImpl.java | 131 +++ .../context/access/CalculatorService-context.xml | 45 + .../context/access/ContextAccess.composite | 49 ++ .../context/imports/ContextImports.composite | 49 ++ .../META-INF/spring/CalculatorService-context.xml | 39 + .../META-INF/spring/SpringImport-context.xml | 29 + .../context/multiple/MultipleContext.composite | 30 + .../multiple/springapp/META-INF/MANIFEST.MF | 3 + .../META-INF/spring/SpringHelloWorld-context.xml | 31 + .../META-INF/spring/StockQuoteService-context.xml | 36 + .../springapp/META-INF/spring/beanRefContext.xml | 34 + .../implementation/policies/CalculatorJass.config | 3 + .../policies/CalculatorLogMessages.properties | 18 + .../policies/ImplementationPolicies.composite | 58 ++ .../META-INF/spring/CalculatorService-context.xml | 39 + .../implementation/policies/definitions.xml | 40 + .../location/folder/SpringFolderLocation.composite | 40 + .../location/folder/springapp/META-INF/MANIFEST.MF | 3 + .../META-INF/spring/SpringSCAProperty-context.xml | 34 + .../location/jar/SpringJarLocation.composite | 40 + .../main/resources/location/jar/spring-context.jar | Bin 0 -> 1454 bytes .../spring/SpringDelegationHelloWorld-context.xml | 39 + .../META-INF/spring/SpringHelloWorld-context.xml | 31 + .../spring/SpringDelegationHelloWorld.composite | 33 + .../sca/itest/spring/SpringHelloWorld.composite | 33 + .../spring/SpringExplicitReference-context.xml | 33 + .../spring/SpringImplicitReference-context.xml | 34 + .../references/SpringExplicitReference.composite | 33 + .../references/SpringImplicitReference.composite | 40 + .../spring/SpringExplicitService-context.xml | 39 + .../spring/SpringImplicitService-context.xml | 31 + .../sca/services/SpringExplicitService.composite | 34 + .../sca/services/SpringImplicitService.composite | 33 + .../spring/annotations/Calculator.composite | 60 ++ .../annotations/CalculatorService-context.xml | 41 + .../test/java/context/access/CalculatorClient.java | 60 ++ .../java/context/access/ContextAccessTestCase.java | 32 + .../java/context/imports/CalculatorClient.java | 53 ++ .../context/imports/ContextImportsTestCase.java | 32 + .../context/multiple/MultipleContextTestCase.java | 32 + .../java/context/multiple/StockQuoteServer.java | 54 ++ .../implementation/policies/CalculatorClient.java | 76 ++ .../policies/ImplementationPoliciesTestCase.java | 32 + .../folder/SpringFolderLocationTestCase.java | 45 + .../location/jar/SpringJarLocationTestCase.java | 45 + .../itest/spring/AbstractHelloWorldTestCase.java | 44 + .../sca/itest/spring/AbstractSCATestCase.java | 60 ++ .../tuscany/sca/itest/spring/HelloWorld.java | 34 + .../tuscany/sca/itest/spring/HelloWorldProxy.java | 41 + .../spring/SpringDelegationHelloWorldTestCase.java | 35 + .../sca/itest/spring/SpringHelloWorldTestCase.java | 36 + .../sca/itest/spring/TestHelloWorldBean.java | 36 + .../itest/spring/TestHelloWorldDelegatorBean.java | 40 + .../SpringExplicitReferenceTestCase.java | 45 + .../SpringImplicitReferenceTestCase.java | 48 ++ .../services/SpringExplicitServiceTestCase.java | 40 + .../services/SpringImplicitServiceTestCase.java | 38 + .../java/spring/annotations/CalculatorClient.java | 55 ++ .../annotations/SpringAnnotationsTestCase.java | 32 + tags/java/sca/2.0-M4-RC2/itest/interfaces/pom.xml | 53 ++ .../itest/interfaces/LocalCallbackInterface.java | 30 + .../sca/itest/interfaces/LocalClientComponent.java | 47 ++ .../itest/interfaces/LocalClientComponentImpl.java | 83 ++ .../itest/interfaces/LocalServiceComponent.java | 37 + .../interfaces/LocalServiceComponentImpl.java | 49 ++ .../sca/itest/interfaces/ParameterObject.java | 48 ++ .../itest/interfaces/RemoteCallbackInterface.java | 33 + .../itest/interfaces/RemoteClientComponent.java | 64 ++ .../interfaces/RemoteClientComponentImpl.java | 81 ++ .../itest/interfaces/RemoteServiceComponent.java | 38 + .../interfaces/RemoteServiceComponentImpl.java | 54 ++ .../src/main/resources/InterfacesTest.composite | 40 + .../resources/InvalidRemoteAttribute.composite | 28 + .../sca/itest/interfaces/InterfacesTestCase.java | 133 +++ .../interfaces/InvalidRemoteAttributeTestCase.java | 49 ++ .../sca/2.0-M4-RC2/itest/jaxws-asyncclient/pom.xml | 53 ++ .../src/main/java/stock/StockQuote.java | 36 + .../src/main/java/stock/StockQuoteClient.java | 69 ++ .../src/main/java/stock/StockQuoteImpl.java | 34 + .../src/main/java/stock/StockQuoteRef.java | 39 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../src/main/resources/StockQuote.composite | 33 + .../src/test/java/itest/AsyncServiceTestCase.java | 67 ++ tags/java/sca/2.0-M4-RC2/itest/jaxws/pom.xml | 53 ++ .../src/test/java/stock/AsyncServiceTestCase.java | 42 + .../jaxws/src/test/java/stock/StockQuote.java | 45 + .../jaxws/src/test/java/stock/StockQuoteImpl.java | 46 ++ .../jaxws/src/test/resources/StockQuote.composite | 31 + .../sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/pom.xml | 83 ++ .../sca/binding/jms/HelloWorldClientImpl.java | 41 + .../tuscany/sca/binding/jms/HelloWorldService.java | 26 + .../sca/binding/jms/HelloWorldServiceImpl.java | 30 + .../main/resources/META-INF/sca-contribution.xml | 24 + .../src/main/resources/dynamic/client.composite | 34 + .../src/main/resources/jndi.properties | 39 + .../src/main/resources/simple/service.composite | 37 + .../sca/binding/jms/DynamicReplyQTestCase.java | 53 ++ tags/java/sca/2.0-M4-RC2/itest/jms/args/pom.xml | 70 ++ .../apache/tuscany/sca/binding/jms/ClientImpl.java | 41 + .../apache/tuscany/sca/binding/jms/MyService.java | 29 + .../tuscany/sca/binding/jms/ServiceImpl.java | 38 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../jms/args/src/main/resources/jndi.properties | 38 + .../main/resources/selectors/selectors.composite | 38 + .../tuscany/sca/binding/jms/ArgsTestCase.java | 62 ++ .../sca/2.0-M4-RC2/itest/jms/callbacks/pom.xml | 73 ++ .../apache/tuscany/sca/binding/jms/JMSClient.java | 28 + .../tuscany/sca/binding/jms/JMSClientImpl.java | 50 ++ .../apache/tuscany/sca/binding/jms/JMSService.java | 34 + .../sca/binding/jms/JMSServiceCallback.java | 32 + .../tuscany/sca/binding/jms/JMSServiceImpl.java | 47 ++ .../main/resources/META-INF/sca-contribution.xml | 24 + .../callbacks/src/main/resources/jndi.properties | 40 + .../src/main/resources/simple/client.composite | 44 + .../src/main/resources/simple/tempq.composite | 50 ++ .../tuscany/sca/binding/jms/CallbackTestCase.java | 61 ++ .../sca/binding/jms/TempCallbackQTestCase.java | 64 ++ .../java/sca/2.0-M4-RC2/itest/jms/defaults/pom.xml | 83 ++ .../sca/binding/jms/HelloWorldClientImpl.java | 41 + .../tuscany/sca/binding/jms/HelloWorldService.java | 26 + .../sca/binding/jms/HelloWorldServiceImpl.java | 30 + .../main/resources/META-INF/sca-contribution.xml | 24 + .../src/main/resources/defaults/client.composite | 31 + .../src/main/resources/defaults/service.composite | 31 + .../defaults/src/main/resources/jndi.properties | 39 + .../tuscany/sca/binding/jms/DefaultsTestCase.java | 54 ++ .../sca/2.0-M4-RC2/itest/jms/definitions/pom.xml | 73 ++ .../tuscany/sca/binding/jms/OneWayClientImpl.java | 41 + .../tuscany/sca/binding/jms/OneWayService.java | 29 + .../tuscany/sca/binding/jms/OneWayServiceImpl.java | 34 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../definitions/src/main/resources/definitions.xml | 28 + .../resources/definitions/definitions.composite | 39 + .../definitions/src/main/resources/jndi.properties | 38 + .../sca/binding/jms/DefinitionsTestCase.java | 62 ++ .../sca/2.0-M4-RC2/itest/jms/exceptions/pom.xml | 90 ++ .../tuscany/sca/binding/jms/CheckedExcpetion.java | 28 + .../sca/binding/jms/CheckedExcpetion2Args.java | 28 + .../sca/binding/jms/CheckedExcpetionChained.java | 28 + .../sca/binding/jms/CheckedExcpetionNoArgs.java | 28 + .../tuscany/sca/binding/jms/ExceptionService.java | 33 + .../sca/binding/jms/ExceptionServiceImpl.java | 44 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../main/resources/exceptions/service.composite | 44 + .../exceptions/src/main/resources/jndi.properties | 40 + .../sca/binding/jms/ExceptionsTestCase.java | 212 +++++ .../sca/2.0-M4-RC2/itest/jms/exceptions1/pom.xml | 83 ++ .../tuscany/sca/binding/jms/CheckedExcpetion.java | 28 + .../sca/binding/jms/CheckedExcpetion2Args.java | 28 + .../sca/binding/jms/CheckedExcpetionChained.java | 28 + .../sca/binding/jms/CheckedExcpetionNoArgs.java | 28 + .../tuscany/sca/binding/jms/ExceptionService.java | 33 + .../sca/binding/jms/ExceptionServiceClient.java | 57 ++ .../sca/binding/jms/ExceptionServiceImpl.java | 44 + .../main/resources/META-INF/sca-contribution.xml | 24 + .../src/main/resources/exceptions/client.composite | 31 + .../main/resources/exceptions/service.composite | 31 + .../exceptions1/src/main/resources/jndi.properties | 39 + .../sca/binding/jms/ExceptionsTestCase.java | 110 +++ .../2.0-M4-RC2/itest/jms/externalBroker/pom.xml | 83 ++ .../sca/binding/jms/HelloWorldClientImpl.java | 41 + .../tuscany/sca/binding/jms/HelloWorldService.java | 26 + .../sca/binding/jms/HelloWorldServiceImpl.java | 30 + .../main/resources/META-INF/sca-contribution.xml | 24 + .../src/main/resources/external/client.composite | 36 + .../src/main/resources/external/service.composite | 36 + .../src/main/resources/jndi.properties | 39 + .../sca/binding/jms/ExternalBrokerTestCase.java | 71 ++ .../2.0-M4-RC2/itest/jms/format-jmsbytes/pom.xml | 83 ++ .../jmsbytes/helloworld/CheckedException.java | 28 + .../jmsbytes/helloworld/HelloWorldReference.java | 32 + .../helloworld/HelloWorldReferenceImpl.java | 50 ++ .../jmsbytes/helloworld/HelloWorldService.java | 35 + .../jmsbytes/helloworld/HelloWorldServiceImpl.java | 40 + .../helloworld/HelloWorldServiceReference.java | 35 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../main/resources/jmsbytes/helloworld.composite | 45 + .../src/main/resources/jndi.properties | 39 + .../binding/jms/format/FormatJMSBytesTestCase.java | 69 ++ .../itest/jms/format-jmsbytesxml/pom.xml | 83 ++ .../jmsbytesxml/helloworld/CheckedException.java | 28 + .../helloworld/HelloWorldReference.java | 32 + .../helloworld/HelloWorldReferenceImpl.java | 46 ++ .../jmsbytesxml/helloworld/HelloWorldService.java | 34 + .../helloworld/HelloWorldServiceImpl.java | 39 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../resources/jmsbytesxml/helloworld.composite | 45 + .../src/main/resources/jndi.properties | 39 + .../jms/format/FormatJMSBytesXMLTestCase.java | 58 ++ .../jmsbytes/helloworld/CheckedException.java | 28 + .../jmsbytes/helloworld/HelloWorldReference.java | 32 + .../helloworld/HelloWorldReferenceImpl.java | 50 ++ .../jmsbytes/helloworld/HelloWorldService.java | 35 + .../jmsbytes/helloworld/HelloWorldServiceImpl.java | 40 + .../helloworld/HelloWorldServiceReference.java | 35 + .../2.0-M4-RC2/itest/jms/format-jmsdefault/pom.xml | 83 ++ .../jmsbytes/helloworld/CheckedException.java | 28 + .../jmsbytes/helloworld/HelloWorldReference.java | 32 + .../helloworld/HelloWorldReferenceImpl.java | 50 ++ .../jmsbytes/helloworld/HelloWorldService.java | 35 + .../jmsbytes/helloworld/HelloWorldServiceImpl.java | 40 + .../helloworld/HelloWorldServiceReference.java | 35 + .../jmsdefault/helloworld/CheckedException.java | 28 + .../jmsdefault/helloworld/HelloWorldReference.java | 36 + .../helloworld/HelloWorldReferenceImpl.java | 85 ++ .../jmsdefault/helloworld/HelloWorldService.java | 38 + .../helloworld/HelloWorldServiceImpl.java | 51 ++ .../jms/format/jmsdefault/helloworld/Person.java | 42 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../main/resources/jmsdefault/helloworld.composite | 94 +++ .../src/main/resources/jmsdefault/helloworld.wsdl | 139 ++++ .../src/main/resources/jndi.properties | 39 + .../jms/format/FormatJMSDefaultTestCase.java | 68 ++ .../2.0-M4-RC2/itest/jms/format-jmsmessage/pom.xml | 83 ++ .../jmsbytes/helloworld/CheckedException.java | 28 + .../jmsbytes/helloworld/HelloWorldReference.java | 32 + .../helloworld/HelloWorldReferenceImpl.java | 50 ++ .../jmsbytes/helloworld/HelloWorldService.java | 35 + .../jmsbytes/helloworld/HelloWorldServiceImpl.java | 40 + .../helloworld/HelloWorldServiceReference.java | 35 + .../jmsmessage/helloworld/HelloWorldReference.java | 32 + .../helloworld/HelloWorldReferenceImpl.java | 41 + .../jmsmessage/helloworld/HelloWorldService.java | 34 + .../helloworld/HelloWorldServiceImpl.java | 51 ++ .../helloworld/HelloWorldServiceReferenceSide.java | 37 + .../jms/format/jmsmessage/helloworld/README | 3 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../main/resources/jmsmessage/helloworld.composite | 46 ++ .../src/main/resources/jmsmessage/helloworld.wsdl | 129 +++ .../src/main/resources/jndi.properties | 39 + .../jms/format/FormatJMSMessageTestCase.java | 58 ++ .../2.0-M4-RC2/itest/jms/format-jmsobject/pom.xml | 83 ++ .../jmsbytes/helloworld/CheckedException.java | 28 + .../jmsbytes/helloworld/HelloWorldReference.java | 32 + .../helloworld/HelloWorldReferenceImpl.java | 50 ++ .../jmsbytes/helloworld/HelloWorldService.java | 35 + .../jmsbytes/helloworld/HelloWorldServiceImpl.java | 40 + .../helloworld/HelloWorldServiceReference.java | 35 + .../jmsobject/helloworld/CheckedException.java | 28 + .../jmsobject/helloworld/HelloWorldReference.java | 32 + .../helloworld/HelloWorldReferenceImpl.java | 112 +++ .../jmsobject/helloworld/HelloWorldService.java | 41 + .../helloworld/HelloWorldServiceImpl.java | 63 ++ .../jms/format/jmsobject/helloworld/Person.java | 47 ++ .../main/resources/META-INF/sca-contribution.xml | 23 + .../main/resources/jmsobject/helloworld.composite | 62 ++ .../src/main/resources/jmsobject/helloworld.wsdl | 368 +++++++++ .../src/main/resources/jndi.properties | 39 + .../jms/format/FormatJMSObjectTestCase.java | 73 ++ .../2.0-M4-RC2/itest/jms/format-jmstext/pom.xml | 83 ++ .../jmsbytes/helloworld/CheckedException.java | 28 + .../jmsbytes/helloworld/HelloWorldReference.java | 32 + .../helloworld/HelloWorldReferenceImpl.java | 50 ++ .../jmsbytes/helloworld/HelloWorldService.java | 35 + .../jmsbytes/helloworld/HelloWorldServiceImpl.java | 40 + .../helloworld/HelloWorldServiceReference.java | 35 + .../jmstext/helloworld/CheckedException.java | 28 + .../jmstext/helloworld/HelloWorldReference.java | 32 + .../helloworld/HelloWorldReferenceImpl.java | 46 ++ .../jmstext/helloworld/HelloWorldService.java | 35 + .../jmstext/helloworld/HelloWorldServiceImpl.java | 38 + .../helloworld/HelloWorldServiceReference.java | 35 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../main/resources/jmstext/helloworld.composite | 45 + .../src/main/resources/jndi.properties | 39 + .../binding/jms/format/FormatJMSTextTestCase.java | 60 ++ .../2.0-M4-RC2/itest/jms/format-jmstextxml/pom.xml | 83 ++ .../jmsbytes/helloworld/CheckedException.java | 28 + .../jmsbytes/helloworld/HelloWorldReference.java | 32 + .../helloworld/HelloWorldReferenceImpl.java | 50 ++ .../jmsbytes/helloworld/HelloWorldService.java | 35 + .../jmsbytes/helloworld/HelloWorldServiceImpl.java | 40 + .../helloworld/HelloWorldServiceReference.java | 35 + .../jmstextxml/helloworld/CheckedException.java | 28 + .../jmstextxml/helloworld/HelloWorldReference.java | 33 + .../helloworld/HelloWorldReferenceImpl.java | 62 ++ .../jmstextxml/helloworld/HelloWorldService.java | 35 + .../helloworld/HelloWorldServiceImpl.java | 44 + .../jms/format/jmstextxml/helloworld/Person.java | 42 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../main/resources/jmstextxml/helloworld.composite | 80 ++ .../src/main/resources/jmstextxml/helloworld.wsdl | 153 ++++ .../src/main/resources/jndi.properties | 39 + .../jms/format/FormatJMSTextXMLTestCase.java | 62 ++ .../jms/format-jmstextxmlinjmsobjectout/pom.xml | 83 ++ .../jmsbytes/helloworld/CheckedException.java | 28 + .../jmsbytes/helloworld/HelloWorldReference.java | 32 + .../helloworld/HelloWorldReferenceImpl.java | 50 ++ .../jmsbytes/helloworld/HelloWorldService.java | 35 + .../jmsbytes/helloworld/HelloWorldServiceImpl.java | 40 + .../helloworld/HelloWorldServiceReference.java | 35 + .../jmsbytesxml/helloworld/CheckedException.java | 28 + .../helloworld/HelloWorldReference.java | 32 + .../helloworld/HelloWorldReferenceImpl.java | 46 ++ .../jmsbytesxml/helloworld/HelloWorldService.java | 34 + .../helloworld/HelloWorldServiceImpl.java | 39 + .../jmsdefault/helloworld/CheckedException.java | 28 + .../jmsdefault/helloworld/HelloWorldReference.java | 36 + .../helloworld/HelloWorldReferenceImpl.java | 85 ++ .../jmsdefault/helloworld/HelloWorldService.java | 38 + .../helloworld/HelloWorldServiceImpl.java | 51 ++ .../jms/format/jmsdefault/helloworld/Person.java | 42 + .../jmsmessage/helloworld/HelloWorldReference.java | 32 + .../helloworld/HelloWorldReferenceImpl.java | 41 + .../jmsmessage/helloworld/HelloWorldService.java | 34 + .../helloworld/HelloWorldServiceImpl.java | 51 ++ .../helloworld/HelloWorldServiceReferenceSide.java | 37 + .../jms/format/jmsmessage/helloworld/README | 3 + .../jmsobject/helloworld/CheckedException.java | 28 + .../jmsobject/helloworld/HelloWorldReference.java | 32 + .../helloworld/HelloWorldReferenceImpl.java | 112 +++ .../jmsobject/helloworld/HelloWorldService.java | 41 + .../helloworld/HelloWorldServiceImpl.java | 63 ++ .../jms/format/jmsobject/helloworld/Person.java | 47 ++ .../jmstext/helloworld/CheckedException.java | 28 + .../jmstext/helloworld/HelloWorldReference.java | 32 + .../helloworld/HelloWorldReferenceImpl.java | 46 ++ .../jmstext/helloworld/HelloWorldService.java | 35 + .../jmstext/helloworld/HelloWorldServiceImpl.java | 38 + .../helloworld/HelloWorldServiceReference.java | 35 + .../jmstextxml/helloworld/CheckedException.java | 28 + .../jmstextxml/helloworld/HelloWorldReference.java | 33 + .../helloworld/HelloWorldReferenceImpl.java | 62 ++ .../jmstextxml/helloworld/HelloWorldService.java | 35 + .../helloworld/HelloWorldServiceImpl.java | 44 + .../jms/format/jmstextxml/helloworld/Person.java | 42 + .../helloworld/HelloWorldReferenceImpl.java | 38 + .../helloworld/HelloWorldService.java | 33 + .../helloworld/HelloWorldServiceImpl.java | 35 + .../helloworld/Person.java | 42 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../jmstextxmlinjmsobjectout/helloworld.composite | 52 ++ .../jmstextxmlinjmsobjectout/helloworld.wsdl | 139 ++++ .../src/main/resources/jndi.properties | 39 + .../FormatJMSTextXMLInJMSObjectOutTestCase.java | 62 ++ .../2.0-M4-RC2/itest/jms/non-sca-client/pom.xml | 83 ++ .../sca/binding/jms/OneWayObjectService.java | 29 + .../sca/binding/jms/OneWayObjectServiceImpl.java | 34 + .../tuscany/sca/binding/jms/OneWayService.java | 29 + .../tuscany/sca/binding/jms/OneWayServiceImpl.java | 34 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../src/main/resources/jndi.properties | 39 + .../main/resources/nonSCAclient/service.composite | 54 ++ .../sca/binding/jms/NonSCAClientTestCase.java | 144 ++++ .../sca/2.0-M4-RC2/itest/jms/noreplyto/pom.xml | 83 ++ .../tuscany/sca/binding/jms/HelloWorldService.java | 26 + .../sca/binding/jms/HelloWorldServiceImpl.java | 30 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../noreplyto/src/main/resources/jndi.properties | 39 + .../noreplyto/src/main/resources/service.composite | 38 + .../tuscany/sca/binding/jms/NoReplyToTestCase.java | 100 +++ tags/java/sca/2.0-M4-RC2/itest/jms/nulls/pom.xml | 71 ++ .../apache/tuscany/sca/binding/jms/ClientImpl.java | 41 + .../apache/tuscany/sca/binding/jms/MyService.java | 28 + .../tuscany/sca/binding/jms/ServiceImpl.java | 28 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../jms/nulls/src/main/resources/jndi.properties | 38 + .../jms/nulls/src/main/resources/nulls.composite | 57 ++ .../tuscany/sca/binding/jms/NullsTestCase.java | 60 ++ .../sca/2.0-M4-RC2/itest/jms/oneway-nocf/pom.xml | 83 ++ .../tuscany/sca/binding/jms/OneWayClientImpl.java | 41 + .../tuscany/sca/binding/jms/OneWayService.java | 29 + .../tuscany/sca/binding/jms/OneWayServiceImpl.java | 34 + .../main/resources/META-INF/sca-contribution.xml | 24 + .../oneway-nocf/src/main/resources/jndi.properties | 38 + .../main/resources/oneway/OneWayClient.composite | 35 + .../main/resources/oneway/OneWayService.composite | 34 + .../tuscany/sca/binding/jms/OneWayTestCase.java | 59 ++ tags/java/sca/2.0-M4-RC2/itest/jms/oneway/pom.xml | 83 ++ .../tuscany/sca/binding/jms/OneWayClientImpl.java | 41 + .../sca/binding/jms/OneWayObjectService.java | 29 + .../sca/binding/jms/OneWayObjectServiceImpl.java | 34 + .../tuscany/sca/binding/jms/OneWayService.java | 29 + .../tuscany/sca/binding/jms/OneWayServiceImpl.java | 34 + .../main/resources/META-INF/sca-contribution.xml | 24 + .../jms/oneway/src/main/resources/jndi.properties | 39 + .../main/resources/oneway/OneWayClient.composite | 33 + .../main/resources/oneway/OneWayService.composite | 33 + .../tuscany/sca/binding/jms/OneWayTestCase.java | 60 ++ .../2.0-M4-RC2/itest/jms/policy-headers/pom.xml | 83 ++ .../apache/tuscany/sca/binding/jms/JMSClient.java | 28 + .../apache/tuscany/sca/binding/jms/MsgClient.java | 29 + .../tuscany/sca/binding/jms/MsgClientImpl.java | 38 + .../tuscany/sca/binding/jms/MsgClientService.java | 33 + .../apache/tuscany/sca/binding/jms/MsgService.java | 32 + .../tuscany/sca/binding/jms/MsgServiceImpl.java | 39 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../src/main/resources/jndi.properties | 39 + .../main/resources/policyHeaders/definitions.xml | 54 ++ .../policyHeaders/policyHeaders.composite | 45 + .../sca/binding/jms/PolicyHeadersTestCase.java | 94 +++ tags/java/sca/2.0-M4-RC2/itest/jms/pom.xml | 68 ++ .../sca/2.0-M4-RC2/itest/jms/properties/pom.xml | 83 ++ .../apache/tuscany/sca/binding/jms/JMSClient.java | 28 + .../apache/tuscany/sca/binding/jms/MsgClient.java | 29 + .../tuscany/sca/binding/jms/MsgClientImpl.java | 38 + .../tuscany/sca/binding/jms/MsgClientService.java | 33 + .../apache/tuscany/sca/binding/jms/MsgService.java | 32 + .../tuscany/sca/binding/jms/MsgServiceImpl.java | 39 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../properties/src/main/resources/jndi.properties | 39 + .../main/resources/properties/properties.composite | 53 ++ .../sca/binding/jms/PropertiesTestCase.java | 93 +++ .../sca/2.0-M4-RC2/itest/jms/responsecf/pom.xml | 83 ++ .../sca/binding/jms/HelloWorldClientImpl.java | 41 + .../tuscany/sca/binding/jms/HelloWorldService.java | 26 + .../sca/binding/jms/HelloWorldServiceImpl.java | 30 + .../main/resources/META-INF/sca-contribution.xml | 24 + .../src/main/resources/cf/client.composite | 36 + .../src/main/resources/cf/service.composite | 36 + .../responsecf/src/main/resources/jndi.properties | 39 + .../sca/binding/jms/ResponseCFTestCase.java | 53 ++ tags/java/sca/2.0-M4-RC2/itest/jms/rpc/pom.xml | 83 ++ .../sca/binding/jms/HelloWorldClientImpl.java | 41 + .../tuscany/sca/binding/jms/HelloWorldService.java | 26 + .../sca/binding/jms/HelloWorldServiceImpl.java | 30 + .../main/resources/META-INF/sca-contribution.xml | 24 + .../jms/rpc/src/main/resources/jndi.properties | 39 + .../rpc/src/main/resources/simple/client.composite | 37 + .../src/main/resources/simple/service.composite | 37 + .../tuscany/sca/binding/jms/RPCTestCase.java | 53 ++ .../sca/2.0-M4-RC2/itest/jms/selectors/pom.xml | 70 ++ .../apache/tuscany/sca/binding/jms/ClientImpl.java | 41 + .../tuscany/sca/binding/jms/SelectorService.java | 29 + .../sca/binding/jms/SelectorServiceImpl1.java | 40 + .../sca/binding/jms/SelectorServiceImpl2.java | 38 + .../sca/binding/jms/SelectorServiceImpl3.java | 38 + .../jmsdefault/HelloWorldReference.java | 32 + .../jmsdefault/HelloWorldReferenceImpl.java | 39 + .../jmsdefault/HelloWorldService.java | 38 + .../jmsdefault/HelloWorldServiceImpl.java | 47 ++ .../jmsuserprop/HelloWorldReference.java | 32 + .../jmsuserprop/HelloWorldReferenceImpl.java | 36 + .../jmsuserprop/HelloWorldService.java | 38 + .../jmsuserprop/HelloWorldServiceImpl.java | 47 ++ .../main/resources/META-INF/sca-contribution.xml | 25 + .../main/resources/jmsdefault/helloworld.composite | 69 ++ .../resources/jmsuserprop/helloworld.composite | 65 ++ .../selectors/src/main/resources/jndi.properties | 38 + .../main/resources/selectors/selectors.composite | 68 ++ .../jms/OperationselectorJMSDefaultTestCase.java | 57 ++ .../jms/OperationselectorJMSUserPropTestCase.java | 57 ++ .../tuscany/sca/binding/jms/SelectorsTestCase.java | 76 ++ tags/java/sca/2.0-M4-RC2/itest/jms/topics/pom.xml | 71 ++ .../tuscany/sca/binding/jms/OneWayClientImpl.java | 41 + .../tuscany/sca/binding/jms/OneWayService.java | 29 + .../tuscany/sca/binding/jms/OneWayServiceImpl.java | 34 + .../main/resources/META-INF/sca-contribution.xml | 24 + .../jms/topics/src/main/resources/jndi.properties | 38 + .../main/resources/topics/TopicsClient.composite | 33 + .../main/resources/topics/TopicsService.composite | 33 + .../tuscany/sca/binding/jms/TopicsTestCase.java | 59 ++ tags/java/sca/2.0-M4-RC2/itest/jms/ttl/pom.xml | 71 ++ .../main/java/itest/MockInitialContextFactory.java | 904 +++++++++++++++++++++ .../tuscany/sca/binding/jms/ClientIface.java | 30 + .../apache/tuscany/sca/binding/jms/ClientImpl.java | 39 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../jms/ttl/src/main/resources/jndi.properties | 38 + .../itest/jms/ttl/src/main/resources/ttl.composite | 35 + .../tuscany/sca/binding/jms/TTLTestCase.java | 64 ++ tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/pom.xml | 83 ++ .../sca/binding/jms/HelloWorldClientImpl.java | 41 + .../tuscany/sca/binding/jms/HelloWorldService.java | 26 + .../sca/binding/jms/HelloWorldServiceImpl.java | 30 + .../main/resources/META-INF/sca-contribution.xml | 24 + .../jms/uri-rpc/src/main/resources/jndi.properties | 39 + .../src/main/resources/simple/service.composite | 37 + .../src/main/resources/simple/uriclient.composite | 31 + .../tuscany/sca/binding/jms/URIRPCTestCase.java | 54 ++ .../itest/nodes/helloworld-client/pom.xml | 44 + .../src/main/java/itest/nodes/HelloworldImpl.java | 43 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../src/main/resources/helloworld-client.composite | 29 + .../itest/nodes/helloworld-iface/pom.xml | 39 + .../src/main/java/itest/nodes/Helloworld.java | 29 + .../itest/nodes/helloworld-service/pom.xml | 49 ++ .../src/main/java/itest/nodes/HelloworldImpl.java | 28 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../main/resources/helloworld-service.composite | 28 + .../2.0-M4-RC2/itest/nodes/one-node-test/pom.xml | 48 ++ .../src/test/java/itest/OneNodeTestCase.java | 87 ++ tags/java/sca/2.0-M4-RC2/itest/nodes/pom.xml | 45 + .../2.0-M4-RC2/itest/nodes/two-nodes-test/pom.xml | 58 ++ .../src/test/java/itest/ClientNode.java | 92 +++ .../src/test/java/itest/ServiceNode.java | 58 ++ .../test/java/itest/StopStartNodesTestCase.java | 102 +++ .../src/test/java/itest/TestCaseRunner.java | 292 +++++++ .../src/test/java/itest/TwoNodesTestCase.java | 105 +++ .../itest/nodes/two-nodes-two-vms-test/build.xml | 38 + .../nodes/two-nodes-two-vms-test/client-config.xml | 38 + .../itest/nodes/two-nodes-two-vms-test/client.xml | 33 + .../itest/nodes/two-nodes-two-vms-test/pom.xml | 117 +++ .../nodes/two-nodes-two-vms-test/server-config.xml | 38 + .../itest/nodes/two-nodes-two-vms-test/server.xml | 33 + .../src/test/java/itest/TwoNodesTestCase.java | 57 ++ .../2.0-M4-RC2/itest/operation-overloading/pom.xml | 53 ++ .../sca/test/opoverload/OverloadASourceTarget.java | 61 ++ .../sca/test/opoverload/impl/OverloadASource.java | 113 +++ .../sca/test/opoverload/impl/OverloadATarget.java | 99 +++ .../src/main/resources/OperationOverload.composite | 34 + .../test/opoverload/impl/OverloadATestCase.java | 98 +++ tags/java/sca/2.0-M4-RC2/itest/policies/pom.xml | 59 ++ .../tuscany/sca/itest/policies/CreditCard.java | 65 ++ .../sca/itest/policies/CreditCardPayment.java | 37 + .../tuscany/sca/itest/policies/Customer.java | 51 ++ .../sca/itest/policies/CustomerRegistry.java | 27 + .../apache/tuscany/sca/itest/policies/Payment.java | 30 + .../itest/policies/impl/CreditCardPaymentImpl.java | 40 + .../itest/policies/impl/CustomerRegistryImpl.java | 78 ++ .../sca/itest/policies/impl/PaymentImpl.java | 54 ++ .../policies/src/main/resources/Customer.composite | 34 + .../src/main/resources/LoggingMessages.properties | 16 + .../src/main/resources/META-INF/definitions.xml | 46 ++ .../main/resources/META-INF/sca-contribution.xml | 23 + .../policies/src/main/resources/Payment.composite | 49 ++ .../sca/itest/policies/PaymentTestCase.java | 69 ++ tags/java/sca/2.0-M4-RC2/itest/pom.xml | 167 ++++ tags/java/sca/2.0-M4-RC2/itest/properties/pom.xml | 74 ++ .../java/mysca/test/myservice/impl/MyService.java | 34 + .../mysca/test/myservice/impl/MyServiceImpl.java | 88 ++ .../test/myservice/impl/MyTotalServiceImpl.java | 46 ++ .../apache/tuscany/sca/itest/ABCDComponent.java | 50 ++ .../tuscany/sca/itest/ABCDComponentImpl.java | 73 ++ .../org/apache/tuscany/sca/itest/ABComponent.java | 75 ++ .../apache/tuscany/sca/itest/ABComponentImpl.java | 131 +++ .../org/apache/tuscany/sca/itest/CDComponent.java | 71 ++ .../apache/tuscany/sca/itest/CDComponentImpl.java | 143 ++++ .../tuscany/sca/itest/ComplexPropertyBean.java | 151 ++++ .../apache/tuscany/sca/itest/OverrideService.java | 27 + .../tuscany/sca/itest/OverrideServiceImpl.java | 28 + .../tuscany/sca/itest/PropertyComponent.java | 114 +++ .../tuscany/sca/itest/PropertyComponentImpl.java | 144 ++++ .../apache/tuscany/sca/itest/PropertyService.java | 27 + .../java/org/apache/tuscany/sca/itest/cdi/Bar.java | 23 + .../org/apache/tuscany/sca/itest/cdi/Foo1.java | 39 + .../org/apache/tuscany/sca/itest/cdi/Foo2.java | 39 + .../org/apache/tuscany/sca/itest/cdi/Foo3.java | 44 + .../main/java/test/jaxb/props/ObjectFactory.java | 75 ++ .../java/test/jaxb/props/ReturnCodeProperties.java | 103 +++ .../main/java/test/jaxb/props/package-info.java | 27 + .../ConstructorPropertyInjection.composite | 39 + .../properties/src/main/resources/Outer.composite | 43 + .../src/main/resources/OuterPropertyTest.composite | 42 + .../src/main/resources/PropertyTest.composite | 260 ++++++ .../properties/src/main/resources/customer.xsd | 30 + .../properties/src/main/resources/fileProperty.txt | 21 + .../src/main/resources/manyValuesFileProperty.txt | 23 + .../src/main/resources/mySimpleService.composite | 40 + .../properties/src/main/resources/rcProps.txt | 22 + .../properties/src/main/resources/rcprops.xsd | 55 ++ .../tuscany/sca/itest/MyTotalServiceTestCase.java | 104 +++ .../tuscany/sca/itest/OuterPropertyTestCase.java | 169 ++++ .../apache/tuscany/sca/itest/PropertyTestCase.java | 422 ++++++++++ .../cdi/ConstructorPropertyInjectionTestCase.java | 72 ++ .../2.0-M4-RC2/itest/recursive-multi-level/pom.xml | 61 ++ .../main/java/mysca/test/myservice/MyService.java | 26 + .../java/mysca/test/myservice/MyServiceImpl.java | 42 + .../mysca/test/myservice/MySimpleTotalService.java | 26 + .../test/myservice/MySimpleTotalServiceImpl.java | 39 + .../src/main/resources/TotalService1Auto.composite | 52 ++ .../src/main/resources/TotalService2Auto.composite | 49 ++ .../src/main/resources/TotalService3Auto.composite | 52 ++ .../java/test/sca/tests/MultiLevelTestCase.java | 90 ++ tags/java/sca/2.0-M4-RC2/itest/references/pom.xml | 52 ++ .../tuscany/sca/itest/references/AComponent.java | 40 + .../sca/itest/references/AComponentImpl.java | 125 +++ .../tuscany/sca/itest/references/BComponent.java | 26 + .../sca/itest/references/BComponentImpl.java | 39 + .../references/BComponentWrongTargetImpl.java | 39 + .../tuscany/sca/itest/references/CComponent.java | 24 + .../sca/itest/references/CComponentImpl.java | 27 + .../tuscany/sca/itest/references/DComponent.java | 26 + .../sca/itest/references/DComponentImpl.java | 35 + .../resources/AutoWiredReferencesTest.composite | 61 ++ .../main/resources/InnerReferencesTest.composite | 51 ++ .../resources/ManualWiredReferencesTest.composite | 59 ++ .../references/AutoWiredReferenceTestCase.java | 114 +++ .../itest/references/InnerReferenceTestCase.java | 99 +++ .../references/ManualWiredReferenceTestCase.java | 97 +++ .../sca/2.0-M4-RC2/itest/scaclient-api/pom.xml | 46 ++ .../src/main/java/itest/HelloworldService.java | 25 + .../src/main/java/itest/HelloworldServiceImpl.java | 38 + .../src/main/resources/Helloworld.composite | 29 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../java/test/scaclient/SCAClientTestCase.java | 61 ++ tags/java/sca/2.0-M4-RC2/itest/scdl/pom.xml | 79 ++ .../sca/itest/scdl/ContributionTestCase.java | 80 ++ .../tuscany/sca/itest/scdl/SCDLTestCase.java | 87 ++ .../itest/scdl/ValidateDependenciesTestCase.java | 73 ++ .../itest/scdl/src/test/resources/test.composite | 51 ++ tags/java/sca/2.0-M4-RC2/itest/scopes/pom.xml | 54 ++ .../scopes/CompositeScopeStateVerifierImpl.java | 46 ++ .../tuscany/sca/itest/scopes/StateVerifier.java | 25 + .../scopes/src/main/resources/scopes.composite | 29 + .../org/apache/tuscany/sca/test/ScopeTestCase.java | 89 ++ .../sca/2.0-M4-RC2/itest/service-reference/pom.xml | 66 ++ .../tuscany/sca/itest/serviceref/AComponent.java | 39 + .../sca/itest/serviceref/AComponentImpl.java | 112 +++ .../tuscany/sca/itest/serviceref/BComponent.java | 31 + .../sca/itest/serviceref/BComponentImpl.java | 38 + .../tuscany/sca/itest/serviceref/Base64Binary.java | 297 +++++++ .../tuscany/sca/itest/serviceref/CComponent.java | 27 + .../sca/itest/serviceref/CComponentImpl.java | 30 + .../tuscany/sca/itest/serviceref/DComponent.java | 30 + .../sca/itest/serviceref/DComponentImpl.java | 64 ++ .../src/main/resources/nodeA/CompositeA.composite | 44 + .../src/main/resources/nodeB/CompositeB.composite | 46 ++ .../ServiceReferenceTest.composite | 48 ++ .../CallableReferenceRemoteTestCase.java | 139 ++++ .../itest/serviceref/ServiceReferenceTestCase.java | 88 ++ tags/java/sca/2.0-M4-RC2/itest/services/pom.xml | 53 ++ .../tuscany/sca/itest/services/AComponent.java | 27 + .../tuscany/sca/itest/services/AComponentImpl.java | 28 + .../tuscany/sca/itest/services/BComponent.java | 25 + .../tuscany/sca/itest/services/BComponentImpl.java | 31 + .../tuscany/sca/itest/services/CComponent.java | 27 + .../tuscany/sca/itest/services/CComponentImpl.java | 28 + .../tuscany/sca/itest/services/D1Component.java | 24 + .../tuscany/sca/itest/services/DComponent.java | 24 + .../tuscany/sca/itest/services/DComponentImpl.java | 34 + .../main/resources/META-INF/sca-contribution.xml | 23 + .../src/main/resources/ServicesTest.composite | 70 ++ .../sca/itest/services/ServicesTestCase.java | 108 +++ tags/java/sca/2.0-M4-RC2/itest/wires/pom.xml | 53 ++ .../org/apache/tuscany/sca/itest/WireClient.java | 34 + .../apache/tuscany/sca/itest/WireClientImpl.java | 51 ++ .../org/apache/tuscany/sca/itest/WireService.java | 36 + .../apache/tuscany/sca/itest/WireServiceImpl.java | 39 + .../wires/src/main/resources/WireTest.composite | 39 + .../org/apache/tuscany/sca/itest/WireTestCase.java | 78 ++ 910 files changed, 48544 insertions(+) create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.wsdl create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.bpel create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.wsdl create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/log4j.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/java/helloworld/HelloWorld.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/java/helloworld/HelloWorldTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.bpel create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.wsdl create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/resources/log4j.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/java/helloworld/HelloWorld.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/java/helloworld/HelloWorldTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.bpel create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.wsdl create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/resources/log4j.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/bpel/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDReferenceMultiplicityImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentEImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentFImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3a.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario1/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario1/scenario1.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario1/scenario1a.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario10/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario10/scenario10.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario10/scenario10a.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario10/service3.wsdl create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario11/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario11/scenario11.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario11/scenario11a.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario11/service3.wsdl create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario12/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario12/scenario12.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario12/scenario12a.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario13/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario13/scenario13.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario13/scenario13a.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario2/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario2/scenario2.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario2/scenario2a.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario3/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario3/scenario3.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario3/scenario3a.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario4/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario4/scenario4.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario4/scenario4a.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario5/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario5/scenario5.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario5/scenario5a.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario5/scenarios.wsdl create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario6/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario6/scenario6.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario6/scenario6a.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario6/scenarios.wsdl create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario7/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario7/scenario7.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario7/scenario7a.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario7/scenarios.wsdl create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario8/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario8/scenario8.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario8/scenario8a.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario8/scenarios.wsdl create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario9/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario9/scenario9.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario9/scenario9a.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/TestUtils.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-api/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/resources/CallBackApiTest.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/resources/CallBackBasicTest.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-basic/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/resources/CallBackBasicTest.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClient.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/resources/CallBackCTypeClient.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.componentType create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClient.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl1.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl2.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceCallback.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/resources/CallbackMultiWireTest.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/test/java/org/apache/tuscany/sca/test/callback/CallbackMultiWireTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClient.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorCallBack.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/resources/CallBackSeparateThreadTest.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/test/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/component-type/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/AddService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/AddServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/CalculatorClient.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/CalculatorService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/CalculatorServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/DivideService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/DivideServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/MultiplyService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/MultiplyServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/SubtractService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/SubtractServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/Calculator.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/calculator/AddServiceImpl.componentType create mode 100644 tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/calculator/CalculatorServiceImpl.componentType create mode 100644 tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/calculator/DivideServiceImpl.componentType create mode 100644 tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/calculator/MultiplyServiceImpl.componentType create mode 100644 tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/calculator/SubtractServiceImpl.componentType create mode 100644 tags/java/sca/2.0-M4-RC2/itest/component-type/src/test/java/calculator/CalculatorTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-folder/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/java/calculator/CalculatorService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/java/test/ContributionFolderTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/resources/repository/folderWithJars/Calculator.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/resources/repository/folderWithJars/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/resources/repository/folderWithJars/service.jar create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/resources/repository/folderWithJars/serviceImpl.jar create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/resources/repository3/contribution.zip create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/src/main/java/hello/Hello.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/src/main/java/hello/HelloImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/src/main/resources/hello.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/src/test/java/org/apache/tuscany/sca/test/contribution/HelloTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-java/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-java/src/main/java/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-java/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-java/src/main/resources/helloworld/HelloWorldImpl.componentType create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-resource/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-resource/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-resource/src/main/resources/ufservices/store.html create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-wsdl/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-wsdl/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.wsdl create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.xsd create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldServer.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/resources/helloworld.wsdl create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/resources/helloworld.xsd create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/resources/helloworldws.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/test/java/org/apache/tuscany/test/contribution/HelloWorldServerTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-java/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-java/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-java/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-java/src/main/resources/helloworldws.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-java/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-resource/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-resource/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-resource/src/main/resources/store.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-resource/src/test/java/org/apache/tuscany/sca/test/contribution/StoreTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldServer.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/main/resources/helloworldws.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-zip/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-zip/src/test/java/calculator/CalculatorService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-zip/src/test/java/org/apache/tuscany/sca/contribution/zip/ContributionZIPTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/contribution-zip/src/test/resources/repository/contribution.zip create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/bin-distro-unzip/build.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/bin-distro-unzip/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/binding-ws-calculator/build.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/binding-ws-calculator/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/calculator-rmi/build.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/calculator-rmi/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/implementation-java-calculator/build.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/implementation-java-calculator/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/legal-checks/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/legal-checks/src/test/java/itest/JarsInLICENSETestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-bpel/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-bpel/src/test/java/itest/HelloworldTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jms/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jms/src/test/java/itest/HelloworldTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-js-client/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-js-client/src/test/java/itest/HelloworldTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jsf/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jsf/src/test/java/itest/HelloworldTestCaseFIXME.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jsp/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jsp/src/test/java/itest/HelloworldTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-stripes/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-stripes/src/test/java/itest/HelloworldTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/endpoints/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/java/helloworld/HelloWorldImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/java/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/java/test/EndpointsTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/java/test/NestedEndpointsTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/java/test/Utils.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/resources/helloworld.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/resources/nested.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/exceptions/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionRemoteThrower.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionRemoteThrowerImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/RemoteExceptionHandlerImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/resources/ExceptionTest.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/ExceptionsTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/bigbank/stockquote/StockQuoteImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/bigbank/stockquote/StockQuoteService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/AddService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/AddServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/CalculatorService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/CalculatorServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/DivideService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/DivideServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/MultiplyService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/MultiplyServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/SubtractService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/SubtractServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/security/CalculatorCallbackHandler.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/security/JaasLoginModule.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/security/UserPrincipal.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/context/access/SCAApplicationContextProvider.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/helloworld/HelloWorld.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/helloworld/HelloWorldProxy.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestBean.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestBeanImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestHelloWorldBean.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestReferenceBean.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestSCAPropertyBean.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/spring/annotations/CalculatorServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/access/CalculatorService-context.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/access/ContextAccess.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/imports/ContextImports.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/imports/META-INF/spring/CalculatorService-context.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/imports/META-INF/spring/SpringImport-context.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/multiple/MultipleContext.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/multiple/springapp/META-INF/MANIFEST.MF create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/multiple/springapp/META-INF/spring/SpringHelloWorld-context.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/multiple/springapp/META-INF/spring/StockQuoteService-context.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/multiple/springapp/META-INF/spring/beanRefContext.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/implementation/policies/CalculatorJass.config create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/implementation/policies/CalculatorLogMessages.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/implementation/policies/ImplementationPolicies.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/implementation/policies/META-INF/spring/CalculatorService-context.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/implementation/policies/definitions.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/location/folder/SpringFolderLocation.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/location/folder/springapp/META-INF/MANIFEST.MF create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/location/folder/springapp/META-INF/spring/SpringSCAProperty-context.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/location/jar/SpringJarLocation.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/location/jar/spring-context.jar create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/META-INF/spring/SpringDelegationHelloWorld-context.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/META-INF/spring/SpringHelloWorld-context.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorld.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/references/META-INF/spring/SpringExplicitReference-context.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/references/META-INF/spring/SpringImplicitReference-context.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/references/SpringExplicitReference.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/references/SpringImplicitReference.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/services/META-INF/spring/SpringExplicitService-context.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/services/META-INF/spring/SpringImplicitService-context.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/services/SpringExplicitService.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/services/SpringImplicitService.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/spring/annotations/Calculator.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/spring/annotations/CalculatorService-context.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/access/CalculatorClient.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/access/ContextAccessTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/imports/CalculatorClient.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/imports/ContextImportsTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/multiple/MultipleContextTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/multiple/StockQuoteServer.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/implementation/policies/CalculatorClient.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/implementation/policies/ImplementationPoliciesTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/location/folder/SpringFolderLocationTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/location/jar/SpringJarLocationTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorldTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldDelegatorBean.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/sca/references/SpringExplicitReferenceTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/sca/references/SpringImplicitReferenceTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/sca/services/SpringExplicitServiceTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/sca/services/SpringImplicitServiceTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/spring/annotations/CalculatorClient.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/spring/annotations/SpringAnnotationsTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/interfaces/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponent.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteCallbackInterface.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponent.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponent.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/resources/InterfacesTest.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/resources/InvalidRemoteAttribute.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/interfaces/src/test/java/org/apache/tuscany/sca/itest/interfaces/InterfacesTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/interfaces/src/test/java/org/apache/tuscany/sca/itest/interfaces/InvalidRemoteAttributeTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/java/stock/StockQuote.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteClient.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteRef.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/resources/StockQuote.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/test/java/itest/AsyncServiceTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jaxws/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jaxws/src/test/java/stock/AsyncServiceTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jaxws/src/test/java/stock/StockQuote.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jaxws/src/test/java/stock/StockQuoteImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jaxws/src/test/resources/StockQuote.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/resources/dynamic/client.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/resources/simple/service.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/test/java/org/apache/tuscany/sca/binding/jms/DynamicReplyQTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/args/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/java/org/apache/tuscany/sca/binding/jms/MyService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/java/org/apache/tuscany/sca/binding/jms/ServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/resources/selectors/selectors.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/args/src/test/java/org/apache/tuscany/sca/binding/jms/ArgsTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSServiceCallback.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/resources/simple/client.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/resources/simple/tempq.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/test/java/org/apache/tuscany/sca/binding/jms/CallbackTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/test/java/org/apache/tuscany/sca/binding/jms/TempCallbackQTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/defaults/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/resources/defaults/client.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/resources/defaults/service.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/test/java/org/apache/tuscany/sca/binding/jms/DefaultsTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/definitions/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/resources/definitions.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/resources/definitions/definitions.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/test/java/org/apache/tuscany/sca/binding/jms/DefinitionsTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion2Args.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetionChained.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetionNoArgs.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/resources/exceptions/service.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion2Args.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetionChained.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetionNoArgs.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceClient.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/resources/exceptions/client.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/resources/exceptions/service.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/resources/external/client.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/resources/external/service.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/resources/jmsbytes/helloworld.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/CheckedException.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/resources/jmsbytesxml/helloworld.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesXMLTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/CheckedException.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/Person.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/resources/jmsdefault/helloworld.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/resources/jmsdefault/helloworld.wsdl create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSDefaultTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceReferenceSide.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/README create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/resources/jmsmessage/helloworld.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/resources/jmsmessage/helloworld.wsdl create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSMessageTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/CheckedException.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/Person.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/resources/jmsobject/helloworld.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/resources/jmsobject/helloworld.wsdl create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSObjectTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/CheckedException.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldServiceReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/resources/jmstext/helloworld.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/CheckedException.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/Person.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/resources/jmstextxml/helloworld.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/resources/jmstextxml/helloworld.wsdl create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextXMLTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/CheckedException.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/CheckedException.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/Person.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceReferenceSide.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/README create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/CheckedException.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/Person.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/CheckedException.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldServiceReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/CheckedException.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/Person.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxmlinjmsobjectout/helloworld/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxmlinjmsobjectout/helloworld/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxmlinjmsobjectout/helloworld/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxmlinjmsobjectout/helloworld/Person.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/resources/jmstextxmlinjmsobjectout/helloworld.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/resources/jmstextxmlinjmsobjectout/helloworld.wsdl create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextXMLInJMSObjectOutTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/resources/nonSCAclient/service.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/test/java/org/apache/tuscany/sca/binding/jms/NonSCAClientTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/main/resources/service.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/test/java/org/apache/tuscany/sca/binding/jms/NoReplyToTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/nulls/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/java/org/apache/tuscany/sca/binding/jms/MyService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/java/org/apache/tuscany/sca/binding/jms/ServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/resources/nulls.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/test/java/org/apache/tuscany/sca/binding/jms/NullsTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/resources/oneway/OneWayClient.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/resources/oneway/OneWayService.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/oneway/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/resources/oneway/OneWayClient.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/resources/oneway/OneWayService.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClient.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/MsgService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/MsgServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/resources/policyHeaders/definitions.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/resources/policyHeaders/policyHeaders.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/test/java/org/apache/tuscany/sca/binding/jms/PolicyHeadersTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/properties/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClient.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/resources/properties/properties.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/test/java/org/apache/tuscany/sca/binding/jms/PropertiesTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/resources/cf/client.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/resources/cf/service.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/test/java/org/apache/tuscany/sca/binding/jms/ResponseCFTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/rpc/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/resources/simple/client.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/resources/simple/service.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl1.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl2.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl3.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/HelloWorldReference.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/HelloWorldReferenceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/resources/jmsdefault/helloworld.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/resources/jmsuserprop/helloworld.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/resources/selectors/selectors.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/test/java/org/apache/tuscany/sca/binding/jms/OperationselectorJMSDefaultTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/test/java/org/apache/tuscany/sca/binding/jms/OperationselectorJMSUserPropTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/test/java/org/apache/tuscany/sca/binding/jms/SelectorsTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/topics/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/resources/topics/TopicsClient.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/resources/topics/TopicsService.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/test/java/org/apache/tuscany/sca/binding/jms/TopicsTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/ttl/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/java/itest/MockInitialContextFactory.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/java/org/apache/tuscany/sca/binding/jms/ClientIface.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/resources/ttl.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/test/java/org/apache/tuscany/sca/binding/jms/TTLTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/resources/jndi.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/resources/simple/service.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/resources/simple/uriclient.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/test/java/org/apache/tuscany/sca/binding/jms/URIRPCTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-client/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-client/src/main/java/itest/nodes/HelloworldImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-client/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-client/src/main/resources/helloworld-client.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-iface/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-iface/src/main/java/itest/nodes/Helloworld.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-service/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-service/src/main/java/itest/nodes/HelloworldImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-service/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-service/src/main/resources/helloworld-service.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/one-node-test/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/src/test/java/itest/ClientNode.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/src/test/java/itest/ServiceNode.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/src/test/java/itest/StopStartNodesTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/src/test/java/itest/TestCaseRunner.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/build.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/client-config.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/client.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/server-config.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/server.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/TwoNodesTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/operation-overloading/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadASource.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATarget.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/operation-overloading/src/main/resources/OperationOverload.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/policies/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/CreditCard.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/CreditCardPayment.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/Customer.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/CustomerRegistry.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/Payment.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/impl/CreditCardPaymentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/impl/CustomerRegistryImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/impl/PaymentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/policies/src/main/resources/Customer.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/policies/src/main/resources/LoggingMessages.properties create mode 100644 tags/java/sca/2.0-M4-RC2/itest/policies/src/main/resources/META-INF/definitions.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/policies/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/policies/src/main/resources/Payment.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/policies/src/test/java/org/apache/tuscany/sca/itest/policies/PaymentTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/mysca/test/myservice/impl/MyService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/mysca/test/myservice/impl/MyTotalServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Bar.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo1.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo2.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo3.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/test/jaxb/props/ObjectFactory.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/test/jaxb/props/ReturnCodeProperties.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/test/jaxb/props/package-info.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/ConstructorPropertyInjection.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/Outer.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/OuterPropertyTest.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/PropertyTest.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/customer.xsd create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/fileProperty.txt create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/manyValuesFileProperty.txt create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/mySimpleService.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/rcProps.txt create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/rcprops.xsd create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/resources/TotalService1Auto.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/resources/TotalService2Auto.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/resources/TotalService3Auto.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/test/java/test/sca/tests/MultiLevelTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/references/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponent.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponent.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentWrongTargetImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponent.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/references/src/main/resources/AutoWiredReferencesTest.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/references/src/main/resources/InnerReferencesTest.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/references/src/main/resources/ManualWiredReferencesTest.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/ManualWiredReferenceTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/scaclient-api/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/scaclient-api/src/main/java/itest/HelloworldService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/scaclient-api/src/main/java/itest/HelloworldServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/scaclient-api/src/main/resources/Helloworld.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/scaclient-api/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/scdl/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/scdl/src/test/java/org/apache/tuscany/sca/itest/scdl/ContributionTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/scdl/src/test/java/org/apache/tuscany/sca/itest/scdl/SCDLTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/scdl/src/test/java/org/apache/tuscany/sca/itest/scdl/ValidateDependenciesTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/scdl/src/test/resources/test.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/scopes/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/CompositeScopeStateVerifierImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/StateVerifier.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/scopes/src/main/resources/scopes.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/service-reference/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponent.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponent.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/Base64Binary.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponent.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponent.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/resources/nodeA/CompositeA.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/resources/nodeB/CompositeB.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/resources/servicereference/ServiceReferenceTest.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/CallableReferenceRemoteTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/ServiceReferenceTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/services/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponent.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponentImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/services/src/main/resources/META-INF/sca-contribution.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/services/src/main/resources/ServicesTest.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/wires/pom.xml create mode 100644 tags/java/sca/2.0-M4-RC2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClient.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireService.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireServiceImpl.java create mode 100644 tags/java/sca/2.0-M4-RC2/itest/wires/src/main/resources/WireTest.composite create mode 100644 tags/java/sca/2.0-M4-RC2/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.java (limited to 'tags/java/sca/2.0-M4-RC2/itest') diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/pom.xml new file mode 100644 index 0000000000..44924206e0 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/pom.xml @@ -0,0 +1,288 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-bpel + 2.0-M4 + ../../pom.xml + + itest-bpel-helloworld-reference + Apache Tuscany SCA iTest HelloWorld Reference BPEL + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-bpel-runtime + 2.0-M4 + runtime + + + + org.apache.ode + ode-dao-jpa-ojpa-derby + 1.1 + zip + + + + xerces + xercesImpl + 2.8.0 + + + + junit + junit + 4.5 + test + + + + + ${artifactId} + + + org.apache.maven.plugins + maven-surefire-plugin + + 2.3.1 + + false + false + true + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack + generate-sources + + unpack + + + + + org.apache.ode + ode-dao-jpa-ojpa-derby + 1.1 + zip + true + ${project.build.directory}/test-classes/ + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + -Djava.endorsed.dirs=target/endorsed + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy + generate-sources + + copy + + + + + javax.xml.ws + jaxws-api + 2.1 + jar + + + javax.xml.bind + jaxb-api + 2.1 + jar + + + ${project.build.directory}/endorsed + false + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.0 + + + add-test-source + generate-sources + + add-test-source + + + + target/jaxws-source + + + + + + + org.codehaus.mojo + jaxws-maven-plugin + 1.12 + + + + javax.jws + jsr181-api + 1.0-MR1 + + + javax.annotation + jsr250-api + 1.0 + + + + + wsimport + generate-test-sources + + wsimport + + + org.apache.tuscany.implementation.bpel.example.helloworld + ${basedir}/src/test/resources/helloworld/ + + helloworld.wsdl + + ${project.build.directory}/jaxws-source + false + true + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsService.java b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsService.java new file mode 100644 index 0000000000..d7dff093f9 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsService.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 greetings; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface GreetingsService { + + public String getGreetings(String name); +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsServiceImpl.java new file mode 100644 index 0000000000..5ecf5494be --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsServiceImpl.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 greetings; + +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(GreetingsService.class) +public class GreetingsServiceImpl implements GreetingsService { + + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestCase.java new file mode 100644 index 0000000000..24ab0a4181 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/greetings/GreetingsTestCase.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 greetings; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +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; + +/** + * Tests the Greetings service + * + * @version $Rev$ $Date$ + */ +public class GreetingsTestCase { + + private static Node node; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUp() throws Exception { + String location = ContributionLocationHelper.getContributionLocation("greetings/greetings.composite"); + node = NodeFactory.newInstance().createNode("greetings/greetings.composite", new Contribution("c1", location)); + node.start(); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDown() throws Exception { + node.stop(); + } + + @Test + public void testInvoke() { + GreetingsService greetingsService = node.getService(GreetingsService.class, "GreetingsServiceComponent"); + String response = greetingsService.getGreetings("Luciano"); + Assert.assertEquals("Hello Luciano", response); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..f46893481b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldService.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 helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The interface for the helloworld service + */ +@Remotable +public interface HelloWorldService { + public String hello(String name); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..a687534bb2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldServiceImpl.java @@ -0,0 +1,47 @@ +/* + * 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 greetings.GreetingsService; + +import org.oasisopen.sca.annotation.Reference; + +/** + * The HelloWorld service implementation + */ +public class HelloWorldServiceImpl implements HelloWorldService { + + protected GreetingsService greetingsService; + + public GreetingsService getGreetingsService() { + System.out.println("Got Injected greetingsService"); + return greetingsService; + } + + @Reference + public void setGreetingsService(GreetingsService greetingsService) { + System.out.println("Injected greetingsService"); + this.greetingsService = greetingsService; + } + + public String hello(String name) { + System.out.println("Calling greeting services getGreetings"); + return greetingsService.getGreetings(name); + } +} \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldTestCase.java new file mode 100644 index 0000000000..a9268ac1b5 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/java/helloworld/HelloWorldTestCase.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 helloworld; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +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; + +/** + * Tests the BPEL Helloworld Service + * + * @version $Rev$ $Date$ + */ +public class HelloWorldTestCase { + private static Node node; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUp() throws Exception { + String location = ContributionLocationHelper.getContributionLocation("helloworld/helloworld.composite"); + node = NodeFactory.newInstance().createNode("helloworld/helloworld.composite", new Contribution("c1", location)); + node.start(); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDown() throws Exception { + node.stop(); + } + + @Test + public void testServiceInvocation() { + HelloWorldService bpelService = node.getService(HelloWorldService.class, "HelloWorldService"); + String response = bpelService.hello("Luciano"); + Assert.assertEquals("Hello Luciano", response); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.composite b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.composite new file mode 100644 index 0000000000..faa10b90ca --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.composite @@ -0,0 +1,32 @@ + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.wsdl b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.wsdl new file mode 100644 index 0000000000..b976a53970 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/greetings/greetings.wsdl @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.bpel b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.bpel new file mode 100644 index 0000000000..c0317687df --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.bpel @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + $helloMessage.TestPart + $greetingsRequest.request + + + + + + + + $greetingsResponse.parameters/greetings:GreetingsResponse + $helloMessageResponse.TestPart + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.composite b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.composite new file mode 100644 index 0000000000..590f05ee84 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.wsdl b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.wsdl new file mode 100644 index 0000000000..541a713112 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/helloworld/helloworld.wsdl @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/log4j.properties b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/log4j.properties new file mode 100644 index 0000000000..4e13380e0b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-reference/src/test/resources/log4j.properties @@ -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. +# + +# Set root logger level to WARN and its only appender to CONSOLE +log4j.rootLogger=OFF, CONSOLE + +# log4j properties to work with commandline tools. +log4j.category.org.mortbay=OFF +log4j.category.org.hibernate.type=OFF +log4j.category.org.objectweb=OFF +log4j.category.org.apache.ode.axis2=OFF +log4j.category.org.apache.ode.bpel.engine=OFF +log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=OFF +log4j.category.org.apache.ode.bpel.epr=OFF +log4j.category.org.apache.tuscany.sca.implementation.bpel=DEBUG +log4j.category.org.apache.tuscany.sca.implementation.bpel.ode=DEBUG +log4j.category.org.apache.tuscany.sca.implementation.bpel.provider=DEBUG + +# Console appender +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=[%p] - %C{1}.%M(%L) | %m%n diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/pom.xml new file mode 100644 index 0000000000..1403e2dd0e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/pom.xml @@ -0,0 +1,178 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-bpel + 2.0-M4 + ../../pom.xml + + itest-bpel-helloworld-ws + + Apache Tuscany SCA iTest HelloWorld BPEL Over Web Services + + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-bpel-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-M4 + runtime + + + + xerces + xercesImpl + 2.8.1 + + + + org.apache.tuscany.sca + tuscany-host-jetty + 1.6-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + ${artifactId} + + + org.apache.maven.plugins + maven-surefire-plugin + + 2.3.1 + + false + false + true + + + + org.apache.maven.plugins + maven-dependency-plugin + + + + unpack + test-compile + + unpack + + + + + org.apache.ode + ode-dao-jpa-ojpa-derby + + 1.1 + zip + true + ${project.build.directory}/test-classes/ + + + + + + + + + org.apache.tuscany.sdo + tuscany-sdo-plugin + 1.1.1 + + + generate-bpel-helloworld + generate-sources + + + ${basedir}/src/test/resources/helloworld/helloworld.wsdl + + ${basedir}/target/wsdl2java-source + + HelloWorld + true + true + true + + + generate + + + + + + org.apache.tuscany.sca + tuscany-maven-wsdl2java + + 1.6-SNAPSHOT + + + + + + + ${basedir}/src/test/resources/helloworld/helloworld.wsdl + + + + + + generate + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/java/helloworld/HelloWorld.java b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/java/helloworld/HelloWorld.java new file mode 100644 index 0000000000..0999e97065 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/java/helloworld/HelloWorld.java @@ -0,0 +1,45 @@ +/* + * 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.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType; +import org.oasisopen.sca.annotation.Reference; + +/** + * @version $Rev$ $Date$ + */ +public class HelloWorld { + private HelloPortType helloService; + + public HelloWorld() { + super(); + } + + @Reference + public void setHelloService(HelloPortType helloService){ + this.helloService = helloService; + } + + public String hello(String hello) throws java.rmi.RemoteException { + System.out.println(">>> Invoking helloService.hello with : " + hello); + return this.helloService.hello(hello); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/java/helloworld/HelloWorldTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/java/helloworld/HelloWorldTestCase.java new file mode 100644 index 0000000000..315591fb98 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/java/helloworld/HelloWorldTestCase.java @@ -0,0 +1,71 @@ +/* + * 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 java.io.IOException; +import java.net.Socket; + +import junit.framework.Assert; + +import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; + +/** + * Tests the BPEL Helloworld Service + * + * @version $Rev$ $Date$ + */ +public class HelloWorldTestCase { + + private Node node; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + protected void setUp() throws Exception { + String location = ContributionLocationHelper.getContributionLocation("helloworld/helloworld.composite"); + node = NodeFactory.newInstance().createNode("CallBackApiTest.composite", new Contribution("c1", location)); + node.start(); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + protected void tearDown() throws Exception { + node.stop(); + } + + public void testPing() throws IOException { + new Socket("127.0.0.1", 8085); + } + + public void testServiceInvocation() throws Exception { + HelloPortType bpelService = node.getService(HelloPortType.class, "BPELHelloWorldServiceComponent"); + String response = bpelService.hello("Hello"); + Assert.assertEquals("Hello World", response); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.bpel b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.bpel new file mode 100644 index 0000000000..8cf91adc2c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.bpel @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + concat($tmpVar,' World') + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.composite b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.composite new file mode 100644 index 0000000000..f42325910d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.composite @@ -0,0 +1,32 @@ + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.wsdl b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.wsdl new file mode 100644 index 0000000000..610bda3cc4 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/resources/helloworld/helloworld.wsdl @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/resources/log4j.properties b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/resources/log4j.properties new file mode 100644 index 0000000000..37f66e4189 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld-ws/src/test/resources/log4j.properties @@ -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. +# + +# Set root logger level to WARN and its only appender to CONSOLE +log4j.rootLogger=OFF, CONSOLE + +# log4j properties to work with commandline tools. +log4j.category.org.mortbay=OFF +log4j.category.org.hibernate.type=OFF +log4j.category.org.objectweb=OFF +log4j.category.org.apache.ode.axis2=OFF +log4j.category.org.apache.ode.bpel.engine=OFF +log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=OFF +log4j.category.org.apache.ode.bpel.epr=OFF +log4j.category.org.apache.tuscany.sca.implementation.bpel=DEBUG +log4j.category.org.apache.tuscany.sca.implementation.bpel.ode=DEBUG +log4j.category.org.apache.tuscany.sca.implementation.bpel.provider=DEBUG + +# Console appender +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=[%p] - %C{1}.%M(%L) | %m%n diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/pom.xml new file mode 100644 index 0000000000..5e00bd0d5f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/pom.xml @@ -0,0 +1,270 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-bpel + 2.0-M4 + ../../pom.xml + + itest-bpel-helloworld + Apache Tuscany SCA iTest HelloWorld BPEL + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-bpel-runtime + 2.0-M4 + runtime + + + + xerces + xercesImpl + 2.8.1 + + + + junit + junit + 4.5 + test + + + + + ${artifactId} + + + org.apache.maven.plugins + maven-surefire-plugin + + 2.3.1 + + false + false + true + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack + test-compile + + unpack + + + + + org.apache.ode + ode-dao-jpa-ojpa-derby + 1.1 + zip + true + ${project.build.directory}/test-classes/ + + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + -Djava.endorsed.dirs=target/endorsed + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy + generate-sources + + copy + + + + + javax.xml.ws + jaxws-api + 2.1 + jar + + + javax.xml.bind + jaxb-api + 2.1 + jar + + + ${project.build.directory}/endorsed + false + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.0 + + + add-test-source + generate-sources + + add-test-source + + + + target/jaxws-source + + + + + + + org.codehaus.mojo + jaxws-maven-plugin + 1.12 + + + + javax.jws + jsr181-api + 1.0-MR1 + + + javax.annotation + jsr250-api + 1.0 + + + + + wsimport + generate-test-sources + + wsimport + + + org.apache.tuscany.implementation.bpel.example.helloworld + ${basedir}/src/test/resources/helloworld/ + + helloworld.wsdl + + ${project.build.directory}/jaxws-source + false + true + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/java/helloworld/HelloWorld.java b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/java/helloworld/HelloWorld.java new file mode 100644 index 0000000000..0999e97065 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/java/helloworld/HelloWorld.java @@ -0,0 +1,45 @@ +/* + * 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.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType; +import org.oasisopen.sca.annotation.Reference; + +/** + * @version $Rev$ $Date$ + */ +public class HelloWorld { + private HelloPortType helloService; + + public HelloWorld() { + super(); + } + + @Reference + public void setHelloService(HelloPortType helloService){ + this.helloService = helloService; + } + + public String hello(String hello) throws java.rmi.RemoteException { + System.out.println(">>> Invoking helloService.hello with : " + hello); + return this.helloService.hello(hello); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/java/helloworld/HelloWorldTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/java/helloworld/HelloWorldTestCase.java new file mode 100644 index 0000000000..86e6e4e9c5 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/java/helloworld/HelloWorldTestCase.java @@ -0,0 +1,73 @@ +/* + * 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 junit.framework.Assert; + +import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +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; + +/** + * Tests the BPEL Helloworld Service + * + * @version $Rev$ $Date$ + */ +public class HelloWorldTestCase { + + private static Node node; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUp() throws Exception { + String location = ContributionLocationHelper.getContributionLocation("helloworld/helloworld.composite"); + node = NodeFactory.newInstance().createNode("helloworld/helloworld.composite", new Contribution("c1", location)); + node.start(); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDown() throws Exception { + node.stop(); + } + + @Test + public void testServiceInvocation() throws Exception { + HelloPortType bpelService = node.getService(HelloPortType.class, "BPELHelloWorldService"); + String response = bpelService.hello("Hello"); + Assert.assertEquals("Hello World", response); + } + + @Test + public void testReferenceInvocation() throws Exception { + HelloWorld bpelService = node.getService(HelloWorld.class, "BPELHelloWorld"); + String response = bpelService.hello("Hello"); + Assert.assertEquals("Hello World", response); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.bpel b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.bpel new file mode 100644 index 0000000000..156e32e9ee --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.bpel @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + concat($helloMessage.TestPart/test:message/text(), ' World') + + + + + + + + Dummy + + + + + + + + $helloMessageResponse.TestResponse/test:messageResponse + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.composite b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.composite new file mode 100644 index 0000000000..832c8f3702 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.wsdl b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.wsdl new file mode 100644 index 0000000000..c77318e8fd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/resources/helloworld/helloworld.wsdl @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/resources/log4j.properties b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/resources/log4j.properties new file mode 100644 index 0000000000..37f66e4189 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/helloworld/src/test/resources/log4j.properties @@ -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. +# + +# Set root logger level to WARN and its only appender to CONSOLE +log4j.rootLogger=OFF, CONSOLE + +# log4j properties to work with commandline tools. +log4j.category.org.mortbay=OFF +log4j.category.org.hibernate.type=OFF +log4j.category.org.objectweb=OFF +log4j.category.org.apache.ode.axis2=OFF +log4j.category.org.apache.ode.bpel.engine=OFF +log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=OFF +log4j.category.org.apache.ode.bpel.epr=OFF +log4j.category.org.apache.tuscany.sca.implementation.bpel=DEBUG +log4j.category.org.apache.tuscany.sca.implementation.bpel.ode=DEBUG +log4j.category.org.apache.tuscany.sca.implementation.bpel.provider=DEBUG + +# Console appender +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=[%p] - %C{1}.%M(%L) | %m%n diff --git a/tags/java/sca/2.0-M4-RC2/itest/bpel/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/bpel/pom.xml new file mode 100644 index 0000000000..bdd7788a37 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/bpel/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-bpel + pom + Apache Tuscany SCA BPEL Integration Tests + + + helloworld + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/builder/pom.xml new file mode 100644 index 0000000000..04d9fd64e0 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/pom.xml @@ -0,0 +1,119 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-builder + Apache Tuscany SCA iTest Builder + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-monitor + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-binding-sca-runtime + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-assembly + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-core-databinding + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-M4 + test + + + + xerces + xercesImpl + 2.8.1 + test + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDImpl.java b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDImpl.java new file mode 100644 index 0000000000..b0dc7a6389 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDImpl.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.itest.builder; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * Implementation class for ComponentD. + * + * @version $Rev$ $Date$ + */ +@Service({Service3.class, Service3a.class}) +public class ComponentDImpl implements Service3, Service3a { + + @Reference + protected Service3a reference3; + + public String getGreetings(String name) { + return "Hello, " + name + "!"; + } + + public String getGreetings2(String name) { + return "Goodbye, " + name + "!"; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDReferenceMultiplicityImpl.java b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDReferenceMultiplicityImpl.java new file mode 100644 index 0000000000..bf73a64027 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDReferenceMultiplicityImpl.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.builder; + +import java.util.List; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * Implementation class for ComponentD. + * + * @version $Rev$ $Date$ + */ +@Service({Service3.class, Service3a.class}) +public class ComponentDReferenceMultiplicityImpl implements Service3, Service3a { + + @Reference + protected Service3a reference3; + + @Reference + protected List reference3a; + + public String getGreetings(String name) { + return "Hello, " + name + "!"; + } + + public String getGreetings2(String name) { + return "Goodbye, " + name + "!"; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentEImpl.java b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentEImpl.java new file mode 100644 index 0000000000..6f36b1c55a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentEImpl.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.builder; + +import org.oasisopen.sca.annotation.Service; + + +/** + * Implementation class for ComponentD. + * + * @version $Rev$ $Date$ + */ +@Service({Service3.class}) +public class ComponentEImpl implements Service3 { + + + public String getGreetings(String name) { + return "Hello, " + name + " from ComponentE"; + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentFImpl.java b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentFImpl.java new file mode 100644 index 0000000000..8c5c5de208 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentFImpl.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.builder; + +import org.oasisopen.sca.annotation.Service; + + +/** + * Implementation class for ComponentD. + * + * @version $Rev$ $Date$ + */ +@Service({Service3.class}) +public class ComponentFImpl implements Service3 { + + + public String getGreetings(String name) { + return "Hello, " + name + " from ComponentF"; + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3.java b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3.java new file mode 100644 index 0000000000..f4b8d2cf39 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3.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 org.apache.tuscany.sca.itest.builder; + +import org.oasisopen.sca.annotation.Remotable; + + +/** + * Interface for Service3 in ComponentD. + * + * @version $Rev$ $Date$ + */ +@Remotable +public interface Service3 { + + String getGreetings(String name); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3a.java b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3a.java new file mode 100644 index 0000000000..299f7606e3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3a.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 org.apache.tuscany.sca.itest.builder; + +import org.oasisopen.sca.annotation.Remotable; + + +/** + * Interface for Service3a in ComponentD. + * + * @version $Rev$ $Date$ + */ +@Remotable +public interface Service3a { + + String getGreetings2(String name); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario1/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario1/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..d8cb23bbd3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario1/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario1/scenario1.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario1/scenario1.composite new file mode 100644 index 0000000000..4e58cdfa16 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario1/scenario1.composite @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario1/scenario1a.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario1/scenario1a.composite new file mode 100644 index 0000000000..06b273c7a7 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario1/scenario1a.composite @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario10/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario10/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ac01b3c687 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario10/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario10/scenario10.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario10/scenario10.composite new file mode 100644 index 0000000000..2d127a7bec --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario10/scenario10.composite @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario10/scenario10a.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario10/scenario10a.composite new file mode 100644 index 0000000000..98103e360e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario10/scenario10a.composite @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario10/service3.wsdl b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario10/service3.wsdl new file mode 100644 index 0000000000..2477e23dc6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario10/service3.wsdl @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario11/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario11/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..8b82b43c68 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario11/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario11/scenario11.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario11/scenario11.composite new file mode 100644 index 0000000000..2f5ca96d07 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario11/scenario11.composite @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario11/scenario11a.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario11/scenario11a.composite new file mode 100644 index 0000000000..381ccddcc3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario11/scenario11a.composite @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario11/service3.wsdl b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario11/service3.wsdl new file mode 100644 index 0000000000..2477e23dc6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario11/service3.wsdl @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario12/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario12/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..4028098023 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario12/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario12/scenario12.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario12/scenario12.composite new file mode 100644 index 0000000000..23799f8487 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario12/scenario12.composite @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario12/scenario12a.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario12/scenario12a.composite new file mode 100644 index 0000000000..a2b4f88dc3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario12/scenario12a.composite @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario13/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario13/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..1da59d5f04 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario13/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario13/scenario13.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario13/scenario13.composite new file mode 100644 index 0000000000..631e38855f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario13/scenario13.composite @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario13/scenario13a.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario13/scenario13a.composite new file mode 100644 index 0000000000..98976dc4e8 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario13/scenario13a.composite @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario2/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario2/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b1d01afafb --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario2/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario2/scenario2.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario2/scenario2.composite new file mode 100644 index 0000000000..7672595959 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario2/scenario2.composite @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario2/scenario2a.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario2/scenario2a.composite new file mode 100644 index 0000000000..2fe3592d12 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario2/scenario2a.composite @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario3/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario3/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..22950dfe03 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario3/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario3/scenario3.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario3/scenario3.composite new file mode 100644 index 0000000000..84f42c60fc --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario3/scenario3.composite @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario3/scenario3a.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario3/scenario3a.composite new file mode 100644 index 0000000000..18ed91142c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario3/scenario3a.composite @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario4/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario4/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..a17e27c9d8 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario4/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario4/scenario4.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario4/scenario4.composite new file mode 100644 index 0000000000..a0bdb0197d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario4/scenario4.composite @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario4/scenario4a.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario4/scenario4a.composite new file mode 100644 index 0000000000..1b4cf27c76 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario4/scenario4a.composite @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario5/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario5/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..83a232db6e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario5/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario5/scenario5.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario5/scenario5.composite new file mode 100644 index 0000000000..2326afd2f2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario5/scenario5.composite @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario5/scenario5a.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario5/scenario5a.composite new file mode 100644 index 0000000000..fdf1423b66 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario5/scenario5a.composite @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario5/scenarios.wsdl b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario5/scenarios.wsdl new file mode 100644 index 0000000000..5cda7327dd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario5/scenarios.wsdl @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario6/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario6/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..776dfe4d97 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario6/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario6/scenario6.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario6/scenario6.composite new file mode 100644 index 0000000000..9575612d51 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario6/scenario6.composite @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario6/scenario6a.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario6/scenario6a.composite new file mode 100644 index 0000000000..9c7b58e2cb --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario6/scenario6a.composite @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario6/scenarios.wsdl b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario6/scenarios.wsdl new file mode 100644 index 0000000000..5cda7327dd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario6/scenarios.wsdl @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario7/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario7/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ede31d6bee --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario7/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario7/scenario7.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario7/scenario7.composite new file mode 100644 index 0000000000..e1d2e0cefe --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario7/scenario7.composite @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario7/scenario7a.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario7/scenario7a.composite new file mode 100644 index 0000000000..ef16dc0785 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario7/scenario7a.composite @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario7/scenarios.wsdl b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario7/scenarios.wsdl new file mode 100644 index 0000000000..5cda7327dd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario7/scenarios.wsdl @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario8/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario8/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..7bb9e694a3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario8/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario8/scenario8.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario8/scenario8.composite new file mode 100644 index 0000000000..467b7f57fa --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario8/scenario8.composite @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario8/scenario8a.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario8/scenario8a.composite new file mode 100644 index 0000000000..9d9b5ba945 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario8/scenario8a.composite @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario8/scenarios.wsdl b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario8/scenarios.wsdl new file mode 100644 index 0000000000..5cda7327dd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario8/scenarios.wsdl @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario9/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario9/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b6ec160506 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario9/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario9/scenario9.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario9/scenario9.composite new file mode 100644 index 0000000000..83584ed482 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario9/scenario9.composite @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario9/scenario9a.composite b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario9/scenario9a.composite new file mode 100644 index 0000000000..0021ec242b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/main/resources/scenario9/scenario9a.composite @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java new file mode 100644 index 0000000000..6d41581371 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java @@ -0,0 +1,814 @@ +/* + * 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.builder; + +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.xml.namespace.QName; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.assembly.Component; +import org.apache.tuscany.sca.assembly.ComponentService; +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.binding.ws.WebServiceBinding; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Load and build some composites and inspect the results. + * + * @version $Rev$ $Date$ + */ +public class BuilderTestCase { + private CustomCompositeBuilder customBuilder; + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } + + /* OASIS doesn't take notice of top level composite services + * + // Scenario 1: on outer composite service CompositeA/Service1 + @Ignore + @Test + public void testScenario1() throws Exception { + System.out.println("====>Running testScenario1"); + customBuilder = new CustomCompositeBuilder(false); + customBuilder.loadContribution("scenario1.composite", "TestContribution", "src/main/resources/scenario1/"); + //TestUtils.printResults(customBuilder); + TestUtils.checkProblems(customBuilder); + checkScenario1Results(false); + } + + @Ignore + @Test + public void testScenario1NonWiring() throws Exception { + System.out.println("====>Running testScenario1NonWiring"); + customBuilder = new CustomCompositeBuilder(true); + customBuilder.loadContribution("scenario1.composite", "TestContribution", "src/main/resources/scenario1/"); + //TestUtils.printResults(customBuilder); + TestUtils.checkProblems(customBuilder); + checkScenario1Results(true); + } + + private void checkScenario1Results(boolean nonWiring) { + Composite domainComposite = customBuilder.getDomainComposite(); + + Component componentD = TestUtils.getComponent(domainComposite, "ComponentD"); + if (!nonWiring) { + // Should create component service $promoted$Service1 on innermost component + // ComponentD, with and uri="/Service1" + // No other services on ComponentD should have + WebServiceBinding wsBinding = null; + for (ComponentService service : componentD.getServices()) { + WebServiceBinding wsb = service.getBinding(WebServiceBinding.class); + if ("$promoted$Service1".equals(service.getName())) { + wsBinding = wsb; + } else { + assert wsb == null; + } + } + assert "/Service1".equals(wsBinding.getURI()); + + // Should create WSDL document for ComponentD/$promoted$Service1 with endpoint uri="/Service1" + Definition def = wsBinding.getWSDLDocument(); + javax.wsdl.Service svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service")); + Port port = svc.getPort("Service3Port"); + assert "/Service1".equals(TestUtils.getPortAddress(port)); + } else { + // Should not create component service $promoted$Service1 on innermost component ComponentD + // No component services on ComponentD should have + for (ComponentService service : componentD.getServices()) { + assert !"$promoted$Service1".equals(service.getName()); + assert service.getBinding(WebServiceBinding.class) == null; + } + } + + // No services on ComponentB should have + Component componentB = TestUtils.getComponent(domainComposite, "ComponentB"); + for (ComponentService service : componentB.getServices()) { + assert service.getBinding(WebServiceBinding.class) == null; + } + + // No services on CompositeC should have + Composite compositeC = TestUtils.getComposite(domainComposite, new QName("http://scenario1", "CompositeC")); + for (Service service : compositeC.getServices()) { + assert service.getBinding(WebServiceBinding.class) == null; + } + + if (nonWiring) { + // Should not add a WSDL document to domain composite service Service1 + WebServiceBinding wsBinding = null; + for (Service service : domainComposite.getServices()) { + if ("Service1".equals(service.getName())) { + wsBinding = service.getBinding(WebServiceBinding.class); + } + } + assert wsBinding.getWSDLDocument() == null; + } + + String expectedEndpoints = "Component - ComponentB\n" + + "Service - Service2\n" + + "Endpoint - Service2\n" + + "Service - Service2a\n" + + "Endpoint - Service2a\n" + + "Reference - reference2\n" + + "Component - ComponentB has composite impl\n" + + " Component - ComponentD\n" + + " Service - Service3\n" + + " Endpoint - Service3\n" + + " Service - Service3a\n" + + " Endpoint - Service3a\n" + + " Reference - reference3"; + + String actualEndpoints = TestUtils.printEndpoints(domainComposite); + System.out.println(actualEndpoints); + + Assert.assertEquals(expectedEndpoints, actualEndpoints); + } +*/ + + // Scenario 2: on outer component service ComponentB/Service2 + @Test + public void testScenario2() throws Exception { + System.out.println("====>Running testScenario2"); + customBuilder = new CustomCompositeBuilder(false); + customBuilder.loadContribution("scenario2.composite", "TestContribution", "src/main/resources/scenario2/"); + //TestUtils.printResults(customBuilder); + TestUtils.checkProblems(customBuilder); + checkScenario2and3Results("http://scenario2", false); + } + + public void testScenario2NonWiring() throws Exception { + System.out.println("====>Running testScenario2NonWiring"); + customBuilder = new CustomCompositeBuilder(true); + customBuilder.loadContribution("scenario2.composite", "TestContribution", "src/main/resources/scenario2/"); + //TestUtils.printResults(customBuilder); + TestUtils.checkProblems(customBuilder); + checkScenario2and3Results("http://scenario2", true); + } + + private void checkScenario2and3Results(String namespace, boolean nonWiring) { + Composite domainComposite = customBuilder.getDomainComposite(); + + // Test that endpoint structure matches expected + String structure = TestUtils.printStructure(domainComposite, ""); + System.out.println(structure); + + String expectedStructure = "Component URI - ComponentB\n" + + " Component URI - ComponentB/ComponentD\n" + + " Endpoint: URI = ComponentB/ComponentD#service-binding(Service3/Service3) org.apache.tuscany.sca.assembly.impl.SCABindingImpl\n" + + " Endpoint: URI = ComponentB/ComponentD#service-binding(Service3a/Service3a) org.apache.tuscany.sca.assembly.impl.SCABindingImpl\n" + + "Endpoint: URI = ComponentB#service-binding(Service2/Service2) org.apache.tuscany.sca.binding.ws.impl.WebServiceBindingImpl\n" + + "Endpoint: URI = ComponentB#service-binding(Service2a/Service3a) org.apache.tuscany.sca.assembly.impl.SCABindingImpl\n"; + + Assert.assertEquals(expectedStructure, structure); + + // Test that generated WSDL matches expected + // Should create WSDL document for ComponentB/Service2 with endpoint uri="/ComponentB/Service2" + // No other services on ComponentB should have + Component componentB = TestUtils.getComponent(domainComposite, "ComponentB"); + WebServiceBinding wsBinding = null; + + for (ComponentService service : componentB.getServices()) { + WebServiceBinding wsb = service.getBinding(WebServiceBinding.class); + if ("Service2".equals(service.getName())) { + wsBinding = wsb; + } else { + assert wsb == null; + } + } + + Definition def = wsBinding.getWSDLDocument(); + TestUtils.writeWSDL(def); + + javax.wsdl.Service svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service")); + Port port = svc.getPort("Service3Port"); + Assert.assertEquals("/ComponentB/Service2",TestUtils.getPortAddress(port)); + + } +/* + // Scenario 3: on inner composite service CompositeC/Service2 + public void testScenario3() throws Exception { + System.out.println("====>Running testScenario3"); + customBuilder = new CustomCompositeBuilder(false); + customBuilder.loadContribution("scenario3.composite", "TestContribution", "src/main/resources/scenario3/"); + //TestUtils.printResults(customBuilder); + TestUtils.checkProblems(customBuilder); + checkScenario2and3Results("http://scenario3", false); + } + + public void testScenario3NonWiring() throws Exception { + System.out.println("====>Running testScenario3NonWiring"); + customBuilder = new CustomCompositeBuilder(true); + customBuilder.loadContribution("scenario3.composite", "TestContribution", "src/main/resources/scenario3/"); + //TestUtils.printResults(customBuilder); + TestUtils.checkProblems(customBuilder); + checkScenario2and3Results("http://scenario3", true); + } + + // Scenario 4: on inner component service ComponentD/Service3 + public void testScenario4() throws Exception { + System.out.println("====>Running testScenario4"); + customBuilder = new CustomCompositeBuilder(false); + customBuilder.loadContribution("scenario4.composite", "TestContribution", "src/main/resources/scenario4/"); + //TestUtils.printResults(customBuilder); + TestUtils.checkProblems(customBuilder); + checkScenario4Results(false); + } + + public void testScenario4NonWiring() throws Exception { + System.out.println("====>Running testScenario4NonWiring"); + customBuilder = new CustomCompositeBuilder(true); + customBuilder.loadContribution("scenario4.composite", "TestContribution", "src/main/resources/scenario4/"); + //TestUtils.printResults(customBuilder); + TestUtils.checkProblems(customBuilder); + checkScenario4Results(true); + } + + private void checkScenario4Results(boolean nonWiring) { + Composite domainComposite = customBuilder.getDomainComposite(); + + // Should create WSDL document for ComponentD/Service3 with endpoint uri="/ComponentD/Service3" + Component componentD = TestUtils.getComponent(domainComposite, "ComponentD"); + WebServiceBinding wsBinding = null; + for (ComponentService service : componentD.getServices()) { + if ("Service3".equals(service.getName())) { + wsBinding = service.getBinding(WebServiceBinding.class); + } + } + Definition def = wsBinding.getWSDLDocument(); + javax.wsdl.Service svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service")); + Port port = svc.getPort("Service3Port"); + assert "/ComponentB/ComponentD/Service3".equals(TestUtils.getPortAddress(port)); + + // Should add to inner composite service CompositeC/Service2 + // No other services on CompositeC should have + Composite compositeC = TestUtils.getComposite(domainComposite, new QName("http://scenario4", "CompositeC")); + wsBinding = null; + for (Service service : compositeC.getServices()) { + WebServiceBinding wsb = service.getBinding(WebServiceBinding.class); + if ("Service2".equals(service.getName())) { + wsBinding = wsb; + } else { + assert wsb == null; + } + } + assert "/ComponentB/Service2".equals(wsBinding.getURI()); + + // Should add to outer component service ComponentB/Service2 + // Should create WSDL document for ComponentB/Service2 with endpoint uri="/ComponentB/Service2" + // No other services on ComponentB should have + Component componentB = TestUtils.getComponent(domainComposite, "ComponentB"); + wsBinding = null; + for (ComponentService service : componentB.getServices()) { + WebServiceBinding wsb = service.getBinding(WebServiceBinding.class); + if ("Service2".equals(service.getName())) { + wsBinding = wsb; + } else { + assert wsb == null; + } + } + assert "/ComponentB/Service2".equals(wsBinding.getURI()); + def = wsBinding.getWSDLDocument(); + svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service")); + port = svc.getPort("Service3Port"); + assert "/ComponentB/Service2".equals(TestUtils.getPortAddress(port)); + + if (!nonWiring) { + // Should create component service $promoted$ComponentB$slash$Service2 on innermost component + // ComponentD, with and uri="/ComponentB/Service2" + wsBinding = null; + for (ComponentService service : componentD.getServices()) { + if ("$promoted$ComponentB$slash$Service2".equals(service.getName())) { + wsBinding = service.getBinding(WebServiceBinding.class); + } + } + assert "/ComponentB/Service2".equals(wsBinding.getURI()); + + // Should create WSDL document for ComponentD/$promoted$ComponentB$slash$Service2 with endpoint uri="/ComponentB/Service2" + def = wsBinding.getWSDLDocument(); + svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service")); + port = svc.getPort("Service3Port"); + assert "/ComponentB/Service2".equals(TestUtils.getPortAddress(port)); + } else { + // Should not create component service $promoted$ComponentB$slash$Service2 on innermost component ComponentD + for (ComponentService service : componentD.getServices()) { + assert !"$promoted$ComponentB$slash$Service2".equals(service.getName()); + } + } + + // Should add to outer composite service CompositeA/Service1 + wsBinding = null; + for (Service service : domainComposite.getServices()) { + if ("Service1".equals(service.getName())) { + wsBinding = service.getBinding(WebServiceBinding.class); + } + } + assert wsBinding != null; + if (nonWiring) { + // Should not add a WSDL document to domain composite service Service1 + assert wsBinding.getWSDLDocument() == null; + } + + if (!nonWiring) { + // Should create component service $promoted$Service1 on innermost component + // ComponentD, with and uri="/Service1" + wsBinding = null; + for (ComponentService service : componentD.getServices()) { + if ("$promoted$Service1".equals(service.getName())) { + wsBinding = service.getBinding(WebServiceBinding.class); + } + } + assert "/Service1".equals(wsBinding.getURI()); + + // Should create WSDL document for ComponentD/$promoted$Service1 with endpoint uri="/Service1" + def = wsBinding.getWSDLDocument(); + svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service")); + port = svc.getPort("Service3Port"); + assert "/Service1".equals(TestUtils.getPortAddress(port)); + } else { + // Should not create component service $promoted$.Service1 on innermost component ComponentD + for (ComponentService service : componentD.getServices()) { + assert !"$promoted$Service1".equals(service.getName()); + } + } + + // No services on ComponentD should have , except for Service3, + // $promoted$.Service1 and $promoted$.ComponentB.Service2 + for (ComponentService service : componentD.getServices()) { + if (!"Service3".equals(service.getName()) && + !"$promoted$Service1".equals(service.getName()) && + !"$promoted$ComponentB$slash$Service2".equals(service.getName())) { + assert service.getBinding(WebServiceBinding.class) == null; + } + } + } + + // Scenario 5: and on outer composite reference CompositeA/reference1 + @Test + public void testScenario5() throws Exception { + System.out.println("====>Running testScenario5"); + customBuilder = new CustomCompositeBuilder(false); + customBuilder.loadContribution("scenario5.composite", "TestContribution", "src/main/resources/scenario5/"); + //TestUtils.printResults(customBuilder); + TestUtils.checkProblems(customBuilder); + checkScenario5Results(false); + } + + @Test + public void testScenario5NonWiring() throws Exception { + System.out.println("====>Running testScenario5NonWiring"); + customBuilder = new CustomCompositeBuilder(true); + customBuilder.loadContribution("scenario5.composite", "TestContribution", "src/main/resources/scenario5/"); + //TestUtils.printResults(customBuilder); + TestUtils.checkProblems(customBuilder); + checkScenario5Results(true); + } + + private void checkScenario5Results(boolean nonWiring) { + Composite domainComposite = customBuilder.getDomainComposite(); + + // Should not add to any outer component references + Component componentB = TestUtils.getComponent(domainComposite, "ComponentB"); + for (ComponentReference reference : componentB.getReferences()) { + assert reference.getBinding(WebServiceBinding.class) == null; + } + + Definition def; + javax.wsdl.Service svc; + Port port; + WebServiceBinding wsBinding; + Component componentD = TestUtils.getComponent(domainComposite, "ComponentD"); + if (!nonWiring) { + // Should add to inner component reference ComponentD/reference3 with uri="http://foo.com/bar" + // Should set on inner component reference ComponentD/reference3 + wsBinding = null; + for (ComponentReference reference : componentD.getReferences()) { + if ("reference3".equals(reference.getName())) { + wsBinding = reference.getBinding(WebServiceBinding.class); + assert reference.getInterfaceContract(wsBinding) instanceof WSDLInterfaceContract; + } + } + assert "http://foo.com/bar".equals(wsBinding.getURI()); + + // Should create WSDL document for ComponentD/reference3 with endpoint uri="http://foo.com/bar" + def = wsBinding.getWSDLDocument(); + svc = def.getService(new QName("http://scenarios/ComponentD/reference3", "Service3aService")); + port = svc.getPort("Service3aPort"); + assert "http://foo.com/bar".equals(TestUtils.getPortAddress(port)); + } else { + // Should not add to any inner component references + for (ComponentReference reference : componentD.getReferences()) { + assert reference.getBinding(WebServiceBinding.class) == null; + } + } + + // Should not add or to inner composite reference CompositeC/reference2 + Composite compositeC = TestUtils.getComposite(domainComposite, new QName("http://scenario5", "CompositeC")); + for (Reference reference : compositeC.getReferences()) { + assert reference.getBinding(WebServiceBinding.class) == null; + assert reference.getInterfaceContract() instanceof JavaInterfaceContract; + } + + String expectedEndpoints = "Component - ComponentB\n" + + "Service - Service2\n" + + "Endpoint - Service2\n" + + "Service - Service2a\n" + + "Endpoint - Service2a\n" + + "Reference - reference2\n" + + "Component - ComponentB has composite impl\n" + + " Component - ComponentD\n" + + " Service - Service3\n" + + " Endpoint - Service3\n" + + " Service - Service3a\n" + + " Endpoint - Service3a\n" + + " Reference - reference3"; + + String actualEndpoints = TestUtils.printEndpoints(domainComposite); + System.out.println(actualEndpoints); + + Assert.assertEquals(expectedEndpoints, actualEndpoints); + } + + + // Scenario 6: and on outer component reference ComponentB/reference2 + @Ignore + @Test + public void testScenario6() throws Exception { + System.out.println("====>Running testScenario6"); + customBuilder = new CustomCompositeBuilder(false); + customBuilder.loadContribution("scenario6.composite", "TestContribution", "src/main/resources/scenario6/"); + //TestUtils.printResults(customBuilder); + TestUtils.checkProblems(customBuilder); + checkScenario6and7Results("http://scenario6", false); + } + + @Ignore + @Test + public void testScenario6NonWiring() throws Exception { + System.out.println("====>Running testScenario6NonWiring"); + customBuilder = new CustomCompositeBuilder(true); + customBuilder.loadContribution("scenario6.composite", "TestContribution", "src/main/resources/scenario6/"); + //TestUtils.printResults(customBuilder); + TestUtils.checkProblems(customBuilder); + checkScenario6and7Results("http://scenario6", true); + } + + private void checkScenario6and7Results(String namespace, boolean nonWiring) { + Composite domainComposite = customBuilder.getDomainComposite(); + + // Should remove target= on ComponentB/reference2 (for Scenario 6) or + // CompositeC/reference2 (for Scenario 7), and add uri="http://foo.com/bar" + // to the element on ComponentB/reference2 + // For nonWiring, ComponentB/reference2 should have target= + // and no uri= should be added + Component componentB = TestUtils.getComponent(domainComposite, "ComponentB"); + WebServiceBinding wsBinding = null; + for (ComponentReference reference : componentB.getReferences()) { + if ("reference2".equals(reference.getName())) { + if (!nonWiring) { + assert reference.getTargets().size() == 0; + } else { + assert reference.getTargets().size() == 1; + } + wsBinding = reference.getBinding(WebServiceBinding.class); + } + } + if (!nonWiring) { + assert "http://foo.com/bar".equals(wsBinding.getURI()); + } else { + assert wsBinding.getURI() == null; + } + + Definition def; + javax.wsdl.Service svc; + Port port; + if (!nonWiring) { + // Should create WSDL document for ComponentB/reference2 with endpoint uri="http://foo.com/bar" + def = wsBinding.getWSDLDocument(); + svc = def.getService(new QName("http://scenarios/ComponentB/reference2", "Service3aService")); + port = svc.getPort("Service3aPort"); + assert "http://foo.com/bar".equals(TestUtils.getPortAddress(port)); + } + + Component componentD = TestUtils.getComponent(domainComposite, "ComponentD"); + if (!nonWiring) { + // Should add to inner component reference ComponentD/reference3 with uri="http://foo.com/bar" + // Should set on inner component reference ComponentD/reference3 + wsBinding = null; + for (ComponentReference reference : componentD.getReferences()) { + if ("reference3".equals(reference.getName())) { + wsBinding = reference.getBinding(WebServiceBinding.class); + assert reference.getBindings().size() == 1; + assert reference.getInterfaceContract(wsBinding) instanceof WSDLInterfaceContract; + } + } + assert "http://foo.com/bar".equals(wsBinding.getURI()); + + // Should create WSDL document for ComponentD/reference3 with endpoint uri="http://foo.com/bar" + def = wsBinding.getWSDLDocument(); + svc = def.getService(new QName("http://scenarios/ComponentB/reference2", "Service3aService")); + port = svc.getPort("Service3aPort"); + assert "http://foo.com/bar".equals(TestUtils.getPortAddress(port)); + } else { + // Should not add to any inner component references + for (ComponentReference reference : componentD.getReferences()) { + assert reference.getBinding(WebServiceBinding.class) == null; + } + } + + // No references on CompositeC should have or , except for + // reference2 in Scenario 7 + Composite compositeC = TestUtils.getComposite(domainComposite, new QName(namespace, "CompositeC")); + for (Reference reference : compositeC.getReferences()) { + if ("http://scenario7".equals(namespace) && "reference2".equals(reference.getName())) { + assert reference.getBinding(WebServiceBinding.class)!= null; + assert reference.getInterfaceContract() instanceof WSDLInterfaceContract; + } else { + assert reference.getBinding(WebServiceBinding.class) == null; + assert reference.getInterfaceContract() instanceof JavaInterfaceContract; + } + } + + // Should add and to outer composite reference CompositeA/reference1 + wsBinding = null; + for (Reference reference : domainComposite.getReferences()) { + if ("reference1".equals(reference.getName())) { + wsBinding = reference.getBinding(WebServiceBinding.class); + assert reference.getInterfaceContract() instanceof WSDLInterfaceContract; + } + } + assert wsBinding.getURI() == null; + + // Should not add a WSDL document to domain composite reference reference1 + assert wsBinding.getWSDLDocument() == null; + + String expectedEndpoints = "Component - ComponentB\n" + + "Service - Service2\n" + + "Endpoint - Service2\n" + + "Service - Service2a\n" + + "Endpoint - Service2a\n" + + "Reference - reference2\n" + + "Component - ComponentB has composite impl\n" + + " Component - ComponentD\n" + + " Service - Service3\n" + + " Endpoint - Service3\n" + + " Service - Service3a\n" + + " Endpoint - Service3a\n" + + " Reference - reference3"; + + String actualEndpoints = TestUtils.printEndpoints(domainComposite); + System.out.println(actualEndpoints); + + Assert.assertEquals(expectedEndpoints, actualEndpoints); + } + + // Scenario 7: and on inner composite reference CompositeC/reference2 + public void testScenario7() throws Exception { + System.out.println("====>Running testScenario7"); + customBuilder = new CustomCompositeBuilder(false); + customBuilder.loadContribution("scenario7.composite", "TestContribution", "src/main/resources/scenario7/"); + //TestUtils.printResults(customBuilder); + TestUtils.checkProblems(customBuilder); + checkScenario6and7Results("http://scenario7", false); + } + + public void testScenario7NonWiring() throws Exception { + System.out.println("====>Running testScenario7NonWiring"); + customBuilder = new CustomCompositeBuilder(true); + customBuilder.loadContribution("scenario7.composite", "TestContribution", "src/main/resources/scenario7/"); + //TestUtils.printResults(customBuilder); + TestUtils.checkProblems(customBuilder); + checkScenario6and7Results("http://scenario7", true); + } + + // Scenario 8: and on inner component reference ComponentD/reference3 + public void testScenario8() throws Exception { + System.out.println("====>Running testScenario8"); + customBuilder = new CustomCompositeBuilder(false); + customBuilder.loadContribution("scenario8.composite", "TestContribution", "src/main/resources/scenario8/"); + //TestUtils.printResults(customBuilder); + TestUtils.checkProblems(customBuilder); + checkScenario8Results(false); + } + + public void testScenario8NonWiring() throws Exception { + System.out.println("====>Running testScenario8NonWiring"); + customBuilder = new CustomCompositeBuilder(true); + customBuilder.loadContribution("scenario8.composite", "TestContribution", "src/main/resources/scenario8/"); + //TestUtils.printResults(customBuilder); + TestUtils.checkProblems(customBuilder); + checkScenario8Results(true); + } + + private void checkScenario8Results(boolean nonWiring) { + Composite domainComposite = customBuilder.getDomainComposite(); + + // Should replace target= on ComponentD/reference3 by uri="http://foo.com/bar" on + // For nonWiring, the original target= is preserved and there is no uri= + Component componentD = TestUtils.getComponent(domainComposite, "ComponentD"); + WebServiceBinding wsBinding = null; + for (ComponentReference reference : componentD.getReferences()) { + if ("reference3".equals(reference.getName())) { + if (!nonWiring) { + assert reference.getTargets().size() == 0; + } else { + assert reference.getTargets().size() == 1; + } + wsBinding = reference.getBinding(WebServiceBinding.class); + } + } + if (!nonWiring) { + assert "http://foo.com/bar".equals(wsBinding.getURI()); + } else { + assert wsBinding.getURI() == null; + } + + Definition def; + javax.wsdl.Service svc; + Port port; + if (!nonWiring) { + // Should create WSDL document for ComponentD/reference3 with endpoint uri="http://foo.com/bar" + def = wsBinding.getWSDLDocument(); + svc = def.getService(new QName("http://scenarios/ComponentD/reference3", "Service3aService")); + port = svc.getPort("Service3aPort"); + assert "http://foo.com/bar".equals(TestUtils.getPortAddress(port)); + } + + // Should add and to inner composite reference CompositeC/reference2 + Composite compositeC = TestUtils.getComposite(domainComposite, new QName("http://scenario8", "CompositeC")); + wsBinding = null; + for (Reference reference : compositeC.getReferences()) { + if ("reference2".equals(reference.getName())) { + wsBinding = reference.getBinding(WebServiceBinding.class); + assert reference.getInterfaceContract() instanceof WSDLInterfaceContract; + } + } + assert wsBinding.getURI() == null; + + // Should add and to outer component reference ComponentB/reference2 + Component componentB = TestUtils.getComponent(domainComposite, "ComponentB"); + wsBinding = null; + for (ComponentReference reference : componentB.getReferences()) { + if ("reference2".equals(reference.getName())) { + wsBinding = reference.getBinding(WebServiceBinding.class); + assert reference.getInterfaceContract() instanceof WSDLInterfaceContract; + } + } + assert wsBinding.getURI() == null; + + // Should add and to outer composite reference CompositeA/reference1 + wsBinding = null; + for (Reference reference : domainComposite.getReferences()) { + if ("reference1".equals(reference.getName())) { + wsBinding = reference.getBinding(WebServiceBinding.class); + assert reference.getInterfaceContract() instanceof WSDLInterfaceContract; + } + } + assert wsBinding.getURI() == null; + + // Should not add a WSDL document to domain composite reference reference1 + assert wsBinding.getWSDLDocument() == null; + } + + // Scenario 9: target in reference CDR3A and binding.ws uri= at CAR1A + public void testScenario9() throws Exception { + System.out.println("====>Running testScenario9"); + customBuilder = new CustomCompositeBuilder(false); + customBuilder.loadContribution("scenario9.composite", "TestContribution", "src/main/resources/scenario9/"); + //TestUtils.printResults(customBuilder); + TestUtils.checkProblems(customBuilder); + checkScenario9Results(); + } + + private void checkScenario9Results() { + Composite domainComposite = customBuilder.getDomainComposite(); + + Component componentD = TestUtils.getComponent(domainComposite, "ComponentD"); + ComponentReference componentRef = null; + for (ComponentReference reference : componentD.getReferences()) { + if ("reference3a".equals(reference.getName())) { + componentRef = reference; + assertTrue(reference.getBindings().size() == 2); + assertTrue(reference.getBindings().get(0) instanceof SCABinding); + assertTrue(reference.getBindings().get(1) instanceof WebServiceBinding); + } + } + assertTrue(componentRef != null); + } + + // Scenario 10: targets in references CBR2A and CDR3A and binding.ws at CBR2A + public void testScenario10() throws Exception { + System.out.println("====>Running testScenario10"); + customBuilder = new CustomCompositeBuilder(false); + customBuilder.loadContribution("scenario10.composite", "TestContribution", "src/main/resources/scenario10/"); + //TestUtils.printResults(customBuilder); + TestUtils.checkProblems(customBuilder); + checkScenario10And11Results(); + } + + // Scenario 11: targets in references CBR2A and CDR3A and binding.ws at CCR2A + public void testScenario11() throws Exception { + System.out.println("====>Running testScenario11"); + customBuilder = new CustomCompositeBuilder(false); + customBuilder.loadContribution("scenario11.composite", "TestContribution", "src/main/resources/scenario11/"); + //TestUtils.printResults(customBuilder); + TestUtils.checkProblems(customBuilder); + checkScenario10And11Results(); + } + + private void checkScenario10And11Results() { + Composite domainComposite = customBuilder.getDomainComposite(); + + Component componentD = TestUtils.getComponent(domainComposite, "ComponentD"); + ComponentReference componentRef = null; + for (ComponentReference reference : componentD.getReferences()) { + if ("reference3a".equals(reference.getName())) { + componentRef = reference; + assertTrue(reference.getBindings().size() == 2); + Binding binding1 = reference.getBindings().get(0); + assertTrue(binding1 instanceof SCABinding); + assertTrue(reference.getInterfaceContract(binding1) instanceof JavaInterfaceContract); + Binding binding2 = reference.getBindings().get(1); + assertTrue(binding2 instanceof WebServiceBinding); + assertTrue(reference.getInterfaceContract(binding2) instanceof WSDLInterfaceContract); + } + } + assertTrue(componentRef != null); + } + + // Scenario 12: targets in references CBR2A and CDR3A and binding.ws at CDR3A + public void testScenario12() throws Exception { + System.out.println("====>Running testScenario12"); + customBuilder = new CustomCompositeBuilder(false); + customBuilder.loadContribution("scenario12.composite", "TestContribution", "src/main/resources/scenario12/"); + //TestUtils.printResults(customBuilder); + TestUtils.checkProblems(customBuilder); + checkScenario12Results(); + } + + private void checkScenario12Results() { + Composite domainComposite = customBuilder.getDomainComposite(); + + Component componentD = TestUtils.getComponent(domainComposite, "ComponentD"); + ComponentReference componentRef = null; + for (ComponentReference reference : componentD.getReferences()) { + if ("reference3a".equals(reference.getName())) { + componentRef = reference; + assertTrue(reference.getBindings().size() == 2); + assertTrue(reference.getBindings().get(0) instanceof WebServiceBinding); + assertTrue(reference.getBindings().get(1) instanceof WebServiceBinding); + } + } + assertTrue(componentRef != null); + } + + // Scenario 13: target in reference CDR3A + public void testScenario13() throws Exception { + System.out.println("====>Running testScenario13"); + customBuilder = new CustomCompositeBuilder(false); + customBuilder.loadContribution("scenario13.composite", "TestContribution", "src/main/resources/scenario13/"); + //TestUtils.printResults(customBuilder); + TestUtils.checkProblems(customBuilder); + checkScenario13Results(); + } + + private void checkScenario13Results() { + Composite domainComposite = customBuilder.getDomainComposite(); + + Component componentD = TestUtils.getComponent(domainComposite, "ComponentD"); + ComponentReference componentRef = null; + for (ComponentReference reference : componentD.getReferences()) { + if ("reference3a".equals(reference.getName())) { + componentRef = reference; + assertTrue(reference.getBindings().size() == 1); + assertTrue(reference.getBindings().get(0) instanceof WebServiceBinding); + } + } + assertTrue(componentRef != null); + } +*/ +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java b/tags/java/sca/2.0-M4-RC2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java new file mode 100644 index 0000000000..27768f3799 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java @@ -0,0 +1,99 @@ +/* + * 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.builder; + +import javax.xml.stream.XMLOutputFactory; + +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.apache.tuscany.sca.node.impl.NodeImpl; +import org.apache.tuscany.sca.runtime.CompositeActivator; + + +public class CustomCompositeBuilder { + + private boolean nonWiring; + private Node node; + private ExtensionPointRegistry extensionPoints; + private Monitor monitor; + private StAXArtifactProcessor compositeProcessor; + + public CustomCompositeBuilder(boolean nonWiring) { + this.nonWiring = nonWiring; + } + + public void loadContribution(String compositeURL, String sourceURI, String sourceURL) throws Exception { + NodeFactory nodeFactory = NodeFactory.newInstance(); + node = nodeFactory.createNode(compositeURL, new Contribution(sourceURI, sourceURL)); + node.start(); + + // get some things out of the extension registry + extensionPoints = ((NodeImpl)node).getExtensionPoints(); + + UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + monitor = monitorFactory.createMonitor(); + + StAXArtifactProcessorExtensionPoint xmlProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); + compositeProcessor = xmlProcessors.getProcessor(Composite.class); + + CompositeActivator compositeActivator = utilities.getUtility(CompositeActivator.class); + } + + /** + * Returns the delegating model processor. + * @return the delegating model processor + */ + public StAXArtifactProcessor getModelProcessor() { + return null;//compositeProcessor; + } + + /** + * Returns the XML output factory. + * @return the XML output factory + */ + public XMLOutputFactory getOutputFactory() { + return null; //outputFactory; + } + + /** + * Returns the domain composite. + * @return the domain composite model object + */ + public Composite getDomainComposite() { + return (Composite) ((NodeImpl)node).getDomainComposite(); + } + + /** + * Returns the monitor. + * @return the monitor instance + */ + public Monitor getMonitor() { + return monitor; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/TestUtils.java b/tags/java/sca/2.0-M4-RC2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/TestUtils.java new file mode 100644 index 0000000000..c5eb7a70ea --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/TestUtils.java @@ -0,0 +1,319 @@ +/* + * 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.builder; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; + +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.WSDLException; +import javax.wsdl.extensions.soap.SOAPAddress; +import javax.wsdl.extensions.soap12.SOAP12Address; +import javax.wsdl.factory.WSDLFactory; +import javax.wsdl.xml.WSDLWriter; +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.stream.XMLStreamWriter; + +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.Component; +import org.apache.tuscany.sca.assembly.ComponentReference; +import org.apache.tuscany.sca.assembly.ComponentService; +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.assembly.Contract; +import org.apache.tuscany.sca.assembly.Endpoint; +import org.apache.tuscany.sca.assembly.EndpointReference; +import org.apache.tuscany.sca.assembly.Implementation; +import org.apache.tuscany.sca.assembly.Reference; +import org.apache.tuscany.sca.assembly.Service; +import org.apache.tuscany.sca.assembly.impl.EndpointImpl; +import org.apache.tuscany.sca.assembly.impl.EndpointReferenceImpl; +import org.apache.tuscany.sca.binding.ws.WebServiceBinding; +import org.apache.tuscany.sca.contribution.processor.ProcessorContext; +import org.apache.tuscany.sca.monitor.Problem; +import org.apache.xml.serialize.OutputFormat; +import org.apache.xml.serialize.XMLSerializer; +import org.w3c.dom.Document; + +/** + * Static utility methods for use by test cases. + * + * @version $Rev$ $Date$ + */ +public class TestUtils { + + protected static void checkProblems(CustomCompositeBuilder customBuilder) throws Exception { + boolean problems = false; + for (Problem problem : customBuilder.getMonitor().getProblems()) { + if (problem.getCause() != null) { + problem.getCause().printStackTrace(); + } + if (problem.getSeverity() == Problem.Severity.ERROR){ + problems = true; + } + } + assert !problems; + } + + protected static String getPortAddress(Port port) { + Object ext = port.getExtensibilityElements().get(0); + String returnAddress = null; + if (ext instanceof SOAPAddress) { + returnAddress = ((SOAPAddress)ext).getLocationURI(); + } + if (ext instanceof SOAP12Address) { + returnAddress = ((SOAP12Address)ext).getLocationURI(); + } + + returnAddress = returnAddress.substring(returnAddress.indexOf("//") + 2); + returnAddress = returnAddress.substring(returnAddress.indexOf("/")); + + return returnAddress; + } + + protected static Component getComponent(Composite composite, String name) { + for (Component component : composite.getComponents()) { + if (name.equals(component.getName())) { + return component; + } + // process implementation composites recursively + Implementation impl = component.getImplementation(); + if (impl instanceof Composite) { + Component comp = getComponent((Composite)impl, name); + if (comp != null) { + return comp; + } + } + } + return null; + } + + protected static Composite getComposite(Composite composite, QName name) { + if (name.equals(composite.getName())) { + return composite; + } + for (Component component : composite.getComponents()) { + // process implementation composites recursively + Implementation impl = component.getImplementation(); + if (impl instanceof Composite) { + Composite comp = getComposite((Composite)impl, name); + if (comp != null) { + return comp; + } + } + } + return null; + } + + protected static void printResults(CustomCompositeBuilder customBuilder) throws Exception { + for (Problem problem : customBuilder.getMonitor().getProblems()) { + if (problem.getCause() != null) { + problem.getCause().printStackTrace(); + } + } + Composite domainComposite = customBuilder.getDomainComposite(); + printComposite(domainComposite, customBuilder); + } + + private static void printComposite(Composite composite, CustomCompositeBuilder customBuilder) throws Exception { + // process implementation composites recursively + for (Component component : composite.getComponents()) { + Implementation implementation = component.getImplementation(); + if (implementation instanceof Composite) { + printComposite((Composite)implementation, customBuilder); + } + } + + // write out the SCDL + writeSCDL(composite, customBuilder); + + // find all the component service and reference bindings + for (Component component : composite.getComponents()) { + for (ComponentService componentService : component.getServices()) { + for (Binding binding : componentService.getBindings()) { + if (binding instanceof WebServiceBinding) { + writeWSDL(component, componentService, ((WebServiceBinding)binding).getWSDLDocument()); + } + } + } + for (ComponentReference componentReference : component.getReferences()) { + for (Binding binding : componentReference.getBindings()) { + if (binding instanceof WebServiceBinding) { + writeWSDL(component, componentReference, ((WebServiceBinding)binding).getWSDLDocument()); + } + } + } + } + + // find all the composite service and reference bindings + for (Service service : composite.getServices()) { + for (Binding binding : service.getBindings()) { + if (binding instanceof WebServiceBinding) { + writeWSDL(null, service, ((WebServiceBinding)binding).getWSDLDocument()); + } + } + } + for (Reference reference : composite.getReferences()) { + for (Binding binding : reference.getBindings()) { + if (binding instanceof WebServiceBinding) { + writeWSDL(null, reference, ((WebServiceBinding)binding).getWSDLDocument()); + } + } + } + } + + private static void writeSCDL(Composite composite, CustomCompositeBuilder customBuilder) throws Exception { + // Print out a composite + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + XMLStreamWriter writer = customBuilder.getOutputFactory().createXMLStreamWriter(bos); + customBuilder.getModelProcessor().write(composite, writer, new ProcessorContext()); + + // Parse and write again to pretty format it + DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + Document document = documentBuilder.parse(new ByteArrayInputStream(bos.toByteArray())); + OutputFormat format = new OutputFormat(); + format.setIndenting(true); + format.setIndent(2); + XMLSerializer serializer = new XMLSerializer(System.out, format); + System.out.println("-->Runtime SCDL model for composite " + composite.getName()); + serializer.serialize(document); + } + + private static void writeWSDL(Component component, Contract contract, Definition definition) { + if (definition == null) { + System.out.println("-->No generated WSDL for " + (component != null ? component.getName() : "") + "/" + contract.getName()); + } else { + try { + System.out.println("-->Generated WSDL for " + (component != null ? component.getName() : "") + "/" + contract.getName()); + WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter(); + writer.writeWSDL(definition, System.out); + } catch (WSDLException e) { + // ignore + } + } + } + + protected static void writeWSDL(Definition definition) { + try { + WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter(); + writer.writeWSDL(definition, System.out); + } catch (WSDLException e) { + // ignore + } + } + + protected static String printStructure(Composite composite, String indent){ + String structure = ""; + for (Component component : composite.getComponents()){ + structure += indent + "Component URI - " + component.getURI() + "\n"; + + // recurse for composite implementations + Implementation implementation = component.getImplementation(); + if (implementation instanceof Composite) { + structure += printStructure((Composite)implementation, indent + " "); + } + + for (Service service : component.getServices()){ + for (Endpoint endpoint : service.getEndpoints()){ + structure += indent + ((EndpointImpl)endpoint).toStringWithoutHash() + " " + endpoint.getBinding().getClass().getName() + "\n"; + } + } + for (Reference reference : component.getReferences()){ + for (EndpointReference endpointReference : reference.getEndpointReferences()){ + structure += indent + ((EndpointReferenceImpl)endpointReference).toStringWithoutHash() + " " + endpointReference.getBinding().getClass().getName() + "\n"; + } + } + } + return structure; + } +/* + protected static String printEndpoints(Composite composite){ + return printEndpoints(composite, ""); + } + + protected static String printEndpoints(Composite composite, String indent){ + + String buffer = ""; + + for (Component component : composite.getComponents()) { + buffer += indent + "Component - " + component.getName() + "\n"; + + // print component service endpoints + for (ComponentService componentService : component.getServices()) { + buffer += indent + "Service - " + componentService.getName() + "\n"; + for (Endpoint endpoint : componentService.getEndpoints()) { + if (endpoint.getBinding() != null){ + buffer += printEndpoint(endpoint, indent); + } + } + } + + for (ComponentReference componentReference : component.getReferences()) { + buffer += indent + "Reference - " + componentReference.getName() + "\n"; + for (EndpointReference endpointReference : componentReference.getEndpointReferences()) { + buffer += printEndpointReference(endpointReference, indent); + } + } + + // process implementation composites recursively + Implementation implementation = component.getImplementation(); + if (implementation instanceof Composite) { + buffer += indent + "Component - " + component.getName() + " has composite impl" + "\n"; + buffer += printEndpoints((Composite)implementation, indent + " "); + } + } + + return buffer; + } + + protected static String printEndpoint(Endpoint endpoint, String indent){ + String buffer = ""; + + buffer += indent + " Endpoint - Component: " + endpoint.getComponent().getName() +"\n"; + buffer += indent + " Service: " + endpoint.getService().getName() +"\n"; + buffer += indent + " Binding: " + endpoint.getBinding().getName() +"\n"; + + return buffer; + } + + protected static String printEndpointReference(EndpointReference endpointReference, String indent){ + String buffer = ""; + + buffer += indent + " EndpointReference - Component: " + endpointReference.getComponent().getName() +"\n"; + buffer += indent + " Reference: " + endpointReference.getReference().getName() +"\n"; + if (endpointReference.getTargetEndpoint() != null){ + buffer += indent + " Wired: " +"\n"; + buffer += indent + " Target: " + endpointReference.getTargetEndpoint().getComponent().getName()+"\n"; + if (endpointReference.getTargetEndpoint() != null && + endpointReference.getTargetEndpoint().isUnresolved() == false){ + buffer += indent + " Binding: " + endpointReference.getBinding().getName() +"\n"; + buffer += indent + " TargetEndpoint: " + endpointReference.getTargetEndpoint().getBinding().getName()+"\n"; + } else { + buffer += indent + " Unresolved: " +"\n"; + } + } else { + buffer += indent + " NonWired: " +"\n"; + } + + return buffer; + } +*/ +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-api/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/callback-api/pom.xml new file mode 100644 index 0000000000..212bf0f572 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-api/pom.xml @@ -0,0 +1,58 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-callback-api + Apache Tuscany SCA iTest Callback API + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + test + + + + + + ${basedir}/../build-was-integration.xml + ${basedir}/../wasAdmin.py + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java b/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java new file mode 100644 index 0000000000..b013462f9f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.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.test; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +/** + * + */ +public interface CallBackApiCallBack { + /** + * This function is defined in CallBackApiClientImpl + */ + void callBackMessage(String aString); + + /** + * This function is defined in CallBackApiClientImpl + */ + void callBackIncrement(String aString); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java b/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java new file mode 100644 index 0000000000..252e4dc45f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.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.test; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface CallBackApiClient { + /** + * This function is defined in CallBackApiClientImpl + */ + void run(); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java new file mode 100644 index 0000000000..d883dc2d6f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java @@ -0,0 +1,201 @@ +/* + * 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.test; + +import org.junit.Assert; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +@Service(CallBackApiClient.class) +public class CallBackApiClientImpl implements CallBackApiClient, CallBackApiCallBack { + + @Reference + protected CallBackApiService aCallBackService; + + private static String returnMessage = null; + private static int callBackCount = 0; + private static Object monitor = new Object(); + + /** + * This test calls function test 3a,3a1,3b,3c + */ + public void run() { + + // This tests basic callback patterns. + + // Test3a is the basic callback where the target calls back prior to + // returning to the client. + test3a(); + + test3a1(); + + // Test3b is where the target does not call back to the client. + test3b(); + + // Test3c is where the target calls back multiple times to the client. + test3c(); + } + + /** + * This test is the basic callback where the target calls back prior to returning to the client. + */ + + private void test3a() { + aCallBackService.knockKnock("Knock Knock"); + int count = 0; + + // + // If we can't get a response in 30 seconds consider this a failure + // + + synchronized (monitor) { + while (returnMessage == null && count++ < 30) { + try { + monitor.wait(1000L); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + Assert.assertEquals("CallBackApiITest - test3a", "Who's There", this.getReturnMessage()); + + } + + /** + * This test is the basic callback where the target calls back prior to returning to the client. + */ + private void test3a1() { + aCallBackService.knockKnockByRef("Knock Knock"); + int count = 0; + + // + // If we can't get a response in 30 seconds consider this a failure + // + + synchronized (monitor) { + while (returnMessage == null && count++ < 30) { + try { + monitor.wait(1000L); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + Assert.assertEquals("CallBackApiITest - test3a", "Who's There", this.getReturnMessage()); + + } + + /** + * This test is the basic callback where the target does not call back to the client + */ + private void test3b() { + aCallBackService.noCallBack("No Reply Desired"); + Assert.assertEquals("CallBackApiITest - test3b", 1, 1); + } + + /** + * This test is the basic callback where the target calls back multiple times to the client + */ + + private void test3c() { + aCallBackService.multiCallBack("Call me back 3 times"); + int count = 0; + + // + // If we can't get a response in 30 seconds consider this a failure + // + + synchronized (monitor) { + while (this.getCallBackCount() < 3 && count++ < 30) { + try { + monitor.wait(1000L); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + Assert.assertEquals("CallBackApiITest - test3c", 3, this.getCallBackCount()); + } + + /** + * This function returns a string + * + * @param void + * @return String result string + */ + + public String getReturnMessage() { + return returnMessage; + } + + /** + * This function set the returnMessage string + * + * @param String + */ + public void setReturnMessage(String aReturnMessage) { + returnMessage = aReturnMessage; + } + + /** + * This function returns the callBackCount variable + * + * @return Integer callBackCount variable + */ + public int getCallBackCount() { + return callBackCount; + } + + /** + * This function increments callBackCount variable by 1 + */ + public void incrementCallBackCount() { + callBackCount++; + } + + /** + * This function prints a message synched with setReturnMessage function + * + * @param String + */ + public void callBackMessage(String aString) { + System.out.println("Entering callback callBackMessage: " + aString); + synchronized (monitor) { + this.setReturnMessage(aString); + monitor.notify(); + } + } + + /** + * This function prints a message synched with incrementCallBackCount function + * + * @param String + */ + public void callBackIncrement(String aString) { + System.out.println("Entering callback increment: " + aString); + synchronized (monitor) { + this.incrementCallBackCount(); + monitor.notify(); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java b/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java new file mode 100644 index 0000000000..afb7c45e2c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java @@ -0,0 +1,50 @@ +/* + * 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.test; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +@Callback(CallBackApiCallBack.class) +/** + * + */ +public interface CallBackApiService { + /** + * This function is defined in CallBackApiServiceImpl + */ + void knockKnock(String aString); + + /** + * This function is defined in CallBackApiServiceImpl + */ + void knockKnockByRef(String aString); + + /** + * This function is defined in CallBackApiServiceImpl + */ + void noCallBack(String aString); + + /** + * This function is defined in CallBackApiServiceImpl + */ + void multiCallBack(String aString); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java new file mode 100644 index 0000000000..44f57b4316 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java @@ -0,0 +1,113 @@ +/* + * 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.test; + +import org.oasisopen.sca.ComponentContext; +import org.oasisopen.sca.RequestContext; +import org.oasisopen.sca.ServiceReference; +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Context; +import org.oasisopen.sca.annotation.Service; + +@Service(CallBackApiService.class) +public class CallBackApiServiceImpl implements CallBackApiService { + + @Context + protected ComponentContext componentContext; + /** + * Object of CallBackApiCallBack class + */ + private CallBackApiCallBack callback; + + @Callback + protected ServiceReference callbackRef; + + /** + * This function get an object of CallBackApiServiceImpl by calling getCallBackInterface function and calls the + * callBackMessage function. + * + * @param aString String passed by a function call + */ + + public void knockKnock(String aString) { + + System.out.println("CallBackApiServiceImpl message received: " + aString); + callback = this.getCallBackInterface(); + callback.callBackMessage("Who's There"); + System.out.println("CallBackApiServiceImpl response sent"); + } + + /** + * This function calls the callBackMessage function.
+ * The reference to this function is received from Call back reference to the class CallBackApiService. + * + * @param aString String passed by a function call + */ + public void knockKnockByRef(String aString) { + + System.out.println("CallBackApiServiceImpl message received: " + aString); + callbackRef.getService().callBackMessage("Who's There"); + System.out.println("CallBackApiServiceImpl response sent"); + } + + /** + * This function get an object of CallBackApiServiceImpl by calling getCallBackInterface function.
+ * This function then places multiple callBack using the callbackIncrement function defined in + * callBack.ApiServiceImpl + * + * @param aString String passed by a function call + */ + public void multiCallBack(String aString) { + + callback = this.getCallBackInterface(); + + System.out.println("CallBackApiServiceImpl message received: " + aString); + callback.callBackIncrement("Who's There 1"); + System.out.println("CallBackApiServiceImpl response sent"); + callback.callBackIncrement("Who's There 2"); + System.out.println("CallBackApiServiceImpl response sent"); + callback.callBackIncrement("Who's There 3"); + System.out.println("CallBackApiServiceImpl response sent"); + } + + /** + * This function does not callBack any function. + * + * @param aString String passed by a function call + */ + public void noCallBack(String aString) { + System.out.println("CallBackApiServiceImpl message received: " + aString); + } + + /** + * This function get an object of CallBackApiServiceImpl from the present componentContext + * + * @param void + */ + private CallBackApiCallBack getCallBackInterface() { + System.out.println("CallBackApiServiceImpl getting request context"); + RequestContext rc = componentContext.getRequestContext(); + System.out.println("CallBackApiServiceImpl getting callback from request context"); + callback = rc.getCallback(); + System.out.println("CallBackApiServiceImpl returning callback"); + return callback; + + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/resources/CallBackApiTest.composite b/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/resources/CallBackApiTest.composite new file mode 100644 index 0000000000..309311e258 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/resources/CallBackApiTest.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..55736e5254 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTestCase.java new file mode 100644 index 0000000000..75fab95efb --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTestCase.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.test; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +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 CallBackApiTestCase { + + private static Node node; + private CallBackApiClient aCallBackClient; + + /** + * This function uses the Instance of CallBackApiClient.class
+ * This function calls the run function defined in the CallBackApiClinet Interface
+ * which in turn executes the following test cases.
+ * 1. Basic callback patterns
+ * 2. Test in which the target does not call back to the client
+ * 3. Test in which the target calls back multiple times to the client. + */ + @Test + public void testCallBackBasic() { + aCallBackClient = node.getService(CallBackApiClient.class, "CallBackApiClient"); + aCallBackClient.run(); + } + + /** + * This function creates the Node instance and gets an Instance of CallBackApiClient.class + */ + + @BeforeClass + public static void setUp() throws Exception { + if (node == null) { + String location = ContributionLocationHelper.getContributionLocation("CallBackApiTest.composite"); + node = NodeFactory.newInstance().createNode("CallBackApiTest.composite", new Contribution("c1", location)); + node.start(); + } + } + + /** + * This function destroys the Node instance that was created in setUp() + */ + + @AfterClass + public static void tearDown() throws Exception { + node.stop(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/pom.xml new file mode 100644 index 0000000000..4be520aabd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/pom.xml @@ -0,0 +1,78 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-callback-basic-ws + Apache Tuscany SCA iTest Callback Basic WebServices + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-host-http + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-M4 + test + + + + + ${basedir}/../build-was-integration.xml + ${basedir}/../wasAdmin.py + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java b/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java new file mode 100644 index 0000000000..291a72b9d6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.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.test; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +/** + * + */ +public interface CallBackBasicCallBack { + + void callBackMessage(String aString); + + void callBackIncrement(String aString); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.java b/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.java new file mode 100644 index 0000000000..19f366c423 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.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 org.apache.tuscany.sca.test; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface CallBackBasicClient { + + void run(); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java new file mode 100644 index 0000000000..4bb6b29a8d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java @@ -0,0 +1,129 @@ +/* + * 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.test; + +import org.junit.Assert; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +@Service(CallBackBasicClient.class) +public class CallBackBasicClientImpl implements CallBackBasicClient, CallBackBasicCallBack { + + @Reference + protected CallBackBasicService aCallBackService; + private static String returnMessage = null; + private static int callBackCount = 0; + private static Object monitor = new Object(); + + public void run() { + + // This tests basic callback patterns. + + // Test1 is the basic callback where the target calls back prior to + // returning to the client. + test1a(); + + // Test2 is where the target does not call back to the client. + test1b(); + + // Test3 is where the target calls back multiple times to the client. + test1c(); + } + + private void test1a() { + aCallBackService.knockKnock("Knock Knock"); + int count = 0; + + // + // If we can't get a response in 30 seconds consider this a failure + // + + synchronized (monitor) { + while (returnMessage == null && count++ < 30) { + try { + monitor.wait(1000L); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + Assert.assertEquals("CallBackBasicITest - test1a", "Who's There", this.getReturnMessage()); + + } + + private void test1b() { + aCallBackService.noCallBack("No Reply Desired"); + Assert.assertEquals("CallBackBasicITest - test1b", 1, 1); + } + + private void test1c() { + aCallBackService.multiCallBack("Call me back 3 times"); + int count = 0; + + // + // If we can't get a response in 30 seconds consider this a failure + // + + synchronized (monitor) { + while (this.getCallBackCount() < 3 && count++ < 30) { + try { + monitor.wait(1000L); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + Assert.assertEquals("CallBackBasicITest - test1c", 3, this.getCallBackCount()); + } + + public String getReturnMessage() { + return returnMessage; + } + + public void setReturnMessage(String aReturnMessage) { + returnMessage = aReturnMessage; + } + + public int getCallBackCount() { + return callBackCount; + } + + public void incrementCallBackCount() { + callBackCount++; + } + + public void callBackMessage(String aString) { + System.out.println("Entering callback callBackMessage: " + aString); + synchronized (monitor) { + this.setReturnMessage(aString); + monitor.notify(); + } + } + + public void callBackIncrement(String aString) { + System.out.println("Entering callback increment: " + aString); + synchronized (monitor) { + this.incrementCallBackCount(); + monitor.notify(); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.java b/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.java new file mode 100644 index 0000000000..5396879e83 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.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 org.apache.tuscany.sca.test; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +@Callback(CallBackBasicCallBack.class) +/** + * + */ +public interface CallBackBasicService { + + void knockKnock(String aString); + + void noCallBack(String aString); + + void multiCallBack(String aString); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java new file mode 100644 index 0000000000..07010f61e1 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java @@ -0,0 +1,56 @@ +/* + * 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.test; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Service; + +@Service(CallBackBasicService.class) +public class CallBackBasicServiceImpl implements CallBackBasicService { + + @Callback + protected CallBackBasicCallBack callback; + + public void knockKnock(String aString) { + + System.out.println("CallBackBasicServiceImpl message received: " + aString); + callback.callBackMessage("Who's There"); + System.out.println("CallBackBasicServiceImpl response sent"); + + } + + public void multiCallBack(String aString) { + + System.out.println("CallBackBasicServiceImpl message received: " + aString); + callback.callBackIncrement("Who's There 1"); + System.out.println("CallBackBasicServiceImpl response sent"); + callback.callBackIncrement("Who's There 2"); + System.out.println("CallBackBasicServiceImpl response sent"); + callback.callBackIncrement("Who's There 3"); + System.out.println("CallBackBasicServiceImpl response sent"); + + } + + public void noCallBack(String aString) { + + System.out.println("CallBackBasicServiceImpl message received: " + aString); + // System.out.println("CallBackBasicServiceImpl No response desired"); + + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/resources/CallBackBasicTest.composite b/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/resources/CallBackBasicTest.composite new file mode 100644 index 0000000000..db1a2fbf6a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/resources/CallBackBasicTest.composite @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b58fabcd79 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java new file mode 100644 index 0000000000..43b812faed --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-basic-ws/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java @@ -0,0 +1,56 @@ +/* + * 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.test; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CallBackBasicTestCase { + + private static Node node; + private CallBackBasicClient aCallBackClient; + + @Test + public void testCallBackBasic() { + aCallBackClient.run(); + } + + @Before + public void setUp() throws Exception { + if (node == null) { + String location = ContributionLocationHelper.getContributionLocation("CallBackBasicTest.composite"); + node = NodeFactory.newInstance().createNode("CallBackBasicTest.composite", new Contribution("c1", location)); + node.start(); + } + + aCallBackClient = node.getService(CallBackBasicClient.class, "CallBackBasicClient"); + } + + @After + public void tearDown() throws Exception { + node.stop(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-basic/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/callback-basic/pom.xml new file mode 100644 index 0000000000..f281878d17 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-basic/pom.xml @@ -0,0 +1,58 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-callback-basic + Apache Tuscany SCA iTest Callback Basic + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + test + + + + + + ${basedir}/../build-was-integration.xml + ${basedir}/../wasAdmin.py + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java b/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java new file mode 100644 index 0000000000..291a72b9d6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.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.test; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +/** + * + */ +public interface CallBackBasicCallBack { + + void callBackMessage(String aString); + + void callBackIncrement(String aString); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.java b/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.java new file mode 100644 index 0000000000..19f366c423 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.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 org.apache.tuscany.sca.test; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface CallBackBasicClient { + + void run(); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java new file mode 100644 index 0000000000..4bb6b29a8d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java @@ -0,0 +1,129 @@ +/* + * 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.test; + +import org.junit.Assert; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +@Service(CallBackBasicClient.class) +public class CallBackBasicClientImpl implements CallBackBasicClient, CallBackBasicCallBack { + + @Reference + protected CallBackBasicService aCallBackService; + private static String returnMessage = null; + private static int callBackCount = 0; + private static Object monitor = new Object(); + + public void run() { + + // This tests basic callback patterns. + + // Test1 is the basic callback where the target calls back prior to + // returning to the client. + test1a(); + + // Test2 is where the target does not call back to the client. + test1b(); + + // Test3 is where the target calls back multiple times to the client. + test1c(); + } + + private void test1a() { + aCallBackService.knockKnock("Knock Knock"); + int count = 0; + + // + // If we can't get a response in 30 seconds consider this a failure + // + + synchronized (monitor) { + while (returnMessage == null && count++ < 30) { + try { + monitor.wait(1000L); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + Assert.assertEquals("CallBackBasicITest - test1a", "Who's There", this.getReturnMessage()); + + } + + private void test1b() { + aCallBackService.noCallBack("No Reply Desired"); + Assert.assertEquals("CallBackBasicITest - test1b", 1, 1); + } + + private void test1c() { + aCallBackService.multiCallBack("Call me back 3 times"); + int count = 0; + + // + // If we can't get a response in 30 seconds consider this a failure + // + + synchronized (monitor) { + while (this.getCallBackCount() < 3 && count++ < 30) { + try { + monitor.wait(1000L); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + Assert.assertEquals("CallBackBasicITest - test1c", 3, this.getCallBackCount()); + } + + public String getReturnMessage() { + return returnMessage; + } + + public void setReturnMessage(String aReturnMessage) { + returnMessage = aReturnMessage; + } + + public int getCallBackCount() { + return callBackCount; + } + + public void incrementCallBackCount() { + callBackCount++; + } + + public void callBackMessage(String aString) { + System.out.println("Entering callback callBackMessage: " + aString); + synchronized (monitor) { + this.setReturnMessage(aString); + monitor.notify(); + } + } + + public void callBackIncrement(String aString) { + System.out.println("Entering callback increment: " + aString); + synchronized (monitor) { + this.incrementCallBackCount(); + monitor.notify(); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.java b/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.java new file mode 100644 index 0000000000..5396879e83 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.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 org.apache.tuscany.sca.test; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +@Callback(CallBackBasicCallBack.class) +/** + * + */ +public interface CallBackBasicService { + + void knockKnock(String aString); + + void noCallBack(String aString); + + void multiCallBack(String aString); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java new file mode 100644 index 0000000000..07010f61e1 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java @@ -0,0 +1,56 @@ +/* + * 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.test; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Service; + +@Service(CallBackBasicService.class) +public class CallBackBasicServiceImpl implements CallBackBasicService { + + @Callback + protected CallBackBasicCallBack callback; + + public void knockKnock(String aString) { + + System.out.println("CallBackBasicServiceImpl message received: " + aString); + callback.callBackMessage("Who's There"); + System.out.println("CallBackBasicServiceImpl response sent"); + + } + + public void multiCallBack(String aString) { + + System.out.println("CallBackBasicServiceImpl message received: " + aString); + callback.callBackIncrement("Who's There 1"); + System.out.println("CallBackBasicServiceImpl response sent"); + callback.callBackIncrement("Who's There 2"); + System.out.println("CallBackBasicServiceImpl response sent"); + callback.callBackIncrement("Who's There 3"); + System.out.println("CallBackBasicServiceImpl response sent"); + + } + + public void noCallBack(String aString) { + + System.out.println("CallBackBasicServiceImpl message received: " + aString); + // System.out.println("CallBackBasicServiceImpl No response desired"); + + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/resources/CallBackBasicTest.composite b/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/resources/CallBackBasicTest.composite new file mode 100644 index 0000000000..87cde940e1 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/resources/CallBackBasicTest.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b58fabcd79 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java new file mode 100644 index 0000000000..43b812faed --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java @@ -0,0 +1,56 @@ +/* + * 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.test; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CallBackBasicTestCase { + + private static Node node; + private CallBackBasicClient aCallBackClient; + + @Test + public void testCallBackBasic() { + aCallBackClient.run(); + } + + @Before + public void setUp() throws Exception { + if (node == null) { + String location = ContributionLocationHelper.getContributionLocation("CallBackBasicTest.composite"); + node = NodeFactory.newInstance().createNode("CallBackBasicTest.composite", new Contribution("c1", location)); + node.start(); + } + + aCallBackClient = node.getService(CallBackBasicClient.class, "CallBackBasicClient"); + } + + @After + public void tearDown() throws Exception { + node.stop(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/pom.xml new file mode 100644 index 0000000000..2b22d38030 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/pom.xml @@ -0,0 +1,53 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-callback-complex-type + Apache Tuscany SCA iTest Callback Complex Type + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + test + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.java b/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.java new file mode 100644 index 0000000000..627d37e27d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.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.test; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +/** + * + */ +public interface CallBackCTypeCallBack { + + void callBackMessage(String aString); + + void callBackIncrement(String aString); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClient.java b/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClient.java new file mode 100644 index 0000000000..966ad17b9a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClient.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 org.apache.tuscany.sca.test; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface CallBackCTypeClient { + + void run(); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.java new file mode 100644 index 0000000000..d2dc0add75 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.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.test; + +import org.junit.Assert; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +@Service(CallBackCTypeClient.class) +public class CallBackCTypeClientImpl implements CallBackCTypeClient, CallBackCTypeCallBack { + + @Reference + protected CallBackCTypeService aCallBackService; + private static String returnMessage = null; + private static int callBackCount = 0; + private static Object monitor = new Object(); + + public CallBackCTypeClientImpl() { + } + + public void run() { + + // This test is the same as the Basic Callback except it uses a + // componentType side file. + // This test currently fails because the integration test environment + // does not properly copy + // the componentType files to the target folder. This is documented in + // Tuscany-967. + + // Test12a is the basic callback where the target calls back prior to + // returning to the client. + test12a(); + + // Test12b is where the target does not call back to the client. + test12b(); + + // Test12c is where the target calls back multiple times to the client. + test12c(); + + } + + private void test12a() { + aCallBackService.knockKnock("Knock Knock"); + int count = 0; + + // + // If we can't get a response in 30 seconds consider this a failure + // + + synchronized (monitor) { + while (returnMessage == null && count++ < 30) { + try { + monitor.wait(1000L); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + Assert.assertEquals("CallBackBasicITest - test12a -", "Who's There", this.getReturnMessage()); + + } + + private void test12b() { + aCallBackService.noCallBack("No Reply Desired"); + Assert.assertEquals("CallBackBasicITest - test12b -", 1, 1); + } + + private void test12c() { + aCallBackService.multiCallBack("Call me back 3 times"); + int count = 0; + + // + // If we can't get a response in 30 seconds consider this a failure + // + + synchronized (monitor) { + while (this.getCallBackCount() < 3 && count++ < 30) { + try { + monitor.wait(1000L); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + Assert.assertEquals("CallBackBasicITest - test12c -", 3, this.getCallBackCount()); + } + + public String getReturnMessage() { + return returnMessage; + } + + public void setReturnMessage(String aReturnMessage) { + returnMessage = aReturnMessage; + } + + public int getCallBackCount() { + return callBackCount; + } + + public void incrementCallBackCount() { + callBackCount++; + } + + public void callBackMessage(String aString) { + System.out.println("Entering callback callBackMessage: " + aString); + synchronized (monitor) { + this.setReturnMessage(aString); + monitor.notify(); + } + } + + public void callBackIncrement(String aString) { + System.out.println("Entering callback increment: " + aString); + synchronized (monitor) { + this.incrementCallBackCount(); + monitor.notify(); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeService.java b/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeService.java new file mode 100644 index 0000000000..32ab1bdd3e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeService.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 org.apache.tuscany.sca.test; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +@Callback(CallBackCTypeCallBack.class) +/** + * + */ +public interface CallBackCTypeService { + + void knockKnock(String aString); + + void noCallBack(String aString); + + void multiCallBack(String aString); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.java new file mode 100644 index 0000000000..f7a1a195ed --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.java @@ -0,0 +1,59 @@ +/* + * 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.test; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Service; + +@Service(CallBackCTypeService.class) +public class CallBackCTypeServiceImpl implements CallBackCTypeService { + + @Callback + protected CallBackCTypeCallBack callback; + + public CallBackCTypeServiceImpl() { + } + + public void knockKnock(String aString) { + + System.out.println("CallBackCTypeServiceImpl message received: " + aString); + callback.callBackMessage("Who's There"); + System.out.println("CallBackCTypeServiceImpl response sent"); + + } + + public void multiCallBack(String aString) { + + System.out.println("CallBackCTypeServiceImpl message received: " + aString); + callback.callBackIncrement("Who's There 1"); + System.out.println("CallBackCTypeServiceImpl response sent"); + callback.callBackIncrement("Who's There 2"); + System.out.println("CallBackCTypeServiceImpl response sent"); + callback.callBackIncrement("Who's There 3"); + System.out.println("CallBackCTypeServiceImpl response sent"); + + } + + public void noCallBack(String aString) { + + System.out.println("CallBackCTypeServiceImpl message received: " + aString); + System.out.println("CallBackCTypeServiceImpl No response desired"); + + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/resources/CallBackCTypeClient.composite b/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/resources/CallBackCTypeClient.composite new file mode 100644 index 0000000000..2eea567fff --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/resources/CallBackCTypeClient.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.componentType b/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.componentType new file mode 100644 index 0000000000..af0b373472 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.componentType @@ -0,0 +1,28 @@ + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTestCase.java new file mode 100644 index 0000000000..dde489d766 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-complex-type/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTestCase.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.test; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class CallBackCTypeTestCase { + + private Node node; + private CallBackCTypeClient aCallBackClient; + + @Test + public void testCallBackBasic() { + aCallBackClient.run(); + } + + @Before + public void setUp() throws Exception { + String location = ContributionLocationHelper.getContributionLocation("CallBackCTypeClient.composite"); + node = + NodeFactory.newInstance().createNode("CallBackCTypeClient.composite", new Contribution("c1", location)) + .start(); + + aCallBackClient = node.getService(CallBackCTypeClient.class, "CallBackCTypeClient"); + } + + @After + public void tearDown() throws Exception { + node.stop(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/pom.xml new file mode 100644 index 0000000000..39a7f05332 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/pom.xml @@ -0,0 +1,53 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-callback-multiple-wires + Apache Tuscany SCA iTest Callback With Mutiple Wires + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + test + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClient.java b/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClient.java new file mode 100644 index 0000000000..7c80d222fc --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClient.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.test.callback; + +/** + * The client interface + */ +public interface MyClient { + + void aClientMethod(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl1.java b/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl1.java new file mode 100644 index 0000000000..c3ea6c3032 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl1.java @@ -0,0 +1,49 @@ +/* + * 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.test.callback; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +/** + * Demonstrates a component-to-component callback invocation + */ +@Service(MyClient.class) +@Scope("COMPOSITE") +public class MyClientImpl1 implements MyClient, MyServiceCallback { + + private MyService myService; + static String result; + + @Reference + public void setMyService(MyService myService) { + this.myService = myService; + } + + public void aClientMethod() { + myService.someMethod("-> someMethod1"); + } + + public void receiveResult(String result) { + System.out.println("Work thread " + Thread.currentThread()); + System.out.println("Result in client1: " + result); + MyClientImpl1.result = result; + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl2.java b/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl2.java new file mode 100644 index 0000000000..84ca158c97 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyClientImpl2.java @@ -0,0 +1,49 @@ +/* + * 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.test.callback; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +/** + * Demonstrates a component-to-component callback invocation + */ +@Service(MyClient.class) +@Scope("COMPOSITE") +public class MyClientImpl2 implements MyClient, MyServiceCallback { + + private MyService myService; + static String result; + + @Reference + public void setMyService(MyService myService) { + this.myService = myService; + } + + public void aClientMethod() { + myService.someMethod("-> someMethod2"); + } + + public void receiveResult(String result) { + System.out.println("Work thread " + Thread.currentThread()); + System.out.println("Result in client2: " + result); + MyClientImpl2.result = result; + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyService.java b/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyService.java new file mode 100644 index 0000000000..66758a1e73 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyService.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 org.apache.tuscany.sca.test.callback; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.OneWay; + +/** + * This service that will be invoked in a non-blocking fashion + */ +@Callback(MyServiceCallback.class) +public interface MyService { + + @OneWay + void someMethod(String arg); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceCallback.java b/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceCallback.java new file mode 100644 index 0000000000..f198efae51 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceCallback.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.test.callback; + +/** + * The callback interface for {@link MyService}. + */ +public interface MyServiceCallback { + + void receiveResult(String result); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceImpl.java new file mode 100644 index 0000000000..49df5aa17a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/java/org/apache/tuscany/sca/test/callback/MyServiceImpl.java @@ -0,0 +1,45 @@ +/* + * 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.test.callback; + +import org.oasisopen.sca.RequestContext; +import org.oasisopen.sca.annotation.Context; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements MyService and uses a callback. + */ +@Service(MyService.class) +@Scope("COMPOSITE") +public class MyServiceImpl implements MyService { + + @Context + protected RequestContext requestContext; + + public void someMethod(String arg) { + // invoke the callback + try { + MyServiceCallback myServiceCallback = requestContext.getCallback(); + myServiceCallback.receiveResult(arg + " -> receiveResult"); + } catch (RuntimeException e) { + System.out.println("RuntimeException invoking receiveResult: " + e.toString()); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/resources/CallbackMultiWireTest.composite b/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/resources/CallbackMultiWireTest.composite new file mode 100644 index 0000000000..3d0b37eeae --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/main/resources/CallbackMultiWireTest.composite @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/test/java/org/apache/tuscany/sca/test/callback/CallbackMultiWireTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/test/java/org/apache/tuscany/sca/test/callback/CallbackMultiWireTestCase.java new file mode 100644 index 0000000000..bd3cce74b4 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-multiple-wires/src/test/java/org/apache/tuscany/sca/test/callback/CallbackMultiWireTestCase.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.test.callback; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * A TestCase that demonstrates resolving the client service and initiating the callback sequence + */ +public class CallbackMultiWireTestCase { + + private Node node; + private MyClient myClient1; + private MyClient myClient2; + + @Before + public void setUp() throws Exception { + String location = ContributionLocationHelper.getContributionLocation("CallbackMultiWireTest.composite"); + node = NodeFactory.newInstance().createNode("CallbackMultiWireTest.composite", new Contribution("c1", location)); + node.start(); + myClient1 = node.getService(MyClient.class, "MyClientComponent1"); + myClient2 = node.getService(MyClient.class, "MyClientComponent2"); + } + + @After + public void tearDown() throws Exception { + node.stop(); + } + + @Test + public void test() throws Exception { + System.out.println("Main thread " + Thread.currentThread()); + myClient1.aClientMethod(); + myClient2.aClientMethod(); + System.out.println("Sleeping ..."); + Thread.sleep(300); + assertEquals("-> someMethod1 -> receiveResult", MyClientImpl1.result); + assertEquals("-> someMethod2 -> receiveResult", MyClientImpl2.result); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/pom.xml new file mode 100644 index 0000000000..823ef6dd18 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/pom.xml @@ -0,0 +1,53 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-callback-separatethread + Apache Tuscany SCA iTest Callback Using Separate Thread + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + test + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClient.java b/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClient.java new file mode 100644 index 0000000000..dc66003604 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClient.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 org.apache.tuscany.sca.itest; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the client interface for the call backs in a separate thread tests + */ +@Remotable +public interface CallBackSeparateThreadClient { + + /** + * This tests call back patterns using separate threads. + */ + void runTests(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClientImpl.java new file mode 100644 index 0000000000..f03144db8a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadClientImpl.java @@ -0,0 +1,186 @@ +/* + * 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; + +import java.util.concurrent.atomic.AtomicInteger; + +import org.junit.Assert; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * This is the client implementation for the call backs in a separate thread tests + */ +@Service(CallBackSeparateThreadClient.class) +public class CallBackSeparateThreadClientImpl implements CallBackSeparateThreadClient, EventProcessorCallBack { + /** + * Max time to wait to receive events. If not all the events are received then timeout. + */ + private static final int TIMEOUT = 30 * 1000; + + /** + * Counts the number of fast call backs. + */ + private static final AtomicInteger FAST_CALLBACK_COUNT = new AtomicInteger(); + + /** + * Counts the number of slow call backs. + */ + private static final AtomicInteger SLOW_CALLBACK_COUNT = new AtomicInteger(); + + /** + * This is our injected reference to the EventProcessorService + */ + @Reference + protected EventProcessorService aCallBackService; + + /** + * This tests call back patterns using separate threads. + */ + public void runTests() { + try { + // Register for fast call back + registerForFastCallback(); + + // Wait for a few fast call backs + System.out.println("Waiting for some fast call backs"); + waitForSomeFastCallbacks(); + + try { + // Register for slow call back + registerForSlowCallback(); + + // Wait for a few fast call backs + System.out.println("Waiting for some fast calls"); + waitForSomeFastCallbacks(); + + // Wait for a few slow call backs + System.out.println("Waiting for some slow calls"); + waitForSomeSlowCallbacks(); + } finally { + unregisterForSlowCallback(); + } + + System.out.println("Done"); + } finally { + unregisterForFastCallback(); + } + } + + /** + * Waits for some fast call backs to be fired + */ + private void waitForSomeFastCallbacks() { + // Reset the fast call back count + FAST_CALLBACK_COUNT.set(0); + + // Wait until we have 10 fast call backs or timeout occurs + final long start = System.currentTimeMillis(); + do { + if (FAST_CALLBACK_COUNT.get() >= 10) { + System.out.println("Received enough fast notifications"); + return; + } + + try { + Thread.sleep(5); + } catch (InterruptedException e) { + Assert.fail("Unexpeceted exception " + e); + } + } while (System.currentTimeMillis() - start < TIMEOUT); + + // If we get to here then we did not receive enough events + Assert.fail("Did not receive enough fast events"); + } + + /** + * Waits for some slow call backs to be fired + */ + private void waitForSomeSlowCallbacks() { + // Reset the slow call back count + SLOW_CALLBACK_COUNT.set(0); + + // Wait until we have 4 slow call backs or timeout + final long start = System.currentTimeMillis(); + do { + if (SLOW_CALLBACK_COUNT.get() >= 4) { + System.out.println("Received enough slow notifications"); + return; + } + + try { + Thread.sleep(5); + } catch (InterruptedException e) { + Assert.fail("Unexpeceted exception " + e); + } + } while (System.currentTimeMillis() - start < TIMEOUT); + + // If we get to here then we did not receive enough events + Assert.fail("Did not receive enough slow events"); + } + + /** + * Register to receive fast call backs + */ + private void registerForFastCallback() { + aCallBackService.registerForEvent("FAST"); + } + + /** + * Register to receive slow call backs + */ + private void registerForSlowCallback() { + aCallBackService.registerForEvent("SLOW"); + } + + /** + * Unregister to receive fast call backs + */ + private void unregisterForFastCallback() { + aCallBackService.unregisterForEvent("FAST"); + } + + /** + * Unregister to receive slow call backs + */ + private void unregisterForSlowCallback() { + aCallBackService.unregisterForEvent("SLOW"); + } + + /** + * Method that is called when an Event is delivered. + * + * @param aEventName The name of the Event + * @param aEventData The Event data + */ + public void eventNotification(String aEventName, Object aEventData) { + // System.out.println("Received Event : " + aEventName + " " + aEventData); + + if (aEventName.equals("FAST")) { + final int newValue = FAST_CALLBACK_COUNT.incrementAndGet(); + //System.out.println("Received total of " + newValue + " fast call backs"); + } else if (aEventName.equals("SLOW")) { + final int newValue = SLOW_CALLBACK_COUNT.incrementAndGet(); + //System.out.println("Received total of " + newValue + " slow call backs"); + } else { + System.out.println("Unknown event type of " + aEventName); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorCallBack.java b/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorCallBack.java new file mode 100644 index 0000000000..137ea6a658 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorCallBack.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 org.apache.tuscany.sca.itest; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The call back interface for the EventProcessorService that is implemented + * by the client to receive event notifications + */ +@Remotable +public interface EventProcessorCallBack { + /** + * Call back notifying client of an Event + * + * @param aEventName The name of the Event + * @param aEventData The data for the Event + */ + void eventNotification(String aEventName, Object aEventData); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorService.java b/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorService.java new file mode 100644 index 0000000000..4bf05fc925 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorService.java @@ -0,0 +1,45 @@ +/* + * 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; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Remotable; + +/** + * Sample Event Processor Service + */ +@Callback(EventProcessorCallBack.class) +@Remotable +public interface EventProcessorService { + + /** + * Registers the client to receive notifications for the specified event + * + * @param aEventName The name of the Event to register + */ + void registerForEvent(String aEventName); + + /** + * Unregisters the client so it no longer receives notifications for the specified event + * + * @param aEventName The name of the Event to unregister + */ + void unregisterForEvent(String aEventName); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorServiceImpl.java new file mode 100644 index 0000000000..bec98a49c9 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/java/org/apache/tuscany/sca/itest/EventProcessorServiceImpl.java @@ -0,0 +1,195 @@ +/* + * 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; + +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; + +import org.oasisopen.sca.ServiceReference; +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Destroy; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +/** + * Sample Event Processor Service Implementation + */ +@Service(EventProcessorService.class) +@Scope("COMPOSITE") +public class EventProcessorServiceImpl implements EventProcessorService { + + /** + * Reference to the call back + */ + @Callback + protected ServiceReference clientCallback; + + /** + * This map contains the call backs for each of the registered Event names + */ + private final Map> eventListeners; + + /** + * The list of all Event Generators we create + */ + private final EventGenerator[] allEventGenerators; + + /** + * Constructor. Starts the Event Generators + */ + public EventProcessorServiceImpl() { + eventListeners = new ConcurrentHashMap>(); + + // We will simulate an Event generator + allEventGenerators = new EventGenerator[2]; + allEventGenerators[0] = new EventGenerator("FAST", 10); // Generate the FAST event every 10ms + allEventGenerators[1] = new EventGenerator("SLOW", 50); // Generate the SLOW event every 50ms + } + + /** + * Registers the client to receive notifications for the specified event + * + * @param aEventName The name of the Event to register + */ + public void registerForEvent(String aEventName) { + // Register for the Event + eventListeners.put(aEventName, clientCallback); + + // Send the "register" started event to the client + receiveEvent(aEventName, "SameThread: Registered to receive notifications for " + aEventName); + } + + /** + * Unregisters the client so it no longer receives notifications for the specified event + * + * @param aEventName The name of the Event to unregister + */ + public void unregisterForEvent(String aEventName) { + // Send the "register" started event to the client + receiveEvent(aEventName, "SameThread: Unregister from receiving notifications for " + aEventName); + + eventListeners.remove(aEventName); + } + + /** + * This method is called whenever the EventProcessorService receives an Event + * + * @param aEventName The name of the Event received + * @param aEventData The Event data + */ + private void receiveEvent(String aEventName, Object aEventData) { + // Get the listener for the Event + final ServiceReference callback = eventListeners.get(aEventName); + if (callback == null) { + //System.out.println("No registered listeners for " + aEventName); + return; + } + + // Trigger the call back + // System.out.println("Notifying " + callback + " of event " + aEventName); + callback.getService().eventNotification(aEventName, aEventData); + // System.out.println("Done notify " + callback + " of event " + aEventName); + } + + /** + * Shuts down the Event Processor + */ + @Destroy + public void shutdown() { + System.out.println("Shutting down the EventProcessor"); + + // Clear list of call back locations as we don't want to send any more notifications + eventListeners.clear(); + + // Stop the Event Generators + for (EventGenerator generator : allEventGenerators) { + generator.stop(); + } + } + + /** + * Utility class for generating Events + */ + private final class EventGenerator { + /** + * The Timer we are using to generate the events + */ + private final Timer timer = new Timer(); + + /** + * Lock object to ensure that we can cancel the timer cleanly. + */ + private final Object lock = new Object(); + + /** + * Constructor + * + * @param aEventName The name of the Event to generate + * @param frequencyInMilliseconds How frequently we should generate the Events + */ + private EventGenerator(String aEventName, int frequencyInMilliseconds) { + timer.schedule(new EventGeneratorTimerTask(aEventName), + frequencyInMilliseconds, + frequencyInMilliseconds); + } + + /** + * Stop this Event Generator + */ + private void stop() { + synchronized (lock) { + timer.cancel(); + } + } + + /** + * The TimerTask that is invoked by the Timer for the EventGenerator + */ + private final class EventGeneratorTimerTask extends TimerTask { + /** + * The name of the Event we should generate + */ + private final String eventName; + + /** + * Constructor + * + * @param aEventName The name of the Event we should generate + */ + private EventGeneratorTimerTask(String aEventName) { + eventName = aEventName; + } + + /** + * Timer calls this method and it will generate an Event + */ + + public void run() { + synchronized(lock) { + // System.out.println("Generating new event " + eventName); + receiveEvent(eventName, "Separate Thread Notification: " + UUID.randomUUID().toString()); + } + } + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/resources/CallBackSeparateThreadTest.composite b/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/resources/CallBackSeparateThreadTest.composite new file mode 100644 index 0000000000..f803fb2ec9 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/main/resources/CallBackSeparateThreadTest.composite @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/test/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/test/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadTestCase.java new file mode 100644 index 0000000000..c216cab1be --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/callback-separatethread/src/test/java/org/apache/tuscany/sca/itest/CallBackSeparateThreadTestCase.java @@ -0,0 +1,73 @@ +/* + * 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; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * This test case will attempt to trigger a call back using a separate thread + */ +public class CallBackSeparateThreadTestCase { + + /** + * The Node we are using + */ + private Node node; + + /** + * The client the tests should use + */ + private CallBackSeparateThreadClient aCallBackClient; + + /** + * Run the call back in separate thread tests + */ + @Test + public void testCallBackSeparateThread() { + aCallBackClient.runTests(); + } + + /** + * Load the Call back in separate thread composite and look up the client. + */ + + @Before + public void setUp() throws Exception { + String location = ContributionLocationHelper.getContributionLocation("CallBackSeparateThreadTest.composite"); + node = NodeFactory.newInstance().createNode("CallBackSeparateThreadTest.composite", new Contribution("c1", location)); + node.start(); + aCallBackClient = node.getService(CallBackSeparateThreadClient.class, "CallBackSeparateThreadClient"); + } + + /** + * Shutdown the SCA node + */ + + @After + public void tearDown() throws Exception { + node.stop(); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/component-type/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/component-type/pom.xml new file mode 100644 index 0000000000..5e9d63778d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/component-type/pom.xml @@ -0,0 +1,53 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-component-type + Apache Tuscany SCA iTest Component Type + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/AddService.java b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/AddService.java new file mode 100644 index 0000000000..188451ebac --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/AddService.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 calculator; + +/** + * The Add service interface + */ +public interface AddService { + + double add(double n1, double n2); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/AddServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/AddServiceImpl.java new file mode 100644 index 0000000000..8b6fe066a6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/AddServiceImpl.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 calculator; + +/** + * An implementation of the Add service + */ +public class AddServiceImpl implements AddService { + + public double add(double n1, double n2) { + return n1 + n2; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/CalculatorClient.java b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/CalculatorClient.java new file mode 100644 index 0000000000..6f978bd9be --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/CalculatorClient.java @@ -0,0 +1,49 @@ +/* + * 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 calculator; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; + +/** + * This client program shows how to create an SCA runtime, start it, + * and locate and invoke a SCA component + */ +public class CalculatorClient { + public static void main(String[] args) throws Exception { + + String location = ContributionLocationHelper.getContributionLocation("Calculator.composite"); + Node node = NodeFactory.newInstance().createNode("Calculator.composite", new Contribution("c1", location)); + node.start(); + + CalculatorService calculatorService = + node.getService(CalculatorService.class, "CalculatorServiceComponent/CalculatorService"); + + // Calculate + System.out.println("3 + 2=" + calculatorService.add(3, 2)); + System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); + System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); + System.out.println("3 / 2=" + calculatorService.divide(3, 2)); + + node.stop(); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/CalculatorService.java b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..c89043276e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/CalculatorService.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 calculator; + +/** + * The Calculator service interface. + */ +public interface CalculatorService { + + double add(double n1, double n2); + + double subtract(double n1, double n2); + + double multiply(double n1, double n2); + + double divide(double n1, double n2); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/CalculatorServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..1209ac128a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/CalculatorServiceImpl.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 calculator; + +/** + * An implementation of the Calculator service. + */ +public class CalculatorServiceImpl implements CalculatorService { + + private AddService addService; + private SubtractService subtractService; + private MultiplyService multiplyService; + private DivideService divideService; + + public void setAddService(AddService addService) { + this.addService = addService; + } + + public void setSubtractService(SubtractService subtractService) { + this.subtractService = subtractService; + } + + public void setDivideService(DivideService divideService) { + this.divideService = divideService; + } + + public void setMultiplyService(MultiplyService multiplyService) { + this.multiplyService = multiplyService; + } + + public double add(double n1, double n2) { + return addService.add(n1, n2); + } + + public double subtract(double n1, double n2) { + return subtractService.subtract(n1, n2); + } + + public double multiply(double n1, double n2) { + return multiplyService.multiply(n1, n2); + } + + public double divide(double n1, double n2) { + return divideService.divide(n1, n2); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/DivideService.java b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..30d248208b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/DivideService.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 calculator; + +/** + * The divide service interface + */ +public interface DivideService { + + double divide(double n1, double n2); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/DivideServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/DivideServiceImpl.java new file mode 100644 index 0000000000..f7ac0b7287 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/DivideServiceImpl.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 calculator; + +/** + * An implementation of the Divide service. + */ +public class DivideServiceImpl implements DivideService { + + public double divide(double n1, double n2) { + return n1 / n2; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/MultiplyService.java b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/MultiplyService.java new file mode 100644 index 0000000000..5290605938 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/MultiplyService.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 calculator; + +/** + * The interface for the multiply service + */ +public interface MultiplyService { + + double multiply(double n1, double n2); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/MultiplyServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/MultiplyServiceImpl.java new file mode 100644 index 0000000000..b7dca792b2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/MultiplyServiceImpl.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 calculator; + +/** + * An implementation of the Multiply service. + */ +public class MultiplyServiceImpl implements MultiplyService { + + public double multiply(double n1, double n2) { + return n1 * n2; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/SubtractService.java b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/SubtractService.java new file mode 100644 index 0000000000..bf0d1882b6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/SubtractService.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 calculator; + +/** + * The interface for the multiply service + */ +public interface SubtractService { + + double subtract(double n1, double n2); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/SubtractServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/SubtractServiceImpl.java new file mode 100644 index 0000000000..77b128ab8d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/java/calculator/SubtractServiceImpl.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 calculator; + +/** + * An implementation of the subtract service. + */ +public class SubtractServiceImpl implements SubtractService { + + public double subtract(double n1, double n2) { + return n1 - n2; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/Calculator.composite b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/Calculator.composite new file mode 100644 index 0000000000..ecee33e072 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/Calculator.composite @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/calculator/AddServiceImpl.componentType b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/calculator/AddServiceImpl.componentType new file mode 100644 index 0000000000..78e169deb4 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/calculator/AddServiceImpl.componentType @@ -0,0 +1,27 @@ + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/calculator/CalculatorServiceImpl.componentType b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/calculator/CalculatorServiceImpl.componentType new file mode 100644 index 0000000000..5d66becedf --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/calculator/CalculatorServiceImpl.componentType @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/calculator/DivideServiceImpl.componentType b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/calculator/DivideServiceImpl.componentType new file mode 100644 index 0000000000..22236ae0d0 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/calculator/DivideServiceImpl.componentType @@ -0,0 +1,27 @@ + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/calculator/MultiplyServiceImpl.componentType b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/calculator/MultiplyServiceImpl.componentType new file mode 100644 index 0000000000..2035d617e5 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/calculator/MultiplyServiceImpl.componentType @@ -0,0 +1,27 @@ + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/calculator/SubtractServiceImpl.componentType b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/calculator/SubtractServiceImpl.componentType new file mode 100644 index 0000000000..fe76f553be --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/main/resources/calculator/SubtractServiceImpl.componentType @@ -0,0 +1,27 @@ + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/component-type/src/test/java/calculator/CalculatorTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/test/java/calculator/CalculatorTestCase.java new file mode 100644 index 0000000000..ac3ccc3d08 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/component-type/src/test/java/calculator/CalculatorTestCase.java @@ -0,0 +1,60 @@ +/* + * 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 calculator; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * This shows how to test the Calculator service component. + */ +public class CalculatorTestCase { + + private CalculatorService calculatorService; + private Node node; + + @Before + public void setUp() throws Exception { + String location = ContributionLocationHelper.getContributionLocation("Calculator.composite"); + node = NodeFactory.newInstance().createNode("Calculator.composite", new Contribution("c1", location)); + node.start(); + calculatorService = node.getService(CalculatorService.class, "CalculatorServiceComponent/CalculatorService"); + } + + @After + public void tearDown() throws Exception { + node.stop(); + } + + @Test + public void testCalculator() throws Exception { + // Calculate + /* + assertEquals(calculatorService.add(3, 2), 5.0, 0.0); + assertEquals(calculatorService.subtract(3, 2), 1.0, 0.0); + assertEquals(calculatorService.multiply(3, 2), 6.0, 0.0); + assertEquals(calculatorService.divide(3, 2), 1.5, 0.0); + */ + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/pom.xml new file mode 100644 index 0000000000..20ec8c6ae8 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/pom.xml @@ -0,0 +1,46 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-contribution-folder + Apache Tuscany SCA iTest Contribution Folder + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/java/calculator/CalculatorService.java b/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..b4c677b371 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/java/calculator/CalculatorService.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 calculator; + +public interface CalculatorService { + double add(double n1, double n2); + + double subtract(double n1, double n2); + + double multiply(double n1, double n2); + + double divide(double n1, double n2); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/java/test/ContributionFolderTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/java/test/ContributionFolderTestCase.java new file mode 100644 index 0000000000..ef2a43c766 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/java/test/ContributionFolderTestCase.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 test; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; + +import calculator.CalculatorService; + +/** + * Test SCADomain.newInstance and invocation of a service. + * + * @version $Rev$ $Date$ + */ +public class ContributionFolderTestCase extends TestCase { + + private Node node; + + @Override + protected void setUp() throws Exception { + node = NodeFactory.newInstance().createNode(new Contribution("foo", "src/test/resources/repository")); + node.start(); + } + + public void testInvoke() throws Exception { + CalculatorService service = node.getService(CalculatorService.class, "CalculatorServiceComponent"); + assertEquals(3.0, service.add(1, 2)); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/resources/repository/folderWithJars/Calculator.composite b/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/resources/repository/folderWithJars/Calculator.composite new file mode 100644 index 0000000000..f67b212d99 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/resources/repository/folderWithJars/Calculator.composite @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/resources/repository/folderWithJars/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/resources/repository/folderWithJars/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..27a1ee74e4 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/resources/repository/folderWithJars/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/resources/repository/folderWithJars/service.jar b/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/resources/repository/folderWithJars/service.jar new file mode 100644 index 0000000000..fe264693fe Binary files /dev/null and b/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/resources/repository/folderWithJars/service.jar differ diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/resources/repository/folderWithJars/serviceImpl.jar b/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/resources/repository/folderWithJars/serviceImpl.jar new file mode 100644 index 0000000000..d5dfb647d3 Binary files /dev/null and b/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/resources/repository/folderWithJars/serviceImpl.jar differ diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/resources/repository3/contribution.zip b/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/resources/repository3/contribution.zip new file mode 100644 index 0000000000..b293aa4bcc Binary files /dev/null and b/tags/java/sca/2.0-M4-RC2/itest/contribution-folder/src/test/resources/repository3/contribution.zip differ diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/pom.xml new file mode 100644 index 0000000000..1ab420e93c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/pom.xml @@ -0,0 +1,67 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 1.6-SNAPSHOT + ../pom.xml + + itest-contribution-export-composite + Apache Tuscany SCA iTest Contribution Export + + + + org.apache.tuscany.sca + tuscany-host-embedded + 1.6-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.6-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 1.6-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 1.6-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/src/main/java/hello/Hello.java b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/src/main/java/hello/Hello.java new file mode 100644 index 0000000000..669821261c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/src/main/java/hello/Hello.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 hello; + +import org.osoa.sca.annotations.Remotable; + +/** + * This is the business interface of the Hello service. + */ +@Remotable +public interface Hello { + + public String getGreetings(String name); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/src/main/java/hello/HelloImpl.java b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/src/main/java/hello/HelloImpl.java new file mode 100644 index 0000000000..ff9f6e75f3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/src/main/java/hello/HelloImpl.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 hello; + +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(Hello.class) +public class HelloImpl implements Hello { + + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..bea6f39932 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/src/main/resources/hello.composite b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/src/main/resources/hello.composite new file mode 100644 index 0000000000..aeeab337fa --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/src/main/resources/hello.composite @@ -0,0 +1,31 @@ + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/src/test/java/org/apache/tuscany/sca/test/contribution/HelloTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/src/test/java/org/apache/tuscany/sca/test/contribution/HelloTestCase.java new file mode 100644 index 0000000000..44614f243a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-composite/src/test/java/org/apache/tuscany/sca/test/contribution/HelloTestCase.java @@ -0,0 +1,91 @@ +/* + * 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.test.contribution; + +import hello.Hello; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.contribution.Contribution; +import org.apache.tuscany.sca.contribution.service.ContributionService; +import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain; + +/** + * Tests that the helloworld server is available + */ +public class HelloTestCase extends TestCase { + private ClassLoader cl; + private EmbeddedSCADomain domain; + + @Override + protected void setUp() throws Exception { + // Create a test embedded SCA domain + cl = getClass().getClassLoader(); + domain = new EmbeddedSCADomain(cl, "http://localhost"); + + // Start the domain + domain.start(); + + // Contribute the SCA contribution + ContributionService contributionService = domain.getContributionService(); + + URL helloURL = getContributionURL(Hello.class); + + // File helloContrib = new File("./target/classes/"); + // URL helloURL = helloContrib.toURL(); + Contribution consumerContribution = + contributionService.contribute("http://import-export/hello", helloURL, false); + Composite consumerComposite = consumerContribution.getDeployables().get(0); + domain.getDomainComposite().getIncludes().add(consumerComposite); + domain.buildComposite(consumerComposite); + + // Start Components from my composite + domain.getCompositeActivator().activate(consumerComposite); + domain.getCompositeActivator().start(consumerComposite); + } + + private URL getContributionURL(Class cls) throws MalformedURLException { + String flag = "/" + cls.getName().replace('.', '/') + ".class"; + URL url = cls.getResource(flag); + String root = url.toExternalForm(); + root = root.substring(0, root.length() - flag.length() + 1); + if (root.startsWith("jar:") && root.endsWith("!/")) { + root = root.substring(4, root.length() - 2); + } + url = new URL(root); + return url; + } + + public void testHello() throws IOException { + Hello hello = domain.getService(Hello.class, "HelloServiceComponent"); + assertNotNull(hello); + assertEquals(hello.getGreetings("lresende"), "Hello lresende"); + } + + @Override + public void tearDown() throws Exception { + domain.close(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-java/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-java/pom.xml new file mode 100644 index 0000000000..cca05b9bb9 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-java/pom.xml @@ -0,0 +1,67 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 1.6-SNAPSHOT + ../pom.xml + + itest-contribution-export-java + Apache Tuscany SCA iTest Contribution Java Export + + + + org.apache.tuscany.sca + tuscany-host-embedded + 1.6-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.6-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 1.6-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 1.6-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-java/src/main/java/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-java/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..268d90e910 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-java/src/main/java/helloworld/HelloWorldService.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 helloworld; + +import org.osoa.sca.annotations.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public String getGreetings(String name); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-java/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-java/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..7e11adcec7 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-java/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-java/src/main/resources/helloworld/HelloWorldImpl.componentType b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-java/src/main/resources/helloworld/HelloWorldImpl.componentType new file mode 100644 index 0000000000..5a14b41650 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-java/src/main/resources/helloworld/HelloWorldImpl.componentType @@ -0,0 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-resource/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-resource/pom.xml new file mode 100644 index 0000000000..d8133c4acc --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-resource/pom.xml @@ -0,0 +1,31 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 1.6-SNAPSHOT + ../pom.xml + + itest-contribution-export-resource + Apache Tuscany SCA iTest Contribution Resource Export + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-resource/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-resource/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..f11eacb416 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-resource/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-resource/src/main/resources/ufservices/store.html b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-resource/src/main/resources/ufservices/store.html new file mode 100644 index 0000000000..1ff281373a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-resource/src/main/resources/ufservices/store.html @@ -0,0 +1,27 @@ + + + +Store + + + +

Sample Store Page

+ + diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-wsdl/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-wsdl/pom.xml new file mode 100644 index 0000000000..7c504aee50 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-wsdl/pom.xml @@ -0,0 +1,31 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 1.6-SNAPSHOT + ../pom.xml + + itest-contribution-export-wsdl + Apache Tuscany SCA iTest Contribution WSDL Export + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-wsdl/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-wsdl/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..8254b667f2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-wsdl/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.wsdl b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.wsdl new file mode 100644 index 0000000000..0172fb2c7c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.wsdl @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.xsd b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.xsd new file mode 100644 index 0000000000..d49e2ead99 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/export-wsdl/src/main/resources/helloworld.xsd @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/pom.xml new file mode 100644 index 0000000000..40dab26baa --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/pom.xml @@ -0,0 +1,73 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 1.6-SNAPSHOT + ../pom.xml + + itest-contribution-import-composite + Apache Tuscany SCA iTest Contribution Import + + + + org.apache.tuscany.sca + itest-contribution-export-composite + 1.6-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-host-embedded + 1.6-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.6-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 1.6-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 1.6-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldImpl.java b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..c062afaed0 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldImpl.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 helloworld; + +import hello.Hello; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + @Reference + protected Hello helloServiceRef; + + public String getGreetings(String name) { + return helloServiceRef.getGreetings(name); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldServer.java b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldServer.java new file mode 100644 index 0000000000..e03ed4dc25 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldServer.java @@ -0,0 +1,46 @@ +/* + * 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 java.io.IOException; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This server program shows how to create an SCA runtime, and start it which + * activates the helloworld Web service endpoint. + */ +public class HelloWorldServer { + + public static void main(String[] args) { + + SCADomain scaDomain = SCADomain.newInstance("helloworldws.composite"); + + try { + System.out.println("HelloWorld server started (press enter to shutdown)"); + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + + scaDomain.close(); + System.out.println("HelloWorld server stopped"); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..268d90e910 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/java/helloworld/HelloWorldService.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 helloworld; + +import org.osoa.sca.annotations.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public String getGreetings(String name); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..130aa91093 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,27 @@ + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/resources/helloworld.wsdl b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/resources/helloworld.wsdl new file mode 100644 index 0000000000..0172fb2c7c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/resources/helloworld.wsdl @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/resources/helloworld.xsd b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/resources/helloworld.xsd new file mode 100644 index 0000000000..d49e2ead99 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/resources/helloworld.xsd @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/resources/helloworldws.composite b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/resources/helloworldws.composite new file mode 100644 index 0000000000..44ceba1240 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/main/resources/helloworldws.composite @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/test/java/org/apache/tuscany/test/contribution/HelloWorldServerTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/test/java/org/apache/tuscany/test/contribution/HelloWorldServerTestCase.java new file mode 100644 index 0000000000..3cc6784eca --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-composite/src/test/java/org/apache/tuscany/test/contribution/HelloWorldServerTestCase.java @@ -0,0 +1,126 @@ +/* + * 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.test.contribution; + +import hello.Hello; +import helloworld.HelloWorldService; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.Socket; +import java.net.URL; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.contribution.Contribution; +import org.apache.tuscany.sca.contribution.service.ContributionService; +import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain; + +/** + * Tests that the helloworld server is available + */ +public class HelloWorldServerTestCase extends TestCase { + private ClassLoader cl; + private EmbeddedSCADomain domain; + private Contribution helloWorldContribution; + private Contribution compositeContribution; + + @Override + protected void setUp() throws Exception { + //Create a test embedded SCA domain + cl = getClass().getClassLoader(); + domain = new EmbeddedSCADomain(cl, "http://localhost"); + + //Start the domain + domain.start(); + + // Contribute the SCA contribution + ContributionService contributionService = domain.getContributionService(); + + // File compositeContribLocation = new File("../export-composite/target/classes"); + // URL compositeContribURL = compositeContribLocation.toURL(); + URL compositeContribURL = getContributionURL(Hello.class); + compositeContribution = + contributionService.contribute("http://import-export/export-composite", compositeContribURL, false); + for (Composite deployable : compositeContribution.getDeployables()) { + domain.getDomainComposite().getIncludes().add(deployable); + domain.buildComposite(deployable); + } + +// File helloWorldContribLocation = new File("./target/classes/"); +// URL helloWorldContribURL = helloWorldContribLocation.toURL(); + URL helloWorldContribURL = getContributionURL(HelloWorldService.class); + helloWorldContribution = + contributionService.contribute("http://import-export/helloworld", helloWorldContribURL, false); + for (Composite deployable : helloWorldContribution.getDeployables()) { + domain.getDomainComposite().getIncludes().add(deployable); + domain.buildComposite(deployable); + } + + // Start Components from my composite + for (Composite deployable : helloWorldContribution.getDeployables()) { + domain.getCompositeActivator().activate(deployable); + domain.getCompositeActivator().start(deployable); + } + } + + private URL getContributionURL(Class cls) throws MalformedURLException { + String flag = "/" + cls.getName().replace('.', '/') + ".class"; + URL url = cls.getResource(flag); + String root = url.toExternalForm(); + root = root.substring(0, root.length() - flag.length() + 1); + if (root.startsWith("jar:") && root.endsWith("!/")) { + root = root.substring(4, root.length() - 2); + } + url = new URL(root); + return url; + } + + public void testPing() throws IOException { + new Socket("127.0.0.1", 8085); + } + + public void testServiceCall() throws IOException { + HelloWorldService helloWorldService = + domain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService"); + assertNotNull(helloWorldService); + + assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); + } + + @Override + public void tearDown() throws Exception { + ContributionService contributionService = domain.getContributionService(); + + // Remove the contribution from the in-memory repository + contributionService.remove("http://import-export/helloworld"); + contributionService.remove("http://import-export/export-composite"); + + //Stop Components from my composite + for (Composite deployable : helloWorldContribution.getDeployables()) { + domain.getCompositeActivator().stop(deployable); + domain.getCompositeActivator().deactivate(deployable); + } + + domain.stop(); + domain.close(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-java/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-java/pom.xml new file mode 100644 index 0000000000..91eb35d6c1 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-java/pom.xml @@ -0,0 +1,73 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 1.6-SNAPSHOT + ../pom.xml + + itest-contribution-import-java + Apache Tuscany SCA iTest Contribution Java Import + + + + org.apache.tuscany.sca + itest-contribution-export-java + 1.6-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-host-embedded + 1.6-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.6-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 1.6-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 1.6-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-java/src/main/java/helloworld/HelloWorldImpl.java b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-java/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..0de3c70303 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-java/src/main/java/helloworld/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 helloworld; + +import org.osoa.sca.annotations.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/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-java/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-java/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..224e2c4d79 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-java/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-java/src/main/resources/helloworldws.composite b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-java/src/main/resources/helloworldws.composite new file mode 100644 index 0000000000..a53117e72f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-java/src/main/resources/helloworldws.composite @@ -0,0 +1,29 @@ + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-java/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-java/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java new file mode 100644 index 0000000000..9bc94525e0 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-java/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java @@ -0,0 +1,127 @@ +/* + * 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.test.contribution; + +import helloworld.HelloWorldImpl; +import helloworld.HelloWorldService; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.contribution.Contribution; +import org.apache.tuscany.sca.contribution.service.ContributionService; +import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain; + +/** + * Tests that the helloworld server is available + */ +public class HelloWorldServerTestCase extends TestCase { + private ClassLoader cl; + private EmbeddedSCADomain domain; + private Contribution helloWorldContribution; + private Contribution javaContribution; + + @Override + protected void setUp() throws Exception { + //Create a test embedded SCA domain + cl = getClass().getClassLoader(); + domain = new EmbeddedSCADomain(cl, "http://localhost"); + + //Start the domain + domain.start(); + + // Contribute the SCA contribution + ContributionService contributionService = domain.getContributionService(); + + //File javaContribLocation = new File("../export-java/target/classes"); + //URL javaContribURL = javaContribLocation.toURL(); + URL javaContribURL = getContributionURL(HelloWorldService.class); + javaContribution = contributionService.contribute("http://import-export/export-java", javaContribURL, false); + for (Composite deployable : javaContribution.getDeployables()) { + domain.getDomainComposite().getIncludes().add(deployable); + domain.buildComposite(deployable); + } + + //File helloWorldContribLocation = new File("./target/classes/"); + //URL helloWorldContribURL = helloWorldContribLocation.toURL(); + URL helloWorldContribURL = getContributionURL(HelloWorldImpl.class); + helloWorldContribution = contributionService.contribute("http://import-export/helloworld", helloWorldContribURL, false); + for (Composite deployable : helloWorldContribution.getDeployables()) { + domain.getDomainComposite().getIncludes().add(deployable); + domain.buildComposite(deployable); + } + + // Start Components from my composite + for (Composite deployable : helloWorldContribution.getDeployables()) { + domain.getCompositeActivator().activate(deployable); + domain.getCompositeActivator().start(deployable); + } + } + + private URL getContributionURL(Class cls) throws MalformedURLException { + String flag = "/" + cls.getName().replace('.', '/') + ".class"; + URL url = cls.getResource(flag); + String root = url.toExternalForm(); + root = root.substring(0, root.length() - flag.length() + 1); + if (root.startsWith("jar:") && root.endsWith("!/")) { + root = root.substring(4, root.length() - 2); + } + url = new URL(root); + return url; + } + + public void testPing() throws IOException { + HelloWorldService helloWorldService = + domain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService"); + assertNotNull(helloWorldService); + assertEquals("Hello test", helloWorldService.getGreetings("test")); + } + + public void testServiceCall() throws IOException { + HelloWorldService helloWorldService = + domain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService"); + assertNotNull(helloWorldService); + + assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); + } + + @Override + public void tearDown() throws Exception { + ContributionService contributionService = domain.getContributionService(); + + // Remove the contribution from the in-memory repository + contributionService.remove("http://import-export/helloworld"); + contributionService.remove("http://import-export/export-java"); + + // Stop Components from my composite + for (Composite deployable : helloWorldContribution.getDeployables()) { + domain.getCompositeActivator().stop(deployable); + domain.getCompositeActivator().deactivate(deployable); + } + + domain.stop(); + + domain.close(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-resource/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-resource/pom.xml new file mode 100644 index 0000000000..0696df1951 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-resource/pom.xml @@ -0,0 +1,102 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 1.6-SNAPSHOT + ../pom.xml + + itest-contribution-import-resource + Apache Tuscany SCA iTest Contribution Resource Import + + + + + org.apache.tuscany.sca + itest-contribution-export-resource + 1.6-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-host-embedded + 1.6-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.6-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-http + 1.6-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-binding-http-runtime + 1.6-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-resource-runtime + 1.6-SNAPSHOT + test + + + + org.apache.tuscany.sca + tuscany-contribution-resource + 1.6-SNAPSHOT + test + + + + javax.servlet + servlet-api + 2.5 + provided + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 1.6-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-resource/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-resource/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ac6d7becb3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-resource/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-resource/src/main/resources/store.composite b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-resource/src/main/resources/store.composite new file mode 100644 index 0000000000..bb5a7b764f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-resource/src/main/resources/store.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-resource/src/test/java/org/apache/tuscany/sca/test/contribution/StoreTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-resource/src/test/java/org/apache/tuscany/sca/test/contribution/StoreTestCase.java new file mode 100644 index 0000000000..1b7542b7d9 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-resource/src/test/java/org/apache/tuscany/sca/test/contribution/StoreTestCase.java @@ -0,0 +1,129 @@ +/* + * 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.test.contribution; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.Socket; +import java.net.URL; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.contribution.Contribution; +import org.apache.tuscany.sca.contribution.service.ContributionService; +import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain; + +/** + * Tests that the helloworld server is available + */ +public class StoreTestCase extends TestCase { + private ClassLoader cl; + private EmbeddedSCADomain domain; + private Contribution storeContribution; + private Contribution resourceContribution; + + @Override + protected void setUp() throws Exception { + //Create a test embedded SCA domain + cl = getClass().getClassLoader(); + domain = new EmbeddedSCADomain(cl, "http://localhost"); + + //Start the domain + domain.start(); + + // Contribute the SCA contribution + ContributionService contributionService = domain.getContributionService(); + + URL javaContribURL = getContributionURL(cl, "ufservices/store.html"); + resourceContribution = contributionService.contribute("http://import-export/export-resource", javaContribURL, false); + for (Composite deployable : resourceContribution.getDeployables()) { + domain.getDomainComposite().getIncludes().add(deployable); + domain.buildComposite(deployable); + } + + URL storeContributionURL = getContributionURL(cl, "store.composite"); + + storeContribution = + contributionService.contribute("http://import-export/store", storeContributionURL, false); + for (Composite deployable : storeContribution.getDeployables()) { + domain.getDomainComposite().getIncludes().add(deployable); + domain.buildComposite(deployable); + } + + // Start Components from my composite + for (Composite deployable : storeContribution.getDeployables()) { + domain.getCompositeActivator().activate(deployable); + domain.getCompositeActivator().start(deployable); + } + } + + public void testPing() throws IOException { + new Socket("127.0.0.1", 8085); + } + + + @Override + public void tearDown() throws Exception { + ContributionService contributionService = domain.getContributionService(); + + // Remove the contribution from the in-memory repository + contributionService.remove("http://import-export/store"); + contributionService.remove("http://import-export/export-resource"); + + // Stop Components from my composite + for (Composite deployable : storeContribution.getDeployables()) { + domain.getCompositeActivator().stop(deployable); + domain.getCompositeActivator().deactivate(deployable); + } + + domain.stop(); + + domain.close(); + } + + + /** + * Utility methods + */ + + + private URL getContributionURL(ClassLoader cl, Class cls) throws MalformedURLException { + String flag = "/" + cls.getName().replace('.', '/') + ".class"; + URL url = cl.getResource(flag); + String root = url.toExternalForm(); + root = root.substring(0, root.length() - flag.length() + 1); + if (root.startsWith("jar:") && root.endsWith("!/")) { + root = root.substring(4, root.length() - 2); + } + url = new URL(root); + return url; + } + + private URL getContributionURL(ClassLoader cl, String uri) throws MalformedURLException { + URL url = cl.getResource(uri); + String root = url.toExternalForm(); + root = root.substring(0, root.length() - uri.length()); + if (root.startsWith("jar:") && root.endsWith("!/")) { + root = root.substring(4, root.length() - 2); + } + url = new URL(root); + return url; + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/pom.xml new file mode 100644 index 0000000000..3d8b5e85c3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/pom.xml @@ -0,0 +1,73 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 1.6-SNAPSHOT + ../pom.xml + + itest-contribution-import-wsdl + Apache Tuscany SCA iTest Contribution WSDL Import + + + + org.apache.tuscany.sca + itest-contribution-export-wsdl + 1.6-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-host-embedded + 1.6-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.6-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 1.6-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 1.6-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldImpl.java b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..0de3c70303 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/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 helloworld; + +import org.osoa.sca.annotations.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/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldServer.java b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldServer.java new file mode 100644 index 0000000000..e03ed4dc25 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldServer.java @@ -0,0 +1,46 @@ +/* + * 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 java.io.IOException; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This server program shows how to create an SCA runtime, and start it which + * activates the helloworld Web service endpoint. + */ +public class HelloWorldServer { + + public static void main(String[] args) { + + SCADomain scaDomain = SCADomain.newInstance("helloworldws.composite"); + + try { + System.out.println("HelloWorld server started (press enter to shutdown)"); + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + + scaDomain.close(); + System.out.println("HelloWorld server stopped"); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..268d90e910 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/main/java/helloworld/HelloWorldService.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 helloworld; + +import org.osoa.sca.annotations.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public String getGreetings(String name); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..a47b9a71e9 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/main/resources/helloworldws.composite b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/main/resources/helloworldws.composite new file mode 100644 index 0000000000..76ccf71fb8 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/main/resources/helloworldws.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java new file mode 100644 index 0000000000..66227eacaa --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/import-wsdl/src/test/java/org/apache/tuscany/sca/test/contribution/HelloWorldServerTestCase.java @@ -0,0 +1,137 @@ +/* + * 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.test.contribution; + +import helloworld.HelloWorldService; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.Socket; +import java.net.URL; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.contribution.Contribution; +import org.apache.tuscany.sca.contribution.service.ContributionService; +import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain; + +/** + * Tests that the helloworld server is available + */ +public class HelloWorldServerTestCase extends TestCase { + private ClassLoader cl; + private EmbeddedSCADomain domain; + private Contribution wsdlContribution; + private Contribution consumerContribution; + + @Override + protected void setUp() throws Exception { + // Create a test embedded SCA domain + cl = getClass().getClassLoader(); + domain = new EmbeddedSCADomain(cl, "http://localhost"); + + //Start the domain + domain.start(); + + // Contribute the SCA contribution + ContributionService contributionService = domain.getContributionService(); + + // File wsdlContribLocation = new File("../export-wsdl/target/classes"); + // URL wsdlContribURL = wsdlContribLocation.toURL(); + URL wsdlContribURL = getContributionURL(getClass().getClassLoader(), "helloworld.wsdl"); + wsdlContribution = contributionService.contribute("http://import-export/export-wsdl", wsdlContribURL, false); + for (Composite deployable : wsdlContribution.getDeployables()) { + domain.getDomainComposite().getIncludes().add(deployable); + domain.buildComposite(deployable); + } + + // File helloWorldContribLocation = new File("./target/classes/"); + // URL helloWorldContribURL = helloWorldContribLocation.toURL(); + URL helloWorldContribURL = getContributionURL(HelloWorldService.class); + consumerContribution = + contributionService.contribute("http://import-export/helloworld", helloWorldContribURL, false); + for (Composite deployable : consumerContribution.getDeployables()) { + domain.getDomainComposite().getIncludes().add(deployable); + domain.buildComposite(deployable); + } + + // Start Components from my composite + for (Composite deployable : consumerContribution.getDeployables()) { + domain.getCompositeActivator().activate(deployable); + domain.getCompositeActivator().start(deployable); + } + } + + public void testPing() throws IOException { + new Socket("127.0.0.1", 8085); + } + + private URL getContributionURL(Class cls) throws MalformedURLException { + String flag = "/" + cls.getName().replace('.', '/') + ".class"; + URL url = cls.getResource(flag); + String root = url.toExternalForm(); + root = root.substring(0, root.length() - flag.length() + 1); + if (root.startsWith("jar:") && root.endsWith("!/")) { + root = root.substring(4, root.length() - 2); + } + url = new URL(root); + return url; + } + + private URL getContributionURL(ClassLoader cl, String flag) throws MalformedURLException { + URL url = cl.getResource(flag); + String root = url.toExternalForm(); + root = root.substring(0, root.length() - flag.length()); + if (root.startsWith("jar:") && root.endsWith("!/")) { + root = root.substring(4, root.length() - 2); + } + url = new URL(root); + // System.out.println(url); + return url; + } + + public void testServiceCall() throws IOException { + HelloWorldService helloWorldService = + domain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService"); + assertNotNull(helloWorldService); + + assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); + } + + @Override + public void tearDown() throws Exception { + ContributionService contributionService = domain.getContributionService(); + + // Remove the contribution from the in-memory repository + contributionService.remove("http://import-export/helloworld"); + contributionService.remove("http://import-export/export-wsdl"); + + // Stop Components from my composite + for (Composite deployable : consumerContribution.getDeployables()) { + domain.getCompositeActivator().stop(deployable); + domain.getCompositeActivator().deactivate(deployable); + } + + domain.stop(); + + domain.close(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/pom.xml new file mode 100644 index 0000000000..e64ff002e1 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-import-export/pom.xml @@ -0,0 +1,56 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 1.6-SNAPSHOT + ../pom.xml + + itest-contribution-import-export + pom + Apache Tuscany SCA Contribution Import/Export Integration Tests + + + export-composite + export-java + export-resource + export-wsdl + import-composite + import-java + import-resource + import-wsdl + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 1.6-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-contribution-impl + 1.6-SNAPSHOT + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-zip/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/contribution-zip/pom.xml new file mode 100644 index 0000000000..51ee2a349d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-zip/pom.xml @@ -0,0 +1,45 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-contribution-zip + Apache Tuscany SCA iTest Contribution ZIP + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-zip/src/test/java/calculator/CalculatorService.java b/tags/java/sca/2.0-M4-RC2/itest/contribution-zip/src/test/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..b4c677b371 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-zip/src/test/java/calculator/CalculatorService.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 calculator; + +public interface CalculatorService { + double add(double n1, double n2); + + double subtract(double n1, double n2); + + double multiply(double n1, double n2); + + double divide(double n1, double n2); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-zip/src/test/java/org/apache/tuscany/sca/contribution/zip/ContributionZIPTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/contribution-zip/src/test/java/org/apache/tuscany/sca/contribution/zip/ContributionZIPTestCase.java new file mode 100644 index 0000000000..303e2a6d9a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/contribution-zip/src/test/java/org/apache/tuscany/sca/contribution/zip/ContributionZIPTestCase.java @@ -0,0 +1,56 @@ +/* + * 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.contribution.zip; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; + +import calculator.CalculatorService; + +/** + * Test SCADomain.newInstance and invocation of a service. + * + * @version $Rev$ $Date$ + */ +public class ContributionZIPTestCase extends TestCase { + + private Node node; + + @Override + protected void setUp() throws Exception { + node = + NodeFactory.newInstance().createNode(new Contribution("foo", + "src/test/resources/repository/contribution.zip")); + node.start(); + } + + public void testInvoke() throws Exception { + CalculatorService service = node.getService(CalculatorService.class, "CalculatorServiceComponent"); + assertEquals(3.0, service.add(1, 2)); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/contribution-zip/src/test/resources/repository/contribution.zip b/tags/java/sca/2.0-M4-RC2/itest/contribution-zip/src/test/resources/repository/contribution.zip new file mode 100644 index 0000000000..3239ae1242 Binary files /dev/null and b/tags/java/sca/2.0-M4-RC2/itest/contribution-zip/src/test/resources/repository/contribution.zip differ diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/bin-distro-unzip/build.xml b/tags/java/sca/2.0-M4-RC2/itest/distribution/bin-distro-unzip/build.xml new file mode 100644 index 0000000000..68e15d4a8b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/bin-distro-unzip/build.xml @@ -0,0 +1,24 @@ + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/bin-distro-unzip/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/distribution/bin-distro-unzip/pom.xml new file mode 100644 index 0000000000..e87bf00476 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/bin-distro-unzip/pom.xml @@ -0,0 +1,138 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-distribution + 2.0-M4 + ../pom.xml + + itest-bin-distro-unzip + Apache Tuscany SCA iTest Bin Distro Unzip + + + + org.apache.tuscany.sca + tuscany-distribution-all + pom + 2.0-M4 + + + + + + + + not-sun-jdk + + + ${java.home}/../lib/tools.jar + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.3 + + + + ant + ant-trax + 1.6.5 + + + + + + run-samples + verify + + run + + + + + + + + + + + + + + + + + sun-jdk + + + ${java.home}/../lib/tools.jar + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.3 + + + + ant + ant-trax + 1.6.5 + + + + sun.jdk + tools + 1.6 + system + ${java.home}/../lib/tools.jar + + + + + + run-samples + verify + + run + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/binding-ws-calculator/build.xml b/tags/java/sca/2.0-M4-RC2/itest/distribution/binding-ws-calculator/build.xml new file mode 100644 index 0000000000..ed22bce2dc --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/binding-ws-calculator/build.xml @@ -0,0 +1,40 @@ + + + + ${java.home} + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/binding-ws-calculator/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/distribution/binding-ws-calculator/pom.xml new file mode 100644 index 0000000000..681e1ed85c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/binding-ws-calculator/pom.xml @@ -0,0 +1,82 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-distribution + 2.0-M4 + ../pom.xml + + itest-distribution-binding-ws-calculator + Apache Tuscany SCA iTest Distribution binding-ws-calculator + + + + org.apache.tuscany.sca + itest-bin-distro-unzip + pom + 2.0-M4 + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.3 + + + + ant + ant-trax + 1.6.5 + + + + sun.jdk + tools + 1.6 + system + ${java.home}/../lib/tools.jar + + + + + + run-samples + verify + + run + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/calculator-rmi/build.xml b/tags/java/sca/2.0-M4-RC2/itest/distribution/calculator-rmi/build.xml new file mode 100644 index 0000000000..25abf4e040 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/calculator-rmi/build.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/calculator-rmi/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/distribution/calculator-rmi/pom.xml new file mode 100644 index 0000000000..7b39859144 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/calculator-rmi/pom.xml @@ -0,0 +1,81 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-distribution + 2.0-M4 + ../pom.xml + + itest-distribution-calculator-rmi + Apache Tuscany SCA iTest Distribution calculator-rmi + + + + org.apache.tuscany.sca + itest-bin-distro-unzip + pom + 2.0-M4 + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.3 + + + + ant + ant-trax + 1.6.5 + + + + sun.jdk + tools + 1.6 + system + ${java.home}/../lib/tools.jar + + + + + + run-samples + verify + + run + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/implementation-java-calculator/build.xml b/tags/java/sca/2.0-M4-RC2/itest/distribution/implementation-java-calculator/build.xml new file mode 100644 index 0000000000..106fee758c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/implementation-java-calculator/build.xml @@ -0,0 +1,40 @@ + + + + ${java.home} + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/implementation-java-calculator/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/distribution/implementation-java-calculator/pom.xml new file mode 100644 index 0000000000..76f9c786b8 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/implementation-java-calculator/pom.xml @@ -0,0 +1,82 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-distribution + 2.0-M4 + ../pom.xml + + itest-distribution-implementation-java-calculator + Apache Tuscany SCA iTest Distribution implementation-java-calculator + + + + org.apache.tuscany.sca + itest-bin-distro-unzip + pom + 2.0-M4 + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.3 + + + + ant + ant-trax + 1.6.5 + + + + sun.jdk + tools + 1.6 + system + ${java.home}/../lib/tools.jar + + + + + + run-samples + verify + + run + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/legal-checks/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/distribution/legal-checks/pom.xml new file mode 100644 index 0000000000..5aa8a2a44a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/legal-checks/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-distribution + 2.0-M4 + ../pom.xml + + itest-distribution-legal-checks + Apache Tuscany SCA iTest Distribution Legal Checks + + + + org.apache.tuscany.sca + itest-bin-distro-unzip + pom + 2.0-M4 + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/legal-checks/src/test/java/itest/JarsInLICENSETestCase.java b/tags/java/sca/2.0-M4-RC2/itest/distribution/legal-checks/src/test/java/itest/JarsInLICENSETestCase.java new file mode 100644 index 0000000000..2cbbe57125 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/legal-checks/src/test/java/itest/JarsInLICENSETestCase.java @@ -0,0 +1,162 @@ +/* + * 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.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.StringTokenizer; + +import org.junit.Test; + +/** + * Checks that all jar files included in the distribution are mentioned in the LICENSE file + * and that all jars mentioned in the LICENSE are in the distribution. + */ +public class JarsInLICENSETestCase { + + @Test + public void testJars() throws Exception { + File distroRoot = getUnzipedDistroRoot(); + + File licenseFile = new File(distroRoot, "LICENSE"); + if (!licenseFile.exists()) { + throw new IllegalStateException("can't find LICENSE file at: " + licenseFile.getAbsoluteFile().toString()); + } + + File libDirectory = new File(distroRoot, "modules"); + if (!libDirectory.exists()) { + throw new IllegalStateException("can't find modules folder at: " + libDirectory.getAbsoluteFile().toString()); + } + + List jars = getJarsInDistro(libDirectory); + + List bad2 = getLICENSEJarsNotInDistro(licenseFile, jars); + if (bad2.size() > 0) { + System.err.println("Jars in LICENSE but not in Distribution: " + bad2); + } + + List bad1 = getJarsNotInLICENSE(jars, licenseFile); + if (bad1.size() > 0) { + System.err.println("Jars in distribution but not in LICENSE: " + bad1); + } + + if (bad1.size() > 0 || bad2.size() > 0) { + throw new IllegalStateException("LICENSE problems, check log"); + } + } + + private List getLICENSEJarsNotInDistro(File licenseFile, List jars) throws IOException { + List badJars = new ArrayList(); + BufferedReader reader = new BufferedReader(new FileReader(licenseFile)); + String line = null; + while ((line = reader.readLine()) != null) { + line = line.trim(); + if (line.contains(".jar")) { + StringTokenizer st = new StringTokenizer(line); + while (st.hasMoreTokens()) { + String s = st.nextToken(); + if (s.contains(".jar")) { + if (s.startsWith("(")) { + s = s.substring(1); + } + if (s.endsWith(",") || s.endsWith(":")) { + s = s.substring(0, s.length()-1); + } + if (s.endsWith(")")) { + s = s.substring(0, s.length()-1); + } + if (!jars.contains(s) && !s.startsWith("tuscany-")) { + badJars.add(s); + } + } + } + } + } + return badJars; + } + + private List getJarsNotInLICENSE(List jars, File licenseFile) throws IOException { + List badJars = new ArrayList(); + String licenseText = readLICENSE(licenseFile); + for (String jar : jars) { + if (!licenseText.contains(jar)) { + if (jar.startsWith("tuscany-")) { + // ignore tuscany jars as they're not mentioned in the LICENSE file + } else { + badJars.add(jar); + } + } + } + return badJars; + } + + private List getJarsInDistro(File directory) { + List jars = new ArrayList(); + for (String fn : directory.list()){ + if (fn.endsWith(".jar")) { + jars.add(fn); + } else { + File f = new File(directory, fn); + if (f.isDirectory()) { + jars.addAll(getJarsInDistro(f)); + } + } + } + return jars; + } + + private File getUnzipedDistroRoot() { + File distroTarget = new File("../../../distribution/all/target"); + File root = null; + for (String f : distroTarget.list()) { + if (f.endsWith("-dir")) { + root = new File(distroTarget, f); + break; + } + } + if (root == null) { + throw new IllegalStateException("can't find distro root"); + } + if (root.list().length != 1) { + throw new IllegalStateException("expecting one directory in distro root"); + } + root = new File(root, root.list()[0]); + return root; + } + + private static String readLICENSE(File licenseFile) throws java.io.IOException { + StringBuffer fileData = new StringBuffer(); + BufferedReader reader = new BufferedReader(new FileReader(licenseFile)); + char[] buf = new char[1024]; + int numRead = 0; + while ((numRead = reader.read(buf)) != -1) { + String readData = String.valueOf(buf, 0, numRead); + fileData.append(readData); + buf = new char[1024]; + } + reader.close(); + return fileData.toString(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/distribution/pom.xml new file mode 100644 index 0000000000..b62849a2ef --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/pom.xml @@ -0,0 +1,49 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + pom + itest-distribution + Apache Tuscany SCA iTest Distribution + + + install + + + + bin-distro-unzip + binding-ws-calculator + calculator-rmi + implementation-java-calculator + legal-checks + webapp-helloworld + webapp-helloworld-bpel + webapp-helloworld-js-client + webapp-helloworld-jsp + webapp-helloworld-stripes + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-bpel/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-bpel/pom.xml new file mode 100644 index 0000000000..da7b3f620d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-bpel/pom.xml @@ -0,0 +1,124 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-distribution + 2.0-M4 + ../pom.xml + + itest-distribution-webapp-helloworld-bpel + Apache Tuscany SCA iTest Distribution Webapp helloworld-bpel + + + + + org.apache.tuscany.sca + itest-bin-distro-unzip + pom + 2.0-M4 + + + + org.apache.tuscany.sca + helloworld-bpel + war + 2.0-M4 + + + + junit + junit + 4.5 + test + + + + htmlunit + htmlunit + 1.9 + test + + + + + + + + org.codehaus.cargo + cargo-maven2-plugin + 1.0 + + + start-container + compile + + start + + + + stop-container + post-integration-test + + stop + + + + + false + + jetty6x + embedded + + org.apache.commons.logging.impl.SimpleLog + + + + + ${project.build.directory}/cargo-jetty + + + + 8085 + helloworld-bpel + + + + org.apache.tuscany.sca + helloworld-bpel + war + + helloworld-bpel + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-bpel/src/test/java/itest/HelloworldTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-bpel/src/test/java/itest/HelloworldTestCase.java new file mode 100644 index 0000000000..5b29292acf --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-bpel/src/test/java/itest/HelloworldTestCase.java @@ -0,0 +1,50 @@ +/* + * 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 java.io.IOException; +import java.net.MalformedURLException; +import java.util.Iterator; + +import org.junit.Test; + +import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; +import com.gargoylesoftware.htmlunit.WebClient; +import com.gargoylesoftware.htmlunit.html.HtmlPage; +import com.gargoylesoftware.htmlunit.html.HtmlParagraph; + +/** + */ +public class HelloworldTestCase { + + @Test + public void testA() throws FailingHttpStatusCodeException, MalformedURLException, IOException { + HtmlPage page = (HtmlPage)new WebClient().getPage("http://localhost:8085/helloworld-bpel"); + Iterator ss = page.getAllHtmlChildElements(); + ss.next(); + ss.next(); + ss.next(); + HtmlParagraph p = (HtmlParagraph)ss.next(); + assertEquals("Hello world", p.asText()); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jms/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jms/pom.xml new file mode 100644 index 0000000000..3d79100bb0 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jms/pom.xml @@ -0,0 +1,216 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-distribution + 2.0-M4 + ../pom.xml + + itest-distribution-webapp-helloworld-jms + Apache Tuscany SCA iTest Distribution Webapp helloworld-jms + + + + + org.apache.tuscany.sca + itest-bin-distro-unzip + pom + 2.0-M4 + + + + org.apache.tuscany.sca + helloworld-jms + war + 2.0-M4 + + + + junit + junit + 4.5 + test + + + + htmlunit + htmlunit + 1.9 + test + + + + org.mortbay.jetty + jsp-2.0 + 6.1.19 + pom + compile + + + org.mortbay.jetty + jetty-naming + 6.1.19 + + + org.mortbay.jetty + jetty-plus + 6.1.19 + + + geronimo-spec + geronimo-spec-jta + 1.0.1B-rc4 + + + + + + + + org.codehaus.cargo + cargo-maven2-plugin + 1.0 + + + start-container + compile + + start + + + + stop-container + post-integration-test + + stop + + + + + false + + + jetty6x + org.codehaus.cargo.container.jetty.Jetty6xEmbeddedLocalContainer + + embedded + + + + org.mortbay.jetty + jetty + + + org.mortbay.jetty + jetty-util + + + org.mortbay.jetty + jetty-plus + + + org.mortbay.jetty + jetty-naming + + + geronimo-spec + geronimo-spec-jta + + + javax.servlet + servlet-api + + + org.mortbay.jetty + jsp-2.0 + + + tomcat + jasper-runtime + + + tomcat + jasper-compiler + + + commons-logging + commons-logging + + + tomcat + jasper-compiler-jdt + + + org.mortbay.jetty + jsp-api-2.0 + + + commons-el + commons-el + + + + + + + + org.codehaus.cargo.container.jetty.Jetty6xEmbeddedStandaloneLocalConfiguration + + + ${project.build.directory}/cargo-jetty + + + + 8085 + helloworld-jms + + + + org.apache.tuscany.sca + helloworld-jms + war + + helloworld-jms + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jms/src/test/java/itest/HelloworldTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jms/src/test/java/itest/HelloworldTestCase.java new file mode 100644 index 0000000000..bc436667c8 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jms/src/test/java/itest/HelloworldTestCase.java @@ -0,0 +1,51 @@ +/* + * 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 java.io.IOException; +import java.net.MalformedURLException; +import java.util.Iterator; + +import org.junit.Test; + +import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; +import com.gargoylesoftware.htmlunit.WebClient; +import com.gargoylesoftware.htmlunit.html.HtmlPage; +import com.gargoylesoftware.htmlunit.html.HtmlParagraph; + +/** + */ +public class HelloworldTestCase { + + @Test + public void testA() throws FailingHttpStatusCodeException, MalformedURLException, IOException { + HtmlPage page = (HtmlPage)new WebClient().getPage("http://localhost:8085/helloworld-jms"); + Iterator ss = page.getAllHtmlChildElements(); + ss.next(); + ss.next(); + ss.next(); + ss.next(); + HtmlParagraph p = (HtmlParagraph)ss.next(); + assertEquals("Hello world", p.asText()); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-js-client/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-js-client/pom.xml new file mode 100644 index 0000000000..bca540e6dc --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-js-client/pom.xml @@ -0,0 +1,188 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-distribution + 2.0-M4 + ../pom.xml + + itest-distribution-webapp-helloworld-js-client + Apache Tuscany SCA iTest Distribution Webapp helloworld-js-client + + + + + org.apache.tuscany.sca + itest-bin-distro-unzip + pom + 2.0-M4 + + + + org.apache.tuscany.sca + helloworld-js-client + war + 2.0-M4 + + + + junit + junit + 4.5 + test + + + + htmlunit + htmlunit + 1.9 + test + + + + org.mortbay.jetty + jsp-2.0 + 6.1.19 + pom + compile + + + + + + + + org.codehaus.cargo + cargo-maven2-plugin + 1.0 + + + start-container + compile + + start + + + + stop-container + post-integration-test + + stop + + + + + false + + + latest-jetty6x + org.codehaus.cargo.container.jetty.Jetty6xEmbeddedLocalContainer + + embedded + + + + org.mortbay.jetty + jetty + + + org.mortbay.jetty + jetty-util + + + javax.servlet + servlet-api + + + org.mortbay.jetty + jsp-2.0 + + + tomcat + jasper-runtime + + + tomcat + jasper-compiler + + + commons-logging + commons-logging + + + tomcat + jasper-compiler-jdt + + + org.mortbay.jetty + jsp-api-2.0 + + + commons-el + commons-el + + + + + + + + org.codehaus.cargo.container.jetty.Jetty6xEmbeddedStandaloneLocalConfiguration + + + ${project.build.directory}/cargo-jetty + + + + 8085 + helloworld-jsp + + + + org.apache.tuscany.sca + helloworld-js-client + war + + helloworld-js-client + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-js-client/src/test/java/itest/HelloworldTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-js-client/src/test/java/itest/HelloworldTestCase.java new file mode 100644 index 0000000000..099b442050 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-js-client/src/test/java/itest/HelloworldTestCase.java @@ -0,0 +1,75 @@ +/* + * 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.assertTrue; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLEncoder; + +import org.junit.Test; + +/** + * Verfiy the serverside code is working, not sure how to easily itest the browser javascript code + */ +public class HelloworldTestCase { + + @Test + public void testA() throws MalformedURLException, IOException { + + URL url = new URL("http://localhost:8085/helloworld-js-client/org.oasisopen.sca.componentContext.js/foo/call/plaincall/service.sayHello.dwr"); + URLConnection conn = url.openConnection(); + conn.setDoOutput(true); + OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); + + // to find this run the sample through TCPMON to capture the messages + + String data = URLEncoder.encode("callCount", "UTF-8") + "=" + URLEncoder.encode("1", "UTF-8"); + data += "&" + URLEncoder.encode("page", "UTF-8") + "=" + URLEncoder.encode("/helloworld-js-client/", "UTF-8"); + data += "&" + URLEncoder.encode("httpSessionId", "UTF-8") + "=" + URLEncoder.encode("", "UTF-8"); + data += "&" + URLEncoder.encode("scriptSessionId", "UTF-8") + "=" + URLEncoder.encode("A023DA664E56F075491BE1B87B37B02671", "UTF-8"); + data += "&" + URLEncoder.encode("c0-scriptName", "UTF-8") + "=" + URLEncoder.encode("service", "UTF-8"); + data += "&" + URLEncoder.encode("c0-methodName", "UTF-8") + "=" + URLEncoder.encode("sayHello", "UTF-8"); + data += "&" + URLEncoder.encode("c0-id", "UTF-8") + "=" + URLEncoder.encode("0", "UTF-8"); + data += "&" + URLEncoder.encode("c0-param0", "UTF-8") + "=" + URLEncoder.encode("string:petra", "UTF-8"); + data += "&" + URLEncoder.encode("batchId", "UTF-8") + "=" + URLEncoder.encode("0", "UTF-8"); + + wr.write(data); + wr.flush(); + + BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); + rd.readLine(); // throw 'allowScriptTagRemoting is false.'; + rd.readLine(); //#DWR-INSERT + rd.readLine(); //#DWR-REPLY + String line = rd.readLine(); // dwr.engine._remoteHandleCallback('0','0',"Hello petra"); + wr.close(); + rd.close(); + + assertTrue(line.endsWith("\"Hello petra\");")); + + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jsf/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jsf/pom.xml new file mode 100644 index 0000000000..4b4f07f2e4 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jsf/pom.xml @@ -0,0 +1,130 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-distribution + 2.0-M4 + ../pom.xml + + itest-distribution-webapp-helloworld-jsf + Apache Tuscany SCA iTest Distribution Webapp helloworld-jsf + + + + + org.apache.tuscany.sca + itest-bin-distro-unzip + pom + 2.0-M4 + + + + org.apache.tuscany.sca + helloworld-jsf + war + 2.0-M4 + + + + junit + junit + 4.5 + test + + + + htmlunit + htmlunit + 1.9 + test + + + + javax.el + el-api + 1.0 + + + + + + + + org.codehaus.cargo + cargo-maven2-plugin + 1.0 + + + start-container + compile + + start + + + + stop-container + post-integration-test + + stop + + + + + false + + jetty6x + embedded + + org.apache.commons.logging.impl.SimpleLog + + + + + ${project.build.directory}/cargo-jetty + + + + 8085 + helloworld-jsf + + + + org.apache.tuscany.sca + helloworld-jsf + war + + helloworld-jsf + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jsf/src/test/java/itest/HelloworldTestCaseFIXME.java b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jsf/src/test/java/itest/HelloworldTestCaseFIXME.java new file mode 100644 index 0000000000..1f90a772ac --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jsf/src/test/java/itest/HelloworldTestCaseFIXME.java @@ -0,0 +1,71 @@ +/* + * 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.IOException; +import java.net.MalformedURLException; +import java.util.Iterator; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; +import com.gargoylesoftware.htmlunit.WebClient; +import com.gargoylesoftware.htmlunit.html.HtmlForm; +import com.gargoylesoftware.htmlunit.html.HtmlInput; +import com.gargoylesoftware.htmlunit.html.HtmlPage; +import com.gargoylesoftware.htmlunit.html.HtmlParagraph; + +/** + * TODO: This doesn't work yet, I can't find the hello response in the + * the response page from the button click. Not sure if thats just + * looking in the wrong place or the button click is not working + * Also the Cargo maven plugin has a problem finding the el-api when using Jetty + */ +public class HelloworldTestCaseFIXME { + + @Test + public void testA() throws FailingHttpStatusCodeException, MalformedURLException, IOException { + HtmlPage page = (HtmlPage)new WebClient().getPage("http://localhost:8085/helloworld-jsf"); + + HtmlForm form = page.getFormByName("mainForm"); + + HtmlInput textField = form.getInputByName("mainForm:name"); + textField.setValueAttribute("root"); + + Iterator i = form.getChildIterator(); + i.next(); + HtmlInput button = (HtmlInput)i.next(); + + HtmlPage page2 = (HtmlPage)button.click(); + + Iterator ss = page2.getAllHtmlChildElements(); + ss.next(); + ss.next(); + ss.next(); + ss.next(); + HtmlForm form2 = (HtmlForm)ss.next(); + + Object oow = form2.getFirstChild(); + System.out.println(oow); +// assertTrue(p.asText().startsWith("Hello Petra")); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jsp/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jsp/pom.xml new file mode 100644 index 0000000000..584f2f1038 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jsp/pom.xml @@ -0,0 +1,188 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-distribution + 2.0-M4 + ../pom.xml + + itest-distribution-webapp-helloworld-jsp + Apache Tuscany SCA iTest Distribution Webapp helloworld-jsp + + + + + org.apache.tuscany.sca + itest-bin-distro-unzip + pom + 2.0-M4 + + + + org.apache.tuscany.sca + helloworld-jsp + war + 2.0-M4 + + + + junit + junit + 4.5 + test + + + + htmlunit + htmlunit + 1.9 + test + + + + org.mortbay.jetty + jsp-2.0 + 6.1.19 + pom + compile + + + + + + + + org.codehaus.cargo + cargo-maven2-plugin + 1.0 + + + start-container + compile + + start + + + + stop-container + post-integration-test + + stop + + + + + false + + + latest-jetty6x + org.codehaus.cargo.container.jetty.Jetty6xEmbeddedLocalContainer + + embedded + + + + org.mortbay.jetty + jetty + + + org.mortbay.jetty + jetty-util + + + javax.servlet + servlet-api + + + org.mortbay.jetty + jsp-2.0 + + + tomcat + jasper-runtime + + + tomcat + jasper-compiler + + + commons-logging + commons-logging + + + tomcat + jasper-compiler-jdt + + + org.mortbay.jetty + jsp-api-2.0 + + + commons-el + commons-el + + + + + + + + org.codehaus.cargo.container.jetty.Jetty6xEmbeddedStandaloneLocalConfiguration + + + ${project.build.directory}/cargo-jetty + + + + 8085 + helloworld-jsp + + + + org.apache.tuscany.sca + helloworld-jsp + war + + helloworld-jsp + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jsp/src/test/java/itest/HelloworldTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jsp/src/test/java/itest/HelloworldTestCase.java new file mode 100644 index 0000000000..2be60be081 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-jsp/src/test/java/itest/HelloworldTestCase.java @@ -0,0 +1,50 @@ +/* + * 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 java.io.IOException; +import java.net.MalformedURLException; +import java.util.Iterator; + +import org.junit.Test; + +import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; +import com.gargoylesoftware.htmlunit.WebClient; +import com.gargoylesoftware.htmlunit.html.HtmlPage; +import com.gargoylesoftware.htmlunit.html.HtmlParagraph; + +/** + */ +public class HelloworldTestCase { + + @Test + public void testA() throws FailingHttpStatusCodeException, MalformedURLException, IOException { + HtmlPage page = (HtmlPage)new WebClient().getPage("http://localhost:8085/helloworld-jsp"); + Iterator ss = page.getAllHtmlChildElements(); + ss.next(); + ss.next(); + ss.next(); + HtmlParagraph p = (HtmlParagraph)ss.next(); + assertEquals("Hello world", p.asText()); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-stripes/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-stripes/pom.xml new file mode 100644 index 0000000000..6cb817579f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-stripes/pom.xml @@ -0,0 +1,124 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-distribution + 2.0-M4 + ../pom.xml + + itest-distribution-webapp-helloworld-stripes + Apache Tuscany SCA iTest Distribution Webapp helloworld-stripes + + + + + org.apache.tuscany.sca + itest-bin-distro-unzip + pom + 2.0-M4 + + + + org.apache.tuscany.sca + helloworld-stripes + war + 2.0-M4 + + + + junit + junit + 4.5 + test + + + + htmlunit + htmlunit + 1.9 + test + + + + + + + + org.codehaus.cargo + cargo-maven2-plugin + 1.0 + + + start-container + compile + + start + + + + stop-container + post-integration-test + + stop + + + + + false + + jetty6x + embedded + + org.apache.commons.logging.impl.SimpleLog + + + + + ${project.build.directory}/cargo-jetty + + + + 8085 + helloworld-stripes + + + + org.apache.tuscany.sca + helloworld-stripes + war + + helloworld-stripes + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-stripes/src/test/java/itest/HelloworldTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-stripes/src/test/java/itest/HelloworldTestCase.java new file mode 100644 index 0000000000..743ab054c8 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld-stripes/src/test/java/itest/HelloworldTestCase.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 itest; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.util.Iterator; + +import org.junit.Test; + +import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; +import com.gargoylesoftware.htmlunit.WebClient; +import com.gargoylesoftware.htmlunit.html.HtmlPage; +import com.gargoylesoftware.htmlunit.html.HtmlParagraph; + +/** + */ +public class HelloworldTestCase { + + @Test + public void testA() throws FailingHttpStatusCodeException, MalformedURLException, IOException { + HtmlPage page = (HtmlPage)new WebClient().getPage("http://localhost:8085/helloworld-stripes"); + Iterator ss = page.getAllHtmlChildElements(); + Object o1= ss.next(); + Object o2= ss.next(); + Object o3= ss.next(); + Object o4= ss.next(); + Object o5= ss.next(); + Object o6= ss.next(); + HtmlParagraph p = (HtmlParagraph)ss.next(); + assertEquals("sayHello returns: Hello world", p.asText()); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld/pom.xml new file mode 100644 index 0000000000..2eea7bfcd6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/distribution/webapp-helloworld/pom.xml @@ -0,0 +1,121 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + itest-distribution + 2.0-M4 + ../pom.xml + + itest-distribution-webapp-helloworld + Apache Tuscany SCA iTest Distribution Webapp helloworld + + + + + org.apache.tuscany.sca + itest-bin-distro-unzip + pom + 2.0-M4 + + + + org.apache.tuscany.sca + helloworld + war + 2.0-M4 + + + + junit + junit + 4.5 + test + + + + httpunit + httpunit + 1.6.1 + test + + + + + + + + org.codehaus.cargo + cargo-maven2-plugin + 1.0 + + + start-container + pre-integration-test + + start + + + + stop-container + post-integration-test + + stop + + + + + false + + jetty6x + embedded + + org.apache.commons.logging.impl.SimpleLog + + + + + ${project.build.directory}/cargo-jetty + + + + 8085 + + + + org.apache.tuscany.sca + helloworld + war + http://localhost:8085/helloworld + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/endpoints/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/endpoints/pom.xml new file mode 100644 index 0000000000..f91d34f151 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/endpoints/pom.xml @@ -0,0 +1,68 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-endpoints + Apache Tuscany SCA iTest Endpoints + + + + + org.apache.tuscany.sca + tuscany-binding-jsonp-runtime + 2.0-M4 + + + org.apache.tuscany.sca + tuscany-binding-rmi-runtime + 2.0-M4 + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/java/helloworld/HelloWorldImpl.java b/tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..c307547f56 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/java/helloworld/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 helloworld; + + +public class HelloWorldImpl implements HelloWorldService { + + public String sayHello(String name) { + return "Hello " + name; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/java/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..064d615c45 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/java/helloworld/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 helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloWorldService { + + String sayHello(String name); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/java/test/EndpointsTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/java/test/EndpointsTestCase.java new file mode 100644 index 0000000000..7802848c3b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/java/test/EndpointsTestCase.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 test; + +import java.io.IOException; +import java.net.MalformedURLException; + +import org.apache.tuscany.sca.http.jetty.JettyServer; +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 EndpointsTestCase { + + private static Node node; + + @Test + public void testJSONP1() throws MalformedURLException, IOException { + // + Utils.invokeJSONPEndpoint("http://localhost:8085/JSONPComponent1/HelloWorldService/sayHello?name=petra&callback=foo"); + } + @Test + public void testJSONP2() throws MalformedURLException, IOException { + // + Utils.invokeJSONPEndpoint("http://localhost:8085/JSONPComponent2/HelloWorldService/jsonp2/sayHello?name=petra&callback=foo"); + } + @Test + public void testJSONP3() throws MalformedURLException, IOException { + // + Utils.invokeJSONPEndpoint("http://localhost:8085/JSONPComponent3/HelloWorldService/jsonp3/sayHello?name=petra&callback=foo"); + } + @Test + public void testJSONP4() throws MalformedURLException, IOException { + // + Utils.invokeJSONPEndpoint("http://localhost:8085/jsonp4/sayHello?name=petra&callback=foo"); + } + @Test + public void testJSONP5() throws MalformedURLException, IOException { + // + Utils.invokeJSONPEndpoint("http://localhost:8085/jsonp5b/sayHello?name=petra&callback=foo"); + } + @Test + public void testJSONP6() throws MalformedURLException, IOException { + // + Utils.invokeJSONPEndpoint("http://localhost:8085/JSONPComponent6/HelloWorldService/jsonp6a/jsonp6b/sayHello?name=petra&callback=foo"); + } + + @Test + public void testWS1() throws MalformedURLException, Exception { + // + Utils.invokeWSEndpoint("http://localhost:8085/WSComponent1/HelloWorldService"); + } + @Test + public void testWS2() throws MalformedURLException, Exception { + // + Utils.invokeWSEndpoint("http://localhost:8085/WSComponent2/HelloWorldService/ws2"); + } + @Test + public void testWS3() throws MalformedURLException, Exception { + // + Utils.invokeWSEndpoint("http://localhost:8085/WSComponent3/HelloWorldService/ws3"); + } + @Test + public void testWS4() throws MalformedURLException, Exception { + // + Utils.invokeWSEndpoint("http://localhost:8085/ws4"); + } + @Test + public void testWS5() throws MalformedURLException, Exception { + // + Utils.invokeWSEndpoint("http://localhost:8085/ws5b"); + } + @Test + public void testWS6() throws Exception { + // + Utils.invokeWSEndpoint("http://localhost:8085/WSComponent6/HelloWorldService/ws6a/ws6b"); + } + + @BeforeClass + public static void init() throws Exception { + JettyServer.portDefault = 8085; + node = NodeFactory.newInstance().createNode("helloworld.composite").start(); + } + + @AfterClass + public static void destroy() throws Exception { + if (node != null) { + node.stop(); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/java/test/NestedEndpointsTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/java/test/NestedEndpointsTestCase.java new file mode 100644 index 0000000000..f3b6c15bf1 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/java/test/NestedEndpointsTestCase.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 test; + +import java.io.IOException; +import java.net.MalformedURLException; + +import org.apache.tuscany.sca.http.jetty.JettyServer; +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 NestedEndpointsTestCase { + + private static Node node; + + @Test + public void testJSONP1() throws MalformedURLException, IOException { + // + Utils.invokeJSONPEndpoint("http://localhost:8085/NestedComponent1/JSONPComponent1/HelloWorldService/sayHello?name=petra&callback=foo"); + } + @Test + public void testJSONP2() throws MalformedURLException, IOException { + // + Utils.invokeJSONPEndpoint("http://localhost:8085/NestedComponent1/JSONPComponent2/HelloWorldService/jsonp2/sayHello?name=petra&callback=foo"); + } + @Test + public void testJSONP3() throws MalformedURLException, IOException { + // + Utils.invokeJSONPEndpoint("http://localhost:8085/NestedComponent1/JSONPComponent3/HelloWorldService/jsonp3/sayHello?name=petra&callback=foo"); + } + @Test + public void testJSONP4() throws MalformedURLException, IOException { + // + Utils.invokeJSONPEndpoint("http://localhost:8085/jsonp4/sayHello?name=petra&callback=foo"); + } + @Test + public void testJSONP5() throws MalformedURLException, IOException { + // + Utils.invokeJSONPEndpoint("http://localhost:8085/jsonp5b/sayHello?name=petra&callback=foo"); + } + @Test + public void testJSONP6() throws MalformedURLException, IOException { + // + Utils.invokeJSONPEndpoint("http://localhost:8085/NestedComponent1/JSONPComponent6/HelloWorldService/jsonp6a/jsonp6b/sayHello?name=petra&callback=foo"); + } + + @Test + public void testWS1() throws MalformedURLException, Exception { + // + Utils.invokeWSEndpoint("http://localhost:8085/NestedComponent1/WSComponent1/HelloWorldService"); + } + @Test + public void testWS2() throws MalformedURLException, Exception { + // + Utils.invokeWSEndpoint("http://localhost:8085/NestedComponent1/WSComponent2/HelloWorldService/ws2"); + } + @Test + public void testWS3() throws MalformedURLException, Exception { + // + Utils.invokeWSEndpoint("http://localhost:8085/NestedComponent1/WSComponent3/HelloWorldService/ws3"); + } + @Test + public void testWS4() throws MalformedURLException, Exception { + // + Utils.invokeWSEndpoint("http://localhost:8085/ws4"); + } + @Test + public void testWS5() throws MalformedURLException, Exception { + // + Utils.invokeWSEndpoint("http://localhost:8085/ws5b"); + } + @Test + public void testWS6() throws Exception { + // + Utils.invokeWSEndpoint("http://localhost:8085/NestedComponent1/WSComponent6/HelloWorldService/ws6a/ws6b"); + } + + @BeforeClass + public static void init() throws Exception { + JettyServer.portDefault = 8085; + node = NodeFactory.newInstance().createNode("nested.composite").start(); + } + + @AfterClass + public static void destroy() throws Exception { + if (node != null) { + node.stop(); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/java/test/Utils.java b/tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/java/test/Utils.java new file mode 100644 index 0000000000..5107d8f660 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/java/test/Utils.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 test; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; + +import javax.wsdl.Definition; +import javax.wsdl.Port; +import javax.wsdl.Service; +import javax.wsdl.extensions.soap.SOAPAddress; +import javax.wsdl.factory.WSDLFactory; +import javax.wsdl.xml.WSDLReader; + +import junit.framework.Assert; + +public class Utils { + + public static void invokeJSONPEndpoint(String s) throws MalformedURLException, IOException { + URL url = new URL(s); + BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream())); + String response = br.readLine(); + Assert.assertEquals("foo(\"Hello petra\");", response); + } + + public static void invokeWSEndpoint(String endpoint) throws Exception { + WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader(); + wsdlReader.setFeature("javax.wsdl.verbose",false); + wsdlReader.setFeature("javax.wsdl.importDocuments",true); + + Definition definition = wsdlReader.readWSDL(endpoint + "?wsdl"); + Assert.assertNotNull(definition); + Service service = (Service)definition.getServices().values().iterator().next(); + Port port = (Port)service.getPorts().values().iterator().next(); + + Assert.assertEquals(new URL(endpoint).getPath(), new URL(getEndpoint(port)).getPath()); + } + + private static String getEndpoint(Port port) { + List wsdlPortExtensions = port.getExtensibilityElements(); + for (final Object extension : wsdlPortExtensions) { + if (extension instanceof SOAPAddress) { + return ((SOAPAddress) extension).getLocationURI(); + } + } + throw new RuntimeException("no SOAPAddress"); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/resources/helloworld.composite b/tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/resources/helloworld.composite new file mode 100644 index 0000000000..081804b34e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/resources/helloworld.composite @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/resources/nested.composite b/tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/resources/nested.composite new file mode 100644 index 0000000000..ffc73644f1 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/endpoints/src/test/resources/nested.composite @@ -0,0 +1,30 @@ + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/exceptions/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/exceptions/pom.xml new file mode 100644 index 0000000000..48a8bea40f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/exceptions/pom.xml @@ -0,0 +1,53 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-exceptions + Apache Tuscany SCA iTest Exceptions + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + test + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.java b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.java new file mode 100644 index 0000000000..1f57116bac --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.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.test.exceptions; + +public class Checked extends Exception { + private static final long serialVersionUID = -129752837478357452L; + + /** + * + */ + public Checked() { + + } + + /** + * @param message + */ + public Checked(String message) { + super(message); + + } + + /** + * @param cause + */ + public Checked(Throwable cause) { + super(cause); + + } + + /** + * @param message + * @param cause + */ + public Checked(String message, Throwable cause) { + super(message, cause); + + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.java b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.java new file mode 100644 index 0000000000..112aefc747 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.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 org.apache.tuscany.sca.test.exceptions; + +public interface ExceptionHandler { + + void testing(); + + Checked getTheBad(); + + String getTheGood(); + + UnChecked getTheUgly(); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionRemoteThrower.java b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionRemoteThrower.java new file mode 100644 index 0000000000..53a6c70b57 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionRemoteThrower.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.test.exceptions; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * Remote exception thrower + * @version $Rev$ $Date$ + */ +@Remotable +public interface ExceptionRemoteThrower extends ExceptionThrower { +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.java b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.java new file mode 100644 index 0000000000..ace219991b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.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 org.apache.tuscany.sca.test.exceptions; + +/** + * Local exception thrower + * @version $Rev$ $Date$ + */ +public interface ExceptionThrower { + Checked BAD = new Checked("theBad"); + UnChecked UGLY = new UnChecked("theUgly"); + String SO_THEY_SAY = "All is good that ends good."; + + String theGood() throws Checked; + + String theBad() throws Checked; + + String theUgly() throws Checked; + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.java b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.java new file mode 100644 index 0000000000..453528444d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.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.test.exceptions; + +public class UnChecked extends RuntimeException { + private static final long serialVersionUID = -1318118082838092244L; + + /** + * + */ + public UnChecked() { + + } + + /** + * @param message + */ + public UnChecked(String message) { + super(message); + + } + + /** + * @param cause + */ + public UnChecked(Throwable cause) { + super(cause); + + } + + /** + * @param message + * @param cause + */ + public UnChecked(String message, Throwable cause) { + super(message, cause); + + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.java b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.java new file mode 100644 index 0000000000..26b9f0a383 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.java @@ -0,0 +1,115 @@ +/* + * 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.test.exceptions.impl; + +import org.apache.tuscany.sca.test.exceptions.Checked; +import org.apache.tuscany.sca.test.exceptions.ExceptionHandler; +import org.apache.tuscany.sca.test.exceptions.ExceptionThrower; +import org.apache.tuscany.sca.test.exceptions.UnChecked; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; + +@Scope("COMPOSITE") +public class ExceptionHandlerImpl implements ExceptionHandler { + static final String INIT = "INIT"; + + private ExceptionThrower exceptionThrower; + + private String theGood; + + private Checked theBad; + + private UnChecked theUgly; + + public void testing() { + + assert exceptionThrower != null : "'exceptionThrower' never wired"; + String result = INIT; + try { + theGood = result = exceptionThrower.theGood(); + assert result == ExceptionThrower.SO_THEY_SAY; + } catch (Throwable e) { + assert result == INIT; + assert false; + e.printStackTrace(); + } + + result = INIT; + try { + result = exceptionThrower.theBad(); + // incredible + assert false : "Expected 'Check' Exception"; + + } catch (Checked e) { + // This is good... + assert result == INIT; + theBad = e; + } catch (Throwable t) { + // This is not so good. + t.printStackTrace(); + assert result == INIT; + assert false : "Got wrong exception '" + t.getClass().getName(); + } + + result = INIT; + try { + result = exceptionThrower.theUgly(); + // incredible + assert false : "Expected 'UnCheck' Exception"; + + } catch (Checked e) { + // This is not so good... + assert false : "Got wrong exception '" + e.getClass().getName(); + assert result == INIT; + } catch (UnChecked e) { + theUgly = e; + + } catch (Throwable t) { + // This is not good. + assert false; + assert result == INIT; + + System.out.println(ExceptionThrower.SO_THEY_SAY + " " + INIT); + } + + } + + @Reference + public void setExceptionThrower(ExceptionThrower exceptionThrower) { + this.exceptionThrower = exceptionThrower; + } + + public String getTheGood() { + return theGood; + } + + public Checked getTheBad() { + return theBad; + } + + public UnChecked getTheUgly() { + return theUgly; + } + + public ExceptionThrower getExceptionThrower() { + return exceptionThrower; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionRemoteThrowerImpl.java b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionRemoteThrowerImpl.java new file mode 100644 index 0000000000..cd62338841 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionRemoteThrowerImpl.java @@ -0,0 +1,44 @@ +/* + * 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.test.exceptions.impl; + +import org.apache.tuscany.sca.test.exceptions.Checked; +import org.apache.tuscany.sca.test.exceptions.ExceptionRemoteThrower; +import org.oasisopen.sca.annotation.Service; + +/** + * + * @version $Rev$ $Date$ + */ +@Service(ExceptionRemoteThrower.class) +public class ExceptionRemoteThrowerImpl implements ExceptionRemoteThrower { + public String theBad() throws Checked { + throw BAD; + } + + public String theGood() throws Checked { + return SO_THEY_SAY; + } + + public String theUgly() throws Checked { + throw UGLY; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.java b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.java new file mode 100644 index 0000000000..56b9fc6f5b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.java @@ -0,0 +1,45 @@ +/* + * 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.test.exceptions.impl; + +import org.apache.tuscany.sca.test.exceptions.Checked; +import org.apache.tuscany.sca.test.exceptions.ExceptionThrower; +import org.oasisopen.sca.annotation.Service; + +/** + * + * @version $Rev$ $Date$ + */ +@Service(ExceptionThrower.class) +public class ExceptionThrowerImpl implements ExceptionThrower { + + public String theBad() throws Checked { + throw BAD; + } + + public String theGood() throws Checked { + return SO_THEY_SAY; + } + + public String theUgly() throws Checked { + throw UGLY; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/RemoteExceptionHandlerImpl.java b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/RemoteExceptionHandlerImpl.java new file mode 100644 index 0000000000..c5b54ff902 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/RemoteExceptionHandlerImpl.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.test.exceptions.impl; + +import org.apache.tuscany.sca.test.exceptions.Checked; +import org.apache.tuscany.sca.test.exceptions.ExceptionHandler; +import org.apache.tuscany.sca.test.exceptions.ExceptionRemoteThrower; +import org.apache.tuscany.sca.test.exceptions.ExceptionThrower; +import org.apache.tuscany.sca.test.exceptions.UnChecked; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; + +@Scope("COMPOSITE") +public class RemoteExceptionHandlerImpl implements ExceptionHandler { + static final String INIT = "INIT"; + + private ExceptionRemoteThrower exceptionThrower; + + private String theGood; + + private Checked theBad; + + private UnChecked theUgly; + + public void testing() { + + assert exceptionThrower != null : "'exceptionThrower' never wired"; + String result = INIT; + try { + theGood = result = exceptionThrower.theGood(); + assert result == ExceptionThrower.SO_THEY_SAY; + } catch (Throwable e) { + assert result == INIT; + assert false; + e.printStackTrace(); + } + + result = INIT; + try { + result = exceptionThrower.theBad(); + // incredible + assert false : "Expected 'Check' Exception"; + + } catch (Checked e) { + // This is good... + assert result == INIT; + theBad = e; + } catch (Throwable t) { + // This is not so good. + t.printStackTrace(); + assert result == INIT; + assert false : "Got wrong exception '" + t.getClass().getName(); + } + + result = INIT; + try { + result = exceptionThrower.theUgly(); + // incredible + assert false : "Expected 'UnCheck' Exception"; + + } catch (Checked e) { + // This is not so good... + assert false : "Got wrong exception '" + e.getClass().getName(); + assert result == INIT; + } catch (UnChecked e) { + theUgly = e; + + } catch (Throwable t) { + // This is not good. + assert false; + assert result == INIT; + + System.out.println(ExceptionThrower.SO_THEY_SAY + " " + INIT); + } + + } + + @Reference + public void setExceptionThrower(ExceptionRemoteThrower exceptionThrower) { + this.exceptionThrower = exceptionThrower; + } + + public String getTheGood() { + return theGood; + } + + public Checked getTheBad() { + return theBad; + } + + public UnChecked getTheUgly() { + return theUgly; + } + + public ExceptionRemoteThrower getExceptionThrower() { + return exceptionThrower; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/resources/ExceptionTest.composite b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/resources/ExceptionTest.composite new file mode 100644 index 0000000000..d42866303e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/main/resources/ExceptionTest.composite @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/ExceptionsTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/ExceptionsTestCase.java new file mode 100644 index 0000000000..7794348476 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/ExceptionsTestCase.java @@ -0,0 +1,85 @@ +/* + * 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.test.exceptions; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertSame; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +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 ExceptionsTestCase { + + private static Node node; + + /** + * Test exception handling over a local interface + */ + @Test + public void testLocal() { + ExceptionHandler exceptionHandler = node.getService(ExceptionHandler.class, "main"); + exceptionHandler.testing(); + assertEquals(ExceptionThrower.SO_THEY_SAY, exceptionHandler.getTheGood()); + assertNotNull(exceptionHandler.getTheBad()); + assertEquals(Checked.class, exceptionHandler.getTheBad().getClass()); + assertSame(ExceptionThrower.BAD, exceptionHandler.getTheBad()); + assertNotNull(exceptionHandler.getTheUgly()); + assertEquals(UnChecked.class, exceptionHandler.getTheUgly().getClass()); + assertSame(ExceptionThrower.UGLY, exceptionHandler.getTheUgly()); + } + + /** + * Test exception handling over a remotable interface + */ + @Test + public void testRemote() { + ExceptionHandler exceptionHandler = node.getService(ExceptionHandler.class, "mainRemote"); + exceptionHandler.testing(); + assertEquals(ExceptionThrower.SO_THEY_SAY, exceptionHandler.getTheGood()); + assertNotNull(exceptionHandler.getTheBad()); + assertEquals(Checked.class, exceptionHandler.getTheBad().getClass()); + assertNotSame(ExceptionThrower.BAD, exceptionHandler.getTheBad()); + assertNotNull(exceptionHandler.getTheUgly()); + assertEquals(UnChecked.class, exceptionHandler.getTheUgly().getClass()); + + // [rfeng] We're not in a position to copy non business exceptions + // assertNotSame(ExceptionThrower.UGLY, exceptionHandler.getTheUgly()); + + } + + @BeforeClass + public static void setUp() throws Exception { + String location = ContributionLocationHelper.getContributionLocation("ExceptionTest.composite"); + node = NodeFactory.newInstance().createNode("ExceptionTest.composite", new Contribution("c1", location)); + node.start(); + } + + @AfterClass + public static void tearDown() throws Exception { + node.stop(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/pom.xml new file mode 100644 index 0000000000..623cef9b09 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/pom.xml @@ -0,0 +1,80 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-implementation-spring + Apache Tuscany SCA iTest Spring Implementation + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-spring + 2.0-M4 + + + org.apache.tuscany.sca + tuscany-implementation-spring-sca + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-M4 + + + + + org.springframework + spring-core + 2.5.5 + + + + org.springframework + spring-beans + 2.5.5 + + + + org.springframework + spring-context + 2.5.5 + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/bigbank/stockquote/StockQuoteImpl.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/bigbank/stockquote/StockQuoteImpl.java new file mode 100644 index 0000000000..bd7770ca7d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/bigbank/stockquote/StockQuoteImpl.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 bigbank.stockquote; + +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the StockQuote service. + */ +@Service(StockQuoteService.class) +public class StockQuoteImpl implements StockQuoteService { + + public double getQuote(String symbol) { + double price = 104.0 + Math.random(); + price = ((int)(price * 100)) / 100.0; + + System.out.println("Getting stock quote for: " + symbol + ", value: "+ price); + + return price; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/bigbank/stockquote/StockQuoteService.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/bigbank/stockquote/StockQuoteService.java new file mode 100644 index 0000000000..747433a9e7 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/bigbank/stockquote/StockQuoteService.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 bigbank.stockquote; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the StockQuote service. + */ +@Remotable +public interface StockQuoteService { + + public double getQuote(String symbol); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/AddService.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/AddService.java new file mode 100644 index 0000000000..188451ebac --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/AddService.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 calculator; + +/** + * The Add service interface + */ +public interface AddService { + + double add(double n1, double n2); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/AddServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/AddServiceImpl.java new file mode 100644 index 0000000000..eae607a7ca --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/AddServiceImpl.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 calculator; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * An implementation of the Add service + */ +public class AddServiceImpl implements AddService { + + public double add(double n1, double n2) { + Logger logger = Logger.getLogger("calculator"); + logger.log(Level.FINEST, "Adding " + n1 + " and " + n2); + return n1 + n2; + } + +} \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/CalculatorService.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..ce1cdaae5a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/CalculatorService.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 calculator; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The Calculator service interface. + */ +@Remotable +public interface CalculatorService { + + double add(double n1, double n2); + + double subtract(double n1, double n2); + + double multiply(double n1, double n2); + + double divide(double n1, double n2); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/CalculatorServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..b033516c1b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/CalculatorServiceImpl.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 calculator; + +/** + * An implementation of the Calculator service. + */ +public class CalculatorServiceImpl implements CalculatorService { + + private AddService addService; + private SubtractService subtractService; + private MultiplyService multiplyService; + private DivideService divideService; + + public void setAddService(AddService addService) { + this.addService = addService; + } + + public AddService getAddService() { + return addService; + } + + public void setSubtractService(SubtractService subtractService) { + this.subtractService = subtractService; + } + + public SubtractService getSubtractService() { + return subtractService; + } + + public void setDivideService(DivideService divideService) { + this.divideService = divideService; + } + + public DivideService getDivideService() { + return divideService; + } + + public void setMultiplyService(MultiplyService multiplyService) { + this.multiplyService = multiplyService; + } + + public MultiplyService getMultiplyService() { + return multiplyService; + } + + public double add(double n1, double n2) { + return addService.add(n1, n2); + } + + public double subtract(double n1, double n2) { + return subtractService.subtract(n1, n2); + } + + public double multiply(double n1, double n2) { + return multiplyService.multiply(n1, n2); + } + + public double divide(double n1, double n2) { + return divideService.divide(n1, n2); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/DivideService.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..30d248208b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/DivideService.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 calculator; + +/** + * The divide service interface + */ +public interface DivideService { + + double divide(double n1, double n2); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/DivideServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/DivideServiceImpl.java new file mode 100644 index 0000000000..1323edf55a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/DivideServiceImpl.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 calculator; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * An implementation of the Divide service. + */ +public class DivideServiceImpl implements DivideService { + + public double divide(double n1, double n2) { + Logger logger = Logger.getLogger("calculator"); + logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2); + return n1 / n2; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/MultiplyService.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/MultiplyService.java new file mode 100644 index 0000000000..5290605938 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/MultiplyService.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 calculator; + +/** + * The interface for the multiply service + */ +public interface MultiplyService { + + double multiply(double n1, double n2); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/MultiplyServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/MultiplyServiceImpl.java new file mode 100644 index 0000000000..91b803bc9e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/MultiplyServiceImpl.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 calculator; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * An implementation of the Multiply service. + */ +public class MultiplyServiceImpl implements MultiplyService { + + public double multiply(double n1, double n2) { + Logger logger = Logger.getLogger("calculator"); + logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2); + return n1 * n2; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/SubtractService.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/SubtractService.java new file mode 100644 index 0000000000..bf0d1882b6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/SubtractService.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 calculator; + +/** + * The interface for the multiply service + */ +public interface SubtractService { + + double subtract(double n1, double n2); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/SubtractServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/SubtractServiceImpl.java new file mode 100644 index 0000000000..58cc4a3547 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/SubtractServiceImpl.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 calculator; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * An implementation of the subtract service. + */ +public class SubtractServiceImpl implements SubtractService { + + public double subtract(double n1, double n2) { + Logger logger = Logger.getLogger("calculator"); + logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2); + return n1 - n2; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/security/CalculatorCallbackHandler.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/security/CalculatorCallbackHandler.java new file mode 100644 index 0000000000..4f063993a3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/security/CalculatorCallbackHandler.java @@ -0,0 +1,50 @@ +/* + * 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 calculator.security; + +import java.io.IOException; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.NameCallback; +import javax.security.auth.callback.PasswordCallback; +import javax.security.auth.callback.UnsupportedCallbackException; + +/** + * @version $Rev$ $Date$ + */ +public class CalculatorCallbackHandler implements CallbackHandler { + + public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { + for (int i = 0; i < callbacks.length; i++) { + if (callbacks[i] instanceof NameCallback) { + NameCallback nc = (NameCallback)callbacks[i]; + nc.setName("CalculatorUser"); + } else if (callbacks[i] instanceof PasswordCallback) { + PasswordCallback pc = (PasswordCallback)callbacks[i]; + pc.setPassword("CalculatorUserPasswd".toCharArray()); + } else { + throw new UnsupportedCallbackException + (callbacks[i], "Unsupported Callback!"); + } + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/security/JaasLoginModule.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/security/JaasLoginModule.java new file mode 100644 index 0000000000..b3ef6e7312 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/security/JaasLoginModule.java @@ -0,0 +1,178 @@ +/* + * 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 calculator.security; + +import java.security.Principal; +import java.util.Map; + +import javax.security.auth.Subject; +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.NameCallback; +import javax.security.auth.callback.PasswordCallback; +import javax.security.auth.login.LoginException; +import javax.security.auth.spi.LoginModule; + +/** + * @version $Rev$ $Date$ + */ +public class JaasLoginModule implements LoginModule { + + private CallbackHandler callbackHandler; + private Subject subject; + private Principal userPrincipal; + private String userId; + private String password; + private boolean succeeded; + private boolean commitSucceeded; + + public void initialize(Subject subject, + CallbackHandler callbackHandler, + Map sharedState, + Map options) { + this.callbackHandler = callbackHandler; + this.subject = subject; + } + + public boolean login() throws LoginException { + Callback[] callbacks = new Callback[2]; + callbacks[0] = new NameCallback("UserId:"); + callbacks[1] = new PasswordCallback("Password:", false); + + try { + callbackHandler.handle(callbacks); + userId = ((NameCallback)callbacks[0]).getName(); + password = new String(((PasswordCallback)callbacks[1]).getPassword()); + + if (userId.equals("CalculatorUser") && password.equals("CalculatorUserPasswd")) { + System.out.println("Successfully AUTHENTICATED!!"); + succeeded = true; + return true; + } else { + System.out.println("Incorrect userId / password! AUTHENTICATION FAILED!!"); + return false; + } + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + *

This method is called if the LoginContext's + * overall authentication succeeded + * (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules + * succeeded). + * + *

If this LoginModule's own authentication attempt + * succeeded (checked by retrieving the private state saved by the + * login method), then this method associates a + * UserPrincipal + * with the Subject located in the + * LoginModule. If this LoginModule's own + * authentication attempted failed, then this method removes + * any state that was originally saved. + * + *

+ * + * @exception LoginException if the commit fails. + * + * @return true if this LoginModule's own login and commit + * attempts succeeded, or false otherwise. + */ + public boolean commit() throws LoginException { + if (succeeded == false) { + return false; + } else { + // add a Principal (authenticated identity) to the Subject + + // assume the user we authenticated is the UserPrincipal + userPrincipal = new UserPrincipal(userId); + if (!subject.getPrincipals().contains(userPrincipal)) + subject.getPrincipals().add(userPrincipal); + + // in any case, clean out state + userId = null; + password = null; + commitSucceeded = true; + return true; + } + } + + /** + *

This method is called if the LoginContext's + * overall authentication failed. + * (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules + * did not succeed). + * + *

If this LoginModule's own authentication attempt + * succeeded (checked by retrieving the private state saved by the + * login and commit methods), + * then this method cleans up any state that was originally saved. + * + *

+ * + * @exception LoginException if the abort fails. + * + * @return false if this LoginModule's own login and/or commit attempts + * failed, and true otherwise. + */ + public boolean abort() throws LoginException { + if (succeeded == false) { + return false; + } else if (succeeded == true && commitSucceeded == false) { + // login succeeded but overall authentication failed + succeeded = false; + userId = null; + password = null; + userPrincipal = null; + } else { + // overall authentication succeeded and commit succeeded, + // but someone else's commit failed + logout(); + } + return true; + } + + /** + * Logout the user. + * + *

This method removes the SimplePrincipal + * that was added by the commit method. + * + *

+ * + * @exception LoginException if the logout fails. + * + * @return true in all cases since this LoginModule + * should not be ignored. + */ + public boolean logout() throws LoginException { + subject.getPrincipals().remove(userPrincipal); + succeeded = false; + succeeded = commitSucceeded; + userId = null; + if (password != null) + password = null; + userPrincipal = null; + return true; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/security/UserPrincipal.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/security/UserPrincipal.java new file mode 100644 index 0000000000..595626e672 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/calculator/security/UserPrincipal.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 calculator.security; + +import java.security.Principal; + +/** + * @version $Rev$ $Date$ + */ +public class UserPrincipal implements Principal { + + private final String name; + + public UserPrincipal(String name) { + if (name == null) + throw new IllegalArgumentException("name cannot be null"); + this.name = name; + } + + public String getName() { + return name; + } + + public String toString() { + return name; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final UserPrincipal other = (UserPrincipal)obj; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + return true; + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/context/access/SCAApplicationContextProvider.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/context/access/SCAApplicationContextProvider.java new file mode 100644 index 0000000000..fed509df98 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/context/access/SCAApplicationContextProvider.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 context.access; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; + +public class SCAApplicationContextProvider implements ApplicationContextAware { + + private static ApplicationContext ctx; + + public void setApplicationContext(ApplicationContext appContext) throws BeansException { + // Wiring the ApplicationContext into a static method + ctx = appContext; + } + + public static ApplicationContext getApplicationContext() { + return ctx; + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/helloworld/HelloWorld.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/helloworld/HelloWorld.java new file mode 100644 index 0000000000..8bb3006d12 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/helloworld/HelloWorld.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 helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * Interface for the "hello world" service - predictably simple with a single operation + * "sayHello" + * + * @version $Rev$ $Date$ + */ +@Remotable +public interface HelloWorld { + + String sayHello(String s); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/helloworld/HelloWorldImpl.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..f68134702b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/helloworld/HelloWorldImpl.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 helloworld; + +/** + * A simple proxy Java class which implements the HelloWorld interface but which uses + * a reference "delegate" to actually provide the HelloWorld service + * + * @version $Rev$ $Date$ + */ +public class HelloWorldImpl implements HelloWorld { + + static String hello = "Hello "; + + public String sayHello(String s) { + // Simply call the reference to satisfy the service request... + System.out.println("HelloWorldImpl - sayHello called"); + return (hello + s); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/helloworld/HelloWorldProxy.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/helloworld/HelloWorldProxy.java new file mode 100644 index 0000000000..78b3649b5b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/helloworld/HelloWorldProxy.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 helloworld; + +import org.oasisopen.sca.annotation.Reference; + +/** + * A simple proxy Java class which implements the HelloWorld interface but which uses + * a reference "delegate" to actually provide the HelloWorld service + * + * @version $Rev$ $Date$ + */ +public class HelloWorldProxy implements HelloWorld { + + // Here is the reference "delegate" - it implements the HelloWorld interface... + @Reference + public HelloWorld delegate; + + public String sayHello(String s) { + // Simply call the reference to satisfy the service request... + System.out.println("HelloWorldProxy - calling sayHello"); + return delegate.sayHello(s); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestBean.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestBean.java new file mode 100644 index 0000000000..1a0abd7f8f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestBean.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 mock; + +/** + * @version $Rev$ $Date$ + */ +public interface TestBean { + String echo(String msg); + + TestBean getBean(); + + void setBean(TestBean bean); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestBeanImpl.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestBeanImpl.java new file mode 100644 index 0000000000..e3d9a36bb8 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestBeanImpl.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 mock; + +/** + * @version $Rev$ $Date$ + */ +public class TestBeanImpl implements TestBean { + + private TestBean bean; + + public TestBeanImpl() { + } + + public String echo(String msg) { + return msg; + } + + public TestBean getBean() { + return bean; + } + + public void setBean(TestBean bean) { + this.bean = bean; + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestHelloWorldBean.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestHelloWorldBean.java new file mode 100644 index 0000000000..47342fded8 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestHelloWorldBean.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 mock; + +/** + * A simple test Spring bean which provides the HelloWorld service + * + * @version $Rev$ $Date$ + */ + +import helloworld.HelloWorld; + +public class TestHelloWorldBean implements HelloWorld { + + static String hello = "Hello "; + + // Classic "Hello xxx" response to any input message + public String sayHello(String message) { + System.out.println("TestHelloWorldBean - sayHello called"); + return (hello + message); + } + +} // end class TestHelloWorldBean diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestReference.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestReference.java new file mode 100644 index 0000000000..6f5b280f31 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestReference.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 mock; + +/** + * @version $Rev$ $Date$ + */ +public interface TestReference { + String echo(String msg); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestReferenceBean.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestReferenceBean.java new file mode 100644 index 0000000000..dea7933e1a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestReferenceBean.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 mock; + +/** + * A test Spring bean which provides the HelloWorld service by calling a reference + * to provide the content of the response + * + * @version $Rev$ $Date$ + */ + +import helloworld.HelloWorld; + +public class TestReferenceBean implements HelloWorld { + + // The reference + private HelloWorld bean; + + // Classic "Hello xxx" response to any input message + public String sayHello(String message) { + System.out.println("TestReferenceBean - sayHello called"); + return (bean.sayHello(message)); + } + + /** + * Setter for the bean reference + * @param theBean + */ + public void setBean(HelloWorld theBean) { + this.bean = theBean; + } + + /** + * Getter for the reference + * @return + */ + public HelloWorld getBean() { + return this.bean; + } + +} // end class TestReferenceBean diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestSCAPropertyBean.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestSCAPropertyBean.java new file mode 100644 index 0000000000..b80b05dc08 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/mock/TestSCAPropertyBean.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 mock; + +/** + * A test Spring bean which provides the HelloWorld service. + * This bean has a single String property called "hello" which must be set through + * external configuration to give the correct response message, otherwise an (incorrect) + * default message is generated + * + * @version $Rev$ $Date$ + */ + +import helloworld.HelloWorld; + +public class TestSCAPropertyBean implements HelloWorld { + + private String hello = "Go away"; + + /** + * Provides the operation of the "HelloWorld" interface - a simple string response + * to a string input message, where the response is a greeting followed by the original + * input message. + */ + public String sayHello(String message) { + System.out.println("TestHelloWorldBean - sayHello called"); + return (hello + " " + message); + } + + /** + * Public setter for the (unannotated) field "hello" which constitutes an SCA + * property + * @param message - the message to use for the response to "sayHello" + */ + public void setHello(String message) { + hello = message; + } + +} // end class TestSCAPropertyBean diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/spring/annotations/CalculatorServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/spring/annotations/CalculatorServiceImpl.java new file mode 100644 index 0000000000..ecb085858d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/java/spring/annotations/CalculatorServiceImpl.java @@ -0,0 +1,131 @@ +/* + * 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 spring.annotations; + +import org.oasisopen.sca.annotation.Destroy; +import org.oasisopen.sca.annotation.Init; +import org.oasisopen.sca.annotation.Service; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.ComponentName; + +import calculator.AddService; +import calculator.CalculatorService; +import calculator.DivideService; +import calculator.MultiplyService; +import calculator.SubtractService; + +/** + * An implementation of the Calculator service. + */ +@Service(CalculatorService.class) +public class CalculatorServiceImpl implements AddService, SubtractService, MultiplyService, DivideService { + + public AddService addService; // setter injection + + @Reference + public SubtractService subtractService; // field injection + + @Reference(name="multiplyService", required=false) + public MultiplyService multiply; // field injection (different reference and field name) + + public DivideService divide; // setter injection (different reference and field name) + + public String message; // setter injection + + @Property(name="message", required=false) + public String message2; // field injection + + public String componentName; + + @Init + public void initMethod () { + System.out.println("Init method is sucessfully called....."); + // Property value should be null here. + System.out.println("Property Value message is...." + message); + } + + @Destroy + public void destroyMethod () { + System.out.println("Component Name is...." + componentName); + System.out.println("Property Value message is...." + message); + System.out.println("Property Value message2 is...." + message2); + System.out.println("Destroy method is sucessfully called....."); + } + + @Reference + public void setAddService(AddService addService) { + this.addService = addService; + } + + public AddService getAddService() { + return addService; + } + + /*public void setSubtractService(SubtractService subtractService) { + this.subtractService = subtractService; + } + + public SubtractService getSubtractService() { + return subtractService; + }*/ + + @Reference(name="divideService", required=false) + public void setDivideService(DivideService divide) { + this.divide = divide; + } + + public DivideService getDivideService() { + return divide; + } + + /*public void setMultiplyService(MultiplyService multiplyService) { + this.multiplyService = multiplyService; + } + + public MultiplyService getMultiplyService() { + return multiplyService; + }*/ + + @ComponentName + public void setComponentName(String componentName) { + this.componentName = componentName; + } + + @Property + public void setMessage(String message) { + this.message = message; + } + + public double add(double n1, double n2) { + return addService.add(n1, n2); + } + + public double subtract(double n1, double n2) { + return subtractService.subtract(n1, n2); + } + + public double multiply(double n1, double n2) { + return multiply.multiply(n1, n2); + } + + public double divide(double n1, double n2) { + return divide.divide(n1, n2); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/access/CalculatorService-context.xml b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/access/CalculatorService-context.xml new file mode 100644 index 0000000000..81d59432b8 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/access/CalculatorService-context.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/access/ContextAccess.composite b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/access/ContextAccess.composite new file mode 100644 index 0000000000..abdaa98bff --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/access/ContextAccess.composite @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/imports/ContextImports.composite b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/imports/ContextImports.composite new file mode 100644 index 0000000000..dd186bddfc --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/imports/ContextImports.composite @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/imports/META-INF/spring/CalculatorService-context.xml b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/imports/META-INF/spring/CalculatorService-context.xml new file mode 100644 index 0000000000..c50f0ef4d9 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/imports/META-INF/spring/CalculatorService-context.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/imports/META-INF/spring/SpringImport-context.xml b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/imports/META-INF/spring/SpringImport-context.xml new file mode 100644 index 0000000000..a0bb10e8dd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/imports/META-INF/spring/SpringImport-context.xml @@ -0,0 +1,29 @@ + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/multiple/MultipleContext.composite b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/multiple/MultipleContext.composite new file mode 100644 index 0000000000..1c4b81db33 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/multiple/MultipleContext.composite @@ -0,0 +1,30 @@ + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/multiple/springapp/META-INF/MANIFEST.MF b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/multiple/springapp/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..9267f28e83 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/multiple/springapp/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Spring-Context: META-INF/spring/beanRefContext.xml; META-INF/spring/StockQuoteService-context.xml + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/multiple/springapp/META-INF/spring/SpringHelloWorld-context.xml b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/multiple/springapp/META-INF/spring/SpringHelloWorld-context.xml new file mode 100644 index 0000000000..62e4e077b6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/multiple/springapp/META-INF/spring/SpringHelloWorld-context.xml @@ -0,0 +1,31 @@ + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/multiple/springapp/META-INF/spring/StockQuoteService-context.xml b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/multiple/springapp/META-INF/spring/StockQuoteService-context.xml new file mode 100644 index 0000000000..5b1885d6b3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/multiple/springapp/META-INF/spring/StockQuoteService-context.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/multiple/springapp/META-INF/spring/beanRefContext.xml b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/multiple/springapp/META-INF/spring/beanRefContext.xml new file mode 100644 index 0000000000..dcc88f6770 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/context/multiple/springapp/META-INF/spring/beanRefContext.xml @@ -0,0 +1,34 @@ + + + + + + + + context/multiple/springapp/META-INF/spring/SpringHelloWorld-context.xml + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/implementation/policies/CalculatorJass.config b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/implementation/policies/CalculatorJass.config new file mode 100644 index 0000000000..0e7cb86633 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/implementation/policies/CalculatorJass.config @@ -0,0 +1,3 @@ +Calculator { + calculator.security.JaasLoginModule required debug=true; +}; diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/implementation/policies/CalculatorLogMessages.properties b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/implementation/policies/CalculatorLogMessages.properties new file mode 100644 index 0000000000..0238f0b013 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/implementation/policies/CalculatorLogMessages.properties @@ -0,0 +1,18 @@ +# 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. +CALLING_OPERATION=Inovoking operation {0} with arguments {1} +OPERATION_RETURNED=Returning from operation {0} with return value {1} \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/implementation/policies/ImplementationPolicies.composite b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/implementation/policies/ImplementationPolicies.composite new file mode 100644 index 0000000000..1000e616a7 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/implementation/policies/ImplementationPolicies.composite @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/implementation/policies/META-INF/spring/CalculatorService-context.xml b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/implementation/policies/META-INF/spring/CalculatorService-context.xml new file mode 100644 index 0000000000..c50f0ef4d9 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/implementation/policies/META-INF/spring/CalculatorService-context.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/implementation/policies/definitions.xml b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/implementation/policies/definitions.xml new file mode 100644 index 0000000000..278c94a18e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/implementation/policies/definitions.xml @@ -0,0 +1,40 @@ + + + + + + + + Calculator + calculator.security.CalculatorCallbackHandler + + + + + + + FINER + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/location/folder/SpringFolderLocation.composite b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/location/folder/SpringFolderLocation.composite new file mode 100644 index 0000000000..2731fc455f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/location/folder/SpringFolderLocation.composite @@ -0,0 +1,40 @@ + + + + + + + + + + + + + Hello + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/location/folder/springapp/META-INF/MANIFEST.MF b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/location/folder/springapp/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..950dbeba4c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/location/folder/springapp/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Spring-Context: META-INF/spring/SpringSCAProperty-context.xml + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/location/folder/springapp/META-INF/spring/SpringSCAProperty-context.xml b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/location/folder/springapp/META-INF/spring/SpringSCAProperty-context.xml new file mode 100644 index 0000000000..8613e6c82a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/location/folder/springapp/META-INF/spring/SpringSCAProperty-context.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/location/jar/SpringJarLocation.composite b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/location/jar/SpringJarLocation.composite new file mode 100644 index 0000000000..e8357cc62e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/location/jar/SpringJarLocation.composite @@ -0,0 +1,40 @@ + + + + + + + + + + + + + Hello + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/location/jar/spring-context.jar b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/location/jar/spring-context.jar new file mode 100644 index 0000000000..504d59e5ff Binary files /dev/null and b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/location/jar/spring-context.jar differ diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/META-INF/spring/SpringDelegationHelloWorld-context.xml b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/META-INF/spring/SpringDelegationHelloWorld-context.xml new file mode 100644 index 0000000000..9912624870 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/META-INF/spring/SpringDelegationHelloWorld-context.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/META-INF/spring/SpringHelloWorld-context.xml b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/META-INF/spring/SpringHelloWorld-context.xml new file mode 100644 index 0000000000..62e4e077b6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/META-INF/spring/SpringHelloWorld-context.xml @@ -0,0 +1,31 @@ + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorld.composite b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorld.composite new file mode 100644 index 0000000000..b8389be7f6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorld.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite new file mode 100644 index 0000000000..8d1a655c4e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/references/META-INF/spring/SpringExplicitReference-context.xml b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/references/META-INF/spring/SpringExplicitReference-context.xml new file mode 100644 index 0000000000..1705164104 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/references/META-INF/spring/SpringExplicitReference-context.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/references/META-INF/spring/SpringImplicitReference-context.xml b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/references/META-INF/spring/SpringImplicitReference-context.xml new file mode 100644 index 0000000000..539dfa6e32 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/references/META-INF/spring/SpringImplicitReference-context.xml @@ -0,0 +1,34 @@ + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/references/SpringExplicitReference.composite b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/references/SpringExplicitReference.composite new file mode 100644 index 0000000000..294b211431 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/references/SpringExplicitReference.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/references/SpringImplicitReference.composite b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/references/SpringImplicitReference.composite new file mode 100644 index 0000000000..c77ab00323 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/references/SpringImplicitReference.composite @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/services/META-INF/spring/SpringExplicitService-context.xml b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/services/META-INF/spring/SpringExplicitService-context.xml new file mode 100644 index 0000000000..42e0cdbd23 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/services/META-INF/spring/SpringExplicitService-context.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/services/META-INF/spring/SpringImplicitService-context.xml b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/services/META-INF/spring/SpringImplicitService-context.xml new file mode 100644 index 0000000000..83558e8abc --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/services/META-INF/spring/SpringImplicitService-context.xml @@ -0,0 +1,31 @@ + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/services/SpringExplicitService.composite b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/services/SpringExplicitService.composite new file mode 100644 index 0000000000..b7c45b289f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/services/SpringExplicitService.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/services/SpringImplicitService.composite b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/services/SpringImplicitService.composite new file mode 100644 index 0000000000..e1ccbcf3c6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/sca/services/SpringImplicitService.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/spring/annotations/Calculator.composite b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/spring/annotations/Calculator.composite new file mode 100644 index 0000000000..236e2b23e6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/spring/annotations/Calculator.composite @@ -0,0 +1,60 @@ + + + + + + + HelloWorld + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/spring/annotations/CalculatorService-context.xml b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/spring/annotations/CalculatorService-context.xml new file mode 100644 index 0000000000..4a873f2424 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/main/resources/spring/annotations/CalculatorService-context.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/access/CalculatorClient.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/access/CalculatorClient.java new file mode 100644 index 0000000000..4503294f10 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/access/CalculatorClient.java @@ -0,0 +1,60 @@ +/* + * 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 context.access; + +import java.io.File; +import org.apache.tuscany.sca.node.Client; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.apache.tuscany.sca.node.Contribution; +import org.springframework.context.ApplicationContext; + +import context.access.SCAApplicationContextProvider; +import calculator.CalculatorService; + +/** + * This client program shows how to create an SCA runtime, start it, + * and locate and invoke a SCA component + */ +public class CalculatorClient { + public static void main(String[] args) throws Exception { + + NodeFactory factory = NodeFactory.newInstance(); + Node node = factory.createNode(new File("src/main/resources/context/access/ContextAccess.composite").toURI().toURL().toString(), + new Contribution("TestContribution", new File("src/main/resources/context/access/").toURI().toURL().toString())); + node.start(); + + // Code: To access the Spring Application Context instance + ApplicationContext ctx = SCAApplicationContextProvider.getApplicationContext(); + if (ctx.containsBean("CalculatorServiceBean")) + System.out.println("CalculatorServiceBean is now available for use..."); + + CalculatorService calculatorService = + ((Client)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + + System.out.println("3 + 2=" + calculatorService.add(3, 2)); + System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); + System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); + System.out.println("3 / 2=" + calculatorService.divide(3, 2)); + + node.stop(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/access/ContextAccessTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/access/ContextAccessTestCase.java new file mode 100644 index 0000000000..2602839d1d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/access/ContextAccessTestCase.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 context.access; + +import junit.framework.TestCase; + +/** + * Tests out the big bank service + * + */ +public class ContextAccessTestCase extends TestCase { + + public void testServer() throws Exception { + CalculatorClient.main(new String[] {""}); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/imports/CalculatorClient.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/imports/CalculatorClient.java new file mode 100644 index 0000000000..254b8100e1 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/imports/CalculatorClient.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 context.imports; + +import java.io.File; + +import org.apache.tuscany.sca.node.Client; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.apache.tuscany.sca.node.Contribution; +import calculator.CalculatorService; + +/** + * This client program shows how to create an SCA runtime, start it, + * and locate and invoke a SCA component + */ +public class CalculatorClient { + public static void main(String[] args) throws Exception { + + NodeFactory factory = NodeFactory.newInstance(); + Node node = factory.createNode(new File("src/main/resources/context/imports/ContextImports.composite").toURI().toURL().toString(), + new Contribution("TestContribution", new File("src/main/resources/context/imports/").toURI().toURL().toString())); + node.start(); + + CalculatorService calculatorService = + ((Client)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + + System.out.println("3 + 2=" + calculatorService.add(3, 2)); + System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); + System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); + System.out.println("3 / 2=" + calculatorService.divide(3, 2)); + + node.stop(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/imports/ContextImportsTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/imports/ContextImportsTestCase.java new file mode 100644 index 0000000000..8df60c5bab --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/imports/ContextImportsTestCase.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 context.imports; + +import junit.framework.TestCase; + +/** + * Tests out the big bank service + * + */ +public class ContextImportsTestCase extends TestCase { + + public void testServer() throws Exception { + CalculatorClient.main(new String[] {""}); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/multiple/MultipleContextTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/multiple/MultipleContextTestCase.java new file mode 100644 index 0000000000..f5261c85bb --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/multiple/MultipleContextTestCase.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 context.multiple; + +import junit.framework.TestCase; + +/** + * Tests out the big bank service + * + */ +public class MultipleContextTestCase extends TestCase { + + public void testServer() throws Exception { + StockQuoteServer.main(new String[] {"1000"}); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/multiple/StockQuoteServer.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/multiple/StockQuoteServer.java new file mode 100644 index 0000000000..9ff1b74567 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/context/multiple/StockQuoteServer.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 context.multiple; + +import java.io.File; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.springframework.context.ApplicationContext; +import context.access.SCAApplicationContextProvider; + +/** + * This server program shows how to bootstrap SCA from a simple J2SE program + * and start it which activates the StockQuote Web service endpoint. + */ +public class StockQuoteServer { + + public static void main(String[] args) throws Exception { + + NodeFactory factory = NodeFactory.newInstance(); + Node node = factory.createNode(new File("src/main/resources/context/multiple/MultipleContext.composite").toURI().toURL().toString(), + new Contribution("TestContribution", new File("src/main/resources/context/multiple/").toURI().toURL().toString())); + node.start(); + + // Method 1: To access the Spring Application Context instance + ApplicationContext ctx = SCAApplicationContextProvider.getApplicationContext(); + if (ctx.containsBean("StockQuoteServiceBean")) + System.out.println("StockQuoteServiceBean is now available for use..."); + + System.out.println("Press Enter to Exit..."); + Thread.sleep(1000); + + node.stop(); + System.out.println("Bye"); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/implementation/policies/CalculatorClient.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/implementation/policies/CalculatorClient.java new file mode 100644 index 0000000000..8b12dd7af7 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/implementation/policies/CalculatorClient.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 implementation.policies; + +import java.io.File; + +import javax.security.auth.login.Configuration; +import org.apache.tuscany.sca.node.Client; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import calculator.CalculatorService; + + +/** + * This client program shows how to create an SCA runtime, start it, + * and locate and invoke a SCA component + */ +public class CalculatorClient { + public static void main(String[] args) throws Exception { + try { + Configuration secConf = Configuration.getConfiguration(); + } catch (java.lang.SecurityException e) { + System.setProperty("java.security.auth.login.config", CalculatorClient.class.getClassLoader() + .getResource("implementation/policies/CalculatorJass.config").toString()); + } + + NodeFactory factory = NodeFactory.newInstance(); + Node node = factory.createNode(new File("src/main/resources/implementation/policies/ImplementationPolicies.composite").toURI().toURL().toString(), + new Contribution("TestContribution", new File("src/main/resources/implementation/policies/").toURI().toURL().toString())); + node.start(); + + CalculatorService calculatorService = + ((Client)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + + // Calculate + System.out.println("Calling CalculatorServiceComponent configured with 'logging' " + + "policy for subtract and divide operations..."); + System.out.println("3 + 2=" + calculatorService.add(3, 2)); + System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); + System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); + System.out.println("3 / 2=" + calculatorService.divide(3, 2)); + + calculatorService = + ((Client)node).getService(CalculatorService.class, "AnotherCalculatorServiceComponent"); + + // Calculate + System.out.println("Calling CalculatorServiceComponent configured with 'logging' " + + "for all operations in the implementation..."); + System.out.println("3 + 2=" + calculatorService.add(3, 2)); + System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); + System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); + System.out.println("3 / 2=" + calculatorService.divide(3, 2)); + + node.stop(); + System.out.println("Bye"); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/implementation/policies/ImplementationPoliciesTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/implementation/policies/ImplementationPoliciesTestCase.java new file mode 100644 index 0000000000..a44ae38d24 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/implementation/policies/ImplementationPoliciesTestCase.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 implementation.policies; + +import junit.framework.TestCase; + +/** + * Tests out the big bank service + * + */ +public class ImplementationPoliciesTestCase extends TestCase { + + public void testServer() throws Exception { + CalculatorClient.main(new String[] {""}); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/location/folder/SpringFolderLocationTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/location/folder/SpringFolderLocationTestCase.java new file mode 100644 index 0000000000..d54f0544d8 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/location/folder/SpringFolderLocationTestCase.java @@ -0,0 +1,45 @@ +/* + * 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 location.folder; + +import org.apache.tuscany.sca.itest.spring.AbstractHelloWorldTestCase; + +/** + * A test case designed to test the implementation of Properties from a Spring application + * context, where the properties are explicit, through the presence of an sca:property + * element within the Spring application context + * + * The artifacts involved in this test are: + * + * 1) A composite containing a component with a Spring implementation + * 2) The element references an application context that + * uses an explicit sca:property element which is used to compute the response to an invocation + * of the service of the implementation + * + * @version $Rev$ $Date$ + */ +public class SpringFolderLocationTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name + + public SpringFolderLocationTestCase() { + super("SpringFolderLocation.composite", "location/folder/"); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/location/jar/SpringJarLocationTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/location/jar/SpringJarLocationTestCase.java new file mode 100644 index 0000000000..71768f5a7b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/location/jar/SpringJarLocationTestCase.java @@ -0,0 +1,45 @@ +/* + * 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 location.jar; + +import org.apache.tuscany.sca.itest.spring.AbstractHelloWorldTestCase; + +/** + * A test case designed to test the implementation of Properties from a Spring application + * context, where the properties are explicit, through the presence of an sca:property + * element within the Spring application context + * + * The artifacts involved in this test are: + * + * 1) A composite containing a component with a Spring implementation + * 2) The element references an application context that + * uses an explicit sca:property element which is used to compute the response to an invocation + * of the service of the implementation + * + * @version $Rev$ $Date$ + */ +public class SpringJarLocationTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name + + public SpringJarLocationTestCase() { + super("SpringJarLocation.composite", "location/jar/"); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.java new file mode 100644 index 0000000000..0c6f8d2e84 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.java @@ -0,0 +1,44 @@ +/* + * 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.spring; + + +/** + * Basic "hello world" style test case for testing Spring component implementation + * + */ +public abstract class AbstractHelloWorldTestCase extends AbstractSCATestCase { + + /** + * Calls the hello world service and checks that it gives the right response... + */ + public AbstractHelloWorldTestCase(String compositeName, String contributionLocation) { + super(compositeName, contributionLocation); + } + + public void testHello() throws Exception { + assertEquals("Hello petra", service.sayHello("petra")); + } + + @Override + protected Class getServiceClass() { + return HelloWorld.class; + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java new file mode 100644 index 0000000000..73b151bf7a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java @@ -0,0 +1,60 @@ +/* + * 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.spring; + +import java.io.File; +import junit.framework.TestCase; +import java.net.MalformedURLException; + +import org.apache.tuscany.sca.node.Client; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; + +public abstract class AbstractSCATestCase extends TestCase { + + protected Node node; + protected T service; + protected String compositeName; + protected String contributionLocation; + + public AbstractSCATestCase(String compositeName, String contributionLocation) { + super(); + this.compositeName = compositeName; + this.contributionLocation = contributionLocation; + } + + @Override + protected void setUp() throws Exception { + NodeFactory factory = NodeFactory.newInstance(); + node = factory.createNode(new File("src/main/resources/" + contributionLocation + compositeName).toURI().toURL().toString(), + new Contribution("TestContribution", new File("src/main/resources/" + contributionLocation).toURI().toURL().toString())); + node.start(); + service = ((Client)node).getService(getServiceClass(), "ClientComponent"); + } + + abstract protected Class getServiceClass(); + + @Override + protected void tearDown() throws Exception { + node.stop(); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.java new file mode 100644 index 0000000000..5869d344f6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.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 org.apache.tuscany.sca.itest.spring; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * Interface for the "hello world" service - predictably simple with a single operation + * "sayHello" + * + */ +@Remotable +public interface HelloWorld { + + public String sayHello(String s); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.java new file mode 100644 index 0000000000..90d26dd89f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.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.itest.spring; + +import org.oasisopen.sca.annotation.Reference; + +/** + * A simple proxy Java class which implements the HelloWorld interface but which uses + * a reference "delegate" to actually provide the HelloWorld service + * + */ +public class HelloWorldProxy implements HelloWorld { + + // Here is the reference "delegate" - it implements the HelloWorld interface... + @Reference + public HelloWorld delegate; + + public String sayHello(String s) { + // Simply call the reference to satisfy the service request... + System.out.println("HelloWorldProxy - calling sayHello"); + return delegate.sayHello(s); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorldTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorldTestCase.java new file mode 100644 index 0000000000..f28dace31a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorldTestCase.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.itest.spring; + +/** + * A basic test case of: + * 1) A composite containing a component with a Spring implementation + * 2) The composite has a component with a Java POJO implementation which uses the + * Spring implementation to satisfy a reference + * + */ +public class SpringDelegationHelloWorldTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name + + public SpringDelegationHelloWorldTestCase() { + super("SpringDelegationHelloWorld.composite", "org/apache/tuscany/sca/itest/spring/"); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.java new file mode 100644 index 0000000000..def30b3ea0 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.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.spring; + +/** + * A basic test case of: + * 1) A composite containing a component with a Spring implementation + * 2) The composite has a component with a Java POJO implementation which uses the + * Spring implementation to satisfy a reference + * 3) The Spring component delegates function to a second spring bean + * + */ +public class SpringHelloWorldTestCase extends AbstractHelloWorldTestCase { + + // super class does it all getting composite based on this class name + public SpringHelloWorldTestCase() { + super("SpringHelloWorld.composite", "org/apache/tuscany/sca/itest/spring/"); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.java new file mode 100644 index 0000000000..fa7967c964 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.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.spring; + +/** + * A simple test Spring bean which provides the HelloWorld service + * + */ + +public class TestHelloWorldBean implements HelloWorld { + + static String hello = "Hello "; + + // Classic "Hello xxx" response to any input message + public String sayHello(String message) { + System.out.println("TestHelloWorldBean - sayHello called"); + return (hello + message); + } + +} // end class TestHelloWorldBean diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldDelegatorBean.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldDelegatorBean.java new file mode 100644 index 0000000000..b57cc7f366 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldDelegatorBean.java @@ -0,0 +1,40 @@ +/* + * 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.spring; + +/** + * A simple test Spring bean which delgates to another bean + * + */ + +public class TestHelloWorldDelegatorBean implements HelloWorld { + + HelloWorld delegate; + + public void setDelegate(HelloWorld delegate) { + this.delegate = delegate; + } + + // Classic "Hello xxx" response to any input message + public String sayHello(String message) { + System.out.println("TestHelloWorldDelegatorBean - sayHello called"); + return delegate.sayHello(message); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/sca/references/SpringExplicitReferenceTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/sca/references/SpringExplicitReferenceTestCase.java new file mode 100644 index 0000000000..0c2e1daa81 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/sca/references/SpringExplicitReferenceTestCase.java @@ -0,0 +1,45 @@ +/* + * 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 sca.references; + +import org.apache.tuscany.sca.itest.spring.AbstractHelloWorldTestCase; + +/** + * A test case designed to test the implementation of References from a Spring application + * context, where the references are explicit, through the presence of an sca:reference + * element within the Spring application context + * + * The artifacts involved in this test are: + * + * 1) A composite containing a component with a Spring implementation which makes + * a reference to a second component + * 2) The composite has a component with a Java POJO implementation which satisfies the reference + * 3) The element references an application context that + * uses an explicit sca:reference element to identify the reference made by the Spring application + * + * @version $Rev$ $Date$ + */ +public class SpringExplicitReferenceTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name + + public SpringExplicitReferenceTestCase() { + super("SpringExplicitReference.composite", "sca/references/"); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/sca/references/SpringImplicitReferenceTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/sca/references/SpringImplicitReferenceTestCase.java new file mode 100644 index 0000000000..8d0c548899 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/sca/references/SpringImplicitReferenceTestCase.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 sca.references; + +import org.apache.tuscany.sca.itest.spring.AbstractHelloWorldTestCase; + +/** + * A test case designed to test the implementation of References from a Spring application + * context, where the references are implicit, through the presence of Bean properties with a + * ref attribute which is not satisfied by a Bean within the application context. + * + * The artifacts involved in this test are: + * + * 1) A composite containing a component with a Spring implementation which makes + * a reference to a second component + * 2) The composite has a component with a Java POJO implementation which satisfies the reference + * 3) The element references an application context that + * does not use an explicit sca:reference element to identify the reference made by the + * Spring application, but relies on an unsatisfied Bean property with a ref attribute. + * + * @version $Rev$ $Date$ + */ +public class SpringImplicitReferenceTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name + + public SpringImplicitReferenceTestCase() { + super("SpringImplicitReference.composite", "sca/references/"); + } +} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/sca/services/SpringExplicitServiceTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/sca/services/SpringExplicitServiceTestCase.java new file mode 100644 index 0000000000..f4bd53876c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/sca/services/SpringExplicitServiceTestCase.java @@ -0,0 +1,40 @@ +/* + * 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 sca.services; + +import org.apache.tuscany.sca.itest.spring.AbstractHelloWorldTestCase; + +/** + * A basic test case of: + * 1) A composite containing a component with a Spring implementation + * 2) The composite has a component with a Java POJO implementation which uses the + * Spring implementation to satisfy a reference + * 3) The element references an application context that + * uses an explicit sca: element to identify the service offered by the Spring application + * + * @version $Rev$ $Date$ + */ +public class SpringExplicitServiceTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name + + public SpringExplicitServiceTestCase() { + super("SpringExplicitService.composite", "sca/services/"); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/sca/services/SpringImplicitServiceTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/sca/services/SpringImplicitServiceTestCase.java new file mode 100644 index 0000000000..0907985d7f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/sca/services/SpringImplicitServiceTestCase.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 sca.services; + +import org.apache.tuscany.sca.itest.spring.AbstractHelloWorldTestCase; + +/** + * A basic test case of: + * 1) A composite containing a component with a Spring implementation + * 2) The composite has a component with a Java POJO implementation which uses the + * Spring implementation to satisfy a reference + * + * @version $Rev$ $Date$ + */ +public class SpringImplicitServiceTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name + + public SpringImplicitServiceTestCase() { + super("SpringImplicitService.composite", "sca/services/"); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/spring/annotations/CalculatorClient.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/spring/annotations/CalculatorClient.java new file mode 100644 index 0000000000..13b84c8c73 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/spring/annotations/CalculatorClient.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 spring.annotations; + +import java.io.File; + +import org.apache.tuscany.sca.node.Client; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import calculator.CalculatorService; + + +/** + * This client program shows how to create an SCA runtime, start it, + * and locate and invoke a SCA component + */ +public class CalculatorClient { + public static void main(String[] args) throws Exception { + + NodeFactory factory = NodeFactory.newInstance(); + Node node = factory.createNode(new File("src/main/resources/spring/annotations/Calculator.composite").toURI().toURL().toString(), + new Contribution("TestContribution", new File("src/main/resources/spring/annotations/").toURI().toURL().toString())); + node.start(); + + CalculatorService calculatorService = + ((Client)node).getService(CalculatorService.class, "CalculatorServiceComponent"); + + System.out.println("3 + 2=" + calculatorService.add(3, 2)); + System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); + System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); + System.out.println("3 / 2=" + calculatorService.divide(3, 2)); + + node.stop(); + System.out.println("Bye"); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/spring/annotations/SpringAnnotationsTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/spring/annotations/SpringAnnotationsTestCase.java new file mode 100644 index 0000000000..5db9c84c00 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/implementation-spring/src/test/java/spring/annotations/SpringAnnotationsTestCase.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 spring.annotations; + +import junit.framework.TestCase; + +/** + * Tests out the big bank service + * + */ +public class SpringAnnotationsTestCase extends TestCase { + + public void testServer() throws Exception { + CalculatorClient.main(new String[] {""}); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/interfaces/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/interfaces/pom.xml new file mode 100644 index 0000000000..d55c008338 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/interfaces/pom.xml @@ -0,0 +1,53 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-interfaces + Apache Tuscany SCA iTest Interface + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + test + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.java b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.java new file mode 100644 index 0000000000..f4131593d5 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalCallbackInterface.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.itest.interfaces; + +/** + * only for callBack + */ +public interface LocalCallbackInterface { + + void callbackMethod(String str); + + void modifyParameter(ParameterObject po); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponent.java b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponent.java new file mode 100644 index 0000000000..5fc9ed51b3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponent.java @@ -0,0 +1,47 @@ +/* + * 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.interfaces; + +import org.oasisopen.sca.annotation.OneWay; + +/* + * itest for interface: local,method-overloading + */ +public interface LocalClientComponent { + + String foo1(ParameterObject po); + + String foo1(String str) throws Exception; + + String foo2(String str, int i); + + String foo2(int i, String str) throws Exception; + + void callback(String str); + + void callModifyParameter(); + + @OneWay + void onewayMethod(String str); + + String getCallbackValue(); + + String getOnewayValue(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.java new file mode 100644 index 0000000000..6cd937af12 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalClientComponentImpl.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.itest.interfaces; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +@Service(LocalClientComponent.class) +public class LocalClientComponentImpl implements LocalClientComponent, LocalCallbackInterface { + + @Reference + protected LocalServiceComponent aCallBackService; + private static String callbackValue; + private static String onewayValue; + + public String foo1(ParameterObject po) { + po.field1 = "AComponent"; + return "AComponent"; + } + + public String foo1(String str) throws Exception { + return str + "AComponent"; + } + + public String foo2(String str, int i) { + return str + "AComponent" + i; + } + + public String foo2(int i, String str) throws Exception { + return str + "AComponent" + i; + } + + public void callback(String str) { + aCallBackService.callback(str); + } + + public void callbackMethod(String str) { + callbackValue = str; + } + + public void callModifyParameter() { + this.aCallBackService.modifyParameter(); + } + + public String getCallbackValue() { + return callbackValue; + } + + public void onewayMethod(String str) { + onewayValue = str; + try { + Thread.sleep(200); + } catch (Exception e) { + //do nothing + } + } + + public String getOnewayValue() { + return onewayValue; + } + + public void modifyParameter(ParameterObject po) { + po.field1 = "AComponent"; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.java b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.java new file mode 100644 index 0000000000..05a9d09bdd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponent.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 org.apache.tuscany.sca.itest.interfaces; + +import org.oasisopen.sca.annotation.Callback; + +/** + * Local be-directional callBackService + */ +@Callback(LocalCallbackInterface.class) +public interface LocalServiceComponent { + + String foo(String str); + + void callback(String str); + + void modifyParameter(); + + ParameterObject getPO(); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.java new file mode 100644 index 0000000000..ab0b18191c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/LocalServiceComponentImpl.java @@ -0,0 +1,49 @@ +/* + * 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.interfaces; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Service; + +@Service(LocalServiceComponent.class) +public class LocalServiceComponentImpl implements LocalServiceComponent { + + @Callback + protected LocalCallbackInterface callback; + + private static ParameterObject po; + + public void callback(String str) { + callback.callbackMethod(str); + } + + public void modifyParameter() { + po = new ParameterObject("CallBack"); + callback.modifyParameter(po); + } + + public String foo(String str) { + return str; + } + + public ParameterObject getPO() { + return po; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.java b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.java new file mode 100644 index 0000000000..724d94dffb --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/ParameterObject.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.interfaces; + +import java.io.Serializable; + +public class ParameterObject implements Serializable { + private static final long serialVersionUID = 1L; + public String field1; + + public ParameterObject() { + this.field1 = null; + } + + public ParameterObject(String field1) { + this.field1 = field1; + } + + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ParameterObject) { + ParameterObject other = (ParameterObject)o; + if (field1 != null) { + return field1.equals(other.field1); + } + } + return false; + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteCallbackInterface.java b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteCallbackInterface.java new file mode 100644 index 0000000000..be3fa4c15a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteCallbackInterface.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.itest.interfaces; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * only for callBack + */ +@Remotable +public interface RemoteCallbackInterface { + + void callbackMethod(String str); + + void modifyParameter(ParameterObject po); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponent.java b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponent.java new file mode 100644 index 0000000000..9f34dfd274 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponent.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. + */ +/* + * 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.interfaces; + +import org.oasisopen.sca.annotation.Remotable; + +/* + * different signatures + */ + +@Remotable +public interface RemoteClientComponent { + + String foo1(ParameterObject po); + + String foo3(ParameterObject po); + + String foo2(int i, String str1) throws Exception; + + void callback(String str); + + void callModifyParameter(); + + String getCallbackValue(); + + void onewayMethod(String str); + + String getOnewayValue(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponentImpl.java new file mode 100644 index 0000000000..541b1f1508 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteClientComponentImpl.java @@ -0,0 +1,81 @@ +/* + * 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.interfaces; + +import org.oasisopen.sca.annotation.AllowsPassByReference; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +@Service(RemoteClientComponent.class) +public class RemoteClientComponentImpl implements RemoteClientComponent, RemoteCallbackInterface { + + @Reference + protected RemoteServiceComponent aCallBackService; + private static String callbackValue; + private static String onewayValue; + + public String foo1(ParameterObject po) { + po.field1 = "BComponent"; + return "BComponent"; + } + + @AllowsPassByReference + public String foo3(ParameterObject po) { + po.field1 = "BComponent"; + return "BComponent"; + } + + public String foo2(int i, String str) throws Exception { + return str + "BComponent" + i; + } + + public void callback(String str) { + aCallBackService.callback(str); + } + + public void callModifyParameter() { + this.aCallBackService.modifyParameter(); + } + + public void callbackMethod(String str) { + callbackValue = str; + } + + public String getCallbackValue() { + return callbackValue; + } + + public void onewayMethod(String str) { + onewayValue = str; + try { + Thread.sleep(200); + } catch (Exception e) { + //do nothing + } + } + + public String getOnewayValue() { + return onewayValue; + } + + public void modifyParameter(ParameterObject po) { + po.field1 = "BComponent"; + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponent.java b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponent.java new file mode 100644 index 0000000000..b29b298ab6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponent.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.interfaces; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +@Callback(RemoteCallbackInterface.class) +public interface RemoteServiceComponent { + + String foo(String str); + + void callback(String str); + + void modifyParameter(); + + ParameterObject getPO(); + + String[] bar(int[][] intArray); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponentImpl.java new file mode 100644 index 0000000000..00a0f5645b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/java/org/apache/tuscany/sca/itest/interfaces/RemoteServiceComponentImpl.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.interfaces; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Service; + +@Service(RemoteServiceComponent.class) +public class RemoteServiceComponentImpl implements RemoteServiceComponent { + + @Callback + protected RemoteCallbackInterface callback; + + private static ParameterObject po; + + public void callback(String str) { + callback.callbackMethod(str); + } + + public void modifyParameter() { + po = new ParameterObject("CallBack"); + callback.modifyParameter(po); + } + + public String foo(String str) { + return str; + } + + public ParameterObject getPO() { + return po; + } + + public String[] bar(int[][] intArray) { + return new String[] {"int"}; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/resources/InterfacesTest.composite b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/resources/InterfacesTest.composite new file mode 100644 index 0000000000..27ada047b9 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/resources/InterfacesTest.composite @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/resources/InvalidRemoteAttribute.composite b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/resources/InvalidRemoteAttribute.composite new file mode 100644 index 0000000000..c91d49a49a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/main/resources/InvalidRemoteAttribute.composite @@ -0,0 +1,28 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/test/java/org/apache/tuscany/sca/itest/interfaces/InterfacesTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/test/java/org/apache/tuscany/sca/itest/interfaces/InterfacesTestCase.java new file mode 100644 index 0000000000..31e40d59c5 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/test/java/org/apache/tuscany/sca/itest/interfaces/InterfacesTestCase.java @@ -0,0 +1,133 @@ +/* + * 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.interfaces; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +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; + +@Ignore("TUSCANY-3138") +public class InterfacesTestCase { + private static Node node; + + @BeforeClass + public static void init() throws Exception { + String location = ContributionLocationHelper.getContributionLocation("InterfacesTest.composite"); + node = NodeFactory.newInstance().createNode("InterfacesTest.composite", new Contribution("c1", location)); + node.start(); + } + + @AfterClass + public static void destroy() throws Exception { + node.stop(); + } + + @Test + public void testLocalClient() { + LocalServiceComponent service = node.getService(LocalServiceComponent.class, "LocalServiceComponent"); + LocalClientComponent local = node.getService(LocalClientComponent.class, "LocalClientComponent"); + + try { + ParameterObject po = new ParameterObject(); + assertEquals("AComponent", local.foo1(po)); + assertEquals("AComponent", po.field1); + + assertEquals("AAComponent", local.foo1("A")); + + assertEquals("AAComponent1", local.foo2("A", 1)); + assertEquals("AAComponent1", local.foo2(1, "A")); + } catch (Exception e) { + fail(); + } + + try { + // test local callback + local.callback("CallBack"); + Thread.sleep(100); + assertEquals("CallBack", local.getCallbackValue()); + + local.callModifyParameter(); + Thread.sleep(100); + assertEquals("AComponent", service.getPO().field1); + } catch (Exception e) { + e.printStackTrace(); + fail("CallBack failed"); + } + + try { + local.onewayMethod("OneWay"); + Thread.sleep(100); + assertEquals("OneWay", local.getOnewayValue()); + } catch (Exception e) { + fail("OneWay failed"); + } + } + + @Test + public void testRemoteClient() { + RemoteServiceComponent service = node.getService(RemoteServiceComponent.class, "RemoteServiceComponent"); + RemoteClientComponent remote = node.getService(RemoteClientComponent.class, "RemoteClientComponent"); + + try { + // Test Pass By Value + ParameterObject po = new ParameterObject("NotBComponent"); + assertEquals("BComponent", remote.foo1(po)); + assertEquals("NotBComponent", po.field1); + + assertEquals("BBComponent1", remote.foo2(1, "B")); + + // Test allowsPassByReference + assertEquals("BComponent", remote.foo3(po)); + assertEquals("BComponent", po.field1); + } catch (Exception e) { + e.printStackTrace(); + fail(); + } + + try { + remote.callback("CallBack"); + Thread.sleep(100); + assertEquals("CallBack", remote.getCallbackValue()); + + remote.callModifyParameter(); + Thread.sleep(100); + assertEquals("CallBack", service.getPO().field1); + } catch (Exception e) { + fail("CallBack failed"); + } + + try { + remote.onewayMethod("OneWay"); + Thread.sleep(100); + assertEquals("OneWay", remote.getOnewayValue()); + } catch (Exception e) { + fail("OneWay failed"); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/test/java/org/apache/tuscany/sca/itest/interfaces/InvalidRemoteAttributeTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/test/java/org/apache/tuscany/sca/itest/interfaces/InvalidRemoteAttributeTestCase.java new file mode 100644 index 0000000000..b1d4dba07d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/interfaces/src/test/java/org/apache/tuscany/sca/itest/interfaces/InvalidRemoteAttributeTestCase.java @@ -0,0 +1,49 @@ +/* + * 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.interfaces; + +import org.apache.tuscany.sca.interfacedef.InvalidAnnotationException; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.Test; + +public class InvalidRemoteAttributeTestCase { + + @Test + public void testInvalidRemoteAttribute() throws Exception { + Node node = null; + + try { + String location = ContributionLocationHelper.getContributionLocation("InvalidRemoteAttribute.composite"); + node = NodeFactory.newInstance().createNode("InvalidRemoteAttribute.composite", new Contribution("c1", location)); + node.start(); + } catch (Exception e) { + if (! e.getCause().getClass().equals(InvalidAnnotationException.class)) { + throw e; + } + } finally { + if (node != null) { + node.stop(); + } + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/pom.xml new file mode 100644 index 0000000000..b149bbaf6f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/pom.xml @@ -0,0 +1,53 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jaxws-asyncclient + Apache Tuscany JAX-WS Integration Tests + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + junit + junit + 4.5 + test + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/java/stock/StockQuote.java b/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/java/stock/StockQuote.java new file mode 100644 index 0000000000..4e55bae98d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/java/stock/StockQuote.java @@ -0,0 +1,36 @@ +package stock; +/* + * 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. + */ + + + +import javax.jws.WebService; + +/** + * JAX-WS Async style Stock quote interface + * + * @version $Rev: 828277 $ $Date: 2009-10-22 02:40:52 +0100 (Thu, 22 Oct 2009) $ + */ + +@WebService +public interface StockQuote { + + float getPrice(String ticker); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteClient.java b/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteClient.java new file mode 100644 index 0000000000..0bf3328c31 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteClient.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 stock; + +import java.util.concurrent.ExecutionException; + +import javax.xml.ws.AsyncHandler; +import javax.xml.ws.Response; + +import org.oasisopen.sca.annotation.Reference; + +public class StockQuoteClient { + + @Reference public StockQuoteRef stockQuote; + + public float getPrice(String ticker) { + return stockQuote.getPrice(ticker); + } + + public float getPriceAsyncPoll(String ticker) throws InterruptedException, ExecutionException { + Response response = stockQuote.getPriceAsync("foo"); + return response.get(); + } + + float price = 0f; + Object mutex = new Object(); + Exception exception; + + public float getPriceAsyncCallback(String ticker) throws Exception { + AsyncHandler callback = new AsyncHandler() { + public void handleResponse(Response arg) { + synchronized (mutex) { + try { + price = arg.get(); + } catch (Exception e) { + exception = e; + } + mutex.notify(); + } + } + }; + stockQuote.getPriceAsync("foo", callback); + synchronized (mutex) { + if (price == 0f) + mutex.wait(5000); // wait for up to 5 seconds + } + + if (exception != null) throw exception; + return price; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteImpl.java new file mode 100644 index 0000000000..a43b85361b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteImpl.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 stock; + + +/** + * Stock quote impl + * + * @version $Rev: 828277 $ $Date: 2009-10-22 02:40:52 +0100 (Thu, 22 Oct 2009) $ + */ +public class StockQuoteImpl implements StockQuote { + + public float getPrice(String ticker) { + return 10; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteRef.java b/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteRef.java new file mode 100644 index 0000000000..b15ab6be08 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/java/stock/StockQuoteRef.java @@ -0,0 +1,39 @@ +package stock; +/* + * 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. + */ + + + +import java.util.concurrent.Future; + +import javax.xml.ws.AsyncHandler; +import javax.xml.ws.Response; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * JAX-WS Async style Stock quote interface + */ +@Remotable +public interface StockQuoteRef extends StockQuote { + + Response getPriceAsync(String ticker); + + Future getPriceAsync(String ticker, AsyncHandler callback); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..11ace7a788 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/resources/StockQuote.composite b/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/resources/StockQuote.composite new file mode 100644 index 0000000000..313edf0435 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/main/resources/StockQuote.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/test/java/itest/AsyncServiceTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/test/java/itest/AsyncServiceTestCase.java new file mode 100644 index 0000000000..eb72924093 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jaxws-asyncclient/src/test/java/itest/AsyncServiceTestCase.java @@ -0,0 +1,67 @@ +package itest; +import java.util.concurrent.ExecutionException; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import stock.StockQuoteClient; + +/* + * 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. + */ + +public class AsyncServiceTestCase { + + private Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } + + @Test + public void invokeRPC() { + StockQuoteClient sc = node.getService(StockQuoteClient.class, "StockQuoteClient"); + Assert.assertEquals(10.0f, sc.getPrice("foo")); + } + + @Test + public void invokeAsyncPoll() throws InterruptedException, ExecutionException { + StockQuoteClient sc = node.getService(StockQuoteClient.class, "StockQuoteClient"); + Assert.assertEquals(10.0f, sc.getPriceAsyncPoll("foo")); + } + + @Test + public void invokeAsyncCallback() throws Exception { + StockQuoteClient sc = node.getService(StockQuoteClient.class, "StockQuoteClient"); + Assert.assertEquals(10.0f, sc.getPriceAsyncCallback("foo")); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jaxws/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jaxws/pom.xml new file mode 100644 index 0000000000..751935be6d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jaxws/pom.xml @@ -0,0 +1,53 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jaxws + Apache Tuscany JAX-WS Integration Tests + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + junit + junit + 4.5 + test + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jaxws/src/test/java/stock/AsyncServiceTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jaxws/src/test/java/stock/AsyncServiceTestCase.java new file mode 100644 index 0000000000..e1c2bedea3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jaxws/src/test/java/stock/AsyncServiceTestCase.java @@ -0,0 +1,42 @@ +package stock; +import junit.framework.Assert; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.Test; + +/* + * 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. + */ + +public class AsyncServiceTestCase { + + @Test + public void init() throws Exception { + try{ + String location = ContributionLocationHelper.getContributionLocation("StockQuote.composite"); + Node node = NodeFactory.newInstance().createNode("StockQuote.composite", new Contribution("c1", location)); + node.start(); + node.stop(); + } catch (Exception e) { + Assert.assertTrue(e.getMessage().contains("[JCA100006]")); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jaxws/src/test/java/stock/StockQuote.java b/tags/java/sca/2.0-M4-RC2/itest/jaxws/src/test/java/stock/StockQuote.java new file mode 100644 index 0000000000..74e25bb3bd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jaxws/src/test/java/stock/StockQuote.java @@ -0,0 +1,45 @@ +package stock; +/* + * 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. + */ + + + +import java.util.concurrent.Future; + +import javax.jws.WebService; +import javax.xml.ws.AsyncHandler; +import javax.xml.ws.Response; + +/** + * JAX-WS Async style Stock quote interface + * + * @version $Rev$ $Date$ + */ + +@WebService +public interface StockQuote { + + float getPrice(String ticker); + + Response getPriceAsync(String ticker); + + Future getPriceAsync(String ticker, AsyncHandler callback); + + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jaxws/src/test/java/stock/StockQuoteImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jaxws/src/test/java/stock/StockQuoteImpl.java new file mode 100644 index 0000000000..516c63d864 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jaxws/src/test/java/stock/StockQuoteImpl.java @@ -0,0 +1,46 @@ +/* + * 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 stock; + +import java.util.concurrent.Future; + +import javax.xml.ws.AsyncHandler; +import javax.xml.ws.Response; + +/** + * Stock quote impl + * + * @version $Rev$ $Date$ + */ +public class StockQuoteImpl implements StockQuote { + + public float getPrice(String ticker) { + return 10; + } + + public Response getPriceAsync(String ticker) { + return null; + } + + public Future getPriceAsync(String ticker, AsyncHandler callback) { + return null; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jaxws/src/test/resources/StockQuote.composite b/tags/java/sca/2.0-M4-RC2/itest/jaxws/src/test/resources/StockQuote.composite new file mode 100644 index 0000000000..b2c9bd8ddb --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jaxws/src/test/resources/StockQuote.composite @@ -0,0 +1,31 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/pom.xml new file mode 100644 index 0000000000..e1ab18de9b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-dynamic-replyq + Apache Tuscany SCA iTest JMS with dynamic replyq + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java new file mode 100644 index 0000000000..9aef6ba1a3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.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.jms; + +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 { + + private HelloWorldService serviceA; + + @Reference + public void setServiceA(HelloWorldService service) { + this.serviceA = service; + } + + public String sayHello(String name) { + return serviceA.sayHello(name); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java new file mode 100644 index 0000000000..430c71aaef --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java @@ -0,0 +1,26 @@ +/* + * 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.jms; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloWorldService { + String sayHello(String name); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..2c6d9d0d17 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/java/org/apache/tuscany/sca/binding/jms/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 org.apache.tuscany.sca.binding.jms; + +public class HelloWorldServiceImpl implements HelloWorldService { + + public String sayHello(String name) { + if ("bang".equals(name)) { + throw new RuntimeException("blem wit"); + } + return "jmsHello " + name; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..a9d43b5637 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/resources/dynamic/client.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/resources/dynamic/client.composite new file mode 100644 index 0000000000..cbad991ac5 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/resources/dynamic/client.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/resources/jndi.properties new file mode 100644 index 0000000000..4d6acc037b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.RequestQueue = RequestQueue +queue.ResponseQueue = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/resources/simple/service.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/resources/simple/service.composite new file mode 100644 index 0000000000..01553a968c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/main/resources/simple/service.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/test/java/org/apache/tuscany/sca/binding/jms/DynamicReplyQTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/test/java/org/apache/tuscany/sca/binding/jms/DynamicReplyQTestCase.java new file mode 100644 index 0000000000..3bf4e0bc30 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/DynamicReplyQ/src/test/java/org/apache/tuscany/sca/binding/jms/DynamicReplyQTestCase.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.binding.jms; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class DynamicReplyQTestCase { + + private static Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldService helloWorldService = node.getService(HelloWorldService.class, "HelloWorldClient"); + assertEquals("jmsHello Beate", helloWorldService.sayHello("Beate")); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/args/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/args/pom.xml new file mode 100644 index 0000000000..cb666cac7f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/args/pom.xml @@ -0,0 +1,70 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-args + Apache Tuscany SCA iTest JMS Args + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + + org.apache.activemq + activemq-core + 5.2.0 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.java new file mode 100644 index 0000000000..68506b857b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.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.jms; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the OneWay service. + */ +@Service(MyService.class) +public class ClientImpl implements MyService { + + private MyService serviceA; + + @Reference + public void setServiceA(MyService service) { + this.serviceA = service; + } + + public void sayHello(String name, String n2) { + serviceA.sayHello(name, n2); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/java/org/apache/tuscany/sca/binding/jms/MyService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/java/org/apache/tuscany/sca/binding/jms/MyService.java new file mode 100644 index 0000000000..5f19aa1fa5 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/java/org/apache/tuscany/sca/binding/jms/MyService.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.jms; + +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface MyService { + + @OneWay + void sayHello(String name, String n2); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/java/org/apache/tuscany/sca/binding/jms/ServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/java/org/apache/tuscany/sca/binding/jms/ServiceImpl.java new file mode 100644 index 0000000000..18324d5d1d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/java/org/apache/tuscany/sca/binding/jms/ServiceImpl.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.binding.jms; + + +public class ServiceImpl implements MyService { + + public static Object lock = new Object(); + public static String name; + public static String n2; + + public void sayHello(String name, String n2) { + System.out.println("SelectorServiceImpl1 " + name + n2); + ServiceImpl.name = name; + ServiceImpl.n2 = n2; + synchronized (ServiceImpl.lock) { + ServiceImpl.lock.notify(); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..07caa57490 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/resources/jndi.properties new file mode 100644 index 0000000000..bb431a592b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false&broker.useJmx=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory, ConnectionFactory2 + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic +topic.ServiceTopic = ServiceTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/resources/selectors/selectors.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/resources/selectors/selectors.composite new file mode 100644 index 0000000000..1a9075f6d4 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/args/src/main/resources/selectors/selectors.composite @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/args/src/test/java/org/apache/tuscany/sca/binding/jms/ArgsTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/args/src/test/java/org/apache/tuscany/sca/binding/jms/ArgsTestCase.java new file mode 100644 index 0000000000..28e0b530c1 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/args/src/test/java/org/apache/tuscany/sca/binding/jms/ArgsTestCase.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.binding.jms; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + */ +public class ArgsTestCase { + + private Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testSayHello() throws Exception { + MyService client1 = node.getService(MyService.class, "Client1"); + + client1.sayHello("petra", "beate"); + + synchronized(ServiceImpl.lock) { + if (ServiceImpl.name == null) { + ServiceImpl.lock.wait(5000); + } + } + + assertEquals("petra", ServiceImpl.name); + assertEquals("beate", ServiceImpl.n2); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/pom.xml new file mode 100644 index 0000000000..9929f87db5 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/pom.xml @@ -0,0 +1,73 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-jms-callbacks + Apache Tuscany SCA iTest JMS Tests For Callbacks + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + + org.apache.activemq + activemq-core + 5.2.0 + test + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.java b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.java new file mode 100644 index 0000000000..d4cd5df431 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.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 org.apache.tuscany.sca.binding.jms; + + +/** + * The client interface + */ +public interface JMSClient { + + void aClientMethod(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClientImpl.java new file mode 100644 index 0000000000..a4d5190af3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClientImpl.java @@ -0,0 +1,50 @@ +/* + * 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.jms; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * Remote Web service client with callback interface + */ +@Service(JMSClient.class) +public class JMSClientImpl implements JMSClient, JMSServiceCallback { + + @Reference protected JMSService myService; + + public static String result; + public static Object lock = new Object(); + + public void aClientMethod() { + System.out.println("aClientMethod " + this + " on thread " + Thread.currentThread()); + myService.someMethod(" -> someMethod "); // calls the server + System.out.println("aClientMethod return from someMethod on thread " + Thread.currentThread()); + } + + public void receiveResult(String result) { + System.out.println("receiveResult " + this + " '" + result + "' on thread " + Thread.currentThread()); + JMSClientImpl.result = result; + + // wakeup the waiting testcase + synchronized (lock) { + lock.notifyAll(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSService.java new file mode 100644 index 0000000000..b78feab413 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSService.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 org.apache.tuscany.sca.binding.jms; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +/** + * The remote service that will be invoked by the client + */ +@Remotable +@Callback(JMSServiceCallback.class) +public interface JMSService { + + @OneWay + void someMethod(String arg); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSServiceCallback.java b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSServiceCallback.java new file mode 100644 index 0000000000..20b74ccc1a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSServiceCallback.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 org.apache.tuscany.sca.binding.jms; + +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +/** + * The callback interface for {@link JMSService}. + */ +@Remotable +public interface JMSServiceCallback { + + @OneWay + void receiveResult(String result); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSServiceImpl.java new file mode 100644 index 0000000000..e8357338ae --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/java/org/apache/tuscany/sca/binding/jms/JMSServiceImpl.java @@ -0,0 +1,47 @@ +/* + * 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.jms; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements MyService and uses a callback. + */ +@Service(JMSService.class) +public class JMSServiceImpl implements JMSService { + + private JMSServiceCallback myServiceCallback; + + @Callback + public void setMyServiceCallback(JMSServiceCallback myServiceCallback) { + System.out.println("setMyServiceCallback on thread " + Thread.currentThread() + " cb: " + myServiceCallback); + this.myServiceCallback = myServiceCallback; + } + + public void someMethod(String arg) { + System.out.println("someMethod '" + arg + "' on thread " + Thread.currentThread()); + try { + myServiceCallback.receiveResult(arg + " -> receiveResult "); + } catch(Exception e) { + System.out.println("RuntimeException invoking receiveResult: " + e.toString()); + e.printStackTrace(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..95c3a41c43 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/resources/jndi.properties new file mode 100644 index 0000000000..dec266b133 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/resources/jndi.properties @@ -0,0 +1,40 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false&broker.useJmx=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.ServiceQueue = ServiceQueue +queue.ServiceQueue = TQServiceQueue +queue.CallbackQueue = CallbackQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/resources/simple/client.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/resources/simple/client.composite new file mode 100644 index 0000000000..19124fc3e6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/resources/simple/client.composite @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/resources/simple/tempq.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/resources/simple/tempq.composite new file mode 100644 index 0000000000..5ef7c981f0 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/main/resources/simple/tempq.composite @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/test/java/org/apache/tuscany/sca/binding/jms/CallbackTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/test/java/org/apache/tuscany/sca/binding/jms/CallbackTestCase.java new file mode 100644 index 0000000000..18911ad8b6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/test/java/org/apache/tuscany/sca/binding/jms/CallbackTestCase.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 org.apache.tuscany.sca.binding.jms; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class CallbackTestCase { + + private Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + JMSClient client = node.getService(JMSClient.class, "ClientComponent"); + + client.aClientMethod(); + + // wait for up to 5 seconds but should wake up as soon as done + synchronized(JMSClientImpl.lock) { + JMSClientImpl.lock.wait(5000); + } + + assertEquals(" -> someMethod -> receiveResult ", JMSClientImpl.result); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/test/java/org/apache/tuscany/sca/binding/jms/TempCallbackQTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/test/java/org/apache/tuscany/sca/binding/jms/TempCallbackQTestCase.java new file mode 100644 index 0000000000..b335add358 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/callbacks/src/test/java/org/apache/tuscany/sca/binding/jms/TempCallbackQTestCase.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.binding.jms; + +import static org.junit.Assert.assertEquals; + +import java.net.MalformedURLException; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class TempCallbackQTestCase { + + private Node node; + + @Before + public void init() throws MalformedURLException { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + JMSClient client = node.getService(JMSClient.class, "ClientComponent"); + + client.aClientMethod(); + + // wait for up to 5 seconds but should wake up as soon as done + synchronized (JMSClientImpl.lock) { + JMSClientImpl.lock.wait(5000); + } + + assertEquals(" -> someMethod -> receiveResult ", JMSClientImpl.result); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/pom.xml new file mode 100644 index 0000000000..8d78fde377 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-defaults + Apache Tuscany SCA iTest JMS with Defaults + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java new file mode 100644 index 0000000000..9aef6ba1a3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.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.jms; + +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 { + + private HelloWorldService serviceA; + + @Reference + public void setServiceA(HelloWorldService service) { + this.serviceA = service; + } + + public String sayHello(String name) { + return serviceA.sayHello(name); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java new file mode 100644 index 0000000000..430c71aaef --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java @@ -0,0 +1,26 @@ +/* + * 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.jms; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloWorldService { + String sayHello(String name); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..2c6d9d0d17 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/java/org/apache/tuscany/sca/binding/jms/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 org.apache.tuscany.sca.binding.jms; + +public class HelloWorldServiceImpl implements HelloWorldService { + + public String sayHello(String name) { + if ("bang".equals(name)) { + throw new RuntimeException("blem wit"); + } + return "jmsHello " + name; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..2a74e465ea --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/resources/defaults/client.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/resources/defaults/client.composite new file mode 100644 index 0000000000..c4d5215f86 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/resources/defaults/client.composite @@ -0,0 +1,31 @@ + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/resources/defaults/service.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/resources/defaults/service.composite new file mode 100644 index 0000000000..a4de896f24 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/resources/defaults/service.composite @@ -0,0 +1,31 @@ + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/resources/jndi.properties new file mode 100644 index 0000000000..4d6acc037b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.RequestQueue = RequestQueue +queue.ResponseQueue = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/test/java/org/apache/tuscany/sca/binding/jms/DefaultsTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/test/java/org/apache/tuscany/sca/binding/jms/DefaultsTestCase.java new file mode 100644 index 0000000000..d2b1a5fe59 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/defaults/src/test/java/org/apache/tuscany/sca/binding/jms/DefaultsTestCase.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.binding.jms; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class DefaultsTestCase { + + private Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldService helloWorldService = node.getService(HelloWorldService.class, "HelloWorldClient"); + assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra")); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/pom.xml new file mode 100644 index 0000000000..545ae23615 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/pom.xml @@ -0,0 +1,73 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-definitions + Apache Tuscany SCA iTest JMS Tests For Properties + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + + org.apache.activemq + activemq-core + 5.2.0 + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java new file mode 100644 index 0000000000..b572b1012a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.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.jms; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the OneWay service. + */ +@Service(OneWayService.class) +public class OneWayClientImpl implements OneWayService { + + private OneWayService serviceA; + + @Reference + public void setServiceA(OneWayService service) { + this.serviceA = service; + } + + public void sayHello(String name) { + serviceA.sayHello(name); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java new file mode 100644 index 0000000000..9cec2d9b3e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.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.jms; + +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface OneWayService { + + @OneWay + void sayHello(String name); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java new file mode 100644 index 0000000000..6b763874df --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.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 org.apache.tuscany.sca.binding.jms; + +public class OneWayServiceImpl implements OneWayService { + + public static Object lock = new Object(); + public static String name; + + public void sayHello(String name) { + OneWayServiceImpl.name = name; + synchronized (OneWayServiceImpl.lock) { + OneWayServiceImpl.lock.notify(); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..07caa57490 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/resources/definitions.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/resources/definitions.xml new file mode 100644 index 0000000000..07b9f4aaa8 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/resources/definitions.xml @@ -0,0 +1,28 @@ + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/resources/definitions/definitions.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/resources/definitions/definitions.composite new file mode 100644 index 0000000000..67a62a7165 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/resources/definitions/definitions.composite @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/resources/jndi.properties new file mode 100644 index 0000000000..f7555e0beb --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false&broker.useJmx=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = MyConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.MyServiceQueue= MyServiceQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/test/java/org/apache/tuscany/sca/binding/jms/DefinitionsTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/test/java/org/apache/tuscany/sca/binding/jms/DefinitionsTestCase.java new file mode 100644 index 0000000000..729ad072b7 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/definitions/src/test/java/org/apache/tuscany/sca/binding/jms/DefinitionsTestCase.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.binding.jms; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + */ +public class DefinitionsTestCase { + + private Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testSayHello() throws Exception { + OneWayService client = node.getService(OneWayService.class, "OneWayClient"); + + client.sayHello("petra"); + + // wait for up to 5 seconds but should wake up as soon as done + synchronized(OneWayServiceImpl.lock) { + if (OneWayServiceImpl.name == null) { + OneWayServiceImpl.lock.wait(5000); + } + } + + assertEquals("petra", OneWayServiceImpl.name); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/pom.xml new file mode 100644 index 0000000000..e4d8401cba --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/pom.xml @@ -0,0 +1,90 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-nonscaclient-exceptions + Apache Tuscany SCA iTest JMS NonSCA Client Exceptions + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + xmlunit + xmlunit + 1.2 + test + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion.java b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion.java new file mode 100644 index 0000000000..469882f3b3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion.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 org.apache.tuscany.sca.binding.jms; + +public class CheckedExcpetion extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedExcpetion(String s) { + super(s); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion2Args.java b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion2Args.java new file mode 100644 index 0000000000..19b584950a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion2Args.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 org.apache.tuscany.sca.binding.jms; + +public class CheckedExcpetion2Args extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedExcpetion2Args(String s, Throwable e) { + super(s, e); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetionChained.java b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetionChained.java new file mode 100644 index 0000000000..b12e3a562e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetionChained.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 org.apache.tuscany.sca.binding.jms; + +public class CheckedExcpetionChained extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedExcpetionChained(Throwable e) { + super(e); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetionNoArgs.java b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetionNoArgs.java new file mode 100644 index 0000000000..b23db73c01 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetionNoArgs.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 org.apache.tuscany.sca.binding.jms; + +public class CheckedExcpetionNoArgs extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedExcpetionNoArgs() { + super(); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionService.java new file mode 100644 index 0000000000..9e4c4c46d4 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionService.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.jms; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface ExceptionService { + + public void throwChecked() throws CheckedExcpetion; + public void throwCheckedNoArgs() throws CheckedExcpetionNoArgs; + public void throwChecked2Args() throws CheckedExcpetion2Args; + public void throwCheckedChained() throws CheckedExcpetionChained; + + public void throwUnChecked(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceImpl.java new file mode 100644 index 0000000000..866acf1ce1 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceImpl.java @@ -0,0 +1,44 @@ +/* + * 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.jms; + +public class ExceptionServiceImpl implements ExceptionService { + + public void throwChecked() throws CheckedExcpetion { + throw new CheckedExcpetion("foo"); + } + + public void throwChecked2Args() throws CheckedExcpetion2Args { + throw new CheckedExcpetion2Args("foo", new Exception("bla")); + } + + public void throwCheckedChained() throws CheckedExcpetionChained { + throw new CheckedExcpetionChained(new Exception("bla")); + } + + public void throwCheckedNoArgs() throws CheckedExcpetionNoArgs { + throw new CheckedExcpetionNoArgs(); + } + + public void throwUnChecked() { + throw new RuntimeException("bla"); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..c9945cc57d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/resources/exceptions/service.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/resources/exceptions/service.composite new file mode 100644 index 0000000000..9eb8f2b27d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/resources/exceptions/service.composite @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/resources/jndi.properties new file mode 100644 index 0000000000..72d5457faf --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/main/resources/jndi.properties @@ -0,0 +1,40 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.TextExceptionService = TextRequestQueue +queue.ObjectExceptionService = ObjectRequestQueue +queue.ResponseQueue = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java new file mode 100644 index 0000000000..1e1a0987ad --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java @@ -0,0 +1,212 @@ +/* + * 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.jms; + +import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.util.Properties; + +import javax.jms.Connection; +import javax.jms.ConnectionFactory; +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageConsumer; +import javax.jms.MessageProducer; +import javax.jms.ObjectMessage; +import javax.jms.Session; +import javax.jms.TextMessage; +import javax.naming.InitialContext; +import javax.naming.NamingException; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.xml.sax.SAXException; + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class ExceptionsTestCase { + + private Node node; + private Session session; + private InitialContext context; + private Connection connection; + + private static final String CHECKED_XML = + "foo"; + private static final String CHECKED_NOARGS_XML = ""; + private static final String CHECKED_2ARGS_XML = + "foo"; + private static final String CHECKED_CHAINED_XML = + "java.lang.Exception: bla"; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testTextChecked() throws NamingException, JMSException, SAXException, IOException { + sendJMSTextRequest("throwChecked"); + Message m = receiveJMSResponse(); + assertXMLEqual(CHECKED_XML, ((TextMessage)m).getText()); + } + + @Test + public void testTextCheckedNoArgs() throws NamingException, JMSException, SAXException, IOException { + sendJMSTextRequest("throwCheckedNoArgs"); + Message m = receiveJMSResponse(); + assertXMLEqual(CHECKED_NOARGS_XML, ((TextMessage)m).getText()); + } + + @Test + public void testTextChecked2Args() throws NamingException, JMSException, SAXException, IOException { + sendJMSTextRequest("throwChecked2Args"); + Message m = receiveJMSResponse(); + assertXMLEqual(CHECKED_2ARGS_XML, ((TextMessage)m).getText()); + } + + @Test + public void testTextCheckedChained() throws NamingException, JMSException, SAXException, IOException { + sendJMSTextRequest("throwCheckedChained"); + Message m = receiveJMSResponse(); + assertXMLEqual(CHECKED_CHAINED_XML, ((TextMessage)m).getText()); + } + + @Test + public void testTextUnChecked() throws NamingException, JMSException, SAXException, IOException { + sendJMSTextRequest("throwUnChecked"); + Message m = receiveJMSResponse(); + + // FIXME: what should the response message be for unchecked exceptions with wireFormat.textXML??? + Object o = ((ObjectMessage)m).getObject(); + assertTrue(o instanceof RuntimeException); + assertTrue("java.lang.RuntimeException".equals(o.getClass().getName())); + assertEquals("java.lang.RuntimeException: bla", ((RuntimeException)o).getMessage()); + } + + @Test + public void testObjectChecked() throws NamingException, JMSException { + sendJMSObjectRequest("throwChecked"); + Message m = receiveJMSResponse(); + Object o = ((ObjectMessage)m).getObject(); + assertTrue(o instanceof CheckedExcpetion); + assertEquals("foo", ((CheckedExcpetion)o).getMessage()); + } + + @Test + public void testObjectCheckedNoArgs() throws NamingException, JMSException { + sendJMSObjectRequest("throwCheckedNoArgs"); + Message m = receiveJMSResponse(); + Object o = ((ObjectMessage)m).getObject(); + assertTrue(o instanceof CheckedExcpetionNoArgs); + } + + @Test + public void testObjectChecked2Args() throws NamingException, JMSException { + sendJMSObjectRequest("throwChecked2Args"); + Message m = receiveJMSResponse(); + Object o = ((ObjectMessage)m).getObject(); + assertTrue(o instanceof CheckedExcpetion2Args); + assertEquals("foo", ((CheckedExcpetion2Args)o).getMessage()); + assertEquals("bla", ((CheckedExcpetion2Args)o).getCause().getMessage()); + } + + @Test + public void testObjectCheckedChained() throws NamingException, JMSException { + sendJMSObjectRequest("throwCheckedChained"); + Message m = receiveJMSResponse(); + Object o = ((ObjectMessage)m).getObject(); + assertTrue(o instanceof CheckedExcpetionChained); + assertEquals("bla", ((CheckedExcpetionChained)o).getCause().getMessage()); + } + + @Test + public void testObjectUnChecked() throws NamingException, JMSException { + sendJMSObjectRequest("throwUnChecked"); + Message m = receiveJMSResponse(); + Object o = ((ObjectMessage)m).getObject(); + assertTrue(o instanceof RuntimeException); + assertTrue("java.lang.RuntimeException".equals(o.getClass().getName())); + assertEquals("java.lang.RuntimeException: bla", ((RuntimeException)o).getMessage()); + } + + @After + public void end() throws JMSException { + if (node != null) { + node.stop(); + } + if (connection != null) { + connection.close(); + } + } + + private void sendJMSTextRequest(String operationName) throws NamingException, JMSException { + context = new InitialContext(new Properties()); + ConnectionFactory cf = (ConnectionFactory)context.lookup("ConnectionFactory"); + connection = cf.createConnection(); + connection.start(); + + session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + Destination toDest = (Destination)context.lookup("TextExceptionService"); + + TextMessage m = session.createTextMessage(); + m.setStringProperty("scaOperationName", operationName); + m.setJMSReplyTo((Destination)context.lookup("ResponseQueue")); + m.setText("<_ns_:" + operationName + " xmlns:_ns_=\"http://jms.binding.sca.tuscany.apache.org/\" />"); + + MessageProducer producer = session.createProducer(toDest); + producer.send(m); + } + + private void sendJMSObjectRequest(String operationName) throws NamingException, JMSException { + context = new InitialContext(new Properties()); + ConnectionFactory cf = (ConnectionFactory)context.lookup("ConnectionFactory"); + connection = cf.createConnection(); + connection.start(); + + session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + Destination toDest = (Destination)context.lookup("ObjectExceptionService"); + + ObjectMessage m = session.createObjectMessage(); + m.setStringProperty("scaOperationName", operationName); + m.setJMSReplyTo((Destination)context.lookup("ResponseQueue")); + m.setObject(new Object[0]); + + MessageProducer producer = session.createProducer(toDest); + producer.send(m); + } + + private Message receiveJMSResponse() throws NamingException, JMSException { + Destination replyDest = (Destination)context.lookup("ResponseQueue"); + MessageConsumer consumer = session.createConsumer(replyDest); + Message m = consumer.receive(5000); + if (m == null) { + throw new RuntimeException("No reply message received"); + } + return m; + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/pom.xml new file mode 100644 index 0000000000..a2a029c018 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-exceptions1 + Apache Tuscany SCA iTest JMS with Exceptions1 + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion.java b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion.java new file mode 100644 index 0000000000..469882f3b3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion.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 org.apache.tuscany.sca.binding.jms; + +public class CheckedExcpetion extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedExcpetion(String s) { + super(s); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion2Args.java b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion2Args.java new file mode 100644 index 0000000000..19b584950a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetion2Args.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 org.apache.tuscany.sca.binding.jms; + +public class CheckedExcpetion2Args extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedExcpetion2Args(String s, Throwable e) { + super(s, e); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetionChained.java b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetionChained.java new file mode 100644 index 0000000000..b12e3a562e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetionChained.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 org.apache.tuscany.sca.binding.jms; + +public class CheckedExcpetionChained extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedExcpetionChained(Throwable e) { + super(e); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetionNoArgs.java b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetionNoArgs.java new file mode 100644 index 0000000000..b23db73c01 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/CheckedExcpetionNoArgs.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 org.apache.tuscany.sca.binding.jms; + +public class CheckedExcpetionNoArgs extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedExcpetionNoArgs() { + super(); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionService.java new file mode 100644 index 0000000000..9e4c4c46d4 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionService.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.jms; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface ExceptionService { + + public void throwChecked() throws CheckedExcpetion; + public void throwCheckedNoArgs() throws CheckedExcpetionNoArgs; + public void throwChecked2Args() throws CheckedExcpetion2Args; + public void throwCheckedChained() throws CheckedExcpetionChained; + + public void throwUnChecked(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceClient.java b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceClient.java new file mode 100644 index 0000000000..02426936d2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceClient.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.binding.jms; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(ExceptionService.class) +public class ExceptionServiceClient implements ExceptionService { + + private ExceptionService service; + + @Reference + public void setService(ExceptionService service) { + this.service = service; + } + + public void throwChecked() throws CheckedExcpetion { + service.throwChecked(); + } + + public void throwChecked2Args() throws CheckedExcpetion2Args { + service.throwChecked2Args(); + } + + public void throwCheckedChained() throws CheckedExcpetionChained { + service.throwCheckedChained(); + } + + public void throwCheckedNoArgs() throws CheckedExcpetionNoArgs { + service.throwCheckedNoArgs(); + } + + public void throwUnChecked() { + service.throwUnChecked(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceImpl.java new file mode 100644 index 0000000000..866acf1ce1 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/java/org/apache/tuscany/sca/binding/jms/ExceptionServiceImpl.java @@ -0,0 +1,44 @@ +/* + * 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.jms; + +public class ExceptionServiceImpl implements ExceptionService { + + public void throwChecked() throws CheckedExcpetion { + throw new CheckedExcpetion("foo"); + } + + public void throwChecked2Args() throws CheckedExcpetion2Args { + throw new CheckedExcpetion2Args("foo", new Exception("bla")); + } + + public void throwCheckedChained() throws CheckedExcpetionChained { + throw new CheckedExcpetionChained(new Exception("bla")); + } + + public void throwCheckedNoArgs() throws CheckedExcpetionNoArgs { + throw new CheckedExcpetionNoArgs(); + } + + public void throwUnChecked() { + throw new RuntimeException("bla"); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..c28c94da98 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/resources/exceptions/client.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/resources/exceptions/client.composite new file mode 100644 index 0000000000..5d1c57a1f3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/resources/exceptions/client.composite @@ -0,0 +1,31 @@ + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/resources/exceptions/service.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/resources/exceptions/service.composite new file mode 100644 index 0000000000..6875772d56 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/resources/exceptions/service.composite @@ -0,0 +1,31 @@ + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/resources/jndi.properties new file mode 100644 index 0000000000..4d6acc037b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.RequestQueue = RequestQueue +queue.ResponseQueue = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.java new file mode 100644 index 0000000000..170e28b15d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/exceptions1/src/test/java/org/apache/tuscany/sca/binding/jms/ExceptionsTestCase.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.jms; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class ExceptionsTestCase { + + private static Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testChecked() { + ExceptionService service = node.getService(ExceptionService.class, "ExceptionServiceClient"); + try { + service.throwChecked(); + fail(); + } catch (CheckedExcpetion e) { + assertEquals("foo", e.getMessage()); + } catch (Throwable e) { + fail(); + } + } + + @Test + public void testCheckedNoArgs() { + ExceptionService service = node.getService(ExceptionService.class, "ExceptionServiceClient"); + try { + service.throwCheckedNoArgs(); + fail(); + } catch (CheckedExcpetionNoArgs e) { + // ok + } + } + + @Test + public void testChecked2Args() { + ExceptionService service = node.getService(ExceptionService.class, "ExceptionServiceClient"); + try { + service.throwChecked2Args(); + fail(); + } catch (CheckedExcpetion2Args e) { + assertEquals("foo", e.getMessage()); +// FIXME: TUSCANY-2848: lost the cause! +// assertNotNull(e.getCause()); +// assertEquals("bla", e.getCause().getMessage()); + } + } + + @Test + public void testCheckedChained() { + ExceptionService service = node.getService(ExceptionService.class, "ExceptionServiceClient"); + try { + service.throwCheckedChained(); + fail(); + } catch (CheckedExcpetionChained e) { + // FIXME: TUSCANY-2848: lost the cause! +// assertNotNull(e.getCause()); +// assertEquals("bla", e.getCause().getMessage()); + } + } + + @Test + public void testUnChecked() { + ExceptionService service = node.getService(ExceptionService.class, "ExceptionServiceClient"); + try { + service.throwUnChecked(); + fail(); + } catch (Exception e) { + assertEquals("java.lang.RuntimeException: bla", e.getCause().getMessage()); + } + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/pom.xml new file mode 100644 index 0000000000..a4625ca7f9 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-external-broker + Apache Tuscany SCA iTest JMS with External JMS Broker + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java new file mode 100644 index 0000000000..9aef6ba1a3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.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.jms; + +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 { + + private HelloWorldService serviceA; + + @Reference + public void setServiceA(HelloWorldService service) { + this.serviceA = service; + } + + public String sayHello(String name) { + return serviceA.sayHello(name); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java new file mode 100644 index 0000000000..430c71aaef --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java @@ -0,0 +1,26 @@ +/* + * 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.jms; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloWorldService { + String sayHello(String name); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..2c6d9d0d17 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/java/org/apache/tuscany/sca/binding/jms/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 org.apache.tuscany.sca.binding.jms; + +public class HelloWorldServiceImpl implements HelloWorldService { + + public String sayHello(String name) { + if ("bang".equals(name)) { + throw new RuntimeException("blem wit"); + } + return "jmsHello " + name; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..60b132ca1b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/resources/external/client.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/resources/external/client.composite new file mode 100644 index 0000000000..cad76ef45f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/resources/external/client.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/resources/external/service.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/resources/external/service.composite new file mode 100644 index 0000000000..8a76d8cd29 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/resources/external/service.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/resources/jndi.properties new file mode 100644 index 0000000000..4d6acc037b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.RequestQueue = RequestQueue +queue.ResponseQueue = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java new file mode 100644 index 0000000000..b8cbde7b26 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/externalBroker/src/test/java/org/apache/tuscany/sca/binding/jms/ExternalBrokerTestCase.java @@ -0,0 +1,71 @@ +/* + * 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.jms; + +import static org.junit.Assert.assertEquals; + +import org.apache.activemq.broker.BrokerService; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests using the JMS binding with an external JMS broker + */ +public class ExternalBrokerTestCase { + + private static Node node; + private BrokerService broker; + + @Before + public void init() throws Exception { + startBroker(); + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldService helloWorldService = node.getService(HelloWorldService.class, "HelloWorldClient"); + assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra")); + } + + @After + public void end() throws Exception { + if (node != null) { + node.stop(); + } + stopBroker(); + } + + protected void startBroker() throws Exception { + broker = new BrokerService(); + broker.setPersistent(false); + broker.setUseJmx(false); + broker.addConnector("tcp://localhost:61616"); + broker.start(); + } + protected void stopBroker() throws Exception { + if (broker != null) { + broker.stop(); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/pom.xml new file mode 100644 index 0000000000..81b31c6f6d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-format-jmsbytes + Apache Tuscany SCA iTest JMS Message Format jmsbytes + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java new file mode 100644 index 0000000000..1acbfbd5ae --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.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 org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld; + +public class CheckedException extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedException(String s) { + super(s); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..2d19d4bd82 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.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 org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String message); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..3ccd54e9bd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java @@ -0,0 +1,50 @@ +/* + * 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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Reference; + + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldServiceReference helloWorldService1; + + public String getGreetings(String name){ + byte[] bytesValue = helloWorldService1.getByteArrayGreetings(name.getBytes()); + String stringValue = new String(bytesValue); + + try { + helloWorldService1.throwChecked(name.getBytes()); + } catch (Exception e) { + // Test to see what happens if we talk to a service + // that declares a checked exception through an + // interface that doesn't + stringValue += " " + e.getCause().getMessage(); + } + + try { + helloWorldService1.throwUnChecked(name.getBytes()); + } catch (Exception e) { + stringValue += " " + e.getMessage(); + } + return stringValue; + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..b9a1ffd5ef --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg); + + public void throwChecked(byte[] msg) throws CheckedException; + public void throwUnChecked(byte[] msg); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..b92959cfd3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java @@ -0,0 +1,40 @@ +/* + * 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.jms.format.jmsbytes.helloworld; + + +public class HelloWorldServiceImpl implements HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg){ + + String name = new String(msg); + name = "Hello " + name; + + return name.getBytes(); + } + + public void throwChecked(byte[] msg) throws CheckedException { + throw new CheckedException("foo"); + } + + public void throwUnChecked(byte[] msg) { + throw new RuntimeException("bla"); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java new file mode 100644 index 0000000000..ff5cf617f2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldServiceReference { + + public byte[] getByteArrayGreetings(byte[] msg); + + public void throwChecked(byte[] msg) ; + public void throwUnChecked(byte[] msg); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..84ac2356db --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/resources/jmsbytes/helloworld.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/resources/jmsbytes/helloworld.composite new file mode 100644 index 0000000000..e5a904871c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/resources/jmsbytes/helloworld.composite @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/resources/jndi.properties new file mode 100644 index 0000000000..4d6acc037b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.RequestQueue = RequestQueue +queue.ResponseQueue = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.java new file mode 100644 index 0000000000..49cb0a69ab --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytes/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesTestCase.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 org.apache.tuscany.sca.binding.jms.format; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld.HelloWorldReference; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class FormatJMSBytesTestCase { + + private Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldReference helloWorldService = node.getService(HelloWorldReference.class, "HelloWorldReferenceComponent"); + + System.out.println(helloWorldService.getGreetings("Fred Bloggs")); +/* TUSCANY-2967 - disable this change while we decide what to do and + * return faults as JMSObject messages to be consistent + * again with other wire formats + assertEquals("Hello Fred Bloggs " + + "org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld.CheckedException: foo " + + "org.osoa.sca.ServiceRuntimeException: java.lang.RuntimeException: bla", + helloWorldService.getGreetings("Fred Bloggs")); +*/ + assertEquals("Hello Fred Bloggs " + + "foo " + + "remote service exception, see nested exception" , + helloWorldService.getGreetings("Fred Bloggs")); + + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/pom.xml new file mode 100644 index 0000000000..6f9cdd01cf --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-format-jmsbytesxml + Apache Tuscany SCA iTest JMS Message Format jmsbytesxml + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/CheckedException.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/CheckedException.java new file mode 100644 index 0000000000..1684c19c50 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/CheckedException.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 org.apache.tuscany.sca.binding.jms.format.jmsbytesxml.helloworld; + +public class CheckedException extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedException(String s) { + super(s); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..cc7b7b11e4 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldReference.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 org.apache.tuscany.sca.binding.jms.format.jmsbytesxml.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String message); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..3742bd6ac6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldReferenceImpl.java @@ -0,0 +1,46 @@ +/* + * 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.jms.format.jmsbytesxml.helloworld; + +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldService helloWorldService1; + + public String getGreetings(String name){ + byte[] bytesValue = helloWorldService1.getByteArrayGreetings(name.getBytes()); + String stringValue = new String(bytesValue); + + try { + helloWorldService1.throwChecked(name.getBytes()); + } catch (CheckedException e) { + stringValue += " " + e.getMessage(); + } + + try { + helloWorldService1.throwUnChecked(name.getBytes()); + } catch (Exception e) { + stringValue += " " + e.getMessage(); + } + return stringValue; + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..eae95b4201 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldService.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 org.apache.tuscany.sca.binding.jms.format.jmsbytesxml.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg); + + public void throwChecked(byte[] msg) throws CheckedException; + public void throwUnChecked(byte[] msg); +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..a37a03d994 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldServiceImpl.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.jms.format.jmsbytesxml.helloworld; + +public class HelloWorldServiceImpl implements HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg){ + + String name = new String(msg); + name = "Hello " + name; + + return name.getBytes(); + } + + public void throwChecked(byte[] msg) throws CheckedException { + throw new CheckedException("foo"); + } + + public void throwUnChecked(byte[] msg) { + throw new RuntimeException("bla"); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..84ac2356db --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/resources/jmsbytesxml/helloworld.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/resources/jmsbytesxml/helloworld.composite new file mode 100644 index 0000000000..a28e6e5f6d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/resources/jmsbytesxml/helloworld.composite @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/resources/jndi.properties new file mode 100644 index 0000000000..4d6acc037b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.RequestQueue = RequestQueue +queue.ResponseQueue = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesXMLTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesXMLTestCase.java new file mode 100644 index 0000000000..53498ce44d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSBytesXMLTestCase.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 org.apache.tuscany.sca.binding.jms.format; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld.HelloWorldReference; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class FormatJMSBytesXMLTestCase { + + private static Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldReference helloWorldService = node.getService(HelloWorldReference.class, "HelloWorldReferenceComponent"); + + System.out.println(helloWorldService.getGreetings("Fred Bloggs")); + assertEquals("Hello Fred Bloggs foo remote service exception, see nested exception", helloWorldService.getGreetings("Fred Bloggs")); + + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java new file mode 100644 index 0000000000..1acbfbd5ae --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.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 org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld; + +public class CheckedException extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedException(String s) { + super(s); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..2d19d4bd82 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.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 org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String message); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..3ccd54e9bd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java @@ -0,0 +1,50 @@ +/* + * 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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Reference; + + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldServiceReference helloWorldService1; + + public String getGreetings(String name){ + byte[] bytesValue = helloWorldService1.getByteArrayGreetings(name.getBytes()); + String stringValue = new String(bytesValue); + + try { + helloWorldService1.throwChecked(name.getBytes()); + } catch (Exception e) { + // Test to see what happens if we talk to a service + // that declares a checked exception through an + // interface that doesn't + stringValue += " " + e.getCause().getMessage(); + } + + try { + helloWorldService1.throwUnChecked(name.getBytes()); + } catch (Exception e) { + stringValue += " " + e.getMessage(); + } + return stringValue; + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..b9a1ffd5ef --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg); + + public void throwChecked(byte[] msg) throws CheckedException; + public void throwUnChecked(byte[] msg); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..b92959cfd3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java @@ -0,0 +1,40 @@ +/* + * 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.jms.format.jmsbytes.helloworld; + + +public class HelloWorldServiceImpl implements HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg){ + + String name = new String(msg); + name = "Hello " + name; + + return name.getBytes(); + } + + public void throwChecked(byte[] msg) throws CheckedException { + throw new CheckedException("foo"); + } + + public void throwUnChecked(byte[] msg) { + throw new RuntimeException("bla"); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java new file mode 100644 index 0000000000..ff5cf617f2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsbytesxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldServiceReference { + + public byte[] getByteArrayGreetings(byte[] msg); + + public void throwChecked(byte[] msg) ; + public void throwUnChecked(byte[] msg); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/pom.xml new file mode 100644 index 0000000000..7240897436 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-format-jmsdefault + Apache Tuscany SCA iTest JMS Message Format jmsdefault + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java new file mode 100644 index 0000000000..1acbfbd5ae --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.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 org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld; + +public class CheckedException extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedException(String s) { + super(s); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..2d19d4bd82 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.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 org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String message); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..3ccd54e9bd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java @@ -0,0 +1,50 @@ +/* + * 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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Reference; + + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldServiceReference helloWorldService1; + + public String getGreetings(String name){ + byte[] bytesValue = helloWorldService1.getByteArrayGreetings(name.getBytes()); + String stringValue = new String(bytesValue); + + try { + helloWorldService1.throwChecked(name.getBytes()); + } catch (Exception e) { + // Test to see what happens if we talk to a service + // that declares a checked exception through an + // interface that doesn't + stringValue += " " + e.getCause().getMessage(); + } + + try { + helloWorldService1.throwUnChecked(name.getBytes()); + } catch (Exception e) { + stringValue += " " + e.getMessage(); + } + return stringValue; + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..b9a1ffd5ef --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg); + + public void throwChecked(byte[] msg) throws CheckedException; + public void throwUnChecked(byte[] msg); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..b92959cfd3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java @@ -0,0 +1,40 @@ +/* + * 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.jms.format.jmsbytes.helloworld; + + +public class HelloWorldServiceImpl implements HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg){ + + String name = new String(msg); + name = "Hello " + name; + + return name.getBytes(); + } + + public void throwChecked(byte[] msg) throws CheckedException { + throw new CheckedException("foo"); + } + + public void throwUnChecked(byte[] msg) { + throw new RuntimeException("bla"); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java new file mode 100644 index 0000000000..ff5cf617f2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldServiceReference { + + public byte[] getByteArrayGreetings(byte[] msg); + + public void throwChecked(byte[] msg) ; + public void throwUnChecked(byte[] msg); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/CheckedException.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/CheckedException.java new file mode 100644 index 0000000000..530eac3d00 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/CheckedException.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 org.apache.tuscany.sca.binding.jms.format.jmsdefault.helloworld; + +public class CheckedException extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedException(String s) { + super(s); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..1768816247 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldReference.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.binding.jms.format.jmsdefault.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String name); + + public String getPersonGreetings(Person person); + + public void nullInVoidOut(); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..d0a5faaef7 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldReferenceImpl.java @@ -0,0 +1,85 @@ +/* + * 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.jms.format.jmsdefault.helloworld; + +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldService helloWorldService1; + + @Reference + protected HelloWorldService helloWorldService2; + + @Reference + protected HelloWorldService helloWorldService3; + + @Reference + protected HelloWorldService helloWorldService4; + + public String getGreetings(String name){ + String stringValue = helloWorldService1.getGreetings(name) + " " + + helloWorldService2.getGreetings(name) + " " + + helloWorldService3.getGreetings(name) + " " + + helloWorldService4.getGreetings(name); + + try { + helloWorldService3.throwChecked(name); + } catch (CheckedException e) { + stringValue += " " + e.getMessage(); + } + + try { + helloWorldService3.throwUnChecked(name); + } catch (Exception e) { + stringValue += " " + e.getMessage(); + } + + try { + helloWorldService4.throwChecked(name); + } catch (CheckedException e) { + stringValue += " " + e.getMessage(); + } + + try { + helloWorldService4.throwUnChecked(name); + } catch (Exception e) { + stringValue += " " + e.getMessage(); + } + + return stringValue; + } + + public String getPersonGreetings(Person person){ + return helloWorldService1.getPersonGreetings(person) + " " + + helloWorldService2.getPersonGreetings(person) + " " + + helloWorldService3.getPersonGreetings(person) + " " + + helloWorldService4.getPersonGreetings(person); + } + + public void nullInVoidOut() { + helloWorldService1.nullInVoidOut(); + helloWorldService2.nullInVoidOut(); + helloWorldService3.nullInVoidOut(); + helloWorldService4.nullInVoidOut(); + + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..204863423d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldService.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.binding.jms.format.jmsdefault.helloworld; + +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); + + public String getPersonGreetings(Person person); + + public void nullInVoidOut(); + + public void throwChecked(String msg) throws CheckedException; + public void throwUnChecked(String msg); +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..b143079fe3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldServiceImpl.java @@ -0,0 +1,51 @@ +/* + * 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.jms.format.jmsdefault.helloworld; + + +public class HelloWorldServiceImpl implements HelloWorldService { + + public static int nullInVoidOutCalled = 0; + + public String getGreetings(String name){ + String response = "Hello " + name; + System.out.println("getGreetings: " + response); + return response; + } + + public String getPersonGreetings(Person person){ + String response = "Hello " + person.getFirstName() + " " + person.getLastName(); + System.out.println("getPersonGreetings: " + response); + return response; + } + + public void nullInVoidOut() { + System.out.println("nullInVoidOut"); + nullInVoidOutCalled++; + } + + public void throwChecked(String msg) throws CheckedException { + throw new CheckedException("foo"); + } + + public void throwUnChecked(String msg) { + throw new RuntimeException("bla"); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/Person.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/Person.java new file mode 100644 index 0000000000..b62d1b1f1d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/Person.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.jms.format.jmsdefault.helloworld; + +public class Person { + String firstName; + String lastName; + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..84ac2356db --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/resources/jmsdefault/helloworld.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/resources/jmsdefault/helloworld.composite new file mode 100644 index 0000000000..a6d6e04ac8 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/resources/jmsdefault/helloworld.composite @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/resources/jmsdefault/helloworld.wsdl b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/resources/jmsdefault/helloworld.wsdl new file mode 100644 index 0000000000..935a2e73c5 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/resources/jmsdefault/helloworld.wsdl @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/resources/jndi.properties new file mode 100644 index 0000000000..4d6acc037b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.RequestQueue = RequestQueue +queue.ResponseQueue = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSDefaultTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSDefaultTestCase.java new file mode 100644 index 0000000000..78c0239f0d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsdefault/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSDefaultTestCase.java @@ -0,0 +1,68 @@ +/* + * 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.jms.format; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.binding.jms.format.jmsdefault.helloworld.HelloWorldReference; +import org.apache.tuscany.sca.binding.jms.format.jmsdefault.helloworld.HelloWorldServiceImpl; +import org.apache.tuscany.sca.binding.jms.format.jmsdefault.helloworld.Person; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class FormatJMSDefaultTestCase { + + private static Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldReference helloWorldService = node.getService(HelloWorldReference.class, "HelloWorldReferenceComponent"); + + assertEquals("Hello Fred Bloggs Hello Fred Bloggs Hello Fred Bloggs Hello Fred Bloggs foo remote service exception, see nested exception foo remote service exception, see nested exception", helloWorldService.getGreetings("Fred Bloggs")); + + Person person = new Person(); + person.setFirstName("Fred"); + person.setLastName("Bloggs"); + assertEquals("Hello Fred Bloggs Hello Fred Bloggs Hello Fred Bloggs Hello Fred Bloggs", helloWorldService.getPersonGreetings(person)); + + // this just makes sure that there are no exceptions thrown for this case + helloWorldService.nullInVoidOut(); + Assert.assertEquals(4, HelloWorldServiceImpl.nullInVoidOutCalled); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/pom.xml new file mode 100644 index 0000000000..b0d00e6082 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-format-jmsmessage + Apache Tuscany SCA iTest JMS Message Format jmsmessage + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java new file mode 100644 index 0000000000..1acbfbd5ae --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.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 org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld; + +public class CheckedException extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedException(String s) { + super(s); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..2d19d4bd82 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.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 org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String message); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..3ccd54e9bd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java @@ -0,0 +1,50 @@ +/* + * 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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Reference; + + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldServiceReference helloWorldService1; + + public String getGreetings(String name){ + byte[] bytesValue = helloWorldService1.getByteArrayGreetings(name.getBytes()); + String stringValue = new String(bytesValue); + + try { + helloWorldService1.throwChecked(name.getBytes()); + } catch (Exception e) { + // Test to see what happens if we talk to a service + // that declares a checked exception through an + // interface that doesn't + stringValue += " " + e.getCause().getMessage(); + } + + try { + helloWorldService1.throwUnChecked(name.getBytes()); + } catch (Exception e) { + stringValue += " " + e.getMessage(); + } + return stringValue; + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..b9a1ffd5ef --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg); + + public void throwChecked(byte[] msg) throws CheckedException; + public void throwUnChecked(byte[] msg); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..b92959cfd3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java @@ -0,0 +1,40 @@ +/* + * 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.jms.format.jmsbytes.helloworld; + + +public class HelloWorldServiceImpl implements HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg){ + + String name = new String(msg); + name = "Hello " + name; + + return name.getBytes(); + } + + public void throwChecked(byte[] msg) throws CheckedException { + throw new CheckedException("foo"); + } + + public void throwUnChecked(byte[] msg) { + throw new RuntimeException("bla"); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java new file mode 100644 index 0000000000..ff5cf617f2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldServiceReference { + + public byte[] getByteArrayGreetings(byte[] msg); + + public void throwChecked(byte[] msg) ; + public void throwUnChecked(byte[] msg); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..490bd5d4a3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReference.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 org.apache.tuscany.sca.binding.jms.format.jmsmessage.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String message); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..5aed6b12d7 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReferenceImpl.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.jms.format.jmsmessage.helloworld; + +import org.oasisopen.sca.annotation.Reference; + + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldServiceReferenceSide helloWorldService1; + + public String getGreetings(String name){ + helloWorldService1.getGreetings(name); + + try { + Thread.sleep(2000); + } catch (Exception ex) { + // do nothing + } + + return HelloWorldServiceImpl.getGreetings(); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..efe2f1a4dc --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldService.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 org.apache.tuscany.sca.binding.jms.format.jmsmessage.helloworld; + +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + @OneWay + public void onMessage(javax.jms.Message message); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..c1011ce6fb --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceImpl.java @@ -0,0 +1,51 @@ +/* + * 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.jms.format.jmsmessage.helloworld; + +import javax.jms.TextMessage; + +public class HelloWorldServiceImpl implements HelloWorldService { + + private static String greetings = "not set"; + + public void onMessage(javax.jms.Message message){ + + String name = null; + + try { + name = ((TextMessage)message).getText(); + } catch (Exception ex) { + name = "EXCEPTION"; + } + greetings = "Hello " + name; + } + + public static String getGreetings(){ + return greetings; + } + + // javax.jms.BytesMessage + // javax.jms.MapMessage + // javax.jms.ObjectMessage + // javax.jms.StreamMessage + // javax.jms.TextMessage + + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceReferenceSide.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceReferenceSide.java new file mode 100644 index 0000000000..d863b3a0a3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceReferenceSide.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 org.apache.tuscany.sca.binding.jms.format.jmsmessage.helloworld; + +import javax.jws.soap.SOAPBinding; + +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldServiceReferenceSide { + + @OneWay + @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE) + public void getGreetings(String message); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/README b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/README new file mode 100644 index 0000000000..0f7a730b91 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/README @@ -0,0 +1,3 @@ +This test uses an SCA composite to fake a scenario where the reference is an SCA reference but the +service is a non-SCA JMS endpoint. This gives us the opportunity to play about with the interface +configuration at the reference to see how the contents of the JMS message can be controlled. \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..84ac2356db --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/resources/jmsmessage/helloworld.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/resources/jmsmessage/helloworld.composite new file mode 100644 index 0000000000..c624a11233 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/resources/jmsmessage/helloworld.composite @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/resources/jmsmessage/helloworld.wsdl b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/resources/jmsmessage/helloworld.wsdl new file mode 100644 index 0000000000..f72ce434fa --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/resources/jmsmessage/helloworld.wsdl @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/resources/jndi.properties new file mode 100644 index 0000000000..4d6acc037b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.RequestQueue = RequestQueue +queue.ResponseQueue = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSMessageTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSMessageTestCase.java new file mode 100644 index 0000000000..f47031da10 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsmessage/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSMessageTestCase.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 org.apache.tuscany.sca.binding.jms.format; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.binding.jms.format.jmsmessage.helloworld.HelloWorldReference; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class FormatJMSMessageTestCase { + + private static Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldReference helloWorldService = node.getService(HelloWorldReference.class, "HelloWorldReferenceComponent"); + + System.out.println(helloWorldService.getGreetings("Fred Bloggs")); + assertEquals("Hello Fred Bloggs", helloWorldService.getGreetings("Fred Bloggs")); + + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/pom.xml new file mode 100644 index 0000000000..05c3e3e328 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-format-jmsobject + Apache Tuscany SCA iTest JMS Message Format jmsobject + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java new file mode 100644 index 0000000000..1acbfbd5ae --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.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 org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld; + +public class CheckedException extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedException(String s) { + super(s); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..2d19d4bd82 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.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 org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String message); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..3ccd54e9bd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java @@ -0,0 +1,50 @@ +/* + * 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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Reference; + + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldServiceReference helloWorldService1; + + public String getGreetings(String name){ + byte[] bytesValue = helloWorldService1.getByteArrayGreetings(name.getBytes()); + String stringValue = new String(bytesValue); + + try { + helloWorldService1.throwChecked(name.getBytes()); + } catch (Exception e) { + // Test to see what happens if we talk to a service + // that declares a checked exception through an + // interface that doesn't + stringValue += " " + e.getCause().getMessage(); + } + + try { + helloWorldService1.throwUnChecked(name.getBytes()); + } catch (Exception e) { + stringValue += " " + e.getMessage(); + } + return stringValue; + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..b9a1ffd5ef --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg); + + public void throwChecked(byte[] msg) throws CheckedException; + public void throwUnChecked(byte[] msg); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..b92959cfd3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java @@ -0,0 +1,40 @@ +/* + * 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.jms.format.jmsbytes.helloworld; + + +public class HelloWorldServiceImpl implements HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg){ + + String name = new String(msg); + name = "Hello " + name; + + return name.getBytes(); + } + + public void throwChecked(byte[] msg) throws CheckedException { + throw new CheckedException("foo"); + } + + public void throwUnChecked(byte[] msg) { + throw new RuntimeException("bla"); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java new file mode 100644 index 0000000000..ff5cf617f2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldServiceReference { + + public byte[] getByteArrayGreetings(byte[] msg); + + public void throwChecked(byte[] msg) ; + public void throwUnChecked(byte[] msg); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/CheckedException.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/CheckedException.java new file mode 100644 index 0000000000..a1c38f7295 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/CheckedException.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 org.apache.tuscany.sca.binding.jms.format.jmsobject.helloworld; + +public class CheckedException extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedException(String s) { + super(s); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..3b34dbae85 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReference.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 org.apache.tuscany.sca.binding.jms.format.jmsobject.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetingsWrapSingle(String firstName, String lastName); + public String getGreetingsDontWrapSingle(String firstName, String lastName); +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..443d2aa746 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.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 org.apache.tuscany.sca.binding.jms.format.jmsobject.helloworld; + +import org.oasisopen.sca.annotation.Reference; + + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldService helloWorldServiceWrapSingle; + + @Reference + protected HelloWorldService helloWorldServiceDontWrapSingle; + + public String getGreetingsWrapSingle(String firstName, String lastName){ + Person person = new Person(); + person.setFirstName(firstName); + person.setLastName(lastName); + + String returnString = ""; + + Person returnPerson = helloWorldServiceWrapSingle.getPersonGreetings(person); + returnString = returnPerson.getFirstName() + " " + returnPerson.getLastName(); + + Person returnNullPerson = helloWorldServiceWrapSingle.getNullReturnGreetings(person); + + if (returnNullPerson == null){ + returnString += " Hello2 null"; + } + + String returnGreeting = helloWorldServiceWrapSingle.getArrayGreeting(new String[]{firstName, lastName}); + returnString += " " + returnGreeting; + + returnGreeting = helloWorldServiceWrapSingle.getMultiArrayGreetings(new String[]{firstName, firstName},new String[]{lastName, lastName}); + returnString += " " + returnGreeting; + + returnGreeting = helloWorldServiceWrapSingle.getMultiGreetings(firstName, lastName); + returnString += " " + returnGreeting; + + returnGreeting = helloWorldServiceWrapSingle.getObjectGreeting(person); + returnString += " " + returnGreeting; + + returnGreeting = helloWorldServiceWrapSingle.getObjectArrayGreeting(new Object[]{person}); + returnString += " " + returnGreeting; + + return returnString; + } + + public String getGreetingsDontWrapSingle(String firstName, String lastName){ + Person person = new Person(); + person.setFirstName(firstName); + person.setLastName(lastName); + + String returnString = ""; + + Person returnPerson = helloWorldServiceDontWrapSingle.getPersonGreetings(person); + returnString = returnPerson.getFirstName() + " " + returnPerson.getLastName(); + + Person returnNullPerson = helloWorldServiceDontWrapSingle.getNullReturnGreetings(person); + + if (returnNullPerson == null){ + returnString += " Hello2 null"; + } + + String returnGreeting = helloWorldServiceDontWrapSingle.getArrayGreeting(new String[]{firstName, lastName}); + returnString += " " + returnGreeting; + + returnGreeting = helloWorldServiceDontWrapSingle.getMultiArrayGreetings(new String[]{firstName, firstName},new String[]{lastName, lastName}); + returnString += " " + returnGreeting; + + returnGreeting = helloWorldServiceDontWrapSingle.getMultiGreetings(firstName, lastName); + returnString += " " + returnGreeting; + + returnGreeting = helloWorldServiceDontWrapSingle.getObjectGreeting(person); + returnString += " " + returnGreeting; + + returnGreeting = helloWorldServiceDontWrapSingle.getObjectArrayGreeting(new Object[]{person}); + returnString += " " + returnGreeting; + + try { + helloWorldServiceDontWrapSingle.throwChecked(person); + } catch (CheckedException e) { + returnString += " " + e.getMessage(); + } + + try { + helloWorldServiceDontWrapSingle.throwUnChecked(person); + } catch (Exception e) { + returnString += " " + e.getCause().getMessage(); + } + + return returnString; + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..b179a86f52 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldService.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.jms.format.jmsobject.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public Person getPersonGreetings(Person person); + public Person getNullReturnGreetings(Person person); + public String getArrayGreeting(String[] names); + public String getMultiArrayGreetings(String[] firstName, String[] lastName); + public String getMultiGreetings(String firstName, String lastName); + public String getObjectGreeting(Object person); + public String getObjectArrayGreeting(Object[] pearson); + + public void throwChecked(Person person) throws CheckedException; + public void throwUnChecked(Person person); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..fa9e9eb1cb --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldServiceImpl.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.binding.jms.format.jmsobject.helloworld; + +public class HelloWorldServiceImpl implements HelloWorldService { + + public Person getPersonGreetings(Person person){ + + person.setFirstName("Hello1 " + person.getFirstName()); + person.setLastName("Hello1 " + person.getLastName()); + + return person; + } + + public Person getNullReturnGreetings(Person person){ + return null; + } + + public String getArrayGreeting(String[] names) { + return "Hello3 " + names[0]; + } + + public String getMultiArrayGreetings(String[] firstName, String[] lastName) { + return "Hello4 " + firstName[0] + " " + lastName[0]; + } + + public String getMultiGreetings(String firstName, String lastName) { + return "Hello5 " + firstName + " " + lastName; + } + + public String getObjectGreeting(Object person) { + return "Hello6 " + ((Person)person).getFirstName() + " " + ((Person)person).getLastName(); + } + + public String getObjectArrayGreeting(Object[] person) { + return "Hello7 " + ((Person)person[0]).getFirstName() + " " + ((Person)person[0]).getLastName(); + } + + public void throwChecked(Person person) throws CheckedException { + throw new CheckedException("foo"); + } + + public void throwUnChecked(Person person) { + throw new RuntimeException("bla"); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/Person.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/Person.java new file mode 100644 index 0000000000..29233d74a9 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/Person.java @@ -0,0 +1,47 @@ +/* + * 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.jms.format.jmsobject.helloworld; + +import java.io.Serializable; + +public class Person implements Serializable { + + private static final long serialVersionUID = -6842761353978551779L; + + String firstName; + String lastName; + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..84ac2356db --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/resources/jmsobject/helloworld.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/resources/jmsobject/helloworld.composite new file mode 100644 index 0000000000..e037aa74d9 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/resources/jmsobject/helloworld.composite @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/resources/jmsobject/helloworld.wsdl b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/resources/jmsobject/helloworld.wsdl new file mode 100644 index 0000000000..4625f46578 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/resources/jmsobject/helloworld.wsdl @@ -0,0 +1,368 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/resources/jndi.properties new file mode 100644 index 0000000000..4d6acc037b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.RequestQueue = RequestQueue +queue.ResponseQueue = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSObjectTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSObjectTestCase.java new file mode 100644 index 0000000000..c9609119c9 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmsobject/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSObjectTestCase.java @@ -0,0 +1,73 @@ +/* + * 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.jms.format; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.binding.jms.format.jmsobject.helloworld.HelloWorldReference; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class FormatJMSObjectTestCase { + + private static Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldReference helloWorldService = node.getService(HelloWorldReference.class, "HelloWorldReferenceComponent"); + + assertEquals("Hello1 Fred Hello1 Bloggs Hello2 null Hello3 Fred Hello4 Fred Bloggs Hello5 Fred Bloggs Hello6 Fred Bloggs Hello7 Fred Bloggs", + helloWorldService.getGreetingsWrapSingle("Fred", "Bloggs")); + + assertEquals("Hello1 Fred Hello1 Bloggs Hello2 null Hello3 Fred Hello4 Fred Bloggs Hello5 Fred Bloggs Hello6 Fred Bloggs Hello7 Fred Bloggs foo java.lang.RuntimeException: bla", + helloWorldService.getGreetingsDontWrapSingle("Fred", "Bloggs")); + + } + + @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"); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/pom.xml new file mode 100644 index 0000000000..d004ecbc26 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-format-jmstext + Apache Tuscany SCA iTest JMS Message Format jmstext + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java new file mode 100644 index 0000000000..1acbfbd5ae --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.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 org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld; + +public class CheckedException extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedException(String s) { + super(s); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..2d19d4bd82 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.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 org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String message); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..3ccd54e9bd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java @@ -0,0 +1,50 @@ +/* + * 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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Reference; + + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldServiceReference helloWorldService1; + + public String getGreetings(String name){ + byte[] bytesValue = helloWorldService1.getByteArrayGreetings(name.getBytes()); + String stringValue = new String(bytesValue); + + try { + helloWorldService1.throwChecked(name.getBytes()); + } catch (Exception e) { + // Test to see what happens if we talk to a service + // that declares a checked exception through an + // interface that doesn't + stringValue += " " + e.getCause().getMessage(); + } + + try { + helloWorldService1.throwUnChecked(name.getBytes()); + } catch (Exception e) { + stringValue += " " + e.getMessage(); + } + return stringValue; + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..b9a1ffd5ef --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg); + + public void throwChecked(byte[] msg) throws CheckedException; + public void throwUnChecked(byte[] msg); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..b92959cfd3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java @@ -0,0 +1,40 @@ +/* + * 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.jms.format.jmsbytes.helloworld; + + +public class HelloWorldServiceImpl implements HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg){ + + String name = new String(msg); + name = "Hello " + name; + + return name.getBytes(); + } + + public void throwChecked(byte[] msg) throws CheckedException { + throw new CheckedException("foo"); + } + + public void throwUnChecked(byte[] msg) { + throw new RuntimeException("bla"); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java new file mode 100644 index 0000000000..ff5cf617f2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldServiceReference { + + public byte[] getByteArrayGreetings(byte[] msg); + + public void throwChecked(byte[] msg) ; + public void throwUnChecked(byte[] msg); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/CheckedException.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/CheckedException.java new file mode 100644 index 0000000000..57ad23e064 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/CheckedException.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 org.apache.tuscany.sca.binding.jms.format.jmstext.helloworld; + +public class CheckedException extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedException(String s) { + super(s); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..ea8d5ffd28 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldReference.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 org.apache.tuscany.sca.binding.jms.format.jmstext.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String message); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..afcd391009 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldReferenceImpl.java @@ -0,0 +1,46 @@ +/* + * 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.jms.format.jmstext.helloworld; + +import org.oasisopen.sca.annotation.Reference; + + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldService helloWorldService1; + + public String getGreetings(String name){ + String stringValue = helloWorldService1.getStringGreetings(name); + + try { + helloWorldService1.throwChecked(name); + } catch (Exception e) { + stringValue += " " + e.getMessage(); + } + + try { + helloWorldService1.throwUnChecked(name); + } catch (Exception e) { + stringValue += " " + e.getMessage(); + } + return stringValue; + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..8af585c13c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldService.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.jms.format.jmstext.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public String getStringGreetings(String msg); + + public void throwChecked(String msg) throws CheckedException; + public void throwUnChecked(String msg); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..4f0a6fe4c5 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/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 org.apache.tuscany.sca.binding.jms.format.jmstext.helloworld; + + +public class HelloWorldServiceImpl implements HelloWorldService { + + public String getStringGreetings(String msg){ + + msg = "Hello " + msg; + return msg; + } + + public void throwChecked(String msg) throws CheckedException { + throw new CheckedException("foo"); + } + + public void throwUnChecked(String msg) { + throw new RuntimeException("bla"); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldServiceReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldServiceReference.java new file mode 100644 index 0000000000..a8dd686725 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldServiceReference.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.jms.format.jmstext.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldServiceReference { + + public String getStringGreetings(String msg); + + public void throwChecked(String msg) ; + public void throwUnChecked(String msg); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..84ac2356db --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/resources/jmstext/helloworld.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/resources/jmstext/helloworld.composite new file mode 100644 index 0000000000..d700a92f20 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/resources/jmstext/helloworld.composite @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/resources/jndi.properties new file mode 100644 index 0000000000..4d6acc037b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.RequestQueue = RequestQueue +queue.ResponseQueue = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextTestCase.java new file mode 100644 index 0000000000..b887aa18fd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstext/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextTestCase.java @@ -0,0 +1,60 @@ +/* + * 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.jms.format; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld.HelloWorldReference; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class FormatJMSTextTestCase { + + private static Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldReference helloWorldService = node.getService(HelloWorldReference.class, "HelloWorldReferenceComponent"); + + System.out.println(helloWorldService.getGreetings("Fred Bloggs")); + assertEquals("Hello Fred Bloggs " + + "foo remote service exception, see nested exception", + helloWorldService.getGreetings("Fred Bloggs")); + + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/pom.xml new file mode 100644 index 0000000000..e56246376f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-format-jmstextxml + Apache Tuscany SCA iTest JMS Message Format jmstextxml + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java new file mode 100644 index 0000000000..1acbfbd5ae --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.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 org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld; + +public class CheckedException extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedException(String s) { + super(s); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..2d19d4bd82 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.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 org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String message); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..3ccd54e9bd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java @@ -0,0 +1,50 @@ +/* + * 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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Reference; + + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldServiceReference helloWorldService1; + + public String getGreetings(String name){ + byte[] bytesValue = helloWorldService1.getByteArrayGreetings(name.getBytes()); + String stringValue = new String(bytesValue); + + try { + helloWorldService1.throwChecked(name.getBytes()); + } catch (Exception e) { + // Test to see what happens if we talk to a service + // that declares a checked exception through an + // interface that doesn't + stringValue += " " + e.getCause().getMessage(); + } + + try { + helloWorldService1.throwUnChecked(name.getBytes()); + } catch (Exception e) { + stringValue += " " + e.getMessage(); + } + return stringValue; + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..b9a1ffd5ef --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg); + + public void throwChecked(byte[] msg) throws CheckedException; + public void throwUnChecked(byte[] msg); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..b92959cfd3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java @@ -0,0 +1,40 @@ +/* + * 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.jms.format.jmsbytes.helloworld; + + +public class HelloWorldServiceImpl implements HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg){ + + String name = new String(msg); + name = "Hello " + name; + + return name.getBytes(); + } + + public void throwChecked(byte[] msg) throws CheckedException { + throw new CheckedException("foo"); + } + + public void throwUnChecked(byte[] msg) { + throw new RuntimeException("bla"); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java new file mode 100644 index 0000000000..ff5cf617f2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldServiceReference { + + public byte[] getByteArrayGreetings(byte[] msg); + + public void throwChecked(byte[] msg) ; + public void throwUnChecked(byte[] msg); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/CheckedException.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/CheckedException.java new file mode 100644 index 0000000000..5e9a7a316e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/CheckedException.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 org.apache.tuscany.sca.binding.jms.format.jmstextxml.helloworld; + +public class CheckedException extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedException(String s) { + super(s); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..768b293380 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldReference.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.jms.format.jmstextxml.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String name); + public String getPersonGreetings(Person person); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..2bac5db5ab --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldReferenceImpl.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.binding.jms.format.jmstextxml.helloworld; + +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldService helloWorldService1; + + @Reference + protected HelloWorldService helloWorldService2; + + @Reference + protected HelloWorldService helloWorldService3; + + public String getGreetings(String name){ + String stringValue = helloWorldService1.getGreetings(name) + " " + + helloWorldService2.getGreetings(name) + " " + + helloWorldService3.getGreetings(name); + + return stringValue; + } + + public String getPersonGreetings(Person person){ + String stringValue = helloWorldService1.getPersonGreetings(person) + " " + + helloWorldService2.getPersonGreetings(person) + " " + + helloWorldService3.getPersonGreetings(person); + + try { + helloWorldService1.throwChecked(person.getLastName()); + } catch (CheckedException e) { + stringValue += " " + e.getMessage(); + } + + try { + helloWorldService1.throwUnChecked(person.getLastName()); + } catch (Exception e) { + stringValue += " " + e.getMessage(); + } + + return stringValue; + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..be2af78958 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldService.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.jms.format.jmstextxml.helloworld; + +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); + public String getPersonGreetings(Person person); + + public void throwChecked(String msg) throws CheckedException; + public void throwUnChecked(String msg); +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..e85d4ca5a4 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldServiceImpl.java @@ -0,0 +1,44 @@ +/* + * 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.jms.format.jmstextxml.helloworld; + + +public class HelloWorldServiceImpl implements HelloWorldService { + + public String getGreetings(String name){ + String response = "Hello " + name; + System.out.println("getGreetings: " + response); + return response; + } + + public String getPersonGreetings(Person person){ + String response = "Hello " + person.getFirstName() + " " + person.getLastName(); + System.out.println("getPersonGreetings: " + response); + return response; + } + + public void throwChecked(String msg) throws CheckedException { + throw new CheckedException("foo"); + } + + public void throwUnChecked(String msg) { + throw new RuntimeException("bla"); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/Person.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/Person.java new file mode 100644 index 0000000000..175b482c81 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/Person.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.jms.format.jmstextxml.helloworld; + +public class Person { + String firstName; + String lastName; + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..84ac2356db --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/resources/jmstextxml/helloworld.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/resources/jmstextxml/helloworld.composite new file mode 100644 index 0000000000..72e7646704 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/resources/jmstextxml/helloworld.composite @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/resources/jmstextxml/helloworld.wsdl b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/resources/jmstextxml/helloworld.wsdl new file mode 100644 index 0000000000..53db66ea7e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/resources/jmstextxml/helloworld.wsdl @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/resources/jndi.properties new file mode 100644 index 0000000000..4d6acc037b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.RequestQueue = RequestQueue +queue.ResponseQueue = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextXMLTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextXMLTestCase.java new file mode 100644 index 0000000000..6054050a5d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxml/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextXMLTestCase.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.binding.jms.format; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.binding.jms.format.jmstextxml.helloworld.HelloWorldReference; +import org.apache.tuscany.sca.binding.jms.format.jmstextxml.helloworld.Person; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class FormatJMSTextXMLTestCase { + + private static Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldReference helloWorldService = node.getService(HelloWorldReference.class, "HelloWorldReferenceComponent"); + + assertEquals("Hello Fred Bloggs Hello Fred Bloggs Hello Fred Bloggs", helloWorldService.getGreetings("Fred Bloggs")); + + Person person = new Person(); + person.setFirstName("Fred"); + person.setLastName("Bloggs"); + assertEquals("Hello Fred Bloggs Hello Fred Bloggs Hello Fred Bloggs foo remote service exception, see nested exception", helloWorldService.getPersonGreetings(person)); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/pom.xml new file mode 100644 index 0000000000..d64cc46058 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-format-jmstextxmlinjmsobjectout + Apache Tuscany SCA iTest JMS Message Format jmstextxmlinjmsobjectout + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.java new file mode 100644 index 0000000000..1acbfbd5ae --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/CheckedException.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 org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld; + +public class CheckedException extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedException(String s) { + super(s); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..2d19d4bd82 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReference.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 org.apache.tuscany.sca.binding.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String message); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..3ccd54e9bd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldReferenceImpl.java @@ -0,0 +1,50 @@ +/* + * 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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Reference; + + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldServiceReference helloWorldService1; + + public String getGreetings(String name){ + byte[] bytesValue = helloWorldService1.getByteArrayGreetings(name.getBytes()); + String stringValue = new String(bytesValue); + + try { + helloWorldService1.throwChecked(name.getBytes()); + } catch (Exception e) { + // Test to see what happens if we talk to a service + // that declares a checked exception through an + // interface that doesn't + stringValue += " " + e.getCause().getMessage(); + } + + try { + helloWorldService1.throwUnChecked(name.getBytes()); + } catch (Exception e) { + stringValue += " " + e.getMessage(); + } + return stringValue; + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..b9a1ffd5ef --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldService.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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg); + + public void throwChecked(byte[] msg) throws CheckedException; + public void throwUnChecked(byte[] msg); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..b92959cfd3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceImpl.java @@ -0,0 +1,40 @@ +/* + * 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.jms.format.jmsbytes.helloworld; + + +public class HelloWorldServiceImpl implements HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg){ + + String name = new String(msg); + name = "Hello " + name; + + return name.getBytes(); + } + + public void throwChecked(byte[] msg) throws CheckedException { + throw new CheckedException("foo"); + } + + public void throwUnChecked(byte[] msg) { + throw new RuntimeException("bla"); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.java new file mode 100644 index 0000000000..ff5cf617f2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytes/helloworld/HelloWorldServiceReference.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.jms.format.jmsbytes.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldServiceReference { + + public byte[] getByteArrayGreetings(byte[] msg); + + public void throwChecked(byte[] msg) ; + public void throwUnChecked(byte[] msg); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/CheckedException.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/CheckedException.java new file mode 100644 index 0000000000..1684c19c50 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/CheckedException.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 org.apache.tuscany.sca.binding.jms.format.jmsbytesxml.helloworld; + +public class CheckedException extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedException(String s) { + super(s); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..cc7b7b11e4 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldReference.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 org.apache.tuscany.sca.binding.jms.format.jmsbytesxml.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String message); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..3742bd6ac6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldReferenceImpl.java @@ -0,0 +1,46 @@ +/* + * 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.jms.format.jmsbytesxml.helloworld; + +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldService helloWorldService1; + + public String getGreetings(String name){ + byte[] bytesValue = helloWorldService1.getByteArrayGreetings(name.getBytes()); + String stringValue = new String(bytesValue); + + try { + helloWorldService1.throwChecked(name.getBytes()); + } catch (CheckedException e) { + stringValue += " " + e.getMessage(); + } + + try { + helloWorldService1.throwUnChecked(name.getBytes()); + } catch (Exception e) { + stringValue += " " + e.getMessage(); + } + return stringValue; + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..eae95b4201 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldService.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 org.apache.tuscany.sca.binding.jms.format.jmsbytesxml.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg); + + public void throwChecked(byte[] msg) throws CheckedException; + public void throwUnChecked(byte[] msg); +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..a37a03d994 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsbytesxml/helloworld/HelloWorldServiceImpl.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.jms.format.jmsbytesxml.helloworld; + +public class HelloWorldServiceImpl implements HelloWorldService { + + public byte[] getByteArrayGreetings(byte[] msg){ + + String name = new String(msg); + name = "Hello " + name; + + return name.getBytes(); + } + + public void throwChecked(byte[] msg) throws CheckedException { + throw new CheckedException("foo"); + } + + public void throwUnChecked(byte[] msg) { + throw new RuntimeException("bla"); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/CheckedException.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/CheckedException.java new file mode 100644 index 0000000000..530eac3d00 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/CheckedException.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 org.apache.tuscany.sca.binding.jms.format.jmsdefault.helloworld; + +public class CheckedException extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedException(String s) { + super(s); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..1768816247 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldReference.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.binding.jms.format.jmsdefault.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String name); + + public String getPersonGreetings(Person person); + + public void nullInVoidOut(); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..d0a5faaef7 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldReferenceImpl.java @@ -0,0 +1,85 @@ +/* + * 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.jms.format.jmsdefault.helloworld; + +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldService helloWorldService1; + + @Reference + protected HelloWorldService helloWorldService2; + + @Reference + protected HelloWorldService helloWorldService3; + + @Reference + protected HelloWorldService helloWorldService4; + + public String getGreetings(String name){ + String stringValue = helloWorldService1.getGreetings(name) + " " + + helloWorldService2.getGreetings(name) + " " + + helloWorldService3.getGreetings(name) + " " + + helloWorldService4.getGreetings(name); + + try { + helloWorldService3.throwChecked(name); + } catch (CheckedException e) { + stringValue += " " + e.getMessage(); + } + + try { + helloWorldService3.throwUnChecked(name); + } catch (Exception e) { + stringValue += " " + e.getMessage(); + } + + try { + helloWorldService4.throwChecked(name); + } catch (CheckedException e) { + stringValue += " " + e.getMessage(); + } + + try { + helloWorldService4.throwUnChecked(name); + } catch (Exception e) { + stringValue += " " + e.getMessage(); + } + + return stringValue; + } + + public String getPersonGreetings(Person person){ + return helloWorldService1.getPersonGreetings(person) + " " + + helloWorldService2.getPersonGreetings(person) + " " + + helloWorldService3.getPersonGreetings(person) + " " + + helloWorldService4.getPersonGreetings(person); + } + + public void nullInVoidOut() { + helloWorldService1.nullInVoidOut(); + helloWorldService2.nullInVoidOut(); + helloWorldService3.nullInVoidOut(); + helloWorldService4.nullInVoidOut(); + + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..204863423d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldService.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.binding.jms.format.jmsdefault.helloworld; + +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); + + public String getPersonGreetings(Person person); + + public void nullInVoidOut(); + + public void throwChecked(String msg) throws CheckedException; + public void throwUnChecked(String msg); +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..b143079fe3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/HelloWorldServiceImpl.java @@ -0,0 +1,51 @@ +/* + * 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.jms.format.jmsdefault.helloworld; + + +public class HelloWorldServiceImpl implements HelloWorldService { + + public static int nullInVoidOutCalled = 0; + + public String getGreetings(String name){ + String response = "Hello " + name; + System.out.println("getGreetings: " + response); + return response; + } + + public String getPersonGreetings(Person person){ + String response = "Hello " + person.getFirstName() + " " + person.getLastName(); + System.out.println("getPersonGreetings: " + response); + return response; + } + + public void nullInVoidOut() { + System.out.println("nullInVoidOut"); + nullInVoidOutCalled++; + } + + public void throwChecked(String msg) throws CheckedException { + throw new CheckedException("foo"); + } + + public void throwUnChecked(String msg) { + throw new RuntimeException("bla"); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/Person.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/Person.java new file mode 100644 index 0000000000..b62d1b1f1d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsdefault/helloworld/Person.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.jms.format.jmsdefault.helloworld; + +public class Person { + String firstName; + String lastName; + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..490bd5d4a3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReference.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 org.apache.tuscany.sca.binding.jms.format.jmsmessage.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String message); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..5aed6b12d7 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldReferenceImpl.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.jms.format.jmsmessage.helloworld; + +import org.oasisopen.sca.annotation.Reference; + + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldServiceReferenceSide helloWorldService1; + + public String getGreetings(String name){ + helloWorldService1.getGreetings(name); + + try { + Thread.sleep(2000); + } catch (Exception ex) { + // do nothing + } + + return HelloWorldServiceImpl.getGreetings(); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..efe2f1a4dc --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldService.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 org.apache.tuscany.sca.binding.jms.format.jmsmessage.helloworld; + +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + @OneWay + public void onMessage(javax.jms.Message message); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..c1011ce6fb --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceImpl.java @@ -0,0 +1,51 @@ +/* + * 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.jms.format.jmsmessage.helloworld; + +import javax.jms.TextMessage; + +public class HelloWorldServiceImpl implements HelloWorldService { + + private static String greetings = "not set"; + + public void onMessage(javax.jms.Message message){ + + String name = null; + + try { + name = ((TextMessage)message).getText(); + } catch (Exception ex) { + name = "EXCEPTION"; + } + greetings = "Hello " + name; + } + + public static String getGreetings(){ + return greetings; + } + + // javax.jms.BytesMessage + // javax.jms.MapMessage + // javax.jms.ObjectMessage + // javax.jms.StreamMessage + // javax.jms.TextMessage + + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceReferenceSide.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceReferenceSide.java new file mode 100644 index 0000000000..d863b3a0a3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/HelloWorldServiceReferenceSide.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 org.apache.tuscany.sca.binding.jms.format.jmsmessage.helloworld; + +import javax.jws.soap.SOAPBinding; + +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldServiceReferenceSide { + + @OneWay + @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE) + public void getGreetings(String message); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/README b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/README new file mode 100644 index 0000000000..0f7a730b91 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsmessage/helloworld/README @@ -0,0 +1,3 @@ +This test uses an SCA composite to fake a scenario where the reference is an SCA reference but the +service is a non-SCA JMS endpoint. This gives us the opportunity to play about with the interface +configuration at the reference to see how the contents of the JMS message can be controlled. \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/CheckedException.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/CheckedException.java new file mode 100644 index 0000000000..a1c38f7295 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/CheckedException.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 org.apache.tuscany.sca.binding.jms.format.jmsobject.helloworld; + +public class CheckedException extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedException(String s) { + super(s); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..3b34dbae85 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReference.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 org.apache.tuscany.sca.binding.jms.format.jmsobject.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetingsWrapSingle(String firstName, String lastName); + public String getGreetingsDontWrapSingle(String firstName, String lastName); +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..443d2aa746 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldReferenceImpl.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 org.apache.tuscany.sca.binding.jms.format.jmsobject.helloworld; + +import org.oasisopen.sca.annotation.Reference; + + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldService helloWorldServiceWrapSingle; + + @Reference + protected HelloWorldService helloWorldServiceDontWrapSingle; + + public String getGreetingsWrapSingle(String firstName, String lastName){ + Person person = new Person(); + person.setFirstName(firstName); + person.setLastName(lastName); + + String returnString = ""; + + Person returnPerson = helloWorldServiceWrapSingle.getPersonGreetings(person); + returnString = returnPerson.getFirstName() + " " + returnPerson.getLastName(); + + Person returnNullPerson = helloWorldServiceWrapSingle.getNullReturnGreetings(person); + + if (returnNullPerson == null){ + returnString += " Hello2 null"; + } + + String returnGreeting = helloWorldServiceWrapSingle.getArrayGreeting(new String[]{firstName, lastName}); + returnString += " " + returnGreeting; + + returnGreeting = helloWorldServiceWrapSingle.getMultiArrayGreetings(new String[]{firstName, firstName},new String[]{lastName, lastName}); + returnString += " " + returnGreeting; + + returnGreeting = helloWorldServiceWrapSingle.getMultiGreetings(firstName, lastName); + returnString += " " + returnGreeting; + + returnGreeting = helloWorldServiceWrapSingle.getObjectGreeting(person); + returnString += " " + returnGreeting; + + returnGreeting = helloWorldServiceWrapSingle.getObjectArrayGreeting(new Object[]{person}); + returnString += " " + returnGreeting; + + return returnString; + } + + public String getGreetingsDontWrapSingle(String firstName, String lastName){ + Person person = new Person(); + person.setFirstName(firstName); + person.setLastName(lastName); + + String returnString = ""; + + Person returnPerson = helloWorldServiceDontWrapSingle.getPersonGreetings(person); + returnString = returnPerson.getFirstName() + " " + returnPerson.getLastName(); + + Person returnNullPerson = helloWorldServiceDontWrapSingle.getNullReturnGreetings(person); + + if (returnNullPerson == null){ + returnString += " Hello2 null"; + } + + String returnGreeting = helloWorldServiceDontWrapSingle.getArrayGreeting(new String[]{firstName, lastName}); + returnString += " " + returnGreeting; + + returnGreeting = helloWorldServiceDontWrapSingle.getMultiArrayGreetings(new String[]{firstName, firstName},new String[]{lastName, lastName}); + returnString += " " + returnGreeting; + + returnGreeting = helloWorldServiceDontWrapSingle.getMultiGreetings(firstName, lastName); + returnString += " " + returnGreeting; + + returnGreeting = helloWorldServiceDontWrapSingle.getObjectGreeting(person); + returnString += " " + returnGreeting; + + returnGreeting = helloWorldServiceDontWrapSingle.getObjectArrayGreeting(new Object[]{person}); + returnString += " " + returnGreeting; + + try { + helloWorldServiceDontWrapSingle.throwChecked(person); + } catch (CheckedException e) { + returnString += " " + e.getMessage(); + } + + try { + helloWorldServiceDontWrapSingle.throwUnChecked(person); + } catch (Exception e) { + returnString += " " + e.getCause().getMessage(); + } + + return returnString; + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..b179a86f52 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldService.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.jms.format.jmsobject.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public Person getPersonGreetings(Person person); + public Person getNullReturnGreetings(Person person); + public String getArrayGreeting(String[] names); + public String getMultiArrayGreetings(String[] firstName, String[] lastName); + public String getMultiGreetings(String firstName, String lastName); + public String getObjectGreeting(Object person); + public String getObjectArrayGreeting(Object[] pearson); + + public void throwChecked(Person person) throws CheckedException; + public void throwUnChecked(Person person); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..fa9e9eb1cb --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/HelloWorldServiceImpl.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.binding.jms.format.jmsobject.helloworld; + +public class HelloWorldServiceImpl implements HelloWorldService { + + public Person getPersonGreetings(Person person){ + + person.setFirstName("Hello1 " + person.getFirstName()); + person.setLastName("Hello1 " + person.getLastName()); + + return person; + } + + public Person getNullReturnGreetings(Person person){ + return null; + } + + public String getArrayGreeting(String[] names) { + return "Hello3 " + names[0]; + } + + public String getMultiArrayGreetings(String[] firstName, String[] lastName) { + return "Hello4 " + firstName[0] + " " + lastName[0]; + } + + public String getMultiGreetings(String firstName, String lastName) { + return "Hello5 " + firstName + " " + lastName; + } + + public String getObjectGreeting(Object person) { + return "Hello6 " + ((Person)person).getFirstName() + " " + ((Person)person).getLastName(); + } + + public String getObjectArrayGreeting(Object[] person) { + return "Hello7 " + ((Person)person[0]).getFirstName() + " " + ((Person)person[0]).getLastName(); + } + + public void throwChecked(Person person) throws CheckedException { + throw new CheckedException("foo"); + } + + public void throwUnChecked(Person person) { + throw new RuntimeException("bla"); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/Person.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/Person.java new file mode 100644 index 0000000000..29233d74a9 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmsobject/helloworld/Person.java @@ -0,0 +1,47 @@ +/* + * 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.jms.format.jmsobject.helloworld; + +import java.io.Serializable; + +public class Person implements Serializable { + + private static final long serialVersionUID = -6842761353978551779L; + + String firstName; + String lastName; + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/CheckedException.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/CheckedException.java new file mode 100644 index 0000000000..57ad23e064 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/CheckedException.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 org.apache.tuscany.sca.binding.jms.format.jmstext.helloworld; + +public class CheckedException extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedException(String s) { + super(s); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..ea8d5ffd28 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldReference.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 org.apache.tuscany.sca.binding.jms.format.jmstext.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String message); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..afcd391009 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldReferenceImpl.java @@ -0,0 +1,46 @@ +/* + * 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.jms.format.jmstext.helloworld; + +import org.oasisopen.sca.annotation.Reference; + + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldService helloWorldService1; + + public String getGreetings(String name){ + String stringValue = helloWorldService1.getStringGreetings(name); + + try { + helloWorldService1.throwChecked(name); + } catch (Exception e) { + stringValue += " " + e.getMessage(); + } + + try { + helloWorldService1.throwUnChecked(name); + } catch (Exception e) { + stringValue += " " + e.getMessage(); + } + return stringValue; + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..8af585c13c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldService.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.jms.format.jmstext.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public String getStringGreetings(String msg); + + public void throwChecked(String msg) throws CheckedException; + public void throwUnChecked(String msg); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..4f0a6fe4c5 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/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 org.apache.tuscany.sca.binding.jms.format.jmstext.helloworld; + + +public class HelloWorldServiceImpl implements HelloWorldService { + + public String getStringGreetings(String msg){ + + msg = "Hello " + msg; + return msg; + } + + public void throwChecked(String msg) throws CheckedException { + throw new CheckedException("foo"); + } + + public void throwUnChecked(String msg) { + throw new RuntimeException("bla"); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldServiceReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldServiceReference.java new file mode 100644 index 0000000000..a8dd686725 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstext/helloworld/HelloWorldServiceReference.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.jms.format.jmstext.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldServiceReference { + + public String getStringGreetings(String msg); + + public void throwChecked(String msg) ; + public void throwUnChecked(String msg); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/CheckedException.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/CheckedException.java new file mode 100644 index 0000000000..5e9a7a316e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/CheckedException.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 org.apache.tuscany.sca.binding.jms.format.jmstextxml.helloworld; + +public class CheckedException extends Exception { + private static final long serialVersionUID = 1L; + + public CheckedException(String s) { + super(s); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldReference.java new file mode 100644 index 0000000000..768b293380 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldReference.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.jms.format.jmstextxml.helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String name); + public String getPersonGreetings(Person person); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..2bac5db5ab --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldReferenceImpl.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.binding.jms.format.jmstextxml.helloworld; + +import org.oasisopen.sca.annotation.Reference; + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldService helloWorldService1; + + @Reference + protected HelloWorldService helloWorldService2; + + @Reference + protected HelloWorldService helloWorldService3; + + public String getGreetings(String name){ + String stringValue = helloWorldService1.getGreetings(name) + " " + + helloWorldService2.getGreetings(name) + " " + + helloWorldService3.getGreetings(name); + + return stringValue; + } + + public String getPersonGreetings(Person person){ + String stringValue = helloWorldService1.getPersonGreetings(person) + " " + + helloWorldService2.getPersonGreetings(person) + " " + + helloWorldService3.getPersonGreetings(person); + + try { + helloWorldService1.throwChecked(person.getLastName()); + } catch (CheckedException e) { + stringValue += " " + e.getMessage(); + } + + try { + helloWorldService1.throwUnChecked(person.getLastName()); + } catch (Exception e) { + stringValue += " " + e.getMessage(); + } + + return stringValue; + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..be2af78958 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldService.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.jms.format.jmstextxml.helloworld; + +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); + public String getPersonGreetings(Person person); + + public void throwChecked(String msg) throws CheckedException; + public void throwUnChecked(String msg); +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..e85d4ca5a4 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/HelloWorldServiceImpl.java @@ -0,0 +1,44 @@ +/* + * 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.jms.format.jmstextxml.helloworld; + + +public class HelloWorldServiceImpl implements HelloWorldService { + + public String getGreetings(String name){ + String response = "Hello " + name; + System.out.println("getGreetings: " + response); + return response; + } + + public String getPersonGreetings(Person person){ + String response = "Hello " + person.getFirstName() + " " + person.getLastName(); + System.out.println("getPersonGreetings: " + response); + return response; + } + + public void throwChecked(String msg) throws CheckedException { + throw new CheckedException("foo"); + } + + public void throwUnChecked(String msg) { + throw new RuntimeException("bla"); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/Person.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/Person.java new file mode 100644 index 0000000000..175b482c81 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxml/helloworld/Person.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.jms.format.jmstextxml.helloworld; + +public class Person { + String firstName; + String lastName; + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxmlinjmsobjectout/helloworld/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxmlinjmsobjectout/helloworld/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..7bb33ae270 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxmlinjmsobjectout/helloworld/HelloWorldReferenceImpl.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.binding.jms.format.jmstextxmlinjmsobjectout.helloworld; + +import org.oasisopen.sca.annotation.Reference; + + +public class HelloWorldReferenceImpl implements HelloWorldService { + + @Reference + protected HelloWorldService helloWorldService1; + + public String getGreetings(String name){ + return helloWorldService1.getGreetings(name).toString(); + } + + public String getPersonGreetings(Person person){ + return helloWorldService1.getPersonGreetings(person).toString(); + } + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxmlinjmsobjectout/helloworld/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxmlinjmsobjectout/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..9f955c278a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxmlinjmsobjectout/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 org.apache.tuscany.sca.binding.jms.format.jmstextxmlinjmsobjectout.helloworld; + +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); + + public String getPersonGreetings(Person person); +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxmlinjmsobjectout/helloworld/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxmlinjmsobjectout/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..7c1cce6087 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxmlinjmsobjectout/helloworld/HelloWorldServiceImpl.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.jms.format.jmstextxmlinjmsobjectout.helloworld; + +public class HelloWorldServiceImpl implements HelloWorldService { + + public String getGreetings(String name){ + String response = "Hello " + name; + System.out.println("getGreetings: " + response); + return response; + } + + public String getPersonGreetings(Person person){ + String response = "Hello " + person.getFirstName() + " " + person.getLastName(); + System.out.println("getPersonGreetings: " + response); + return response; + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxmlinjmsobjectout/helloworld/Person.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxmlinjmsobjectout/helloworld/Person.java new file mode 100644 index 0000000000..3d41f656f9 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/java/org/apache/tuscany/sca/binding/jms/format/jmstextxmlinjmsobjectout/helloworld/Person.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.jms.format.jmstextxmlinjmsobjectout.helloworld; + +public class Person { + String firstName; + String lastName; + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..84ac2356db --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/resources/jmstextxmlinjmsobjectout/helloworld.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/resources/jmstextxmlinjmsobjectout/helloworld.composite new file mode 100644 index 0000000000..b8bc67d5e3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/resources/jmstextxmlinjmsobjectout/helloworld.composite @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/resources/jmstextxmlinjmsobjectout/helloworld.wsdl b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/resources/jmstextxmlinjmsobjectout/helloworld.wsdl new file mode 100644 index 0000000000..935a2e73c5 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/resources/jmstextxmlinjmsobjectout/helloworld.wsdl @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/resources/jndi.properties new file mode 100644 index 0000000000..4d6acc037b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.RequestQueue = RequestQueue +queue.ResponseQueue = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextXMLInJMSObjectOutTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextXMLInJMSObjectOutTestCase.java new file mode 100644 index 0000000000..8fc3d77cb3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/format-jmstextxmlinjmsobjectout/src/test/java/org/apache/tuscany/sca/binding/jms/format/FormatJMSTextXMLInJMSObjectOutTestCase.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.binding.jms.format; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.binding.jms.format.jmstextxmlinjmsobjectout.helloworld.HelloWorldService; +import org.apache.tuscany.sca.binding.jms.format.jmstextxmlinjmsobjectout.helloworld.Person; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class FormatJMSTextXMLInJMSObjectOutTestCase { + + private static Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldService helloWorldService = node.getService(HelloWorldService.class, "HelloWorldReferenceComponent"); + + assertEquals("Hello Fred Bloggs", helloWorldService.getGreetings("Fred Bloggs")); + + Person person = new Person(); + person.setFirstName("Fred"); + person.setLastName("Bloggs"); + assertEquals("Hello Fred Bloggs", helloWorldService.getPersonGreetings(person)); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/pom.xml new file mode 100644 index 0000000000..aefc85a28c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-non-sca-client-broker + Apache Tuscany SCA iTest JMS with Non SCA Client + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectService.java new file mode 100644 index 0000000000..9083ba1d9c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectService.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.jms; + +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface OneWayObjectService { + + @OneWay + void sayHello(Object name); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectServiceImpl.java new file mode 100644 index 0000000000..3149f99a25 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectServiceImpl.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 org.apache.tuscany.sca.binding.jms; + +public class OneWayObjectServiceImpl implements OneWayObjectService { + + public static Object mutex = new Object(); + public static Object name; + + public void sayHello(Object name) { + OneWayObjectServiceImpl.name = name; + synchronized (OneWayObjectServiceImpl.mutex) { + OneWayObjectServiceImpl.mutex.notify(); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java new file mode 100644 index 0000000000..9cec2d9b3e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.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.jms; + +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface OneWayService { + + @OneWay + void sayHello(String name); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java new file mode 100644 index 0000000000..0036391696 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.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 org.apache.tuscany.sca.binding.jms; + +public class OneWayServiceImpl implements OneWayService { + + public static Object mutex = new Object(); + public static String name; + + public void sayHello(String name) { + OneWayServiceImpl.name = name; + synchronized (OneWayServiceImpl.mutex) { + OneWayServiceImpl.mutex.notify(); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..90106d2cbf --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/resources/jndi.properties new file mode 100644 index 0000000000..4d6acc037b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.RequestQueue = RequestQueue +queue.ResponseQueue = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/resources/nonSCAclient/service.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/resources/nonSCAclient/service.composite new file mode 100644 index 0000000000..967754b6e4 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/main/resources/nonSCAclient/service.composite @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/test/java/org/apache/tuscany/sca/binding/jms/NonSCAClientTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/test/java/org/apache/tuscany/sca/binding/jms/NonSCAClientTestCase.java new file mode 100644 index 0000000000..54cfdeb273 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/non-sca-client/src/test/java/org/apache/tuscany/sca/binding/jms/NonSCAClientTestCase.java @@ -0,0 +1,144 @@ +/* + * 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.jms; + +import static org.junit.Assert.assertEquals; + +import java.io.Serializable; +import java.util.HashSet; +import java.util.Set; + +import javax.jms.JMSException; +import javax.jms.MessageProducer; +import javax.jms.Session; +import javax.naming.NamingException; + +import org.apache.activemq.broker.BrokerService; +import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory; +import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryImpl; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class NonSCAClientTestCase { + + private static Node node; + + @Before + public void init() throws Exception { + startBroker(); + node = NodeFactory.newInstance().createNode().start(); + } + + @After + public void end() throws Exception { + if (node != null) { + node.stop(); + } + stopBroker(); + } + + + @Test + public void testXMLText() throws Exception { + + synchronized (OneWayServiceImpl.mutex) { + + sendTextMessage("dynamicQueues/OneWayService", "Petra"); + + // wait up to 10 seconds but it will likely be a lot less + // as the service invocation will wake this up earlier + if (OneWayServiceImpl.name == null) { + OneWayServiceImpl.mutex.wait(10000); + } + } + assertEquals("Petra", OneWayServiceImpl.name); + } + + @Test + public void testText() throws Exception { + + synchronized (OneWayServiceImpl.mutex) { + + sendTextMessage("dynamicQueues/TextDest", "Petra"); + + // wait up to 10 seconds but it will likely be a lot less + // as the service invocation will wake this up earlier + OneWayServiceImpl.mutex.wait(10000); + } + assertEquals("Petra", OneWayServiceImpl.name); + } + + @Test + public void testObject() throws Exception { + + Set arg = new HashSet(); + arg.add(new Integer(3)); + + synchronized (OneWayObjectServiceImpl.mutex) { + + sendObjectMessage("dynamicQueues/ObjectDest", arg); + + // wait up to 10 seconds but it will likely be a lot less + // as the service invocation will wake this up earlier + OneWayObjectServiceImpl.mutex.wait(10000); + } + assertEquals(arg, OneWayObjectServiceImpl.name); + } + + private static BrokerService broker; + protected static void startBroker() throws Exception { + broker = new BrokerService(); + broker.setPersistent(false); + broker.setUseJmx(false); + broker.addConnector("tcp://localhost:61623"); + broker.start(); + } + + protected static void stopBroker() throws Exception { + if (broker != null) { + broker.stop(); + } + } + + protected static void sendTextMessage(String destName, String payload) throws JMSException, NamingException { + JMSResourceFactory rf = new JMSResourceFactoryImpl(null, null, null, "tcp://localhost:61623"); + Session session = rf.getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE); + MessageProducer p = session.createProducer(rf.lookupDestination(destName)); + rf.getConnection().start(); + session.run(); + p.send(session.createTextMessage(payload)); + rf.closeConnection(); + } + + protected static void sendObjectMessage(String destName, Object payload) throws JMSException, NamingException { + JMSResourceFactory rf = new JMSResourceFactoryImpl(null, null, null, "tcp://localhost:61623"); + Session session = rf.getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE); + MessageProducer p = session.createProducer(rf.lookupDestination(destName)); + rf.getConnection().start(); + session.run(); + p.send(session.createObjectMessage((Serializable)payload)); + rf.closeConnection(); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/pom.xml new file mode 100644 index 0000000000..9b7054cebe --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-noreplyto + Apache Tuscany SCA iTest JMS No replyTo + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java new file mode 100644 index 0000000000..430c71aaef --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java @@ -0,0 +1,26 @@ +/* + * 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.jms; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloWorldService { + String sayHello(String name); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..2c6d9d0d17 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/main/java/org/apache/tuscany/sca/binding/jms/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 org.apache.tuscany.sca.binding.jms; + +public class HelloWorldServiceImpl implements HelloWorldService { + + public String sayHello(String name) { + if ("bang".equals(name)) { + throw new RuntimeException("blem wit"); + } + return "jmsHello " + name; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..58ceeded7e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/main/resources/jndi.properties new file mode 100644 index 0000000000..4d6acc037b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.RequestQueue = RequestQueue +queue.ResponseQueue = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/main/resources/service.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/main/resources/service.composite new file mode 100644 index 0000000000..86bb60c147 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/main/resources/service.composite @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/test/java/org/apache/tuscany/sca/binding/jms/NoReplyToTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/test/java/org/apache/tuscany/sca/binding/jms/NoReplyToTestCase.java new file mode 100644 index 0000000000..848e340181 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/noreplyto/src/test/java/org/apache/tuscany/sca/binding/jms/NoReplyToTestCase.java @@ -0,0 +1,100 @@ +/* + * 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.jms; + +import static org.junit.Assert.assertEquals; + +import java.util.Properties; + +import javax.jms.Connection; +import javax.jms.ConnectionFactory; +import javax.jms.Destination; +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageConsumer; +import javax.jms.MessageProducer; +import javax.jms.ObjectMessage; +import javax.jms.Session; +import javax.naming.InitialContext; +import javax.naming.NamingException; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Uses a non-Tuscany JMS client to send/receive a JMS request to a Tuscany/SCA JMS service + */ +public class NoReplyToTestCase { + + private Node node; + private Session session; + private InitialContext context; + private Connection connection; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + sendJMSRequest(); + String response = receiveJMSResponse(); + assertEquals("jmsHello Petra", response); + } + + private void sendJMSRequest() throws NamingException, JMSException { + context = new InitialContext(new Properties()); + ConnectionFactory cf = (ConnectionFactory)context.lookup("ConnectionFactory"); + connection = cf.createConnection(); + connection.start(); + + session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + Destination toDest = (Destination)context.lookup("RequestQueue"); + + ObjectMessage m = session.createObjectMessage(); + m.setObject("Petra"); + + MessageProducer producer = session.createProducer(toDest); + producer.send(m); + } + + private String receiveJMSResponse() throws NamingException, JMSException { + Destination replyDest = (Destination)context.lookup("ResponseQueue"); + MessageConsumer consumer = session.createConsumer(replyDest); + Message m = consumer.receive(5000); + if (m == null) { + throw new RuntimeException("No reply message received"); + } + return ((ObjectMessage)m).getObject().toString(); + } + + @After + public void end() throws JMSException { + if (node != null) { + node.stop(); + } + if (connection != null) { + connection.close(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/pom.xml new file mode 100644 index 0000000000..86bcce2990 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/pom.xml @@ -0,0 +1,71 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-nulls + Apache Tuscany SCA iTest JMS Nulls + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + org.apache.activemq + activemq-core + 5.2.0 + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.java new file mode 100644 index 0000000000..7fed36fa77 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.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.jms; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the OneWay service. + */ +@Service(MyService.class) +public class ClientImpl implements MyService { + + private MyService serviceA; + + @Reference + public void setServiceA(MyService service) { + this.serviceA = service; + } + + public void sayHello() { + serviceA.sayHello(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/java/org/apache/tuscany/sca/binding/jms/MyService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/java/org/apache/tuscany/sca/binding/jms/MyService.java new file mode 100644 index 0000000000..7ab6019fd5 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/java/org/apache/tuscany/sca/binding/jms/MyService.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 org.apache.tuscany.sca.binding.jms; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface MyService { + + void sayHello(); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/java/org/apache/tuscany/sca/binding/jms/ServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/java/org/apache/tuscany/sca/binding/jms/ServiceImpl.java new file mode 100644 index 0000000000..89758becff --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/java/org/apache/tuscany/sca/binding/jms/ServiceImpl.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 org.apache.tuscany.sca.binding.jms; + + +public class ServiceImpl implements MyService { + + public void sayHello() { + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..eee9c86565 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/resources/jndi.properties new file mode 100644 index 0000000000..bb431a592b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false&broker.useJmx=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory, ConnectionFactory2 + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic +topic.ServiceTopic = ServiceTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/resources/nulls.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/resources/nulls.composite new file mode 100644 index 0000000000..e190cf92c9 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/main/resources/nulls.composite @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/test/java/org/apache/tuscany/sca/binding/jms/NullsTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/test/java/org/apache/tuscany/sca/binding/jms/NullsTestCase.java new file mode 100644 index 0000000000..ac872f46a6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/nulls/src/test/java/org/apache/tuscany/sca/binding/jms/NullsTestCase.java @@ -0,0 +1,60 @@ +/* + * 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.jms; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + */ +public class NullsTestCase { + + private Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testSayHello() throws Exception { + MyService client1 = node.getService(MyService.class, "Client1"); + + client1.sayHello(); + + } + + @Test + public void testSayHelloObjectFormat() throws Exception { + MyService client1 = node.getService(MyService.class, "Client2"); + + client1.sayHello(); + + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/pom.xml new file mode 100644 index 0000000000..16b133aae3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-jms-oneway-nocf + Apache Tuscany SCA iTest JMS for a oneway service + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java new file mode 100644 index 0000000000..b572b1012a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.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.jms; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the OneWay service. + */ +@Service(OneWayService.class) +public class OneWayClientImpl implements OneWayService { + + private OneWayService serviceA; + + @Reference + public void setServiceA(OneWayService service) { + this.serviceA = service; + } + + public void sayHello(String name) { + serviceA.sayHello(name); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java new file mode 100644 index 0000000000..9cec2d9b3e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.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.jms; + +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface OneWayService { + + @OneWay + void sayHello(String name); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java new file mode 100644 index 0000000000..0036391696 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.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 org.apache.tuscany.sca.binding.jms; + +public class OneWayServiceImpl implements OneWayService { + + public static Object mutex = new Object(); + public static String name; + + public void sayHello(String name) { + OneWayServiceImpl.name = name; + synchronized (OneWayServiceImpl.mutex) { + OneWayServiceImpl.mutex.notify(); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..360b365d1b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/resources/jndi.properties new file mode 100644 index 0000000000..8934614a8a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = SomeConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.SomeQueue = RequestQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/resources/oneway/OneWayClient.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/resources/oneway/OneWayClient.composite new file mode 100644 index 0000000000..70a106bf06 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/resources/oneway/OneWayClient.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/resources/oneway/OneWayService.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/resources/oneway/OneWayService.composite new file mode 100644 index 0000000000..5412a1d6e0 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/main/resources/oneway/OneWayService.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java new file mode 100644 index 0000000000..5d1f764382 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway-nocf/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java @@ -0,0 +1,59 @@ +/* + * 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.jms; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class OneWayTestCase { + + private Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testOneWayInvoked() throws Exception { + OneWayService oneWayService = node.getService(OneWayService.class, "OneWayClient"); + oneWayService.sayHello("Petra"); + synchronized (OneWayServiceImpl.mutex) { + // wait up to 10 seconds but it will likely be a lot less + // as the service invocation will wake this up earlier + OneWayServiceImpl.mutex.wait(10000); + } + assertEquals("Petra", OneWayServiceImpl.name); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/pom.xml new file mode 100644 index 0000000000..ed8e7e93b7 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-oneway + Apache Tuscany SCA iTest JMS with Oneway + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java new file mode 100644 index 0000000000..b572b1012a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.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.jms; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the OneWay service. + */ +@Service(OneWayService.class) +public class OneWayClientImpl implements OneWayService { + + private OneWayService serviceA; + + @Reference + public void setServiceA(OneWayService service) { + this.serviceA = service; + } + + public void sayHello(String name) { + serviceA.sayHello(name); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectService.java new file mode 100644 index 0000000000..9083ba1d9c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectService.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.jms; + +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface OneWayObjectService { + + @OneWay + void sayHello(Object name); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectServiceImpl.java new file mode 100644 index 0000000000..3149f99a25 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayObjectServiceImpl.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 org.apache.tuscany.sca.binding.jms; + +public class OneWayObjectServiceImpl implements OneWayObjectService { + + public static Object mutex = new Object(); + public static Object name; + + public void sayHello(Object name) { + OneWayObjectServiceImpl.name = name; + synchronized (OneWayObjectServiceImpl.mutex) { + OneWayObjectServiceImpl.mutex.notify(); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java new file mode 100644 index 0000000000..9cec2d9b3e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.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.jms; + +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface OneWayService { + + @OneWay + void sayHello(String name); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java new file mode 100644 index 0000000000..0036391696 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.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 org.apache.tuscany.sca.binding.jms; + +public class OneWayServiceImpl implements OneWayService { + + public static Object mutex = new Object(); + public static String name; + + public void sayHello(String name) { + OneWayServiceImpl.name = name; + synchronized (OneWayServiceImpl.mutex) { + OneWayServiceImpl.mutex.notify(); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..360b365d1b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/resources/jndi.properties new file mode 100644 index 0000000000..4d6acc037b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.RequestQueue = RequestQueue +queue.ResponseQueue = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/resources/oneway/OneWayClient.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/resources/oneway/OneWayClient.composite new file mode 100644 index 0000000000..eeeb3b90d0 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/resources/oneway/OneWayClient.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/resources/oneway/OneWayService.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/resources/oneway/OneWayService.composite new file mode 100644 index 0000000000..e41e226994 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/main/resources/oneway/OneWayService.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java new file mode 100644 index 0000000000..14bbf238e1 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/oneway/src/test/java/org/apache/tuscany/sca/binding/jms/OneWayTestCase.java @@ -0,0 +1,60 @@ +/* + * 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.jms; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class OneWayTestCase { + + private Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testOneWayInvoked() throws Exception { + OneWayService oneWayService = node.getService(OneWayService.class, "OneWayClient"); + oneWayService.sayHello("Petra"); + synchronized (OneWayServiceImpl.mutex) { + // wait up to 10 seconds but it will likely be a lot less + // as the service invocation will wake this up earlier + OneWayServiceImpl.mutex.wait(10000); + } + assertEquals("Petra", OneWayServiceImpl.name); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/pom.xml new file mode 100644 index 0000000000..7564b32d33 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-policy-headers + Apache Tuscany SCA iTest JMS with Policy Headers + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.java b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.java new file mode 100644 index 0000000000..d4cd5df431 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.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 org.apache.tuscany.sca.binding.jms; + + +/** + * The client interface + */ +public interface JMSClient { + + void aClientMethod(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClient.java b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClient.java new file mode 100644 index 0000000000..464072b42d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClient.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.jms; + + +/** + * The client interface + */ +public interface MsgClient { + + void aClientMethod(); + void op2(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientImpl.java new file mode 100644 index 0000000000..4140fa0b89 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientImpl.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.binding.jms; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +@Service(MsgClient.class) +public class MsgClientImpl implements MsgClient { + + @Reference protected MsgClientService myService; + + public void aClientMethod() { + myService.aClientMethod(); + } + + public void op2() { + myService.op2(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientService.java new file mode 100644 index 0000000000..2be4f2ad3e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientService.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.jms; + +import org.oasisopen.sca.annotation.Remotable; + + +/** + * The client interface + */ +@Remotable +public interface MsgClientService { + + void aClientMethod(); + + void op2(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/MsgService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/MsgService.java new file mode 100644 index 0000000000..d5684ca56c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/MsgService.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 org.apache.tuscany.sca.binding.jms; + +import org.oasisopen.sca.annotation.AllowsPassByReference; +import org.oasisopen.sca.annotation.Remotable; + + +@Remotable +@AllowsPassByReference +public interface MsgService { + + void onMessage(javax.jms.Message msg); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/MsgServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/MsgServiceImpl.java new file mode 100644 index 0000000000..e18de0456c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/java/org/apache/tuscany/sca/binding/jms/MsgServiceImpl.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.jms; + +import javax.jms.Message; + +import org.oasisopen.sca.annotation.Service; + +@Service(MsgService.class) +public class MsgServiceImpl implements MsgService { + + public static Object lock = new Object(); + public static Message msg; + + public void onMessage(Message msg) { + MsgServiceImpl.msg = msg; + synchronized(lock) { + lock.notifyAll(); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..a930b9e9a7 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/resources/jndi.properties new file mode 100644 index 0000000000..4d6acc037b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.RequestQueue = RequestQueue +queue.ResponseQueue = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/resources/policyHeaders/definitions.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/resources/policyHeaders/definitions.xml new file mode 100644 index 0000000000..8c608adec9 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/resources/policyHeaders/definitions.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/resources/policyHeaders/policyHeaders.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/resources/policyHeaders/policyHeaders.composite new file mode 100644 index 0000000000..f2761f0b78 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/main/resources/policyHeaders/policyHeaders.composite @@ -0,0 +1,45 @@ + + + + + + + + + + myHeadP1 + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/test/java/org/apache/tuscany/sca/binding/jms/PolicyHeadersTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/test/java/org/apache/tuscany/sca/binding/jms/PolicyHeadersTestCase.java new file mode 100644 index 0000000000..ebffbc4bc4 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/policy-headers/src/test/java/org/apache/tuscany/sca/binding/jms/PolicyHeadersTestCase.java @@ -0,0 +1,94 @@ +/* + * 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.jms; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import javax.jms.DeliveryMode; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; + +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; + +/** + */ +public class PolicyHeadersTestCase { + + private Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testProps1() throws Exception { + JMSClient client = node.getService(JMSClient.class, "ClientComponent"); + + client.aClientMethod(); + + // wait for up to 5 seconds but should wake up as soon as done + synchronized(MsgServiceImpl.lock) { + if (MsgServiceImpl.msg == null) { + MsgServiceImpl.lock.wait(5000); // For debugging set higher. + } + } + assertNotNull(MsgServiceImpl.msg); + + assertEquals("myType", MsgServiceImpl.msg.getJMSType()); + assertEquals(DeliveryMode.PERSISTENT, MsgServiceImpl.msg.getJMSDeliveryMode()); + assertEquals(7, MsgServiceImpl.msg.getJMSPriority()); + assertEquals("myHeadP1", MsgServiceImpl.msg.getStringProperty("headP1")); + } + + @Test + @Ignore + public void testOp2() throws Exception { + MsgClient client = node.getService(MsgClient.class, "ClientComponent"); + + client.op2(); + + // wait for up to 5 seconds but should wake up as soon as done + synchronized(MsgServiceImpl.lock) { + if (MsgServiceImpl.msg == null) { + MsgServiceImpl.lock.wait(5000); + } + } + assertNotNull(MsgServiceImpl.msg); + + assertEquals("op2Type", MsgServiceImpl.msg.getJMSType()); + assertEquals(DeliveryMode.NON_PERSISTENT, MsgServiceImpl.msg.getJMSDeliveryMode()); + assertEquals(3, MsgServiceImpl.msg.getJMSPriority()); + assertEquals("myHeadP1", MsgServiceImpl.msg.getStringProperty("headP1")); + assertEquals("foo", MsgServiceImpl.msg.getStringProperty("op2P2")); + assertEquals("nativeOp2", MsgServiceImpl.msg.getStringProperty("scaOperationName")); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/pom.xml new file mode 100644 index 0000000000..7183a4620d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/pom.xml @@ -0,0 +1,68 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + pom + itest-jms + Apache Tuscany SCA iTest JMS + + + args + defaults + DynamicReplyQ + exceptions + exceptions1 + externalBroker + format-jmsbytes + format-jmsbytesxml + format-jmsdefault + format-jmsmessage + format-jmsobject + format-jmstext + format-jmstextxml + format-jmstextxmlinjmsobjectout + non-sca-client + noreplyto + nulls + oneway + oneway-nocf + policy-headers + properties + responsecf + rpc + selectors + topics + ttl + uri-rpc + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/properties/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/pom.xml new file mode 100644 index 0000000000..86d26a4e3e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-properties + Apache Tuscany SCA iTest JMS with Properties + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.java b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.java new file mode 100644 index 0000000000..d4cd5df431 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/JMSClient.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 org.apache.tuscany.sca.binding.jms; + + +/** + * The client interface + */ +public interface JMSClient { + + void aClientMethod(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClient.java b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClient.java new file mode 100644 index 0000000000..464072b42d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClient.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.jms; + + +/** + * The client interface + */ +public interface MsgClient { + + void aClientMethod(); + void op2(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientImpl.java new file mode 100644 index 0000000000..4140fa0b89 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientImpl.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.binding.jms; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +@Service(MsgClient.class) +public class MsgClientImpl implements MsgClient { + + @Reference protected MsgClientService myService; + + public void aClientMethod() { + myService.aClientMethod(); + } + + public void op2() { + myService.op2(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientService.java new file mode 100644 index 0000000000..2be4f2ad3e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgClientService.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.jms; + +import org.oasisopen.sca.annotation.Remotable; + + +/** + * The client interface + */ +@Remotable +public interface MsgClientService { + + void aClientMethod(); + + void op2(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgService.java new file mode 100644 index 0000000000..d5684ca56c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgService.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 org.apache.tuscany.sca.binding.jms; + +import org.oasisopen.sca.annotation.AllowsPassByReference; +import org.oasisopen.sca.annotation.Remotable; + + +@Remotable +@AllowsPassByReference +public interface MsgService { + + void onMessage(javax.jms.Message msg); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgServiceImpl.java new file mode 100644 index 0000000000..e18de0456c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/java/org/apache/tuscany/sca/binding/jms/MsgServiceImpl.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.jms; + +import javax.jms.Message; + +import org.oasisopen.sca.annotation.Service; + +@Service(MsgService.class) +public class MsgServiceImpl implements MsgService { + + public static Object lock = new Object(); + public static Message msg; + + public void onMessage(Message msg) { + MsgServiceImpl.msg = msg; + synchronized(lock) { + lock.notifyAll(); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..a930b9e9a7 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/resources/jndi.properties new file mode 100644 index 0000000000..4d6acc037b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.RequestQueue = RequestQueue +queue.ResponseQueue = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/resources/properties/properties.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/resources/properties/properties.composite new file mode 100644 index 0000000000..73f2a8eadc --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/main/resources/properties/properties.composite @@ -0,0 +1,53 @@ + + + + + + + + + + myHeadP1 + + + + foo + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/test/java/org/apache/tuscany/sca/binding/jms/PropertiesTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/test/java/org/apache/tuscany/sca/binding/jms/PropertiesTestCase.java new file mode 100644 index 0000000000..29d5a345b2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/properties/src/test/java/org/apache/tuscany/sca/binding/jms/PropertiesTestCase.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 org.apache.tuscany.sca.binding.jms; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; + +import javax.jms.DeliveryMode; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + */ +public class PropertiesTestCase { + + private static Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testProps1() throws Exception { + JMSClient client = node.getService(JMSClient.class, "ClientComponent"); + + client.aClientMethod(); + + // wait for up to 5 seconds but should wake up as soon as done + synchronized(MsgServiceImpl.lock) { + if (MsgServiceImpl.msg == null) { + MsgServiceImpl.lock.wait(5000); + } + } + assertNotNull(MsgServiceImpl.msg); + + assertEquals("myType", MsgServiceImpl.msg.getJMSType()); + assertEquals(DeliveryMode.PERSISTENT, MsgServiceImpl.msg.getJMSDeliveryMode()); + // assertEquals(3, MsgServiceImpl.msg.getJMSPriority()); // Doesn't seem to work with ActiveMQ + assertEquals("myHeadP1", MsgServiceImpl.msg.getStringProperty("headP1")); + } + + @Test + public void testOp2() throws Exception { + MsgClient client = node.getService(MsgClient.class, "ClientComponent"); + + client.op2(); + + // wait for up to 5 seconds but should wake up as soon as done + synchronized(MsgServiceImpl.lock) { + if (MsgServiceImpl.msg == null) { + MsgServiceImpl.lock.wait(6000); + } + } + assertNotNull(MsgServiceImpl.msg); + + assertEquals("op2Type", MsgServiceImpl.msg.getJMSType()); + // assertEquals(DeliveryMode.NON_PERSISTENT, MsgServiceImpl.msg.getJMSDeliveryMode()); // Doesn't seem to work with ActiveMQ + // assertEquals(3, MsgServiceImpl.msg.getJMSPriority()); // Doesn't seem to work with ActiveMQ + assertEquals("myHeadP1", MsgServiceImpl.msg.getStringProperty("headP1")); + assertEquals("foo", MsgServiceImpl.msg.getStringProperty("op2P2")); + //operation properties are a service side thing + //assertEquals("nativeOp2", MsgServiceImpl.msg.getStringProperty("scaOperationName")); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/pom.xml new file mode 100644 index 0000000000..f45de031a0 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-responsecf + Apache Tuscany SCA iTest JMS Response ConnectionFactory + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java new file mode 100644 index 0000000000..9aef6ba1a3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.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.jms; + +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 { + + private HelloWorldService serviceA; + + @Reference + public void setServiceA(HelloWorldService service) { + this.serviceA = service; + } + + public String sayHello(String name) { + return serviceA.sayHello(name); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java new file mode 100644 index 0000000000..430c71aaef --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java @@ -0,0 +1,26 @@ +/* + * 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.jms; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloWorldService { + String sayHello(String name); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..2c6d9d0d17 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/java/org/apache/tuscany/sca/binding/jms/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 org.apache.tuscany.sca.binding.jms; + +public class HelloWorldServiceImpl implements HelloWorldService { + + public String sayHello(String name) { + if ("bang".equals(name)) { + throw new RuntimeException("blem wit"); + } + return "jmsHello " + name; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..c062ef9ec0 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/resources/cf/client.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/resources/cf/client.composite new file mode 100644 index 0000000000..3a03f9b675 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/resources/cf/client.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/resources/cf/service.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/resources/cf/service.composite new file mode 100644 index 0000000000..d7ba8f2838 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/resources/cf/service.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/resources/jndi.properties new file mode 100644 index 0000000000..a41e42950e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory, ResponseCF + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.DestQueueA = RequestQueue +queue.RespQueueA = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/test/java/org/apache/tuscany/sca/binding/jms/ResponseCFTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/test/java/org/apache/tuscany/sca/binding/jms/ResponseCFTestCase.java new file mode 100644 index 0000000000..03b834ce7d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/responsecf/src/test/java/org/apache/tuscany/sca/binding/jms/ResponseCFTestCase.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.binding.jms; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * This shows how to test the JMS binding using a response ConnectionFactory + */ +public class ResponseCFTestCase { + + private Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldService helloWorldService = node.getService(HelloWorldService.class, "HelloWorldClient"); + assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra")); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/pom.xml new file mode 100644 index 0000000000..ccbf1b9a32 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-rpc + Apache Tuscany SCA iTest JMS with RPC + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java new file mode 100644 index 0000000000..9aef6ba1a3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.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.jms; + +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 { + + private HelloWorldService serviceA; + + @Reference + public void setServiceA(HelloWorldService service) { + this.serviceA = service; + } + + public String sayHello(String name) { + return serviceA.sayHello(name); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java new file mode 100644 index 0000000000..430c71aaef --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java @@ -0,0 +1,26 @@ +/* + * 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.jms; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloWorldService { + String sayHello(String name); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..2c6d9d0d17 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/java/org/apache/tuscany/sca/binding/jms/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 org.apache.tuscany.sca.binding.jms; + +public class HelloWorldServiceImpl implements HelloWorldService { + + public String sayHello(String name) { + if ("bang".equals(name)) { + throw new RuntimeException("blem wit"); + } + return "jmsHello " + name; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..c062ef9ec0 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/resources/jndi.properties new file mode 100644 index 0000000000..4d6acc037b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.RequestQueue = RequestQueue +queue.ResponseQueue = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/resources/simple/client.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/resources/simple/client.composite new file mode 100644 index 0000000000..bed860e2cd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/resources/simple/client.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/resources/simple/service.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/resources/simple/service.composite new file mode 100644 index 0000000000..01553a968c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/main/resources/simple/service.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.java new file mode 100644 index 0000000000..3c0eb0791b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/rpc/src/test/java/org/apache/tuscany/sca/binding/jms/RPCTestCase.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.binding.jms; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class RPCTestCase { + + private Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldService helloWorldService = node.getService(HelloWorldService.class, "HelloWorldClient"); + assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra")); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/pom.xml new file mode 100644 index 0000000000..6ea78d8107 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/pom.xml @@ -0,0 +1,70 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-selectors + Apache Tuscany SCA iTest JMS Tests For Selectors + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.java new file mode 100644 index 0000000000..b589d5e8bc --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.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.jms; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the OneWay service. + */ +@Service(SelectorService.class) +public class ClientImpl implements SelectorService { + + private SelectorService serviceA; + + @Reference + public void setServiceA(SelectorService service) { + this.serviceA = service; + } + + public void sayHello(String name) { + serviceA.sayHello(name); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorService.java new file mode 100644 index 0000000000..1aff0d454e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorService.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.jms; + +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface SelectorService { + + @OneWay + void sayHello(String name); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl1.java b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl1.java new file mode 100644 index 0000000000..fb53c877e6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl1.java @@ -0,0 +1,40 @@ +/* + * 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.jms; + +import java.util.ArrayList; +import java.util.List; + +public class SelectorServiceImpl1 implements SelectorService { + + public static Object lock = new Object(); + public static List names = new ArrayList(); + + public void sayHello(String name) { + System.out.println("SelectorServiceImpl1 " + name); + SelectorServiceImpl1.names.add(name); + if (names.size() == 2) { + synchronized (SelectorServiceImpl1.lock) { + SelectorServiceImpl1.lock.notify(); + } + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl2.java b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl2.java new file mode 100644 index 0000000000..1bbaf5d6f4 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl2.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.binding.jms; + +public class SelectorServiceImpl2 implements SelectorService { + + public static Object lock = new Object(); + public static String name; + + public void sayHello(String name) { + if (SelectorServiceImpl2.name != null) { + throw new IllegalStateException("name already set"); + } + System.out.println("SelectorServiceImpl2 " + name); + SelectorServiceImpl2.name = name; + synchronized (SelectorServiceImpl2.lock) { + SelectorServiceImpl2.lock.notify(); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl3.java b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl3.java new file mode 100644 index 0000000000..4bdc4edcb5 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/SelectorServiceImpl3.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.binding.jms; + +public class SelectorServiceImpl3 implements SelectorService { + + public static Object lock = new Object(); + public static String name; + + public void sayHello(String name) { + if (SelectorServiceImpl3.name != null) { + throw new IllegalStateException("name already set"); + } + System.out.println("SelectorServiceImpl3 " + name); + SelectorServiceImpl3.name = name; + synchronized (SelectorServiceImpl3.lock) { + SelectorServiceImpl3.lock.notify(); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/HelloWorldReference.java new file mode 100644 index 0000000000..0592194b21 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/HelloWorldReference.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 org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String name); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..2d4ff0192b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/HelloWorldReferenceImpl.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.jms.operationselector.jmsdefault; + +import org.oasisopen.sca.annotation.Reference; + + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldService helloWorldService1; + + @Reference + protected HelloWorldService helloWorldService2; + + public String getGreetings(String name){ + return helloWorldService1.getGreetingsOne(name) + " " + + helloWorldService1.getGreetingsTwo(name) + " " + + helloWorldService2.getGreetingsOne(name) + " " + + helloWorldService1.getGreetingsThree(name); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/HelloWorldService.java new file mode 100644 index 0000000000..b632b3f60f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/HelloWorldService.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.binding.jms.operationselector.jmsdefault; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public String getGreetingsOne(String name); + + public String getGreetingsTwo(String name); + + public String getGreetingsThree(String name); + + public String getGreetingsFour(String name); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..b2df9137c8 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/HelloWorldServiceImpl.java @@ -0,0 +1,47 @@ +/* + * 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.jms.operationselector.jmsdefault; + +public class HelloWorldServiceImpl implements HelloWorldService { + + public String getGreetingsOne(String name){ + String response = "Hello One " + name; + System.out.println("getGreetingsOne: " + response); + return response; + } + + public String getGreetingsTwo(String name){ + String response = "Hello Two " + name; + System.out.println("getGreetingsTwo: " + response); + return response; + } + + public String getGreetingsThree(String name){ + String response = "Hello Three " + name; + System.out.println("getGreetingsThree: " + response); + return response; + } + + public String getGreetingsFour(String name){ + String response = "Hello Four " + name; + System.out.println("getGreetingsFour: " + response); + return response; + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/HelloWorldReference.java b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/HelloWorldReference.java new file mode 100644 index 0000000000..0b24678543 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/HelloWorldReference.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 org.apache.tuscany.sca.binding.jms.operationselector.jmsuserprop; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldReference { + + public String getGreetings(String name); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/HelloWorldReferenceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/HelloWorldReferenceImpl.java new file mode 100644 index 0000000000..0ce66005fc --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/HelloWorldReferenceImpl.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.binding.jms.operationselector.jmsuserprop; + +import org.oasisopen.sca.annotation.Reference; + + +public class HelloWorldReferenceImpl implements HelloWorldReference { + + @Reference + protected HelloWorldService helloWorldService1; + + + public String getGreetings(String name){ + return helloWorldService1.getGreetingsOne(name) + " " + + helloWorldService1.getGreetingsTwo(name) + " " + + helloWorldService1.getGreetingsThree(name); + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/HelloWorldService.java new file mode 100644 index 0000000000..7e42113da4 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/HelloWorldService.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.binding.jms.operationselector.jmsuserprop; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public String getGreetingsOne(String name); + + public String getGreetingsTwo(String name); + + public String getGreetingsThree(String name); + + public String getGreetingsFour(String name); + +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..724de6ff7c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/HelloWorldServiceImpl.java @@ -0,0 +1,47 @@ +/* + * 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.jms.operationselector.jmsuserprop; + +public class HelloWorldServiceImpl implements HelloWorldService { + + public String getGreetingsOne(String name){ + String response = "Hello One " + name; + System.out.println("getGreetingsOne: " + response); + return response; + } + + public String getGreetingsTwo(String name){ + String response = "Hello Two " + name; + System.out.println("getGreetingsTwo: " + response); + return response; + } + + public String getGreetingsThree(String name){ + String response = "Hello Three " + name; + System.out.println("getGreetingsThree: " + response); + return response; + } + + public String getGreetingsFour(String name){ + String response = "Hello Four " + name; + System.out.println("getGreetingsFour: " + response); + return response; + } +} + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..59cf4aee9d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/resources/jmsdefault/helloworld.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/resources/jmsdefault/helloworld.composite new file mode 100644 index 0000000000..ab8e29ccdd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/resources/jmsdefault/helloworld.composite @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + getGreetingsThree + + + + + + + + + + + + + + getGreetingsThree + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/resources/jmsuserprop/helloworld.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/resources/jmsuserprop/helloworld.composite new file mode 100644 index 0000000000..af36b8af9b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/resources/jmsuserprop/helloworld.composite @@ -0,0 +1,65 @@ + + + + + + + + + + + + getGreetingsOne + + + + + getGreetingsThree + + + + + getGreetingsTwo + + + + + + + + + + + + + + getGreetingsThree + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/resources/jndi.properties new file mode 100644 index 0000000000..bb431a592b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false&broker.useJmx=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory, ConnectionFactory2 + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic +topic.ServiceTopic = ServiceTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/resources/selectors/selectors.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/resources/selectors/selectors.composite new file mode 100644 index 0000000000..bf10f20d38 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/main/resources/selectors/selectors.composite @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/test/java/org/apache/tuscany/sca/binding/jms/OperationselectorJMSDefaultTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/test/java/org/apache/tuscany/sca/binding/jms/OperationselectorJMSDefaultTestCase.java new file mode 100644 index 0000000000..bee0c549bd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/test/java/org/apache/tuscany/sca/binding/jms/OperationselectorJMSDefaultTestCase.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.binding.jms; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.HelloWorldReference; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class OperationselectorJMSDefaultTestCase { + + private Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldReference helloWorldReference = node.getService(HelloWorldReference.class, "HelloWorldReferenceComponent"); + + assertEquals("Hello One Fred Bloggs Hello Two Fred Bloggs Hello Three Fred Bloggs Hello Four Fred Bloggs", helloWorldReference.getGreetings("Fred Bloggs")); + + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/test/java/org/apache/tuscany/sca/binding/jms/OperationselectorJMSUserPropTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/test/java/org/apache/tuscany/sca/binding/jms/OperationselectorJMSUserPropTestCase.java new file mode 100644 index 0000000000..33e047ae18 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/test/java/org/apache/tuscany/sca/binding/jms/OperationselectorJMSUserPropTestCase.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.binding.jms; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.HelloWorldReference; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class OperationselectorJMSUserPropTestCase { + + private Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldReference helloWorldReference = node.getService(HelloWorldReference.class, "HelloWorldReferenceComponent1"); + + assertEquals("Hello One Fred Bloggs Hello Four Fred Bloggs Hello Two Fred Bloggs", helloWorldReference.getGreetings("Fred Bloggs")); + + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/test/java/org/apache/tuscany/sca/binding/jms/SelectorsTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/test/java/org/apache/tuscany/sca/binding/jms/SelectorsTestCase.java new file mode 100644 index 0000000000..e7254005be --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/selectors/src/test/java/org/apache/tuscany/sca/binding/jms/SelectorsTestCase.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.jms; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + */ +public class SelectorsTestCase { + + private Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testSayHello() throws Exception { + SelectorService client1 = node.getService(SelectorService.class, "Client1"); + SelectorService client2 = node.getService(SelectorService.class, "Client2"); + + client1.sayHello("petra"); + client2.sayHello("beate"); + + // wait for up to 5 seconds but should wake up as soon as done + synchronized(SelectorServiceImpl2.lock) { + if (SelectorServiceImpl2.name == null) { + SelectorServiceImpl2.lock.wait(5000); + } + } + synchronized(SelectorServiceImpl3.lock) { + if (SelectorServiceImpl3.name == null) { + SelectorServiceImpl3.lock.wait(5000); + } + } + synchronized(SelectorServiceImpl1.lock) { + if (SelectorServiceImpl1.names.size() != 2) { + SelectorServiceImpl1.lock.wait(5000); + } + } + + assertEquals("petra", SelectorServiceImpl2.name); + assertEquals("beate", SelectorServiceImpl3.name); + assertEquals(2, SelectorServiceImpl1.names.size()); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/topics/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/topics/pom.xml new file mode 100644 index 0000000000..9aed46d86e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/topics/pom.xml @@ -0,0 +1,71 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-topics + Apache Tuscany SCA JMS Tests for topics + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + test + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.java new file mode 100644 index 0000000000..b572b1012a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayClientImpl.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.jms; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the OneWay service. + */ +@Service(OneWayService.class) +public class OneWayClientImpl implements OneWayService { + + private OneWayService serviceA; + + @Reference + public void setServiceA(OneWayService service) { + this.serviceA = service; + } + + public void sayHello(String name) { + serviceA.sayHello(name); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.java new file mode 100644 index 0000000000..9cec2d9b3e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayService.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.jms; + +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface OneWayService { + + @OneWay + void sayHello(String name); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.java new file mode 100644 index 0000000000..0036391696 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/java/org/apache/tuscany/sca/binding/jms/OneWayServiceImpl.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 org.apache.tuscany.sca.binding.jms; + +public class OneWayServiceImpl implements OneWayService { + + public static Object mutex = new Object(); + public static String name; + + public void sayHello(String name) { + OneWayServiceImpl.name = name; + synchronized (OneWayServiceImpl.mutex) { + OneWayServiceImpl.mutex.notify(); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..2690297524 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/resources/jndi.properties new file mode 100644 index 0000000000..9888d5843b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false&broker.useJmx=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic +topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/resources/topics/TopicsClient.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/resources/topics/TopicsClient.composite new file mode 100644 index 0000000000..b951484044 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/resources/topics/TopicsClient.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/resources/topics/TopicsService.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/resources/topics/TopicsService.composite new file mode 100644 index 0000000000..80c653cc29 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/main/resources/topics/TopicsService.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/test/java/org/apache/tuscany/sca/binding/jms/TopicsTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/test/java/org/apache/tuscany/sca/binding/jms/TopicsTestCase.java new file mode 100644 index 0000000000..35fe96b81a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/topics/src/test/java/org/apache/tuscany/sca/binding/jms/TopicsTestCase.java @@ -0,0 +1,59 @@ +/* + * 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.jms; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class TopicsTestCase { + + private Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testOneWayInvoked() throws Exception { + OneWayService oneWayService = node.getService(OneWayService.class, "OneWayClient"); + oneWayService.sayHello("Petra"); + synchronized (OneWayServiceImpl.mutex) { + // wait up to 10 seconds but it will likely be a lot less + // as the service invocation will wake this up earlier + OneWayServiceImpl.mutex.wait(10000); + } + assertEquals("Petra", OneWayServiceImpl.name); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/pom.xml new file mode 100644 index 0000000000..49864fb06c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/pom.xml @@ -0,0 +1,71 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-ttl + Apache Tuscany SCA iTest JMS Time To Live + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + org.apache.activemq + activemq-core + 5.2.0 + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/java/itest/MockInitialContextFactory.java b/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/java/itest/MockInitialContextFactory.java new file mode 100644 index 0000000000..336fecf67b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/java/itest/MockInitialContextFactory.java @@ -0,0 +1,904 @@ +/* + * 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.Serializable; +import java.util.Enumeration; +import java.util.Hashtable; + +import javax.jms.BytesMessage; +import javax.jms.Connection; +import javax.jms.ConnectionConsumer; +import javax.jms.ConnectionFactory; +import javax.jms.ConnectionMetaData; +import javax.jms.Destination; +import javax.jms.ExceptionListener; +import javax.jms.JMSException; +import javax.jms.MapMessage; +import javax.jms.Message; +import javax.jms.MessageConsumer; +import javax.jms.MessageListener; +import javax.jms.MessageProducer; +import javax.jms.ObjectMessage; +import javax.jms.Queue; +import javax.jms.QueueBrowser; +import javax.jms.ServerSessionPool; +import javax.jms.Session; +import javax.jms.StreamMessage; +import javax.jms.TemporaryQueue; +import javax.jms.TemporaryTopic; +import javax.jms.TextMessage; +import javax.jms.Topic; +import javax.jms.TopicSubscriber; +import javax.naming.Binding; +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NameClassPair; +import javax.naming.NameParser; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; + +/** + * Some classes that mock up various JMS interfaces with the end result + * of having the Time-To-Live value set on the static timeToLive + * + * This class is referenced from the AMQ jndi.properties file + */ +public class MockInitialContextFactory extends org.apache.activemq.jndi.ActiveMQInitialContextFactory{ + + public static Object lock = new Object(); + public static Long timeToLive; + + public Context getInitialContext(Hashtable environment) throws NamingException { + return new Context() { + + public Object addToEnvironment(String propName, Object propVal) throws NamingException { + // TODO Auto-generated method stub + return null; + } + + public void bind(Name name, Object obj) throws NamingException { + // TODO Auto-generated method stub + + } + + public void bind(String name, Object obj) throws NamingException { + // TODO Auto-generated method stub + + } + + public void close() throws NamingException { + // TODO Auto-generated method stub + + } + + public Name composeName(Name name, Name prefix) throws NamingException { + // TODO Auto-generated method stub + return null; + } + + public String composeName(String name, String prefix) throws NamingException { + // TODO Auto-generated method stub + return null; + } + + public Context createSubcontext(Name name) throws NamingException { + // TODO Auto-generated method stub + return null; + } + + public Context createSubcontext(String name) throws NamingException { + // TODO Auto-generated method stub + return null; + } + + public void destroySubcontext(Name name) throws NamingException { + // TODO Auto-generated method stub + + } + + public void destroySubcontext(String name) throws NamingException { + // TODO Auto-generated method stub + + } + + public Hashtable getEnvironment() throws NamingException { + // TODO Auto-generated method stub + return null; + } + + public String getNameInNamespace() throws NamingException { + // TODO Auto-generated method stub + return null; + } + + public NameParser getNameParser(Name name) throws NamingException { + // TODO Auto-generated method stub + return null; + } + + public NameParser getNameParser(String name) throws NamingException { + // TODO Auto-generated method stub + return null; + } + + public NamingEnumeration list(Name name) throws NamingException { + // TODO Auto-generated method stub + return null; + } + + public NamingEnumeration list(String name) throws NamingException { + // TODO Auto-generated method stub + return null; + } + + public NamingEnumeration listBindings(Name name) throws NamingException { + // TODO Auto-generated method stub + return null; + } + + public NamingEnumeration listBindings(String name) throws NamingException { + // TODO Auto-generated method stub + return null; + } + + public Object lookup(Name name) throws NamingException { + // TODO Auto-generated method stub + return null; + } + + public Object lookup(String name) throws NamingException { + if (name.endsWith("ConnectionFactory")) { + return new ConnectionFactory() { + public Connection createConnection() throws JMSException { + return new Connection(){ + + public void close() throws JMSException { + // TODO Auto-generated method stub + + } + + public ConnectionConsumer createConnectionConsumer(Destination arg0, + String arg1, + ServerSessionPool arg2, + int arg3) throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public ConnectionConsumer createDurableConnectionConsumer(Topic arg0, + String arg1, + String arg2, + ServerSessionPool arg3, + int arg4) throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public Session createSession(boolean arg0, int arg1) throws JMSException { + // TODO Auto-generated method stub + return new Session() { + + public void close() throws JMSException { + // TODO Auto-generated method stub + + } + + public void commit() throws JMSException { + // TODO Auto-generated method stub + + } + + public QueueBrowser createBrowser(Queue arg0) throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public QueueBrowser createBrowser(Queue arg0, String arg1) throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public BytesMessage createBytesMessage() throws JMSException { + // TODO Auto-generated method stub + return new BytesMessage() { + + public long getBodyLength() throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public boolean readBoolean() throws JMSException { + // TODO Auto-generated method stub + return false; + } + + public byte readByte() throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public int readBytes(byte[] arg0) throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public int readBytes(byte[] arg0, int arg1) throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public char readChar() throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public double readDouble() throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public float readFloat() throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public int readInt() throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public long readLong() throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public short readShort() throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public String readUTF() throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public int readUnsignedByte() throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public int readUnsignedShort() throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public void reset() throws JMSException { + // TODO Auto-generated method stub + + } + + public void writeBoolean(boolean arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void writeByte(byte arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void writeBytes(byte[] arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void writeBytes(byte[] arg0, int arg1, int arg2) + throws JMSException { + // TODO Auto-generated method stub + + } + + public void writeChar(char arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void writeDouble(double arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void writeFloat(float arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void writeInt(int arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void writeLong(long arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void writeObject(Object arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void writeShort(short arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void writeUTF(String arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void acknowledge() throws JMSException { + // TODO Auto-generated method stub + + } + + public void clearBody() throws JMSException { + // TODO Auto-generated method stub + + } + + public void clearProperties() throws JMSException { + // TODO Auto-generated method stub + + } + + public boolean getBooleanProperty(String arg0) throws JMSException { + // TODO Auto-generated method stub + return false; + } + + public byte getByteProperty(String arg0) throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public double getDoubleProperty(String arg0) throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public float getFloatProperty(String arg0) throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public int getIntProperty(String arg0) throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public String getJMSCorrelationID() throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public byte[] getJMSCorrelationIDAsBytes() throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public int getJMSDeliveryMode() throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public Destination getJMSDestination() throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public long getJMSExpiration() throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public String getJMSMessageID() throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public int getJMSPriority() throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public boolean getJMSRedelivered() throws JMSException { + // TODO Auto-generated method stub + return false; + } + + public Destination getJMSReplyTo() throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public long getJMSTimestamp() throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public String getJMSType() throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public long getLongProperty(String arg0) throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public Object getObjectProperty(String arg0) throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public Enumeration getPropertyNames() throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public short getShortProperty(String arg0) throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public String getStringProperty(String arg0) throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public boolean propertyExists(String arg0) throws JMSException { + // TODO Auto-generated method stub + return false; + } + + public void setBooleanProperty(String arg0, boolean arg1) + throws JMSException { + // TODO Auto-generated method stub + + } + + public void setByteProperty(String arg0, byte arg1) throws JMSException { + // TODO Auto-generated method stub + + } + + public void setDoubleProperty(String arg0, double arg1) + throws JMSException { + // TODO Auto-generated method stub + + } + + public void setFloatProperty(String arg0, float arg1) + throws JMSException { + // TODO Auto-generated method stub + + } + + public void setIntProperty(String arg0, int arg1) throws JMSException { + // TODO Auto-generated method stub + + } + + public void setJMSCorrelationID(String arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void setJMSCorrelationIDAsBytes(byte[] arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void setJMSDeliveryMode(int arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void setJMSDestination(Destination arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void setJMSExpiration(long arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void setJMSMessageID(String arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void setJMSPriority(int arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void setJMSRedelivered(boolean arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void setJMSReplyTo(Destination arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void setJMSTimestamp(long arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void setJMSType(String arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void setLongProperty(String arg0, long arg1) throws JMSException { + // TODO Auto-generated method stub + + } + + public void setObjectProperty(String arg0, Object arg1) + throws JMSException { + // TODO Auto-generated method stub + + } + + public void setShortProperty(String arg0, short arg1) + throws JMSException { + // TODO Auto-generated method stub + + } + + public void setStringProperty(String arg0, String arg1) + throws JMSException { + // TODO Auto-generated method stub + + }}; + } + + public MessageConsumer createConsumer(Destination arg0) throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public MessageConsumer createConsumer(Destination arg0, String arg1) + throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public MessageConsumer createConsumer(Destination arg0, + String arg1, + boolean arg2) throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public TopicSubscriber createDurableSubscriber(Topic arg0, String arg1) + throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public TopicSubscriber createDurableSubscriber(Topic arg0, + String arg1, + String arg2, + boolean arg3) + throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public MapMessage createMapMessage() throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public Message createMessage() throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public ObjectMessage createObjectMessage() throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public ObjectMessage createObjectMessage(Serializable arg0) throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public MessageProducer createProducer(Destination arg0) throws JMSException { + return new MessageProducer() { + + public void close() throws JMSException { + // TODO Auto-generated method stub + + } + + public int getDeliveryMode() throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public Destination getDestination() throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public boolean getDisableMessageID() throws JMSException { + // TODO Auto-generated method stub + return false; + } + + public boolean getDisableMessageTimestamp() throws JMSException { + // TODO Auto-generated method stub + return false; + } + + public int getPriority() throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public long getTimeToLive() throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public void send(Message arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void send(Destination arg0, Message arg1) throws JMSException { + // TODO Auto-generated method stub + + } + + public void send(Message arg0, int arg1, int arg2, long arg3) + throws JMSException { + // TODO Auto-generated method stub + + } + + public void send(Destination arg0, + Message arg1, + int arg2, + int arg3, + long arg4) throws JMSException { + // TODO Auto-generated method stub + + } + + public void setDeliveryMode(int arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void setDisableMessageID(boolean arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void setDisableMessageTimestamp(boolean arg0) + throws JMSException { + // TODO Auto-generated method stub + + } + + public void setPriority(int arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void setTimeToLive(long arg0) throws JMSException { + MockInitialContextFactory.timeToLive = Long.valueOf(arg0); + synchronized(MockInitialContextFactory.lock) { + MockInitialContextFactory.lock.notifyAll(); + } + }}; + } + + public Queue createQueue(String arg0) throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public StreamMessage createStreamMessage() throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public TemporaryQueue createTemporaryQueue() throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public TemporaryTopic createTemporaryTopic() throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public TextMessage createTextMessage() throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public TextMessage createTextMessage(String arg0) throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public Topic createTopic(String arg0) throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public int getAcknowledgeMode() throws JMSException { + // TODO Auto-generated method stub + return 0; + } + + public MessageListener getMessageListener() throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public boolean getTransacted() throws JMSException { + // TODO Auto-generated method stub + return false; + } + + public void recover() throws JMSException { + // TODO Auto-generated method stub + + } + + public void rollback() throws JMSException { + // TODO Auto-generated method stub + + } + + public void run() { + // TODO Auto-generated method stub + + } + + public void setMessageListener(MessageListener arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void unsubscribe(String arg0) throws JMSException { + // TODO Auto-generated method stub + + }}; + } + + public String getClientID() throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public ExceptionListener getExceptionListener() throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public ConnectionMetaData getMetaData() throws JMSException { + // TODO Auto-generated method stub + return null; + } + + public void setClientID(String arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void setExceptionListener(ExceptionListener arg0) throws JMSException { + // TODO Auto-generated method stub + + } + + public void start() throws JMSException { + // TODO Auto-generated method stub + + } + + public void stop() throws JMSException { + // TODO Auto-generated method stub + + }}; + } + public Connection createConnection(String arg0, String arg1) throws JMSException { + return null; + }}; + } else { + return new Queue(){ + public String getQueueName() throws JMSException { + return null; + }}; + } + } + + public Object lookupLink(Name name) throws NamingException { + // TODO Auto-generated method stub + return null; + } + + public Object lookupLink(String name) throws NamingException { + // TODO Auto-generated method stub + return null; + } + + public void rebind(Name name, Object obj) throws NamingException { + // TODO Auto-generated method stub + + } + + public void rebind(String name, Object obj) throws NamingException { + // TODO Auto-generated method stub + + } + + public Object removeFromEnvironment(String propName) throws NamingException { + // TODO Auto-generated method stub + return null; + } + + public void rename(Name oldName, Name newName) throws NamingException { + // TODO Auto-generated method stub + + } + + public void rename(String oldName, String newName) throws NamingException { + // TODO Auto-generated method stub + + } + + public void unbind(Name name) throws NamingException { + // TODO Auto-generated method stub + + } + + public void unbind(String name) throws NamingException { + // TODO Auto-generated method stub + + }}; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/java/org/apache/tuscany/sca/binding/jms/ClientIface.java b/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/java/org/apache/tuscany/sca/binding/jms/ClientIface.java new file mode 100644 index 0000000000..dc6577b7e1 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/java/org/apache/tuscany/sca/binding/jms/ClientIface.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.jms; + +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface ClientIface { + + @OneWay + void sayHello(String s); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.java new file mode 100644 index 0000000000..4f9908f062 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/java/org/apache/tuscany/sca/binding/jms/ClientImpl.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.jms; + +import org.oasisopen.sca.annotation.Reference; + +/** + * This class implements the OneWay service. + */ +public class ClientImpl implements ClientIface { + + private ClientIface serviceA; + + @Reference + public void setServiceA(ClientIface service) { + this.serviceA = service; + } + + public void sayHello(String name) { + serviceA.sayHello(name); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..eeae8fcc59 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/resources/jndi.properties new file mode 100644 index 0000000000..040ec282d7 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = itest.MockInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false&broker.useJmx=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory, ConnectionFactory2 + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic +topic.ServiceTopic = ServiceTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/resources/ttl.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/resources/ttl.composite new file mode 100644 index 0000000000..91b64cf8dc --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/main/resources/ttl.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/test/java/org/apache/tuscany/sca/binding/jms/TTLTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/test/java/org/apache/tuscany/sca/binding/jms/TTLTestCase.java new file mode 100644 index 0000000000..b5839f4c4f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/ttl/src/test/java/org/apache/tuscany/sca/binding/jms/TTLTestCase.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.binding.jms; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import itest.MockInitialContextFactory; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + */ +public class TTLTestCase { + + private Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @Test + public void testSayHello() throws Exception { + ClientIface client1 = node.getService(ClientIface.class, "Client1"); + + client1.sayHello("petra"); + + synchronized(MockInitialContextFactory.lock) { + if (MockInitialContextFactory.timeToLive == null) { + MockInitialContextFactory.lock.wait(10000); + } + } + + assertNotNull(MockInitialContextFactory.timeToLive); + assertEquals(123, MockInitialContextFactory.timeToLive.longValue()); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/pom.xml new file mode 100644 index 0000000000..7c938fb34f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/pom.xml @@ -0,0 +1,83 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-jms-uri-rpc + Apache Tuscany SCA iTest JMS with URI RPC + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-M4 + + + + org.apache.activemq + activemq-core + 5.2.0 + runtime + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + 1.1 + provided + + + org.apache.geronimo.specs + geronimo-jms_1.1_spec + + + + + + + + ${artifactId} + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java new file mode 100644 index 0000000000..9aef6ba1a3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.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.jms; + +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 { + + private HelloWorldService serviceA; + + @Reference + public void setServiceA(HelloWorldService service) { + this.serviceA = service; + } + + public String sayHello(String name) { + return serviceA.sayHello(name); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java b/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java new file mode 100644 index 0000000000..430c71aaef --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java @@ -0,0 +1,26 @@ +/* + * 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.jms; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloWorldService { + String sayHello(String name); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..2c6d9d0d17 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/java/org/apache/tuscany/sca/binding/jms/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 org.apache.tuscany.sca.binding.jms; + +public class HelloWorldServiceImpl implements HelloWorldService { + + public String sayHello(String name) { + if ("bang".equals(name)) { + throw new RuntimeException("blem wit"); + } + return "jmsHello " + name; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..3349754e4a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/resources/jndi.properties b/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/resources/jndi.properties new file mode 100644 index 0000000000..4d6acc037b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/resources/jndi.properties @@ -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. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false + +# use the following property to specify the JNDI name the connection factory +# should appear as. +#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.RequestQueue = RequestQueue +queue.ResponseQueue = ResponseQueue + +# register some topics in JNDI using the form +# topic.[jndiName] = [physicalName] +#topic.MyTopic = example.MyTopic + +# END SNIPPET: jndi diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/resources/simple/service.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/resources/simple/service.composite new file mode 100644 index 0000000000..01553a968c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/resources/simple/service.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/resources/simple/uriclient.composite b/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/resources/simple/uriclient.composite new file mode 100644 index 0000000000..9e7b119fad --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/main/resources/simple/uriclient.composite @@ -0,0 +1,31 @@ + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/test/java/org/apache/tuscany/sca/binding/jms/URIRPCTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/test/java/org/apache/tuscany/sca/binding/jms/URIRPCTestCase.java new file mode 100644 index 0000000000..60b0f0a1a3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/jms/uri-rpc/src/test/java/org/apache/tuscany/sca/binding/jms/URIRPCTestCase.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.binding.jms; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * This shows how to test the JMS binding using a simple HelloWorld application. + */ +public class URIRPCTestCase { + + private static Node node; + + @Before + public void init() { + node = NodeFactory.newInstance().createNode().start(); + } + + @After + public void end() { + if (node != null) { + node.stop(); + } + } + + @Test + public void testHelloWorldCreate() throws Exception { + HelloWorldService helloWorldService = node.getService(HelloWorldService.class, "HelloWorldClient"); + assertEquals("jmsHello Petra", helloWorldService.sayHello("Petra")); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-client/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-client/pom.xml new file mode 100644 index 0000000000..6eea2088c9 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-client/pom.xml @@ -0,0 +1,44 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-nodes-helloworld-client + Apache Tuscany SCA iTest Nodes Helloworld Client + + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0-M4 + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + provided + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-client/src/main/java/itest/nodes/HelloworldImpl.java b/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-client/src/main/java/itest/nodes/HelloworldImpl.java new file mode 100644 index 0000000000..bf8a588928 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/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(){ + System.out.println(">>>>>> " + sayHello("init")); + } + + public String sayHello(String name) { + return "Hi " + service.sayHello(name); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-client/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-client/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b4ba94220c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-client/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-client/src/main/resources/helloworld-client.composite b/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-client/src/main/resources/helloworld-client.composite new file mode 100644 index 0000000000..9d5e9ae59a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-client/src/main/resources/helloworld-client.composite @@ -0,0 +1,29 @@ + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-iface/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-iface/pom.xml new file mode 100644 index 0000000000..ea5b2dc60a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-iface/pom.xml @@ -0,0 +1,39 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-nodes-helloworld-iface + Apache Tuscany SCA iTest Nodes Helloworld IFaces + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + provided + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-iface/src/main/java/itest/nodes/Helloworld.java b/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-iface/src/main/java/itest/nodes/Helloworld.java new file mode 100644 index 0000000000..76f8d4400d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/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); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-service/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-service/pom.xml new file mode 100644 index 0000000000..a7cdef93c6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-service/pom.xml @@ -0,0 +1,49 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-nodes-helloworld-service + Apache Tuscany SCA iTest Nodes Helloworld Service + + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0-M4 + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + provided + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M4 + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-service/src/main/java/itest/nodes/HelloworldImpl.java b/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-service/src/main/java/itest/nodes/HelloworldImpl.java new file mode 100644 index 0000000000..81f7e1747d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-service/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/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-service/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-service/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..c65718909d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-service/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-service/src/main/resources/helloworld-service.composite b/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-service/src/main/resources/helloworld-service.composite new file mode 100644 index 0000000000..6b2d15b7a6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/helloworld-service/src/main/resources/helloworld-service.composite @@ -0,0 +1,28 @@ + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/nodes/one-node-test/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/nodes/one-node-test/pom.xml new file mode 100644 index 0000000000..99192513ad --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/one-node-test/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../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-M4 + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java new file mode 100644 index 0000000000..6d49b718ef --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/one-node-test/src/test/java/itest/OneNodeTestCase.java @@ -0,0 +1,87 @@ +/* + * 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("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/tags/java/sca/2.0-M4-RC2/itest/nodes/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/nodes/pom.xml new file mode 100644 index 0000000000..d08d2c9402 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/pom.xml @@ -0,0 +1,45 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + pom + itest-nodes + Apache Tuscany SCA iTest Nodes + + + install + + + + helloworld-iface + helloworld-service + helloworld-client + one-node-test + two-nodes-test + two-nodes-two-vms-test + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/pom.xml new file mode 100644 index 0000000000..cefcd7d6ed --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/pom.xml @@ -0,0 +1,58 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../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-M4 + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + org.apache.tuscany.sca + tuscany-sca-client-impl + 2.0-M4 + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-M4 + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/src/test/java/itest/ClientNode.java b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/src/test/java/itest/ClientNode.java new file mode 100644 index 0000000000..5f9453a5d6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/src/test/java/itest/ClientNode.java @@ -0,0 +1,92 @@ +/* + * 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 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.SCAClient; + +/** + * 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/200903"; + 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 = SCAClient.getService(Helloworld.class, "HelloworldService"); + assertNotNull(service); + assertEquals("Hello Petra", service.sayHello("Petra")); + + Helloworld client = SCAClient.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/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/src/test/java/itest/ServiceNode.java b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/src/test/java/itest/ServiceNode.java new file mode 100644 index 0000000000..b413825106 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/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/200903"; + 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/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/src/test/java/itest/StopStartNodesTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/src/test/java/itest/StopStartNodesTestCase.java new file mode 100644 index 0000000000..4a41ae8133 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/src/test/java/itest/StopStartNodesTestCase.java @@ -0,0 +1,102 @@ +/* + * 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/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/src/test/java/itest/TestCaseRunner.java b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/src/test/java/itest/TestCaseRunner.java new file mode 100644 index 0000000000..7dfa6e66cc --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/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/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java new file mode 100644 index 0000000000..769aad1940 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-test/src/test/java/itest/TwoNodesTestCase.java @@ -0,0 +1,105 @@ +/* + * 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 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.SCAClient; + +/** + * 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.newInstance(); + 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 = SCAClient.getService(Helloworld.class, "HelloworldService"); + assertNotNull(service); + assertEquals("Hello Petra", service.sayHello("Petra")); + + Helloworld client = SCAClient.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/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/build.xml b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/build.xml new file mode 100644 index 0000000000..933aec2636 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/build.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/client-config.xml b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/client-config.xml new file mode 100644 index 0000000000..21b03b97a3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/client-config.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/client.xml b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/client.xml new file mode 100644 index 0000000000..bb65805144 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/client.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/pom.xml new file mode 100644 index 0000000000..b0e4c06ebb --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/pom.xml @@ -0,0 +1,117 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-nodes-two-nodes-two-vms-test + Apache Tuscany SCA iTest Nodes Two Nodes Two VMs Test + + + + org.apache.tuscany.sca + tuscany-endpoint-tribes + 2.0-M4 + + + org.apache.tuscany.sca + itest-nodes-helloworld-iface + 2.0-M4 + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + + + org.apache.tuscany.sca + tuscany-node-launcher + 2.0-M4 + + + org.apache.tuscany.sca + tuscany-sca-client-impl + 2.0-M4 + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + + + org.apache.tuscany.sca + tuscany-binding-sca-axis2-runtime + 2.0-M4 + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-M4 + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.3 + + + + ant + ant-trax + 1.6.5 + + + + sun.jdk + tools + 1.6 + system + ${java.home}/../lib/tools.jar + + + + + + run-samples + verify + + run + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/server-config.xml b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/server-config.xml new file mode 100644 index 0000000000..14a48f507a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/server-config.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/server.xml b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/server.xml new file mode 100644 index 0000000000..7b6d206b7f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/server.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/TwoNodesTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/TwoNodesTestCase.java new file mode 100644 index 0000000000..b27d16a562 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/nodes/two-nodes-two-vms-test/src/test/java/itest/TwoNodesTestCase.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 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; + +/** + * This shows how to test the Calculator service component. + */ +public class TwoNodesTestCase { + + private static Node serviceNode; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + NodeFactory factory = NodeFactory.newInstance(); + + serviceNode = factory.createNode(new File("server-config.xml").toURI().toURL()); + serviceNode.start(); + + } + + @Test + public void testNothing() throws Exception { + + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (serviceNode != null) { + serviceNode.stop(); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/operation-overloading/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/operation-overloading/pom.xml new file mode 100644 index 0000000000..3343eb9d58 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/operation-overloading/pom.xml @@ -0,0 +1,53 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-operation-overloading + Apache Tuscany SCA iTest Operation Overloading + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + test + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.java b/tags/java/sca/2.0-M4-RC2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.java new file mode 100644 index 0000000000..1f589b44f4 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.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 org.apache.tuscany.sca.test.opoverload; + +/** + * This is an Interface which has methods declared but not implemented, These methods will be implemented in + * OverloadATarget Class and OverloadASource This class has methods with overloaded parameters. + */ + +//@AllowsPassByReference +public interface OverloadASourceTarget { + String opName = "operationA:"; + + /** + * Method with no parameters + */ + String operationA(); + + /** + * Method with one integer parameter + */ + String operationA(int parm1); + + /** + * Method with one integer parameter and one string parameter + */ + String operationA(int parm1, String parm2); + + /** + * Method with one one string parameter and one integer parameter + */ + String operationA(String parm1, int parm2); + + /** + * Method with one string parameter + */ + String operationA(String string); + + /** + * Method which throws an illegal argument exception in case of any exceptions. + */ + String[] operationAall(); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadASource.java b/tags/java/sca/2.0-M4-RC2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadASource.java new file mode 100644 index 0000000000..a30d3611fb --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadASource.java @@ -0,0 +1,113 @@ +/* + * 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.test.opoverload.impl; + +import java.util.ArrayList; + +import org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * This class Implements the interface OverloadASourceTarget, and gives implementation for all methods which are + * declared in the OverloadASourceTarget interface. + */ +@Service(OverloadASourceTarget.class) +public class OverloadASource implements OverloadASourceTarget { + public OverloadASourceTarget overloadASourceTarget; + + /** + * This is a default constructor + */ + public OverloadASource() { + + } + + /** + * @return + * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA() + */ + public String[] operationAall() { + assert overloadASourceTarget != null : "reference overloadASourceTarget is null"; + ArrayList ret = new ArrayList(); + ret.add(overloadASourceTarget.operationA()); + ret.add(overloadASourceTarget.operationA(11)); + ret.add(overloadASourceTarget.operationA("eleven")); + ret.add(overloadASourceTarget.operationA(3, "three")); + ret.add(overloadASourceTarget.operationA("four", 4)); + return (String[])ret.toArray(new String[ret.size()]); + } + + /** + * @return + * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA() + */ + public String operationA() { + assert overloadASourceTarget != null : "reference overloadASourceTarget is null"; + return overloadASourceTarget.operationA(); + } + + /** + * @param parm1 + * @return + * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA(int) + */ + public String operationA(int parm1) { + assert overloadASourceTarget != null : "reference overloadASourceTarget is null"; + return overloadASourceTarget.operationA(parm1); + } + + /** + * @param parm1 + * @param parm2 + * @return + * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA(int, java.lang.String) + */ + public String operationA(int parm1, String parm2) { + assert overloadASourceTarget != null : "reference overloadASourceTarget is null"; + return overloadASourceTarget.operationA(parm1, parm2); + } + + public String operationA(String string) { + assert overloadASourceTarget != null : "reference overloadASourceTarget is null"; + return overloadASourceTarget.operationA(string); + } + + /** + * @param parm1 + * @param parm2 + * @return + * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA(java.lang.String, int) + */ + public String operationA(String parm1, int parm2) { + assert overloadASourceTarget != null : "reference overloadASourceTarget is null"; + return overloadASourceTarget.operationA(parm1, parm2); + } + + /** + * This method which is used by all the overloaded functions to set the source target + */ + @Reference + public void setOverloadASourceTarget(OverloadASourceTarget overloadASourceTarget) { + assert overloadASourceTarget != null : "reference overloadASourceTarget is set tonull"; + this.overloadASourceTarget = overloadASourceTarget; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATarget.java b/tags/java/sca/2.0-M4-RC2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATarget.java new file mode 100644 index 0000000000..9ec60eb78f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATarget.java @@ -0,0 +1,99 @@ +/* + * 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.test.opoverload.impl; + +import org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget; +import org.oasisopen.sca.annotation.Service; + +/** + * This class Implements the interface OverloadASourceTarget, and gives implementation for all methods which are + * declared in the OverloadASourceTarget interface. + */ +@Service(OverloadASourceTarget.class) +public class OverloadATarget implements OverloadASourceTarget { + + /** + * This is a default Constructor + */ + public OverloadATarget() { + + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA(int) + */ + public String operationA(int parm1) { + final String ret = opName + parm1; + out(ret); + return ret; + + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA(int, java.lang.String) + */ + public String operationA(int parm1, String parm2) { + final String ret = opName + parm1 + parm2; + out(ret); + return ret; + + } + + /* + * (non-Javadoc) + * + * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA() + */ + public String operationA() { + out(opName); + return opName; + + } + + public String operationA(String parm1, int parm2) { + final String ret = opName + parm1 + parm2; + out(ret); + return ret; + } + + public String operationA(String parm1) { + final String ret = opName + parm1; + out(ret); + return ret; + } + + /** + * This method is used to print the message returned by all the overloaded functions + */ + private void out(String msg) { + + java.lang.System.out.println(msg); + } + + public String[] operationAall() { + throw new IllegalArgumentException("not supported"); + + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/operation-overloading/src/main/resources/OperationOverload.composite b/tags/java/sca/2.0-M4-RC2/itest/operation-overloading/src/main/resources/OperationOverload.composite new file mode 100644 index 0000000000..cbf5aa2078 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/operation-overloading/src/main/resources/OperationOverload.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java b/tags/java/sca/2.0-M4-RC2/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java new file mode 100644 index 0000000000..62e5c14ce2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java @@ -0,0 +1,98 @@ +/* + * 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.test.opoverload.impl; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +public class OverloadATestCase { + + private static Node node; + private static OverloadASourceTarget overloadA; + + /** + * Method prefixed with 'test' is a test method where testing logic is written using various assert methods. This + * test verifies the values compared are same as the values retrieved from the SCA runtime. + */ + @Test + public void testOperationAall() { + String[] result = overloadA.operationAall(); + assertEquals(5, result.length); + assertEquals(OverloadASourceTarget.opName, result[0]); + assertEquals(OverloadASourceTarget.opName + 11, result[1]); + assertEquals(OverloadASourceTarget.opName + "eleven", result[2]); + assertEquals(OverloadASourceTarget.opName + 3 + "three", result[3]); + assertEquals(OverloadASourceTarget.opName + "four" + 4, result[4]); + } + + @Test + public void testOperationAInt() { + String result = overloadA.operationA(29); + assertEquals(OverloadASourceTarget.opName + 29, result); + } + + @Test + public void testOperationAString() { + String result = overloadA.operationA("rick:-)"); + assertEquals(OverloadASourceTarget.opName + "rick:-)", result); + } + + @Test + public void testOperationAIntString() { + String result = overloadA.operationA(123, "Tuscany"); + assertEquals(OverloadASourceTarget.opName + 123 + "Tuscany", result); + } + + @Test + public void testOperationStringInt() { + String result = overloadA.operationA("StringInt", 77); + assertEquals(OverloadASourceTarget.opName + "StringInt" + 77, result); + } + + /** + * setUp() is a method in JUnit Frame Work which is executed before all others methods in the class extending + * unit.framework.TestCase. So this method is used to create a test Embedded SCA node, to start the SCA node and + * to get a reference to the contribution service + */ + + @BeforeClass + public static void setUp() throws Exception { + String location = ContributionLocationHelper.getContributionLocation("OperationOverload.composite"); + node = NodeFactory.newInstance().createNode("OperationOverload.composite", new Contribution("c1", location)); + node.start(); + overloadA = node.getService(OverloadASourceTarget.class, "OverloadASourceComponent"); + } + + /** + * tearDown() is a method in JUnit Frame Work which is executed after all other methods in the class extending + * unit.framework.TestCase. So this method is used to close the SCA node. + */ + + @AfterClass + public static void tearDown() throws Exception { + node.stop(); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/policies/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/policies/pom.xml new file mode 100644 index 0000000000..1e1ac8f072 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/policies/pom.xml @@ -0,0 +1,59 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-policies + Apache Tuscany SCA iTest Policies + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-policy-logging + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + test + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/CreditCard.java b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/CreditCard.java new file mode 100644 index 0000000000..fd33be01d6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/CreditCard.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 org.apache.tuscany.sca.itest.policies; + +import java.io.Serializable; + +/** + * Credit Card + */ +public class CreditCard implements Serializable { + private static final long serialVersionUID = -6107293191546007197L; + private String type; + private String number; + private String owner; + private int expMonth; + private int expYear; + + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + public String getNumber() { + return number; + } + public void setNumber(String number) { + this.number = number; + } + public String getOwner() { + return owner; + } + public void setOwner(String owner) { + this.owner = owner; + } + public int getExpMonth() { + return expMonth; + } + public void setExpMonth(int expMonth) { + this.expMonth = expMonth; + } + public int getExpYear() { + return expYear; + } + public void setExpYear(int expYear) { + this.expYear = expYear; + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/CreditCardPayment.java b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/CreditCardPayment.java new file mode 100644 index 0000000000..368179dc29 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/CreditCardPayment.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 org.apache.tuscany.sca.itest.policies; + +import org.oasisopen.sca.annotation.Authentication; +import org.oasisopen.sca.annotation.Confidentiality; +import org.oasisopen.sca.annotation.Remotable; + +/** + * + */ +@Remotable +@Authentication +public interface CreditCardPayment { + String COMPLETED = "Completed"; + String REJECTED = "Rejected"; + + @Confidentiality + String authorize(CreditCard creditCard, float amount); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/Customer.java b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/Customer.java new file mode 100644 index 0000000000..05ea341466 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/Customer.java @@ -0,0 +1,51 @@ +/* + * 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.policies; + +import java.io.Serializable; + +/** + * Customer + */ +public class Customer implements Serializable { + private static final long serialVersionUID = 680227659536711695L; + private String id; + private String name; + private CreditCard creditCard; + + 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; + } + public CreditCard getCreditCard() { + return creditCard; + } + public void setCreditCard(CreditCard creditCard) { + this.creditCard = creditCard; + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/CustomerRegistry.java b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/CustomerRegistry.java new file mode 100644 index 0000000000..c9f50d08ee --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/CustomerRegistry.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.policies; + +/** + * + */ +public interface CustomerRegistry { + Customer find(String id); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/Payment.java b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/Payment.java new file mode 100644 index 0000000000..cc7c555aff --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/Payment.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.itest.policies; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * + */ +@Remotable +public interface Payment { + String charge(String customerID, float amount); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/impl/CreditCardPaymentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/impl/CreditCardPaymentImpl.java new file mode 100644 index 0000000000..01cc8ac636 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/impl/CreditCardPaymentImpl.java @@ -0,0 +1,40 @@ +/* + * 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.policies.impl; + +import org.apache.tuscany.sca.itest.policies.CreditCard; +import org.apache.tuscany.sca.itest.policies.CreditCardPayment; + +/** + * + */ +public class CreditCardPaymentImpl implements CreditCardPayment { + + public String authorize(CreditCard creditCard, float amount) { + System.out.println(creditCard.getType() + " " + creditCard.getNumber()); + System.out.println(amount); + if (amount < 200f) { + return COMPLETED; + } else { + return REJECTED; + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/impl/CustomerRegistryImpl.java b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/impl/CustomerRegistryImpl.java new file mode 100644 index 0000000000..943720451f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/impl/CustomerRegistryImpl.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.itest.policies.impl; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.tuscany.sca.itest.policies.CreditCard; +import org.apache.tuscany.sca.itest.policies.Customer; +import org.apache.tuscany.sca.itest.policies.CustomerRegistry; +import org.oasisopen.sca.annotation.Destroy; +import org.oasisopen.sca.annotation.Init; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +/** + * + */ +@Service(CustomerRegistry.class) +@Scope("COMPOSITE") +public class CustomerRegistryImpl implements CustomerRegistry { + private Map customers = new HashMap(); + + + @Init + public void init() { + Customer c1 = new Customer(); + c1.setId("001"); + c1.setName("John Smith"); + CreditCard creditCard = new CreditCard(); + creditCard.setNumber("1234-5678-1234"); + creditCard.setType("Visa"); + creditCard.setOwner("John Smith"); + creditCard.setExpMonth(6); + creditCard.setExpYear(2015); + c1.setCreditCard(creditCard); + customers.put(c1.getId(), c1); + + Customer c2 = new Customer(); + c2.setId("002"); + c2.setName("Jane Smith"); + creditCard = new CreditCard(); + creditCard.setNumber("1234-5678-5678"); + creditCard.setType("MasterCard"); + creditCard.setOwner("Jane Smith"); + creditCard.setExpMonth(9); + creditCard.setExpYear(2012); + c2.setCreditCard(creditCard); + customers.put(c2.getId(), c2); + } + + public Customer find(String id) { + return customers.get(id); + } + + @Destroy + public void destroy() { + customers.clear(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/impl/PaymentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/impl/PaymentImpl.java new file mode 100644 index 0000000000..b712b99388 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/java/org/apache/tuscany/sca/itest/policies/impl/PaymentImpl.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.policies.impl; + +import org.apache.tuscany.sca.itest.policies.CreditCard; +import org.apache.tuscany.sca.itest.policies.CreditCardPayment; +import org.apache.tuscany.sca.itest.policies.Customer; +import org.apache.tuscany.sca.itest.policies.CustomerRegistry; +import org.apache.tuscany.sca.itest.policies.Payment; +import org.apache.tuscany.sca.policy.logging.Logging; +import org.oasisopen.sca.annotation.Authentication; +import org.oasisopen.sca.annotation.Confidentiality; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Requires; + +/** + * + */ +@Logging +public class PaymentImpl implements Payment { + + @Reference + protected CustomerRegistry customerRegistry; + + @Reference + @Authentication + @Requires({Confidentiality.CONFIDENTIALITY_MESSAGE, Confidentiality.CONFIDENTIALITY_TRANSPORT}) + protected CreditCardPayment creditCardPayment; + + public String charge(String customerID, float amount) { + Customer customer = customerRegistry.find(customerID); + CreditCard creditCard = customer.getCreditCard(); + String status = creditCardPayment.authorize(creditCard, amount); + return status; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/resources/Customer.composite b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/resources/Customer.composite new file mode 100644 index 0000000000..2a8f598b90 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/resources/Customer.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/resources/LoggingMessages.properties b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/resources/LoggingMessages.properties new file mode 100644 index 0000000000..ada808be0e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/resources/LoggingMessages.properties @@ -0,0 +1,16 @@ +# 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. diff --git a/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/resources/META-INF/definitions.xml b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/resources/META-INF/definitions.xml new file mode 100644 index 0000000000..0a39912bf0 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/resources/META-INF/definitions.xml @@ -0,0 +1,46 @@ + + + + + + + FINE + LoggingMessages.properties + + + + + + + INFO + LoggingMessages.properties + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..be63597c12 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/resources/Payment.composite b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/resources/Payment.composite new file mode 100644 index 0000000000..df54d0c1c2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/policies/src/main/resources/Payment.composite @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/policies/src/test/java/org/apache/tuscany/sca/itest/policies/PaymentTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/policies/src/test/java/org/apache/tuscany/sca/itest/policies/PaymentTestCase.java new file mode 100644 index 0000000000..3385ee9071 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/policies/src/test/java/org/apache/tuscany/sca/itest/policies/PaymentTestCase.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 org.apache.tuscany.sca.itest.policies; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class PaymentTestCase { + private static Node node; + + @BeforeClass + public static void init() throws Exception { + try { + String location = ContributionLocationHelper.getContributionLocation("Payment.composite"); + node = NodeFactory.newInstance().createNode(new Contribution("c1", location)); + node.start(); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + + @AfterClass + public static void destroy() throws Exception { + if (node != null) { + node.stop(); + } + } + + @Test + public void testPayment() { + Payment payment = node.getService(Payment.class, "Payment"); + String status = payment.charge("001", 100f); + Assert.assertEquals(CreditCardPayment.COMPLETED, status); + + status = payment.charge("002", 300f); + Assert.assertEquals(CreditCardPayment.REJECTED, status); + } + + public static void main(String[] args) throws Exception { + PaymentTestCase.init(); + PaymentTestCase tester = new PaymentTestCase(); + tester.testPayment(); + PaymentTestCase.destroy(); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/pom.xml new file mode 100644 index 0000000000..fd5759d0aa --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/pom.xml @@ -0,0 +1,167 @@ + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-M4 + ../pom.xml + + tuscany-itest + pom + Apache Tuscany SCA Integration Tests + + + + junit + junit + 4.5 + compile + + + + + + default + + true + + + builder + bpel + callback-api + callback-basic + callback-basic-ws + callback-complex-type + callback-multiple-wires + callback-separatethread + component-type + contribution-folder + contribution-zip + + distribution + exceptions + implementation-spring + interfaces + jms + nodes + + + recursive-multi-level + references + scaclient-api + scopes + scdl + services + service-reference + wires + policies + + + + + old + + bpel + builder + callablereferences + callablereferences-ws + callback-api + callback-basic + callback-complex-type + callback-id + callback-multiple-wires + callback-separatethread + callback-set-callback + callback-set-conversation + component-type + contribution + + contribution-import-export + conversations + conversations-ws + corba + databindings + exceptions + exceptions-cross-binding + exceptions-cross-binding-ws + exceptions-simple-ws + extended-api + interfaces + + jms + jms-args + jms-callbacks + jms-definitions + jms-format + jms-selectors + large-sdo-ws + late-reference-resolution + oneway + operation-overloading + + policy + policy-security + policy-security-basicauth + policy-security-jsr250 + policy-security-token + + properties + recursive + recursive-multi-level + recursive-ws + references + scopes + serialization + services + spring + transaction + validation + wires + wsdl + wsdl2java + wsdlless + wsdl-multiple + ws-void-args-return + + + + + + jaxws + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/properties/pom.xml new file mode 100644 index 0000000000..cdf4c0be74 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/pom.xml @@ -0,0 +1,74 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-properties + Apache Tuscany SCA iTest Properties + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + test + + + + + xalan + xalan + 2.7.1 + test + + + + org.apache.tuscany.sca + tuscany-core-databinding + 2.0-M4 + runtime + + + + org.apache.tuscany.sca + tuscany-databinding-jaxb + 2.0-M4 + compile + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/mysca/test/myservice/impl/MyService.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/mysca/test/myservice/impl/MyService.java new file mode 100644 index 0000000000..b0fd64c9da --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/mysca/test/myservice/impl/MyService.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 mysca.test.myservice.impl; + +public interface MyService { + /** + * This is a method to get the location property value from the sca runtime environment. It is implemented in the + * class MyServiceImpl + */ + String getLocation(); + + /** + * This is a method to get the year property value from the sca runtime environment. It is implemented in the class + * MyServiceImpl + */ + String getYear(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.java new file mode 100644 index 0000000000..7b44ef02e4 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/mysca/test/myservice/impl/MyServiceImpl.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 mysca.test.myservice.impl; + +import java.util.logging.Logger; + +import org.oasisopen.sca.annotation.ComponentName; +import org.oasisopen.sca.annotation.Destroy; +import org.oasisopen.sca.annotation.Init; +import org.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Service; + +/** + * This class Implements the interface MyService and gives implementation for all methods which are declared in that + * interface. scope is specified as Composite using + * + * @scope annotation. + */ + +@Service(MyService.class) +public class MyServiceImpl implements MyService { + + @Property(name = "location") + protected String location = "RTP"; + + @Property(name = "year") + protected String year = "2006"; + + @ComponentName + protected String componentName; + + private Logger logger; + + /** + * @ to print the message in the log + */ + public MyServiceImpl() { + logger = Logger.getAnonymousLogger(); + logger.info("creating service instance..."); + } + + /** + * @Init annotation to Start the service. Which is executed all the time + */ + @Init + public void start() { + logger.info("Start service.."); + } + + /** + * @Destroy annotation to stop the service. Which is executed in the end + */ + @Destroy + public void stop() { + logger.info("Stop service.."); + + } + + public String getComponentName() { + return componentName; + } + + public String getLocation() { + return location; + } + + public String getYear() { + return year; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/mysca/test/myservice/impl/MyTotalServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/mysca/test/myservice/impl/MyTotalServiceImpl.java new file mode 100644 index 0000000000..e8c4341cf2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/mysca/test/myservice/impl/MyTotalServiceImpl.java @@ -0,0 +1,46 @@ +/* + * 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 mysca.test.myservice.impl; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * This class Implements the interface MyService and gives implementation for all methods which are declared in that + * interface. scope is specified as Composite using + * + * @scope annotation. + */ + +@Service(MyService.class) +public class MyTotalServiceImpl implements MyService { + + // default required==true so it is 1:1 + @Reference + public MyService myService; + + public String getLocation() { + return myService.getLocation(); + } + + public String getYear() { + return myService.getYear(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java new file mode 100644 index 0000000000..68ce5a3cb6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java @@ -0,0 +1,50 @@ +/* + * 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; + +/** + * It is an Interface which has method declarations. Methods which are to be accessed as a service are declared in this + * interface. Implementation for these methods is provided in ABCDComponentImpl Class + */ +public interface ABCDComponent { + + /** + * This is a method to get a string property value from the SCA runtime environment. It is implemented in the class + * ABCDComponentImpl + */ + String getA(); + + /** + * This is a method to get a string property value from the SCA runtime environment. It is implemented in the class + * ABCDComponentImpl + */ + String getB(); + + /** + * This is a method to get a string property value from the SCA runtime environment. It is implemented in the class + * ABCDComponentImpl + */ + String getC(); + + /** + * This is a method to get a string property value from the SCA runtime environment. It is implemented in the class + * ABCDComponentImpl + */ + String getD(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java new file mode 100644 index 0000000000..c8d0d4cae4 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java @@ -0,0 +1,73 @@ +/* + * 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; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; + +/** + * This class Implements the interface ABCDComponent and gives implementation for all methods which are declared in that + * interface. scope is specified as Composite using + * + * @scope annotation. + */ +@Scope("COMPOSITE") +public class ABCDComponentImpl implements ABCDComponent { + private ABComponent abComponent; + private CDComponent cdComponent; + + /** + * It is a method which injects the property value to the variable 'abComponent' from the SCA runtime environment + * using + * + * @Property Annotations. + */ + @Reference + public void setAb(ABComponent component) { + this.abComponent = component; + } + + /** + * It is a method which injects the property value to the variable 'cdComponent' from the SCA runtime environment + * using + * + * @Property Annotations. + */ + @Reference + public void setCd(CDComponent component) { + this.cdComponent = component; + } + + public String getA() { + return this.abComponent.getA(); + } + + public String getB() { + return this.abComponent.getB(); + } + + public String getC() { + return this.cdComponent.getC(); + } + + public String getD() { + return this.cdComponent.getD(); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java new file mode 100644 index 0000000000..b727935bc1 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java @@ -0,0 +1,75 @@ +/* + * 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; + +import java.util.Collection; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * It is an Interface which has method declarations. Methods which are to be accessed as a service are declared in this + * interface. Implementation for these methods is provided in ABComponentImpl Class + */ +@Remotable +public interface ABComponent { + + /** + * This is a method to get a string property value from the SCA runtime environment. It is implemented in the class + * ABComponentImpl + */ + + String getA(); + + /** + * This is a method to get a string property value from the SCA runtime environment. It is implemented in the class + * ABComponentImpl + */ + String getB(); + + /** + * This is a method to get a string property value from the SCA runtime environment. It is implemented in the class + * ABComponentImpl + */ + String getZ(); + + /** + * This is a method to get an integer property value from the SCA runtime environment. It is implemented in the + * class ABComponentImpl + */ + int getIntValue(); + + /** + * This is a method to get a string property value from the SCA runtime environment. It is implemented in the class + * ABComponentImpl + */ + String getF(); + + /** + * This is a method to get collection of property values from the SCA runtime environment. It is implemented in the + * class ABComponentImpl + */ + Collection getManyStringValues(); + + /** + * This is a method to get collection of property value from the SCA runtime environment. It is implemented in the + * class ABComponentImpl + */ + Collection getManyIntegers(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java new file mode 100644 index 0000000000..e402131ce2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java @@ -0,0 +1,131 @@ +/* + * 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; + +import java.util.Collection; + +import org.oasisopen.sca.annotation.Property; + +/** + * This class Implements the interface ABComponent and gives implementation for all methods which are declared in that + * interface. + */ + +public class ABComponentImpl implements ABComponent { + + private String aProperty; + private String bProperty; + private int intValue; + private Collection manyStringValues; + private Collection manyIntegerValues; + private String zProperty; + private String fProperty; + + /** + * It is a method which injects the property value to the variable 'zProperty' from the SCA runtime environment + * using Annotations. + */ + @Property(name = "xpath") + public void setZProperty(final String value) { + this.zProperty = value; + } + + /** + * It is a method which injects collection of property values to the variable 'manyStringValues' from the SCA + * runtime environment using Annotations. + */ + @Property(name = "foobar") + public void setManyStringValues(final Collection value) { + this.manyStringValues = value; + } + + /** + * It is a method which injects collection of integer property values to the variable 'manyIntegerValues' from the + * SCA runtime environment using Annotations. + */ + @Property(name = "fooInts") + public void setManyIntegers(final Collection value) { + this.manyIntegerValues = value; + } + + /** + * It is a method which injects the property value to the variable 'aProperty' from the SCA runtime environment + * using Annotations. + */ + @Property + public void setA(final String A) { + this.aProperty = A; + } + + /** + * It is a method which injects the property value to the variable 'bProperty' from the SCA runtime environment + * using Annotations. + */ + @Property + public void setB(final String B) { + this.bProperty = B; + } + + /** + * It is a method which injects the property value to the variable 'fProperty' from the SCA runtime environment + * using Annotations. + */ + @Property + public void setF(final String F) { + this.fProperty = F; + } + + /** + * It is a method which injects integer property value to the variable 'intValue' from the SCA runtime environment + * using Annotations. + */ + @Property + public void setOne(final int value) { + this.intValue = value; + } + + public String getA() { + return this.aProperty; + } + + public String getB() { + return this.bProperty; + } + + public int getIntValue() { + return this.intValue; + } + + public String getZ() { + return this.zProperty; + } + + public String getF() { + return this.fProperty; + } + + public Collection getManyStringValues() { + return manyStringValues; + } + + public Collection getManyIntegers() { + return manyIntegerValues; + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java new file mode 100644 index 0000000000..52f9871d1b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java @@ -0,0 +1,71 @@ +/* + * 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; + +import java.util.Collection; + +/** + * It is an Interface which has method declarations. Methods which are to be accessed as a service are declared in this + * interface. Implementation for these methods is provided in CDComponentImpl Class + */ +public interface CDComponent { + + /** + * This is a method to get a property value from the SCA runtime environment. It is implemented in the class + * CDComponentImpl Class + */ + String getC(); + + /** + * This is a method to get a property value from the SCA runtime environment. It is implemented in the class + * CDComponentImpl Class + */ + String getC2(); + + /** + * This is a method to get a property value from the SCA runtime environment. It is implemented in the class + * CDComponentImpl Class + */ + String getD(); + + /** + * This is a method to get a property value from the SCA runtime environment. It is implemented in the class + * CDComponentImpl Class + */ + String getNoSource(); + + /** + * This is a method to get a property value from the SCA runtime environment. It is implemented in the class + * CDComponentImpl Class + */ + String getFileProperty(); + + /** + * This is a method to get a property value from the SCA runtime environment. It is implemented in the class + * CDComponentImpl Class + */ + Collection getManyValuesFileProperty(); + + /** + * This is a method to get a property value from the SCA runtime environment. It is implemented in the class + * CDComponentImpl Class + */ + int getOverrideValue(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java new file mode 100644 index 0000000000..fceda9d9ae --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java @@ -0,0 +1,143 @@ +/* + * 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; + +import java.util.Collection; + +import org.oasisopen.sca.annotation.Property; + +/** + * This class Implements the interface CDComponent and gives implementation for all methods which are declared in that + * interface. + */ +public class CDComponentImpl implements CDComponent { + + private String cProperty; + private String dProperty; + private String nosource; + private String fileProperty; + private Collection manyValuesFileProperty; + private int overrideNumber; + private String cProperty2; + + /** + * It is a method which injects the property value to the variable 'cProperty2' from the SCA runtime environment + * using + * + * @Property Annotations. + */ + @Property(name = "nonFileProperty") + public void setC2(final String value) { + this.cProperty2 = value; + } + + /** + * It is a method which injects the property value to the variable 'overrideNumber' from the SCA runtime environment + * using + * + * @Property Annotations. + */ + @Property(name = "two") + public void setOverrideNumber(final int value) { + this.overrideNumber = value; + } + + /** + * It is a method which injects the property value to the variable 'fileProperty' from the SCA runtime environment + * using + * + * @Property Annotations. + */ + @Property(name = "fileProperty") + public void setFileProp(final String value) { + this.fileProperty = value; + } + + /** + * It is a method which injects the property value to the variable 'manyValuesFileProperty' from the SCA runtime + * environment using + * + * @Property Annotations. + */ + @Property(name = "manyValuesFileProperty") + public void setFileManyValueProp(final Collection values) { + this.manyValuesFileProperty = values; + } + + /** + * It is a method which injects the property value to the variable 'cProperty' from the SCA runtime environment + * using + * + * @Property Annotations. + */ + @Property + public void setC(final String C) { + this.cProperty = C; + } + + /** + * It is a method which injects the property value to the variable 'dProperty' from the SCA runtime environment + * using + * + * @Property Annotations. + */ + @Property + public void setD(final String D) { + this.dProperty = D; + } + + /** + * It is a method which injects the property value to the variable 'nosource' from the SCA runtime environment using + * + * @Property Annotations. + */ + @Property + public void setNosource(final String value) { + this.nosource = value; + } + + public String getFileProperty() { + return this.fileProperty; + } + + public String getC() { + return this.cProperty; + } + + public String getC2() { + return this.cProperty2; + } + + public String getD() { + return this.dProperty; + } + + public String getNoSource() { + return this.nosource; + } + + public int getOverrideValue() { + return this.overrideNumber; + } + + public Collection getManyValuesFileProperty() { + return this.manyValuesFileProperty; + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java new file mode 100644 index 0000000000..1642ab55f5 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java @@ -0,0 +1,151 @@ +/* + * 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; + +/** + * This is a Java Bean which has setter and getter methods for for the variables used in the property tests. + */ +public class ComplexPropertyBean { + + /** + * Variable declarations + */ + protected int integerNumber = 25; + protected float floatNumber = 50; + protected double doubleNumber = 75; + protected int[] intArray = null; + protected double[] doubleArray = null; + protected String[] stringArray = null; + + ComplexPropertyBean numberSet; + protected ComplexPropertyBean[] numberSetArray = null; + + public ComplexPropertyBean() { + + } + + public double getDoubleNumber() { + return doubleNumber; + } + + /** + * It is a setter method to set a value for the variable doubleNumber + */ + public void setDoubleNumber(double doubleNumber) { + this.doubleNumber = doubleNumber; + } + + /** + * It is a getter method to get a value for the variable floatNumber + */ + public float getFloatNumber() { + return floatNumber; + } + + /** + * It is a setter method to set a value for the variable floatNumber + */ + public void setFloatNumber(float floatNumber) { + this.floatNumber = floatNumber; + } + + /** + * It is a getter method to get a value for the variable floatNumber + */ + public int getIntegerNumber() { + return integerNumber; + } + + /** + * It is a getter method to get a value for the variable integerNumber + */ + public void setIntegerNumber(int integerNumber) { + this.integerNumber = integerNumber; + } + + /** + * It is a getter method to set a value for the variable numberSet + */ + public ComplexPropertyBean getNumberSet() { + return numberSet; + } + + /** + * It is a setter method to set a value for the variable numberSet + */ + public void setNumberSet(ComplexPropertyBean numberSet) { + this.numberSet = numberSet; + } + + /** + * It is a method which implements toString() function + */ + + public String toString() { + return Double.toString(integerNumber) + " - " + + Double.toString(floatNumber) + + " - " + + Double.toString(doubleNumber) + + " \n" + + ((intArray == null) ? "" : intArray[0] + " - " + intArray[1] + " \n ") + + ((doubleArray == null) ? "" : doubleArray[0] + " - " + doubleArray[1] + " \n ") + + ((stringArray == null) ? "" : stringArray[0] + " - " + stringArray[1] + " \n ") + + ((numberSetArray == null) ? "" : numberSetArray[0] + " - " + numberSetArray[1] + " \n ") + + ((numberSet == null) ? "" : numberSet.toString()); + } + + /** + * It is a setter method to set values for the variable stringArray + */ + public String[] getStringArray() { + return stringArray; + } + + /** + * It is a setter method to set values for the variable stringArray + */ + public void setStringArray(String[] stringArray) { + this.stringArray = stringArray; + } + + public int[] getIntArray() { + return intArray; + } + + public void setIntArray(int[] intArray) { + this.intArray = intArray; + } + + public double[] getDoubleArray() { + return doubleArray; + } + + public void setDoubleArray(double[] doubleArray) { + this.doubleArray = doubleArray; + } + + public ComplexPropertyBean[] getNumberSetArray() { + return numberSetArray; + } + + public void setNumberSetArray(ComplexPropertyBean[] numberSetArray) { + this.numberSetArray = numberSetArray; + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java new file mode 100644 index 0000000000..acd1f26670 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.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; + +/** + * This is an Interface for the services + */ +public interface OverrideService { + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java new file mode 100644 index 0000000000..71dce41efc --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.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 org.apache.tuscany.sca.itest; + +/** + * An implementation for the interface OverrideService. + */ + +public class OverrideServiceImpl implements OverrideService { + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java new file mode 100644 index 0000000000..9c7e8c3447 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java @@ -0,0 +1,114 @@ +/* + * 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; + +import java.util.Collection; + +import test.jaxb.props.ReturnCodeProperties; + +/** + * It is an Interface which has method declarations. Methods which are to be accessed as a service are declared in this + * interface. Implementation for these methods is provided in PropertyComponentImpl Class + */ +public interface PropertyComponent { + + /** + * This is a method to get a value for a property name 'location' from the SCA runtime environment. It is + * implemented in the class PropertyComponentImpl + */ + public String getLocation(); + + /** + * This is a method to get a value for a property name 'year' from the SCA runtime environment. It is implemented in + * the class PropertyComponentImpl + */ + public String getYear(); + + /** + * This method is used to test injecting a primitive String Array + * + * @return The injected array + */ + public String[] getDaysOfTheWeek(); + + /** + * This method is used to test injecting an Object Integer Array + * + * @return The injected array + */ + public Integer[] getIntegerNumbers(); + + /** + * This method is used to test injecting an int Array + * + * @return The injected array + */ + public int[] getIntNumbers(); + + /** + * This is a method to get a property value from the SCA runtime environment. It is implemented in the class + * PropertyComponentImpl + */ + + public ComplexPropertyBean getComplexPropertyOne(); + + /** + * This is a method to get a property value from the SCA runtime environment. It is implemented in the class + * PropertyComponentImpl + */ + public ComplexPropertyBean getComplexPropertyTwo(); + + /** + * This is a method to get a property value from the SCA runtime environment. It is implemented in the class + * PropertyComponentImpl + */ + public ComplexPropertyBean getComplexPropertyThree(); + + /** + * This is a method to get a property value from the SCA runtime environment. It is implemented in the class + * PropertyComponentImpl + */ + public Collection getComplexPropertyFour(); + + /** + * This is a method to get a property value from the SCA runtime environment. It is implemented in the class + * PropertyComponentImpl + */ + + public ComplexPropertyBean getComplexPropertyFive(); + + /** + * This is a method to get a property value from the SCA runtime environment. It is implemented in the class + * PropertyComponentImpl + */ + public ReturnCodeProperties getComplexJAXBPropertyOne(); + + /** + * This is a method to get a property value from the SCA runtime environment. It is implemented in the class + * PropertyComponentImpl + */ + public ReturnCodeProperties getComplexJAXBPropertyTwo(); + + /** + * @return + */ + public String getLocationFromComponentContext(); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java new file mode 100644 index 0000000000..64ca749e9f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java @@ -0,0 +1,144 @@ +/* + * 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; + +import java.util.Collection; + +import org.oasisopen.sca.ComponentContext; +import org.oasisopen.sca.annotation.Context; +import org.oasisopen.sca.annotation.Property; + +import test.jaxb.props.ReturnCodeProperties; + +/** + * This class Implements the interface PropertyComponent and gives implementation for all methods which are declared in + * that interface. + */ +public class PropertyComponentImpl implements PropertyComponent { + @Context + protected ComponentContext context; + + @Property + protected ComplexPropertyBean complexPropertyOne; + + @Property + protected ComplexPropertyBean complexPropertyTwo; + + @Property + protected ComplexPropertyBean complexPropertyThree; + + @Property + protected Collection complexPropertyFour; + + @Property + protected ComplexPropertyBean complexPropertyFive; + + @Property(name = "location") + protected String location; + + @Property(name = "year") + protected String year; + + @Property(name = "daysOfTheWeek") + protected String[] daysOfTheWeek; + + @Property(name = "integerNumbers") + protected Integer[] integerNumbers; + + @Property(name = "intNumbers") + protected int[] intNumbers; + + @Property + protected ReturnCodeProperties complexJAXBPropertyOne; + + @Property + protected ReturnCodeProperties complexJAXBPropertyTwo; + + public String getLocation() { + return location; + } + + public String getYear() { + return year; + } + + public ComplexPropertyBean getComplexPropertyOne() { + //System.out.println(complexPropertyOne); + return complexPropertyOne; + } + + public ComplexPropertyBean getComplexPropertyTwo() { + //System.out.println(complexPropertyTwo); + return complexPropertyTwo; + } + + public ComplexPropertyBean getComplexPropertyThree() { + //System.out.println(complexPropertyThree); + return complexPropertyThree; + } + + public Collection getComplexPropertyFour() { + //System.out.println(complexPropertyThree); + return complexPropertyFour; + } + + public ComplexPropertyBean getComplexPropertyFive() { + return complexPropertyFive; + } + + /** + * This method is used to test injecting an Array + * + * @return The injected array + */ + public String[] getDaysOfTheWeek() { + return daysOfTheWeek; + } + + /** + * This method is used to test injecting an Object Integer Array + * + * @return The injected array + */ + public Integer[] getIntegerNumbers() { + return integerNumbers; + } + + /** + * This method is used to test injecting an int Array + * + * @return The injected array + */ + public int[] getIntNumbers() { + return intNumbers; + } + + public String getLocationFromComponentContext() { + return context.getProperty(String.class, "location"); + } + + public ReturnCodeProperties getComplexJAXBPropertyOne() { + return complexJAXBPropertyOne; + } + + public ReturnCodeProperties getComplexJAXBPropertyTwo() { + return complexJAXBPropertyTwo; + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java new file mode 100644 index 0000000000..a57ccd90c8 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.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; + +/** + * This is an Interface for the services. + */ +public interface PropertyService { + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Bar.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Bar.java new file mode 100644 index 0000000000..c147a2affe --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Bar.java @@ -0,0 +1,23 @@ +/* + * 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.cdi; + +public interface Bar { + public String getBar(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo1.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo1.java new file mode 100644 index 0000000000..7c700903d6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo1.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.itest.cdi; + +import org.oasisopen.sca.annotation.Constructor; +import org.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Service; + +@Service(Bar.class) +public class Foo1 implements Bar { + + @Property + protected String bar; + + @Constructor( {"bar"}) + public Foo1(String b) { + this.bar = b; + } + + public String getBar() { + return this.bar; + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo2.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo2.java new file mode 100644 index 0000000000..1d2e563095 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo2.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.itest.cdi; + +import org.oasisopen.sca.annotation.Constructor; +import org.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Service; + +@Service(Bar.class) +public class Foo2 implements Bar { + + protected String bar; + + @Constructor + public Foo2(@Property(name = "bar") String b) { + this.bar = b; + } + + public String getBar() { + return this.bar; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo3.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo3.java new file mode 100644 index 0000000000..54082e297a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/org/apache/tuscany/sca/itest/cdi/Foo3.java @@ -0,0 +1,44 @@ +/* + * 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.cdi; + +import org.oasisopen.sca.annotation.Constructor; +import org.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Service; + +@Service(Bar.class) +public class Foo3 implements Bar { + + protected String bar; + + @Constructor + public Foo3() { + this.bar = "bar"; + } + + public String getBar() { + return this.bar; + } + + @Property(name = "bar") + public void setBar(String b) { + this.bar = b; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/test/jaxb/props/ObjectFactory.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/test/jaxb/props/ObjectFactory.java new file mode 100644 index 0000000000..15fb49ea4e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/test/jaxb/props/ObjectFactory.java @@ -0,0 +1,75 @@ +/* + * 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. + */ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2008.06.07 at 03:30:47 PM EDT +// +package test.jaxb.props; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the test.jaxb.props package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _MyRCProps_QNAME = new QName("http://test.sca.jaxb/rcprops", "MyRCProps"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: test.jaxb.props + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link ReturnCodeProperties } + * + */ + public ReturnCodeProperties createReturnCodeProperties() { + return new ReturnCodeProperties(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ReturnCodeProperties }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://test.sca.jaxb/rcprops", name = "MyRCProps") + public JAXBElement createMyRCProps(ReturnCodeProperties value) { + return new JAXBElement(_MyRCProps_QNAME, ReturnCodeProperties.class, null, value); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/test/jaxb/props/ReturnCodeProperties.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/test/jaxb/props/ReturnCodeProperties.java new file mode 100644 index 0000000000..0a1d4a34a3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/test/jaxb/props/ReturnCodeProperties.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. + */ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2008.06.07 at 03:30:47 PM EDT +// +package test.jaxb.props; + +import java.math.BigInteger; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +/** + *

Java class for ReturnCodeProperties complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ReturnCodeProperties">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="AInt" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         <element name="BInteger" type="{http://www.w3.org/2001/XMLSchema}integer"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ReturnCodeProperties", namespace = "http://test.sca.jaxb/rcprops", propOrder = {"a", "b"}) +public class ReturnCodeProperties { + + @XmlElement(name = "AInt") + protected int a; + @XmlElement(name = "BInteger", required = true) + protected BigInteger b; + + /** + * Gets the value of the a property. + * + */ + public int getA() { + return a; + } + + /** + * Sets the value of the a property. + * + */ + public void setA(int value) { + this.a = value; + } + + /** + * Gets the value of the b property. + * + * @return + * possible object is + * {@link BigInteger } + * + */ + public BigInteger getB() { + return b; + } + + /** + * Sets the value of the b property. + * + * @param value + * allowed object is + * {@link BigInteger } + * + */ + public void setB(BigInteger value) { + this.b = value; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/test/jaxb/props/package-info.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/test/jaxb/props/package-info.java new file mode 100644 index 0000000000..6a6fdd00cc --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/java/test/jaxb/props/package-info.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. + */ +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.3 in JDK 1.6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2008.06.07 at 03:30:47 PM EDT +// +@javax.xml.bind.annotation.XmlSchema(namespace = "http://test.sca.jaxb/rcprops", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package test.jaxb.props; + diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/ConstructorPropertyInjection.composite b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/ConstructorPropertyInjection.composite new file mode 100644 index 0000000000..af65f887c0 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/ConstructorPropertyInjection.composite @@ -0,0 +1,39 @@ + + + + + + + + + + + + fubar + + + + + + fubar + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/Outer.composite b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/Outer.composite new file mode 100644 index 0000000000..5e767b1e0e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/Outer.composite @@ -0,0 +1,43 @@ + + + + + Raleigh + 2008 + + + + + + + + + + + + + + + Durham + 2009 + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/OuterPropertyTest.composite b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/OuterPropertyTest.composite new file mode 100644 index 0000000000..95ee1157bf --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/OuterPropertyTest.composite @@ -0,0 +1,42 @@ + + + + + + + 125 + + + Overriden A + Overriden B + Overriden C + Overriden D + + Overriden Y + Overriden Z + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/PropertyTest.composite b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/PropertyTest.composite new file mode 100644 index 0000000000..36f75d52a1 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/PropertyTest.composite @@ -0,0 +1,260 @@ + + + + + + + + + 1 + + + a + b + c + d + + y + z + + + + + + + + 1 + 11 + 111 + + + 2 + 22 + 222 + + TestString_1 + TestString_2 + 10 + 20 + 27 + 79.34 + 184.52 + 50.05 + 25.52 + + 54 + 158.68 + 369.04 + + + + + + + TestString_3 + TestString_4 + 100 + 200 + + + + + + + + + + + + + + f + + + + Apache + Tuscany + Java SCA + + + 123 + 456 + 789 + + + + + + + + + aValue + + + + 25 + + + + + + + + TestString_1 + TestString_2 + 10 + 27 + 79.34 + 25.52 + 184.52 + 50.05 + 20 + + 1 + 11 + 111 + + + 2 + 22 + 222 + + + 54 + 158.68 + 369.04 + + + + + + TestElementString_1 + TestElementString_2 + 10 + 27 + 79.34 + 25.52 + 184.52 + 50.05 + 20 + + 1 + 11 + 111 + + + 2 + 22 + 222 + + + 54 + 158.68 + 369.04 + + + + + + 1 + 11.11 + 111.111 + + 11 + 1111.1111 + 11111.11111 + + + + 2 + 22.22 + 222.222 + + 22 + 2222.2222 + 22222.22222 + + + + 3 + 33.33 + 333.333 + + 33 + 3333.3333 + 33333.33333 + + + + + RTP + 2006 + + Monday + Tuesday + Wednesday + Thursday + Friday + Saturday + Sunday + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + + + 10 + 9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 + + + + + 10 + 10 + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/customer.xsd b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/customer.xsd new file mode 100644 index 0000000000..7421750f1b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/customer.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/fileProperty.txt b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/fileProperty.txt new file mode 100644 index 0000000000..0d3d9ead83 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/fileProperty.txt @@ -0,0 +1,21 @@ + + + +fileValue diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/manyValuesFileProperty.txt b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/manyValuesFileProperty.txt new file mode 100644 index 0000000000..6d4180ee2f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/manyValuesFileProperty.txt @@ -0,0 +1,23 @@ + + +fileValueOne +fileValueTwo +fileValueThree +fileValueFour diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/mySimpleService.composite b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/mySimpleService.composite new file mode 100644 index 0000000000..3cf25384e6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/mySimpleService.composite @@ -0,0 +1,40 @@ + + + + + + + + + + Raleigh + 2008 + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/rcProps.txt b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/rcProps.txt new file mode 100644 index 0000000000..052c291fd0 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/rcProps.txt @@ -0,0 +1,22 @@ + + + + 20 + 20 + diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/rcprops.xsd b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/rcprops.xsd new file mode 100644 index 0000000000..21289fa7b2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/main/resources/rcprops.xsd @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java new file mode 100644 index 0000000000..efc635c72b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/MyTotalServiceTestCase.java @@ -0,0 +1,104 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; +import mysca.test.myservice.impl.MyService; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +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 MyTotalServiceTestCase { + private static MyService service1; + private static MyService service2; + private static MyService service3; + + private static Node node; + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the local + * property variables defined in the implementation file with the expected values 'RTP' and '2006' + */ + @Test + public void testPropertyDefault() { + assertEquals("RTP", service1.getLocation()); + assertEquals("2006", service1.getYear()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property value obtained using service2 from the SCA runtime environment with the expected values 'Raleigh' + * and '2008'. This overrides the local property values + */ + @Test + public void testPropertyOverride() { + assertEquals("Raleigh", service2.getLocation()); + assertEquals("2008", service2.getYear()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property value obtained using service3 from the SCA runtime environment with the expected values 'Durham' + * and '2009' + */ + @Test + public void testPropertyNestedOverride() { + assertEquals("Durham", service3.getLocation()); + assertEquals("2009", service3.getYear()); + } + + /** + * Method annotated with + * + * @BeforeClass is used for one time set Up, it executes before every tests. This method is used to create a test + * Embedded SCA node, to start the SCA node and to get a reference to the 'outerABService' service + */ + @BeforeClass + public static void setUp() throws Exception { + + String location = ContributionLocationHelper.getContributionLocation("Outer.composite"); + node = NodeFactory.newInstance().createNode("Outer.composite", new Contribution("c1", location)); + node.start(); + service1 = node.getService(MyService.class, "MyServiceComponent/MyService"); + service2 = node.getService(MyService.class, "MyServiceComponentNew/MyService"); + service3 = node.getService(MyService.class, "MySimpleServiceInRecursiveAnother"); + } + + /** + * Method annotated with + * + * @AfterClass is used for one time Tear Down, it executes after every tests. This method is used to close the + * node, close any previously opened connections etc + */ + @AfterClass + public static void tearDown() { + node.stop(); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java new file mode 100644 index 0000000000..0906a45ab3 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java @@ -0,0 +1,169 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; + +import java.util.Iterator; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +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 is a class which makes user of JUnit Framework, all tests are written using JUnit notation. These tests are used + * to test different property values returned from the SCA Runtime Environment which is initialized with the composite + * 'OuterPropertyTest.composite'. It basically tests the Simple type of property and Complex type of property from the + * SCA Runtime Environment. + */ +public class OuterPropertyTestCase { + + private static Node node; + private static ABComponent outerABService; + + /** + * Method annotated with + * + * @BeforeClass is used for one time set Up, it executes before every tests. This method is used to create a test + * Embedded SCA node, to start the SCA node and to get a reference to the 'outerABService' service + */ + @BeforeClass + public static void init() throws Exception { + String location = ContributionLocationHelper.getContributionLocation("OuterPropertyTest.composite"); + node = NodeFactory.newInstance().createNode("OuterPropertyTest.composite", new Contribution("c1", location)); + node.start(); + outerABService = node.getService(ABComponent.class, "OuterComponent"); + } + + /** + * Method annotated with + * + * @AfterClass is used for one time Tear Down, it executes after every tests. This method is used to close the + * node, close any previously opened connections etc + */ + @AfterClass + public static void destroy() throws Exception { + node.stop(); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property value obtained using a service from the SCA runtime environment with the expected value 'Overriden + * A' + */ + @Test + public void testOverridenA() { + assertEquals("Overriden A", outerABService.getA()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property value obtained using a service from the SCA runtime environment with the expected value 'Overriden + * B' + */ + @Test + public void testOverridenB() { + assertEquals("Overriden B", outerABService.getB()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property value obtained using a service from the SCA runtime environment with the expected value 'Overriden + * A' + */ + @Test + public void testOverridenF() { + assertEquals("Overriden A", outerABService.getF()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property value obtained using a service from the SCA runtime environment with the expected value 'Overriden + * Z' + */ + @Test + public void testOverridenZ() { + assertEquals("Overriden Z", outerABService.getZ()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property value obtained using a service from the SCA runtime environment with the expected value 125 + */ + @Test + public void testOverridenIntValue() { + assertEquals(125, outerABService.getIntValue()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property value obtained using a service from the SCA runtime environment with the expected value 125 + */ + @Test + public void testDefaultValue() { + assertEquals(125, outerABService.getIntValue()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property values obtained using a service from the SCA runtime environment with the expected values 'Apache' , + * 'Tuscany' and 'Java SCA' respectively . + */ + @Test + public void testManySimpleStringValues() { + Iterator iterator = outerABService.getManyStringValues().iterator(); + assertEquals("Apache", iterator.next()); + assertEquals("Tuscany", iterator.next()); + assertEquals("Java SCA", iterator.next()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property values obtained using a service from the SCA runtime environment with the expected values 123, 456 + * and 789 + */ + @Test + public void testManySimpleIntegerValues() { + Iterator iterator = outerABService.getManyIntegers().iterator(); + assertEquals(123, iterator.next().intValue()); + assertEquals(456, iterator.next().intValue()); + assertEquals(789, iterator.next().intValue()); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java new file mode 100644 index 0000000000..eb217600db --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java @@ -0,0 +1,422 @@ +/* + * 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; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.math.BigInteger; +import java.util.Arrays; +import java.util.Iterator; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import test.jaxb.props.ReturnCodeProperties; + +/** + * This is a class which makes user of JUnit Framework, all tests are written using JUnit notation. These tests are used + * to test different property values returned from the SCA Runtime Environment which is initialized with the composite + * 'PropertyTest.composite'. It basically tests all types of property values returned from SCA runtime environment. + */ +public class PropertyTestCase { + private static Node node; + private static ABComponent abService; + private static CDComponent cdService; + private static ABCDComponent abcdService; + private static PropertyComponent propertyService; + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property value obtained using a service from the SCA runtime environment with the expected value 'a' + */ + @Test + public void testA() { + assertEquals("a", abService.getA()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property value obtained using a service from the SCA runtime environment with the expected value 'b' + */ + @Test + public void testB() { + assertEquals("b", abService.getB()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property value obtained using a service from the SCA runtime environment with the expected value 'c' + */ + @Test + public void testC() { + assertEquals("c", cdService.getC()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property value obtained using a service from the SCA runtime environment with the expected value 'c' + */ + @Test + public void testC2() { + assertEquals("c", cdService.getC2()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property value obtained using a service from the SCA runtime environment with the expected value 'd' + */ + @Test + public void testD() { + assertEquals("d", cdService.getD()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property value obtained using a service from the SCA runtime environment with the expected value 'a' + */ + @Test + public void testF() { + assertEquals("a", abService.getF()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property value obtained using a service from the SCA runtime environment with the expected value 'z' + */ + @Test + public void testZ() { + assertEquals("z", abService.getZ()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property value obtained using a service from the SCA runtime environment with the expected value 1. + */ + @Test + public void testIntValue() { + assertEquals(1, abService.getIntValue()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property value obtained using a service from the SCA runtime environment with the expected value 1. + */ + @Test + public void testDefaultValue() { + assertEquals(1, abService.getIntValue()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property value obtained using a service from the SCA runtime environment with the expected value 1. + */ + @Test + public void testDefaultValueOverride() { + assertEquals(1, cdService.getOverrideValue()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property value obtained using a service from the SCA runtime environment with the expected value 'aValue' + */ + @Test + public void testNoSource() { + assertEquals("aValue", cdService.getNoSource()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property value obtained using a service from the SCA runtime environment with the expected value + * 'fileValue' + */ + @Test + public void testFileProperty() { + assertEquals("fileValue", cdService.getFileProperty()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property values obtained using a service from the SCA runtime environment with the expected values 4 and + * 'fileValueTwo' respectively. + */ + @Test + public void testManyValuesFileProperty() { + Iterator iterator = cdService.getManyValuesFileProperty().iterator(); + iterator.next(); + String secondValue = iterator.next(); + assertEquals(4, cdService.getManyValuesFileProperty().size()); + assertEquals("fileValueTwo", secondValue); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property values obtained using a service from the SCA runtime environment with the expected values 'a' , + * 'b', 'c' and 'd' respectively. + */ + @Test + public void testABCD() { + assertEquals("a", abcdService.getA()); + assertEquals("b", abcdService.getB()); + assertEquals("c", abcdService.getC()); + assertEquals("d", abcdService.getD()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property values obtained using a service from the SCA runtime environment with the expected values 'RTP' + * and '2006' respectively + */ + @Test + public void testDefaultProperty() { + assertEquals("RTP", propertyService.getLocation()); + assertEquals("2006", propertyService.getYear()); + + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property values obtained using a service from the SCA runtime environment with the expected values 'Apache' , + * 'Tuscany' and 'Java SCA' respectively . + */ + @Test + public void testManySimpleStringValues() { + Iterator iterator = abService.getManyStringValues().iterator(); + assertEquals("Apache", iterator.next()); + assertEquals("Tuscany", iterator.next()); + assertEquals("Java SCA", iterator.next()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property values obtained using a service from the SCA runtime environment with the expected values 123, 456 + * and 789 respectively. + */ + @Test + public void testManySimpleIntegerValues() { + Iterator iterator = abService.getManyIntegers().iterator(); + assertEquals(123, iterator.next().intValue()); + assertEquals(456, iterator.next().intValue()); + assertEquals(789, iterator.next().intValue()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property values obtained using a service from the SCA runtime environment with the expected values + * 'TestString_1' and 2 respectively. + */ + @Test + public void testComplexPropertyOne() { + ComplexPropertyBean propBean = propertyService.getComplexPropertyOne(); + assertNotNull(propBean); + assertEquals("TestString_1", propBean.getStringArray()[0]); + assertEquals(2, propBean.numberSetArray[1].integerNumber); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property values obtained using a service from the SCA runtime environment with the expected integer number + * and a float number + */ + @Test + public void testComplexPropertyTwo() { + ComplexPropertyBean propBean = propertyService.getComplexPropertyTwo(); + assertNotNull(propBean); + assertEquals(10, propBean.intArray[0]); + assertEquals((float)22, propBean.numberSetArray[1].floatNumber); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property values obtained using a service from the SCA runtime environment with the expected value first + * element in the string array and the float number + */ + @Test + public void testComplexPropertyThree() { + ComplexPropertyBean propBean = propertyService.getComplexPropertyThree(); + assertNotNull(propBean); + assertEquals("TestElementString_1", propBean.stringArray[0]); + assertEquals((float)22, propBean.numberSetArray[1].floatNumber); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * complex property value obtained using a service from the SCA runtime environment with the expected values + * 1, 222.222 and 33 respectively. + */ + @Test + public void testComplexPropertyFour() { + Object[] propBeanCollection = propertyService.getComplexPropertyFour().toArray(); + assertNotNull(propBeanCollection); + assertEquals(1, ((ComplexPropertyBean)propBeanCollection[0]).getIntegerNumber()); + assertEquals(222.222, ((ComplexPropertyBean)propBeanCollection[1]).getDoubleNumber()); + assertEquals(33, ((ComplexPropertyBean)propBeanCollection[2]).getNumberSet().getIntegerNumber()); + } + + /** + * Method annotated with + * + * @Test is a test method where testing logic is written using various assert methods. This test verifies the + * property values obtained using a service from the SCA runtime environment with the expected values + * 'TestString_3', 'TestString_4', 100 and 200. + */ + @Test + public void testComplexPropertyFive() { + ComplexPropertyBean propBean = propertyService.getComplexPropertyFive(); + assertNotNull(propBean); + assertEquals("TestString_3", propBean.getStringArray()[0]); + assertEquals("TestString_4", propBean.getStringArray()[1]); + assertEquals(100, propBean.getIntArray()[0]); + assertEquals(200, propBean.getIntArray()[1]); + } + + @Test + public void testGetLocationFromComponentContext() { + String location = propertyService.getLocation(); + assertNotNull(location); + String locationFromCC = propertyService.getLocationFromComponentContext(); + assertNotNull(locationFromCC); + assertEquals(location, locationFromCC); + } + + @Test + public void testGetInjectedStringArrayProperty() { + String[] daysOfWeek = propertyService.getDaysOfTheWeek(); + assertNotNull(daysOfWeek); + + String[] expected = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}; + Assert.assertTrue(Arrays.equals(expected, daysOfWeek)); + } + + @Test + public void testGetInjectedIntegerArrayProperty() { + Integer[] numbers = propertyService.getIntegerNumbers(); + assertNotNull(numbers); + + Integer[] expected = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + Assert.assertTrue(Arrays.equals(expected, numbers)); + } + + @Test + public void testGetInjectedIntArrayProperty() { + int[] numbers = propertyService.getIntNumbers(); + assertNotNull(numbers); + + int[] expected = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; + Assert.assertTrue(Arrays.equals(expected, numbers)); + } + + @Test + public void testComplexJAXBProperty() { + ReturnCodeProperties rc = propertyService.getComplexJAXBPropertyOne(); + assertEquals(10, rc.getA()); + assertEquals(new BigInteger("10"), rc.getB()); + } + + @Test + public void testComplexJAXBPropertyFromFile() { + ReturnCodeProperties rc = propertyService.getComplexJAXBPropertyTwo(); + System.out.println("SKSK: a =" + rc.getA()); + System.out.println("SKSK: b =" + rc.getB()); + assertEquals(20, rc.getA()); + assertEquals(new BigInteger("20"), rc.getB()); + } + + /** + * Method annotated with + * + * @BeforeClass is used for one time set Up, it executes before every tests. This method is used to create a test + * Embedded SCA node, to start the SCA node and to get a reference to 4 services namely 'abService' + * service, 'cdService' service, 'abcdService' service and 'propertyService' service + */ + @BeforeClass + public static void init() throws Exception { + try { + String location = ContributionLocationHelper.getContributionLocation("PropertyTest.composite"); + node = NodeFactory.newInstance().createNode("PropertyTest.composite", new Contribution("c1", location)); + node.start(); + } catch (Exception e) { + e.printStackTrace(); + } + abService = node.getService(ABComponent.class, "ABComponent"); + cdService = node.getService(CDComponent.class, "CDComponent"); + abcdService = node.getService(ABCDComponent.class, "ABCDComponent"); + propertyService = node.getService(PropertyComponent.class, "PropertyComponent"); + } + + /** + * Method annotated with + * + * @AfterClass is used for one time Tear Down, it executes after every tests. This method is used to close the + * node, close any previously opened connections etc + */ + @AfterClass + public static void destroy() throws Exception { + node.stop(); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java new file mode 100644 index 0000000000..a0213ced46 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/properties/src/test/java/org/apache/tuscany/sca/itest/cdi/ConstructorPropertyInjectionTestCase.java @@ -0,0 +1,72 @@ +/* + * 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.cdi; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class ConstructorPropertyInjectionTestCase { + private static org.apache.tuscany.sca.node.Node node; + + @BeforeClass + public static void init() throws Exception { + try { + String location = ContributionLocationHelper.getContributionLocation("ConstructorPropertyInjection.composite"); + node = NodeFactory.newInstance().createNode("ConstructorPropertyInjection.composite", new Contribution("c1", location)); + node.start(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Method annotated with + * + * @AfterClass is used for one time Tear Down, it executes after every tests. This method is used to close the + * node, close any previously opened connections etc + */ + @AfterClass + public static void destroy() throws Exception { + node.stop(); + } + + @Test + public void testFoo1() throws Exception { + Bar foo = node.getService(Bar.class, "Foo1Component"); + assertEquals("fubar", foo.getBar()); + } + + @Test + public void testFoo2() throws Exception { + Bar foo = node.getService(Bar.class, "Foo2Component"); + assertEquals("fubar", foo.getBar()); + } + + @Test + public void testFoo3() throws Exception { + Bar foo = node.getService(Bar.class, "Foo3Component"); + assertEquals("fubar", foo.getBar()); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/pom.xml new file mode 100644 index 0000000000..00ff3be9e5 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/pom.xml @@ -0,0 +1,61 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + + + itest-recursive-multi-level + Apache Tuscany SCA iTest Recusive Multi-Level + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + test + + + + + xalan + xalan + 2.7.1 + test + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyService.java b/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyService.java new file mode 100644 index 0000000000..986c8305dd --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyService.java @@ -0,0 +1,26 @@ +/* + * 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 mysca.test.myservice; + +public interface MyService { + String getLocation(); + + String getYear(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyServiceImpl.java new file mode 100644 index 0000000000..6cad998042 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MyServiceImpl.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 mysca.test.myservice; + +import org.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Service; + +@Service(MyService.class) +public class MyServiceImpl implements MyService { + + @Property(name = "location") + protected String location = "ABC"; + + @Property(name = "year") + protected String year = "2006"; + + public String getLocation() { + return location; + } + + public String getYear() { + return year; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalService.java b/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalService.java new file mode 100644 index 0000000000..261eff2584 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalService.java @@ -0,0 +1,26 @@ +/* + * 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 mysca.test.myservice; + +public interface MySimpleTotalService { + String getLocation(); + + String getYear(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalServiceImpl.java new file mode 100644 index 0000000000..f3c9280f96 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/java/mysca/test/myservice/MySimpleTotalServiceImpl.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 mysca.test.myservice; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +@Service(MySimpleTotalService.class) +public class MySimpleTotalServiceImpl implements MySimpleTotalService { + // default required==true so it is 1:1 + @Reference + public MyService myService; + + public String getLocation() { + return myService.getLocation(); + } + + public String getYear() { + return myService.getYear(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/resources/TotalService1Auto.composite b/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/resources/TotalService1Auto.composite new file mode 100644 index 0000000000..090bc49a41 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/resources/TotalService1Auto.composite @@ -0,0 +1,52 @@ + + + + + Level 1 + 2001 + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/resources/TotalService2Auto.composite b/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/resources/TotalService2Auto.composite new file mode 100644 index 0000000000..8c1a9a2f72 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/resources/TotalService2Auto.composite @@ -0,0 +1,49 @@ + + + + + Level 2 + 2002 + + + + Default 2 + 1992 + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/resources/TotalService3Auto.composite b/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/resources/TotalService3Auto.composite new file mode 100644 index 0000000000..884a8b0a96 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/main/resources/TotalService3Auto.composite @@ -0,0 +1,52 @@ + + + + + Level 3 + 2003 + + + + Default 3 + 1993 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/test/java/test/sca/tests/MultiLevelTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/test/java/test/sca/tests/MultiLevelTestCase.java new file mode 100644 index 0000000000..b9b4e3ba7c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/recursive-multi-level/src/test/java/test/sca/tests/MultiLevelTestCase.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 test.sca.tests; + +import static org.junit.Assert.assertEquals; +import mysca.test.myservice.MySimpleTotalService; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +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; + +/** + * Tests to make sure that autowiring and recusive composite work together + * + */ +public class MultiLevelTestCase { + private static Node node1; + private static Node node2; + private static Node node3; + private static MySimpleTotalService myService1; + private static MySimpleTotalService myService2; + private static MySimpleTotalService myService3; + + @BeforeClass + public static void setUp() throws Exception { + String location = ContributionLocationHelper.getContributionLocation("TotalService1Auto.composite"); + Contribution contribution = new Contribution("c1", location); + try { + node1 = NodeFactory.newInstance().createNode("TotalService1Auto.composite", contribution); + } catch (Exception e) { + e.printStackTrace(); + } + node2 = NodeFactory.newInstance().createNode("TotalService2Auto.composite", contribution); + node3 = NodeFactory.newInstance().createNode("TotalService3Auto.composite", contribution); + + node1.start(); + node2.start(); + node3.start(); + + myService1 = node1.getService(MySimpleTotalService.class, "TotalServiceComponentLevel1Auto"); + myService2 = node2.getService(MySimpleTotalService.class, "TotalServiceInRecursive2Auto/MyServiceLevel1Auto"); + myService3 = node3.getService(MySimpleTotalService.class, "TotalServiceInRecursive3Auto/MyServiceLevel2Auto"); + } + + @Test + public void testLevel1() { + assertEquals("Level 1", myService1.getLocation()); + assertEquals("2001", myService1.getYear()); + } + + @Test + public void testLevel2() { + assertEquals("Default 2", myService2.getLocation()); + assertEquals("1992", myService2.getYear()); + } + + @Test + public void testLevel3() { + assertEquals("Default 3", myService3.getLocation()); + assertEquals("1993", myService3.getYear()); + } + + @AfterClass + public static void tearDown() { + node1.stop(); + node2.stop(); + node3.stop(); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/references/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/references/pom.xml new file mode 100644 index 0000000000..f094d7be82 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/references/pom.xml @@ -0,0 +1,52 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-references + Apache Tuscany SCA iTest References + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + test + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponent.java b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponent.java new file mode 100644 index 0000000000..f8c0850118 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponent.java @@ -0,0 +1,40 @@ +/* + * 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.references; + +public interface AComponent { + + String fooB(); + + String fooC(); + + String fooBC(); + + String fooD1(); + + String fooD2(); + + String fooMultipleD(); + + String fooMultipleDArray(); + + String fooMultipleDServiceRef(); + + DComponent getDReference(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java new file mode 100644 index 0000000000..cd0aad3eea --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/AComponentImpl.java @@ -0,0 +1,125 @@ +/* + * 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.references; + +import java.util.Collection; +import java.util.List; + +import org.oasisopen.sca.ServiceReference; +import org.oasisopen.sca.annotation.Reference; + +public class AComponentImpl implements AComponent { + + @Reference(name = "bReference") + protected BComponent b; + + @Reference + private CComponent cReference; + + @Reference(required = false) + protected DComponent dReference; + + @Reference(name = "dReferences") + public Collection dReferences; + + @Reference(name = "dReferenceArray") + public DComponent[] dReferenceArray; + + @Reference(name = "dServiceReferences") + public List> dServiceReferences; + + private DComponent dReference1; + + private DComponent dReference2; + + @Reference(name = "dReference1", required = false) + public void setDReference(DComponent dReference) { + this.dReference1 = dReference; + } + + @Reference + public void setDReference2(DComponent dReference2) { + this.dReference2 = dReference2; + } + + public String fooB() { + return b.bFoo(); + } + + public String fooC() { + return cReference.cFoo(); + } + + public String fooBC() { + return b.fooC(); + } + + public String fooD() { + return dReference1.dFoo(); + } + + public String fooD1() { + return dReference1.dFoo(); + } + + public String fooD2() { + return dReference2.dFoo(); + } + + public String fooMultipleDArray() { + StringBuffer str = new StringBuffer(); + for (DComponent d : dReferenceArray) { + str.append(d.getComponentName()); + str.append(','); + } + if (str.length() > 0) { + str.deleteCharAt(str.length() - 1); + } + return str.toString(); + } + + public String fooMultipleD() { + StringBuffer str = new StringBuffer(); + for (DComponent d : dReferences) { + str.append(d.getComponentName()); + str.append(','); + } + if (str.length() > 0) { + str.deleteCharAt(str.length() - 1); + } + return str.toString(); + } + + public String fooMultipleDServiceRef() { + StringBuffer str = new StringBuffer(); + for (ServiceReference d : dServiceReferences) { + str.append(d.getService().getComponentName()); + str.append(','); + } + if (str.length() > 0) { + str.deleteCharAt(str.length() - 1); + } + return str.toString(); + } + + public DComponent getDReference() { + return dReference; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponent.java b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponent.java new file mode 100644 index 0000000000..785920bb2d --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponent.java @@ -0,0 +1,26 @@ +/* + * 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.references; + +public interface BComponent { + + String bFoo(); + + String fooC(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentImpl.java new file mode 100644 index 0000000000..211e6160f6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentImpl.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.itest.references; + +import org.oasisopen.sca.annotation.Reference; + +public class BComponentImpl implements BComponent { + + protected CComponent cReference; + + public BComponentImpl(@Reference(name = "cReference") CComponent cReference) { + this.cReference = cReference; + } + + public String bFoo() { + return "BComponent"; + } + + public String fooC() { + return "B" + cReference.cFoo(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentWrongTargetImpl.java b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentWrongTargetImpl.java new file mode 100644 index 0000000000..47a1f9bde8 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/BComponentWrongTargetImpl.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.itest.references; + +import org.oasisopen.sca.annotation.Reference; + +public class BComponentWrongTargetImpl implements BComponent { + + protected CComponent cReference; + + public BComponentWrongTargetImpl(@Reference(name = "cReference") CComponent cReference) { + this.cReference = cReference; + } + + public String bFoo() { + return "BComponentWrongTarget"; + } + + public String fooC() { + return "B" + cReference.cFoo(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponent.java b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponent.java new file mode 100644 index 0000000000..d436c28adc --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponent.java @@ -0,0 +1,24 @@ +/* + * 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.references; + +public interface CComponent { + + String cFoo(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponentImpl.java new file mode 100644 index 0000000000..a1823e1cdc --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/CComponentImpl.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.references; + +public class CComponentImpl implements CComponent { + + public String cFoo() { + return "CComponent"; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java new file mode 100644 index 0000000000..80617bdec2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponent.java @@ -0,0 +1,26 @@ +/* + * 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.references; + +public interface DComponent { + + String dFoo(); + + String getComponentName(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponentImpl.java new file mode 100644 index 0000000000..d181ac96ca --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/java/org/apache/tuscany/sca/itest/references/DComponentImpl.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.itest.references; + +import org.oasisopen.sca.annotation.ComponentName; + +public class DComponentImpl implements DComponent { + @ComponentName + public String name; + + public String dFoo() { + return "DComponent"; + } + + public String getComponentName() { + return name; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/references/src/main/resources/AutoWiredReferencesTest.composite b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/resources/AutoWiredReferencesTest.composite new file mode 100644 index 0000000000..3934025e64 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/resources/AutoWiredReferencesTest.composite @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/references/src/main/resources/InnerReferencesTest.composite b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/resources/InnerReferencesTest.composite new file mode 100644 index 0000000000..871a846edf --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/resources/InnerReferencesTest.composite @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/references/src/main/resources/ManualWiredReferencesTest.composite b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/resources/ManualWiredReferencesTest.composite new file mode 100644 index 0000000000..52d6fe48c1 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/references/src/main/resources/ManualWiredReferencesTest.composite @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java new file mode 100644 index 0000000000..76264d308f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/AutoWiredReferenceTestCase.java @@ -0,0 +1,114 @@ +/* + * 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.references; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.oasisopen.sca.ServiceUnavailableException; + +public class AutoWiredReferenceTestCase { + private static Node node; + private static AComponent acomponent; + private static AComponent acomponentAutowire; + + @BeforeClass + public static void init() throws Exception { + try { + String location = ContributionLocationHelper.getContributionLocation("AutoWiredReferencesTest.composite"); + node = + NodeFactory.newInstance().createNode("AutoWiredReferencesTest.composite", + new Contribution("c1", location)); + node.start(); + acomponent = node.getService(AComponent.class, "AComponent"); + acomponentAutowire = node.getService(AComponent.class, "AComponentAutowire"); + } catch (Throwable e) { + e.printStackTrace(); + } + } + + @AfterClass + public static void destroy() throws Exception { + node.stop(); + } + + @Test + public void testBReference() { + assertEquals("BComponent", acomponent.fooB()); + } + + @Test + public void testCReference() { + assertEquals("CComponent", acomponent.fooC()); + } + + @Test + public void testBCReference() { + assertEquals("BCComponent", acomponent.fooBC()); + } + + @Test(expected = Exception.class) + public void testD1Reference() { + acomponent.fooD1(); + } + + @Test + public void testD2Reference() { + assertEquals("DComponent", acomponent.fooD2()); + } + + @Test + public void testMultiDReferenceArray() { + String components = acomponent.fooMultipleDArray(); + Assert.assertTrue(components.contains("DComponent1")); + } + + @Test + public void testMultiDServiceReference() { + String components = acomponent.fooMultipleDServiceRef(); + Assert.assertTrue(components.contains("DComponent")); + Assert.assertTrue(components.contains("DComponent1")); + } + + @Test + public void testRequiredFalseReference() { + try { + acomponent.getDReference().dFoo(); + } catch (Exception e) { + Assert.assertTrue(true); + } + } + + @Test + public void testTargetPrecendence() { + try { + assertEquals("BComponent", acomponentAutowire.fooB()); + } catch (Exception e) { + Assert.assertTrue(true); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java new file mode 100644 index 0000000000..6e4212fd9a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/InnerReferenceTestCase.java @@ -0,0 +1,99 @@ +/* + * 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.references; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class InnerReferenceTestCase { + private static Node node; + private static AComponent acomponent; + + @BeforeClass + public static void init() throws Exception { + String location = ContributionLocationHelper.getContributionLocation("InnerReferencesTest.composite"); + node = NodeFactory.newInstance().createNode("InnerReferencesTest.composite", new Contribution("c1", location)); + node.start(); + acomponent = node.getService(AComponent.class, "AComponent"); + } + + @AfterClass + public static void destroy() throws Exception { + node.stop(); + } + + @Test + public void testBReference() { + assertEquals("BComponent", acomponent.fooB()); + } + + @Test + public void testCReference() { + assertEquals("CComponent", acomponent.fooC()); + } + + @Test + public void testBCReference() { + assertEquals("BCComponent", acomponent.fooBC()); + } + + @Test + public void testD1Reference() { + assertEquals("DComponent", acomponent.fooD1()); + } + + @Test + public void testD2Reference() { + assertEquals("DComponent", acomponent.fooD2()); + } + + @Test + public void testMultiDReference() { + String components = acomponent.fooMultipleD(); + Assert.assertTrue(components.contains("DComponent")); + Assert.assertTrue(components.contains("DComponent1")); + } + + @Test + public void testMultiDReferenceArray() { + String components = acomponent.fooMultipleDArray(); + Assert.assertTrue(components.equals("DComponent1")); + } + + @Test + public void testMultiDServiceReference() { + String components = acomponent.fooMultipleDServiceRef(); + Assert.assertTrue(components.contains("DComponent")); + Assert.assertTrue(components.contains("DComponent1")); + } + + @Test(expected = Exception.class) + public void testRequiredFalseReference() { + acomponent.getDReference().dFoo(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/ManualWiredReferenceTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/ManualWiredReferenceTestCase.java new file mode 100644 index 0000000000..2fce95401e --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/references/src/test/java/org/apache/tuscany/sca/itest/references/ManualWiredReferenceTestCase.java @@ -0,0 +1,97 @@ +/* + * 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.references; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +public class ManualWiredReferenceTestCase { + private static Node node; + private static AComponent acomponent; + + @BeforeClass + public static void init() throws Exception { + String location = ContributionLocationHelper.getContributionLocation("ManualWiredReferencesTest.composite"); + node = NodeFactory.newInstance().createNode("ManualWiredReferencesTest.composite", new Contribution("c1", location)); + node.start(); + acomponent = node.getService(AComponent.class, "AComponent"); + } + + @AfterClass + public static void destroy() throws Exception { + node.stop(); + } + + @Test + public void testBReference() { + assertEquals("BComponent", acomponent.fooB()); + } + + @Test + public void testCReference() { + assertEquals("CComponent", acomponent.fooC()); + } + + @Test + public void testBCReference() { + assertEquals("BCComponent", acomponent.fooBC()); + } + + @Test + public void testD1Reference() { + acomponent.fooD1(); + } + + @Test + public void testD2Reference() { + assertEquals("DComponent", acomponent.fooD2()); + } + + @Test + public void testMultiDReferenceArray() { + String components = acomponent.fooMultipleDArray(); + Assert.assertTrue(components.contains("DComponent1")); + } + + @Test + public void testMultiDServiceReference() { + String components = acomponent.fooMultipleDServiceRef(); + Assert.assertTrue(components.contains("DComponent")); + Assert.assertTrue(components.contains("DComponent1")); + } + + @Test + public void testRequiredFalseReference() { + try { + acomponent.getDReference().dFoo(); + } catch (Exception e) { + Assert.assertTrue(true); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/scaclient-api/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/scaclient-api/pom.xml new file mode 100644 index 0000000000..48f14e6875 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/scaclient-api/pom.xml @@ -0,0 +1,46 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-scaclient-api + Apache Tuscany SCA iTest SCAClient API + + + + org.apache.tuscany.sca + tuscany-sca-client-impl + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + runtime + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/scaclient-api/src/main/java/itest/HelloworldService.java b/tags/java/sca/2.0-M4-RC2/itest/scaclient-api/src/main/java/itest/HelloworldService.java new file mode 100644 index 0000000000..1c7edaefb6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/scaclient-api/src/main/java/itest/HelloworldService.java @@ -0,0 +1,25 @@ +/* + * 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; + +public interface HelloworldService { + + String sayHello(String name); + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/scaclient-api/src/main/java/itest/HelloworldServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/scaclient-api/src/main/java/itest/HelloworldServiceImpl.java new file mode 100644 index 0000000000..4b9910bb21 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/scaclient-api/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(sayHello("world")); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/scaclient-api/src/main/resources/Helloworld.composite b/tags/java/sca/2.0-M4-RC2/itest/scaclient-api/src/main/resources/Helloworld.composite new file mode 100644 index 0000000000..3f0e0a164c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/scaclient-api/src/main/resources/Helloworld.composite @@ -0,0 +1,29 @@ + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/scaclient-api/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/scaclient-api/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..d8604a5cc0 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/scaclient-api/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.java new file mode 100644 index 0000000000..a331e4dd22 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/scaclient-api/src/test/java/test/scaclient/SCAClientTestCase.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 test.scaclient; + +import itest.HelloworldService; +import junit.framework.TestCase; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.oasisopen.sca.client.SCAClient; +import org.oasisopen.sca.client.SCAClientFactory; + +/** + * Test SCADomain.newInstance and invocation of a service. + * + * @version $Rev$ $Date$ + */ +public class SCAClientTestCase extends TestCase { + + private Node node; + + @Override + protected void setUp() throws Exception { + node = NodeFactory.newInstance().createNode(); + node.start(); + } + + public void testInvoke() throws Exception { + HelloworldService service = + SCAClientFactory.newInstance(null).getService(HelloworldService.class, "HelloworldComponent"); + assertEquals("Hello petra", service.sayHello("petra")); + } + + public void testSimpleAPI() throws Exception { + HelloworldService service = SCAClient.getService(HelloworldService.class, "/HelloworldComponent"); + assertEquals("Hello petra", service.sayHello("petra")); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/scdl/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/scdl/pom.xml new file mode 100644 index 0000000000..21ded9671c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/scdl/pom.xml @@ -0,0 +1,79 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + + itest-scdl + Apache Tuscany SCA iTest SCDL + + + + org.apache.tuscany.sca + tuscany-deployment + 2.0-M4 + + + org.apache.tuscany.sca + tuscany-implementation-java + 2.0-M4 + + + org.apache.tuscany.sca + tuscany-binding-jsonp + 2.0-M4 + + + org.apache.tuscany.sca + tuscany-binding-rmi + 2.0-M4 + + + org.apache.tuscany.sca + tuscany-binding-jms + 2.0-M4 + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy + compile + + copy-dependencies + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/scdl/src/test/java/org/apache/tuscany/sca/itest/scdl/ContributionTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/scdl/src/test/java/org/apache/tuscany/sca/itest/scdl/ContributionTestCase.java new file mode 100644 index 0000000000..c56545dd3b --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/scdl/src/test/java/org/apache/tuscany/sca/itest/scdl/ContributionTestCase.java @@ -0,0 +1,80 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.itest.scdl; + +import java.io.File; +import java.net.URL; +import java.util.Arrays; +import java.util.List; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.assembly.Component; +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.assembly.Implementation; +import org.apache.tuscany.sca.assembly.Reference; +import org.apache.tuscany.sca.contribution.Contribution; +import org.apache.tuscany.sca.deployment.DefaultDeployer; +import org.apache.tuscany.sca.deployment.Deployer; +import org.apache.tuscany.sca.implementation.java.JavaImplementation; +import org.apache.tuscany.sca.monitor.Monitor; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Test case for reading and writing SCDL + */ +public class ContributionTestCase { + + @Test + public void testRead() throws Exception { + Deployer deployer = new DefaultDeployer(); + File file = new File("../../samples/calculator/target/sample-calculator.jar"); + URL url = file.toURI().toURL(); + Monitor monitor = deployer.createMonitor(); + Contribution contribution = deployer.loadContribution(url.toURI(), url, monitor); + deployer.build(Arrays.asList(contribution), null, monitor); + + // Ferkle around in the contribution verifying it looks as expected + Assert.assertNotNull(contribution); + List deployables = contribution.getDeployables(); + Assert.assertEquals(1, deployables.size()); + Composite calculatorComposte = deployables.get(0); + Assert.assertEquals("Calculator", calculatorComposte.getName().getLocalPart()); + Assert.assertEquals(5, calculatorComposte.getComponents().size()); + Component calcComp = calculatorComposte.getComponent("CalculatorServiceComponent"); + Assert.assertNotNull(calcComp); + Assert.assertEquals(4, calcComp.getReferences().size()); + Reference ref = calcComp.getReference("addService"); + Assert.assertEquals("AddServiceComponent", ref.getTargets().get(0).getName()); + Implementation impl = calcComp.getImplementation(); + Assert.assertTrue(impl instanceof JavaImplementation); + Assert.assertEquals("calculator.CalculatorServiceImpl", ((JavaImplementation)impl).getJavaClass().getName()); + } + + @Before + public void setUp() throws Exception { + } + + @After + public void tearDown() throws Exception { + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/scdl/src/test/java/org/apache/tuscany/sca/itest/scdl/SCDLTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/scdl/src/test/java/org/apache/tuscany/sca/itest/scdl/SCDLTestCase.java new file mode 100644 index 0000000000..18fb9394bf --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/scdl/src/test/java/org/apache/tuscany/sca/itest/scdl/SCDLTestCase.java @@ -0,0 +1,87 @@ +/* + * 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.scdl; + +import java.net.URL; + +import javax.xml.stream.XMLStreamException; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.assembly.Component; +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.assembly.Service; +import org.apache.tuscany.sca.binding.jms.JMSBinding; +import org.apache.tuscany.sca.binding.jsonp.JSONPBinding; +import org.apache.tuscany.sca.binding.rmi.RMIBinding; +import org.apache.tuscany.sca.contribution.processor.ContributionReadException; +import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.deployment.Deployer; +import org.junit.Test; + +/** + * Test case for reading and writing a composite + */ +public class SCDLTestCase { + + @Test + public void testRead() throws ContributionReadException, XMLStreamException { + ExtensionPointRegistry registry = new DefaultExtensionPointRegistry(); + Deployer deployer = registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Deployer.class); + + URL r = getClass().getResource("/test.composite"); + Composite composite = deployer.loadXMLDocument(r, null); + Assert.assertNotNull(composite); + + Component JavaComp = composite.getComponent("JavaComponent"); + Assert.assertNotNull(JavaComp); + + Component bpelComp = composite.getComponent("BPELComponent"); + Assert.assertNotNull(bpelComp); + + Service jsonpService = composite.getService("JSONPService"); + Assert.assertNotNull(jsonpService); + Assert.assertEquals(1, jsonpService.getBindings().size()); + JSONPBinding jsonpBinding = jsonpService.getBinding(JSONPBinding.class); + Assert.assertNotNull(jsonpBinding); + + Service jmsService = composite.getService("JMSService"); + Assert.assertNotNull(jmsService); + Assert.assertEquals(1, jmsService.getBindings().size()); + JMSBinding jmsBinding = jmsService.getBinding(JMSBinding.class); + Assert.assertNotNull(jmsBinding); + + Service rmiService = composite.getService("RMIService"); + Assert.assertNotNull(rmiService); + Assert.assertEquals(1, rmiService.getBindings().size()); + RMIBinding rmiBinding = rmiService.getBinding(RMIBinding.class); + Assert.assertNotNull(rmiBinding); + +// TODO: WS binding drags in entire runtime +// Service wsService = composite.getService("WSService"); +// Assert.assertNotNull(wsService); +// Assert.assertEquals(1, wsService.getBindings().size()); +// WSBinding wsBinding = wsService.getBinding(WSBinding.class); +// Assert.assertNotNull(wsBinding); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/scdl/src/test/java/org/apache/tuscany/sca/itest/scdl/ValidateDependenciesTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/scdl/src/test/java/org/apache/tuscany/sca/itest/scdl/ValidateDependenciesTestCase.java new file mode 100644 index 0000000000..44695e5dde --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/scdl/src/test/java/org/apache/tuscany/sca/itest/scdl/ValidateDependenciesTestCase.java @@ -0,0 +1,73 @@ +/* + * 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.scdl; + +import java.io.File; + +import junit.framework.Assert; + +import org.junit.Test; + +/** + * Test case for verifying only SCDL jars are needed + * + * Uses maven-dependency-plugin config in the pom.xml + * + * Current required jars are: + * geronimo-stax-api_1.0_spec-1.0.1.jar + * jsr181-api-1.0-MR1.jar + * junit-4.5.jar + * tuscany-assembly-2.0-SNAPSHOT.jar + * tuscany-assembly-xml-2.0-SNAPSHOT.jar + * tuscany-assembly-xsd-2.0-SNAPSHOT.jar + * tuscany-binding-jms-2.0-SNAPSHOT.jar + * tuscany-binding-jsonp-2.0-SNAPSHOT.jar + * tuscany-binding-rmi-2.0-SNAPSHOT.jar + * tuscany-binding-ws-2.0-SNAPSHOT.jar + * tuscany-common-java-2.0-SNAPSHOT.jar + * tuscany-common-xml-2.0-SNAPSHOT.jar + * tuscany-contribution-2.0-SNAPSHOT.jar + * tuscany-extensibility-2.0-SNAPSHOT.jar + * tuscany-implementation-bpel-2.0-SNAPSHOT.jar + * tuscany-implementation-java-2.0-SNAPSHOT.jar + * tuscany-interface-java-2.0-SNAPSHOT.jar + * tuscany-interface-wsdl-2.0-SNAPSHOT.jar + * tuscany-monitor-2.0-SNAPSHOT.jar + * tuscany-sca-api-2.0-SNAPSHOT.jar + * tuscany-scdl-2.0-SNAPSHOT.jar + * tuscany-xsd-2.0-SNAPSHOT.jar + * wsdl4j-1.6.2.jar + * wstx-asl-3.2.4.jar + * XmlSchema-1.4.2.jar + * + * TODO: WS binding drags in all runtime + */ +public class ValidateDependenciesTestCase { + + @Test + public void countDependencies() { + + File dependenciesDir = new File("target/dependency"); + Assert.assertTrue(dependenciesDir.exists()); + + File[] dependencyFiles = dependenciesDir.listFiles(); + Assert.assertEquals(20, dependencyFiles.length); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/scdl/src/test/resources/test.composite b/tags/java/sca/2.0-M4-RC2/itest/scdl/src/test/resources/test.composite new file mode 100644 index 0000000000..aa11c0d092 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/scdl/src/test/resources/test.composite @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/scopes/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/scopes/pom.xml new file mode 100644 index 0000000000..50b70cf391 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/scopes/pom.xml @@ -0,0 +1,54 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + Apache Tuscany SCA iTest Scopes + itest-scopes + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + test + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/CompositeScopeStateVerifierImpl.java b/tags/java/sca/2.0-M4-RC2/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/CompositeScopeStateVerifierImpl.java new file mode 100644 index 0000000000..208ac3ba44 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/CompositeScopeStateVerifierImpl.java @@ -0,0 +1,46 @@ +/* + * 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.scopes; + +import org.oasisopen.sca.annotation.Scope; + +/** + * Test Composite scope + */ +@Scope("COMPOSITE") +public class CompositeScopeStateVerifierImpl implements StateVerifier { + + // State data for this module (composite). + // In order to support thread-based state verification, + // the module state needs to be a ThreadLocal. + ThreadLocal moduleState; + + public CompositeScopeStateVerifierImpl() { + moduleState = new ThreadLocal(); + } + + public void setState(int i) { + moduleState.set(i); + } + + public boolean checkState(int i) { + return (moduleState.get() == i); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/StateVerifier.java b/tags/java/sca/2.0-M4-RC2/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/StateVerifier.java new file mode 100644 index 0000000000..e6bf08ccf2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/scopes/src/main/java/org/apache/tuscany/sca/itest/scopes/StateVerifier.java @@ -0,0 +1,25 @@ +/* + * 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.scopes; + +public interface StateVerifier { + void setState(int i); + + boolean checkState(int i); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/scopes/src/main/resources/scopes.composite b/tags/java/sca/2.0-M4-RC2/itest/scopes/src/main/resources/scopes.composite new file mode 100644 index 0000000000..83a71218f5 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/scopes/src/main/resources/scopes.composite @@ -0,0 +1,29 @@ + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.java new file mode 100644 index 0000000000..594bdd5038 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/scopes/src/test/java/org/apache/tuscany/sca/test/ScopeTestCase.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 org.apache.tuscany.sca.test; + +import static org.junit.Assert.fail; + +import org.apache.tuscany.sca.itest.scopes.StateVerifier; +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class ScopeTestCase { + + /** + * Number of threads to drive each scope container. + */ + private static final int NUM_THREADS = 4; + + /** + * Number of iterations per thread. + */ + private static final int ITERATIONS = 200; + + private Node node; + + @Before + public void setUp() throws Exception { + String location = ContributionLocationHelper.getContributionLocation("scopes.composite"); + node = NodeFactory.newInstance().createNode("scopes.composite", new Contribution("c1", location)); + node.start(); + } + + @After + public void tearDown() throws Exception { + node.stop(); + } + + @Test + public void testScopes() throws InterruptedException { + + Thread[] moduleScopeThreadTable = new Thread[NUM_THREADS]; + + for (int i = 0; i < NUM_THREADS; i++) { + moduleScopeThreadTable[i] = new ModuleScopeTestThread(); + } + for (int j = 0; j < NUM_THREADS; j++) { + moduleScopeThreadTable[j].start(); + } + for (int k = 0; k < NUM_THREADS; k++) { + moduleScopeThreadTable[k].join(); + } + } + + private class ModuleScopeTestThread extends Thread { + + public void run() { + StateVerifier moduleScopeService = node.getService(StateVerifier.class, "ModuleScopeComponent"); + for (int i = 1; i <= ITERATIONS; i++) { + moduleScopeService.setState(i); + if (!moduleScopeService.checkState(i)) { + fail("The module scope service lost its state on iteration " + i); + } + } + } + } + + + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/service-reference/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/service-reference/pom.xml new file mode 100644 index 0000000000..dab9279fb6 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/service-reference/pom.xml @@ -0,0 +1,66 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-service-reference + Apache Tuscany SCA iTest ServiceReference + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-M4 + test + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponent.java b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponent.java new file mode 100644 index 0000000000..8b5cf4d29a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponent.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.itest.serviceref; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface AComponent { + String foo(); + + String fooB(); + String fooB1(); + + String fooC(); + String fooC1(); + + String fooStringD(); + String fooD(); + + String fooBC(); + + String invokeDReference(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponentImpl.java new file mode 100644 index 0000000000..3f68ac828a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/AComponentImpl.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 org.apache.tuscany.sca.itest.serviceref; + +import java.io.ByteArrayOutputStream; +import java.io.ObjectOutputStream; + +import org.oasisopen.sca.ComponentContext; +import org.oasisopen.sca.ServiceReference; +import org.oasisopen.sca.annotation.Context; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +@Service(AComponent.class) +public class AComponentImpl implements AComponent { + + @Context + protected ComponentContext componentContext; + + @Reference(name = "bReference") + protected BComponent b; + + @Reference + protected CComponent cReference; + + @Reference + protected ServiceReference cServiceReference; + + @Reference(required=false) + protected DComponent dReference; + + protected DComponent dReference1; + + @Reference(name = "dReference1") + public void setDReference(DComponent dReference) { + this.dReference1 = dReference; + } + + public String foo() { + return "AComponent"; + } + + public String fooB() { + return b.foo(); + } + + public String fooB1() { + ServiceReference bRef = componentContext.cast(b); + return bRef.getService().foo(); + } + + public String fooC() { + return cReference.foo(); + } + + public String fooC1() { + return cServiceReference.getService().foo(); + } + + public String fooBC() { + ServiceReference cReference = componentContext.getServiceReference(CComponent.class, "cReference"); + return b.fooC(cReference); + } + + public String fooD() { + ServiceReference aReference = componentContext.createSelfReference(AComponent.class); + return dReference1.foo(aReference); + } + + /** + * A test case to work out what needs to be done in a transformer to get the + * CallableReference across the wire. Left here for interest in case anyone + * is looking for how to get at the innards of CallableReferences + */ + public String fooStringD() { + ServiceReference aReference = componentContext.createSelfReference(AComponent.class); + ByteArrayOutputStream bos = null; + + try { + bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(bos); + oos.writeObject(aReference); + } catch (Exception ex) { + System.out.println(ex.toString()); + return null; + } + + String aReferenceString = Base64Binary.encode(bos.toByteArray()); + return dReference1.fooString(aReferenceString); + } + + public String invokeDReference() { + return dReference.foo(null); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponent.java b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponent.java new file mode 100644 index 0000000000..18242cd594 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponent.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.itest.serviceref; + +import org.oasisopen.sca.ServiceReference; +import org.oasisopen.sca.annotation.Remotable; + + +@Remotable +public interface BComponent { + + String foo(); + + String fooC(ServiceReference cComponent); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponentImpl.java new file mode 100644 index 0000000000..dd143df036 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/BComponentImpl.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.serviceref; + +import org.oasisopen.sca.ServiceReference; +import org.oasisopen.sca.annotation.Service; + +@Service(BComponent.class) +public class BComponentImpl implements BComponent { + + public BComponentImpl() { + } + + public String foo() { + return "BComponent"; + } + + public String fooC(ServiceReference cReference) { + return "B" + cReference.getService().foo(); + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/Base64Binary.java b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/Base64Binary.java new file mode 100644 index 0000000000..fb436ae10c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/Base64Binary.java @@ -0,0 +1,297 @@ +/* + * 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.serviceref; + +import java.io.IOException; +import java.io.OutputStream; +import java.io.Writer; + +/** + * + */ + +public final class Base64Binary { + private static final char[] S_BASE64CHAR = + {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', + 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', + 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'}; + + private static final char S_BASE64PAD = '='; + + private static final byte[] S_DECODETABLE = new byte[128]; + + static { + for (int i = 0; i < S_DECODETABLE.length; i++) { + S_DECODETABLE[i] = Byte.MAX_VALUE; // 127 + } + for (int i = 0; i < S_BASE64CHAR.length; i++) { + // 0 to 63 + S_DECODETABLE[S_BASE64CHAR[i]] = (byte)i; + } + } + + private Base64Binary() { + } + + /** + * + */ + public static byte[] decode(char[] data, int off, int len) { + char[] ibuf = new char[4]; + int ibufcount = 0; + byte[] obuf = new byte[len / 4 * 3 + 3]; + int obufcount = 0; + for (int i = off; i < off + len; i++) { + char ch = data[i]; + if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) { + ibuf[ibufcount++] = ch; + if (ibufcount == ibuf.length) { + ibufcount = 0; + obufcount += decode0(ibuf, obuf, obufcount); + } + } + } + if (obufcount == obuf.length) { + return obuf; + } + byte[] ret = new byte[obufcount]; + System.arraycopy(obuf, 0, ret, 0, obufcount); + return ret; + } + + /** + * + */ + public static void decode(char[] data, int off, int len, OutputStream ostream) throws IOException { + char[] ibuf = new char[4]; + int ibufcount = 0; + byte[] obuf = new byte[3]; + for (int i = off; i < off + len; i++) { + char ch = data[i]; + if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) { + ibuf[ibufcount++] = ch; + if (ibufcount == ibuf.length) { + ibufcount = 0; + int obufcount = decode0(ibuf, obuf, 0); + ostream.write(obuf, 0, obufcount); + } + } + } + } + + /** + * + */ + public static byte[] decode(String data) { + char[] ibuf = new char[4]; + int ibufcount = 0; + byte[] obuf = new byte[data.length() / 4 * 3 + 3]; + int obufcount = 0; + for (int i = 0; i < data.length(); i++) { + char ch = data.charAt(i); + if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) { + ibuf[ibufcount++] = ch; + if (ibufcount == ibuf.length) { + ibufcount = 0; + obufcount += decode0(ibuf, obuf, obufcount); + } + } + } + if (obufcount == obuf.length) { + return obuf; + } + byte[] ret = new byte[obufcount]; + System.arraycopy(obuf, 0, ret, 0, obufcount); + return ret; + } + + /** + * + */ + public static void decode(String data, OutputStream ostream) throws IOException { + char[] ibuf = new char[4]; + int ibufcount = 0; + byte[] obuf = new byte[3]; + for (int i = 0; i < data.length(); i++) { + char ch = data.charAt(i); + if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) { + ibuf[ibufcount++] = ch; + if (ibufcount == ibuf.length) { + ibufcount = 0; + int obufcount = decode0(ibuf, obuf, 0); + ostream.write(obuf, 0, obufcount); + } + } + } + } + + private static int decode0(char[] ibuf, byte[] obuf, int index) { + int wp = index; + int outlen = 3; + if (ibuf[3] == S_BASE64PAD) { + outlen = 2; + } + if (ibuf[2] == S_BASE64PAD) { + outlen = 1; + } + int b0 = S_DECODETABLE[ibuf[0]]; + int b1 = S_DECODETABLE[ibuf[1]]; + int b2 = S_DECODETABLE[ibuf[2]]; + int b3 = S_DECODETABLE[ibuf[3]]; + switch (outlen) { + case 1: + obuf[wp] = (byte)(b0 << 2 & 0xfc | b1 >> 4 & 0x3); + return 1; + case 2: + obuf[wp++] = (byte)(b0 << 2 & 0xfc | b1 >> 4 & 0x3); + obuf[wp] = (byte)(b1 << 4 & 0xf0 | b2 >> 2 & 0xf); + return 2; + case 3: + obuf[wp++] = (byte)(b0 << 2 & 0xfc | b1 >> 4 & 0x3); + obuf[wp++] = (byte)(b1 << 4 & 0xf0 | b2 >> 2 & 0xf); + obuf[wp] = (byte)(b2 << 6 & 0xc0 | b3 & 0x3f); + return 3; + default: + throw new IllegalArgumentException("The character sequence is not base64 encoded."); + } + } + + /** + * Returns base64 representation of specified byte array. + */ + public static String encode(byte[] data) { + return encode(data, 0, data.length); + } + + /** + * Returns base64 representation of specified byte array. + */ + public static String encode(byte[] data, int off, int len) { + if (len <= 0) { + return ""; + } + char[] out = new char[len / 3 * 4 + 4]; + int rindex = off; + int windex = 0; + int rest = len - off; + while (rest >= 3) { + int i = ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8) + (data[rindex + 2] & 0xff); + out[windex++] = S_BASE64CHAR[i >> 18]; + out[windex++] = S_BASE64CHAR[(i >> 12) & 0x3f]; + out[windex++] = S_BASE64CHAR[(i >> 6) & 0x3f]; + out[windex++] = S_BASE64CHAR[i & 0x3f]; + rindex += 3; + rest -= 3; + } + if (rest == 1) { + int i = data[rindex] & 0xff; + out[windex++] = S_BASE64CHAR[i >> 2]; + out[windex++] = S_BASE64CHAR[(i << 4) & 0x3f]; + out[windex++] = S_BASE64PAD; + out[windex++] = S_BASE64PAD; + } else if (rest == 2) { + int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff); + out[windex++] = S_BASE64CHAR[i >> 10]; + out[windex++] = S_BASE64CHAR[(i >> 4) & 0x3f]; + out[windex++] = S_BASE64CHAR[(i << 2) & 0x3f]; + out[windex++] = S_BASE64PAD; + } + return new String(out, 0, windex); + } + + /** + * Outputs base64 representation of the specified byte array to a byte stream. + */ + public static void encode(byte[] data, int off, int len, OutputStream ostream) throws IOException { + if (len <= 0) { + return; + } + byte[] out = new byte[4]; + int rindex = off; + int rest = len - off; + while (rest >= 3) { + int i = ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8) + (data[rindex + 2] & 0xff); + out[0] = (byte)S_BASE64CHAR[i >> 18]; + out[1] = (byte)S_BASE64CHAR[(i >> 12) & 0x3f]; + out[2] = (byte)S_BASE64CHAR[(i >> 6) & 0x3f]; + out[3] = (byte)S_BASE64CHAR[i & 0x3f]; + ostream.write(out, 0, 4); + rindex += 3; + rest -= 3; + } + if (rest == 1) { + int i = data[rindex] & 0xff; + out[0] = (byte)S_BASE64CHAR[i >> 2]; + out[1] = (byte)S_BASE64CHAR[(i << 4) & 0x3f]; + out[2] = (byte)S_BASE64PAD; + out[3] = (byte)S_BASE64PAD; + ostream.write(out, 0, 4); + } else if (rest == 2) { + int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff); + out[0] = (byte)S_BASE64CHAR[i >> 10]; + out[1] = (byte)S_BASE64CHAR[(i >> 4) & 0x3f]; + out[2] = (byte)S_BASE64CHAR[(i << 2) & 0x3f]; + out[3] = (byte)S_BASE64PAD; + ostream.write(out, 0, 4); + } + } + + /** + * Outputs base64 representation of the specified byte array to a character stream. + */ + public static void encode(byte[] data, int off, int len, Writer writer) throws IOException { + if (len <= 0) { + return; + } + char[] out = new char[4]; + int rindex = off; + int rest = len - off; + int output = 0; + while (rest >= 3) { + int i = ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8) + (data[rindex + 2] & 0xff); + out[0] = S_BASE64CHAR[i >> 18]; + out[1] = S_BASE64CHAR[(i >> 12) & 0x3f]; + out[2] = S_BASE64CHAR[(i >> 6) & 0x3f]; + out[3] = S_BASE64CHAR[i & 0x3f]; + writer.write(out, 0, 4); + rindex += 3; + rest -= 3; + output += 4; + if (output % 76 == 0) { + writer.write("\n"); + } + } + if (rest == 1) { + int i = data[rindex] & 0xff; + out[0] = S_BASE64CHAR[i >> 2]; + out[1] = S_BASE64CHAR[(i << 4) & 0x3f]; + out[2] = S_BASE64PAD; + out[3] = S_BASE64PAD; + writer.write(out, 0, 4); + } else if (rest == 2) { + int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff); + out[0] = S_BASE64CHAR[i >> 10]; + out[1] = S_BASE64CHAR[(i >> 4) & 0x3f]; + out[2] = S_BASE64CHAR[(i << 2) & 0x3f]; + out[3] = S_BASE64PAD; + writer.write(out, 0, 4); + } + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponent.java b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponent.java new file mode 100644 index 0000000000..fc15b632d2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponent.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.serviceref; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface CComponent { + + String foo(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponentImpl.java new file mode 100644 index 0000000000..276093b69f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/CComponentImpl.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.itest.serviceref; + +import org.oasisopen.sca.annotation.Service; + +@Service(CComponent.class) +public class CComponentImpl implements CComponent { + + public String foo() { + return "CComponent"; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponent.java b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponent.java new file mode 100644 index 0000000000..84e15b5eb2 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponent.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.itest.serviceref; + +import org.oasisopen.sca.ServiceReference; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface DComponent { + + String foo(ServiceReference aReference); + + String fooString(String aReferenceString); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponentImpl.java new file mode 100644 index 0000000000..db99472385 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/java/org/apache/tuscany/sca/itest/serviceref/DComponentImpl.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.serviceref; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; + +import org.oasisopen.sca.RequestContext; +import org.oasisopen.sca.ServiceReference; +import org.oasisopen.sca.annotation.Context; +import org.oasisopen.sca.annotation.Service; + +@Service(DComponent.class) +public class DComponentImpl implements DComponent { + + @Context + protected RequestContext requestContext; + + public String foo(ServiceReference aReference) { + try { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(bos); + oos.writeObject(aReference); + ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray())); + Object obj = ois.readObject(); + aReference = (ServiceReference) obj; + } catch (Exception e) { + e.printStackTrace(); + } + System.out.println("Invoking service: " + requestContext.getServiceName()); + return "D" + aReference.getService().foo(); + } + + public String fooString(String aReferenceString) { + ServiceReference aReference = null; + try { + ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(Base64Binary.decode(aReferenceString))); + Object obj = ois.readObject(); + aReference = (ServiceReference) obj; + } catch (Exception e) { + e.printStackTrace(); + } + System.out.println("Invoking service: " + requestContext.getServiceName()); + return "D" + aReference.getService().foo(); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/resources/nodeA/CompositeA.composite b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/resources/nodeA/CompositeA.composite new file mode 100644 index 0000000000..fb88cd8bea --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/resources/nodeA/CompositeA.composite @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/resources/nodeB/CompositeB.composite b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/resources/nodeB/CompositeB.composite new file mode 100644 index 0000000000..06e4c63e94 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/resources/nodeB/CompositeB.composite @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/resources/servicereference/ServiceReferenceTest.composite b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/resources/servicereference/ServiceReferenceTest.composite new file mode 100644 index 0000000000..63302847b5 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/main/resources/servicereference/ServiceReferenceTest.composite @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/CallableReferenceRemoteTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/CallableReferenceRemoteTestCase.java new file mode 100644 index 0000000000..843afe207c --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/CallableReferenceRemoteTestCase.java @@ -0,0 +1,139 @@ +/* + * 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.serviceref; + +import static junit.framework.Assert.assertEquals; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.itest.serviceref.AComponent; +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; + + +/** + * Runs a distributed domain in a single VM by using and in memory + * implementation of the distributed domain + */ +public class CallableReferenceRemoteTestCase { + + private static Node nodeA; + private static Node nodeB; + + private static AComponent acomponent; + + @BeforeClass + public static void init() throws Exception { + + try { + + System.out.println("Setting up nodes"); + + NodeFactory nodeFactory = NodeFactory.newInstance(); + + nodeA = nodeFactory.createNode("nodeA/CompositeA.composite", new Contribution("contrib","target/classes")); + nodeA.start(); + + nodeB = nodeFactory.createNode("nodeB/CompositeB.composite", new Contribution("contrib","target/classes")); + nodeB.start(); + + acomponent = nodeA.getService(AComponent.class, "AComponent/AComponent"); + + } catch (Throwable ex) { + System.out.println(ex.toString()); + // Print detailed cause information. + ex.printStackTrace(); + StringBuffer sb = new StringBuffer(); + Throwable cause = ex.getCause(); + while ( cause != null ) { + sb.append( " " ); + System.out.println( sb.toString() + "Cause: " + cause ); + if (cause instanceof java.lang.reflect.InvocationTargetException) + System.out.println( sb.toString() + "Target Exception: " + ((java.lang.reflect.InvocationTargetException)cause).getTargetException() ); + cause = cause.getCause(); + } + } + } + + @AfterClass + public static void destroy() throws Exception { + // stop the nodes and hence the domains they contain + nodeA.stop(); + nodeB.stop(); + } + + //@Test + public void testKeepServerRunning1() throws Exception { + System.out.println("press enter to continue"); + System.in.read(); + } + + @Test + public void testBReference() { + assertEquals("BComponent", acomponent.fooB()); + } + + @Test + public void testBCast() { + assertEquals("BComponent", acomponent.fooB1()); + } + + @Test + public void testCReference() { + assertEquals("CComponent", acomponent.fooC()); + } + + @Test + public void testCServiceReference() { + assertEquals("CComponent", acomponent.fooC1()); + } + + @Test + public void testDReferenceString() { + assertEquals("DAComponent", acomponent.fooStringD()); + } + + @Test + @Ignore + public void testDReference() { + assertEquals("DAComponent", acomponent.fooD()); + } + + + @Test + @Ignore + public void testBCReference() { + assertEquals("BCComponent", acomponent.fooBC()); + } + + @Test + public void testRequiredFalseReference() { + try { + acomponent.invokeDReference(); + } catch (Exception e) { + Assert.assertTrue(true); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/ServiceReferenceTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/ServiceReferenceTestCase.java new file mode 100644 index 0000000000..1a454c939a --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/service-reference/src/test/java/org/apache/tuscany/sca/itest/serviceref/ServiceReferenceTestCase.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 org.apache.tuscany.sca.itest.serviceref; + +import static junit.framework.Assert.assertEquals; +import junit.framework.Assert; + +import org.apache.tuscany.sca.itest.serviceref.AComponent; +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 ServiceReferenceTestCase { + private static Node node; + private static AComponent acomponent; + + @BeforeClass + public static void init() throws Exception { + node = NodeFactory.newInstance().createNode("ServiceReferenceTest.composite", + new Contribution("contrib","src/main/resources/servicereference")); + node.start(); + acomponent = node.getService(AComponent.class, "AComponent"); + } + + @AfterClass + public static void destroy() throws Exception { + node.stop(); + } + + @Test + public void testBReference() { + assertEquals("BComponent", acomponent.fooB()); + } + + @Test + public void testBCast() { + assertEquals("BComponent", acomponent.fooB1()); + } + + @Test + public void testCReference() { + assertEquals("CComponent", acomponent.fooC()); + } + + @Test + public void testCServiceReference() { + assertEquals("CComponent", acomponent.fooC1()); + } + + @Test + public void testDReference() { + assertEquals("DAComponent", acomponent.fooD()); + } + + @Test + public void testBCReference() { + assertEquals("BCComponent", acomponent.fooBC()); + } + + @Test + public void testRequiredFalseReference() { + try { + acomponent.invokeDReference(); + } catch (Exception e) { + Assert.assertTrue(true); + } + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/services/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/services/pom.xml new file mode 100644 index 0000000000..940c540f03 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/services/pom.xml @@ -0,0 +1,53 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-services + Apache Tuscany SCA iTest Services + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + test + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.java b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.java new file mode 100644 index 0000000000..26e58dc530 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponent.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.services; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface AComponent { + String foo(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.java new file mode 100644 index 0000000000..627ff4976f --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/AComponentImpl.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 org.apache.tuscany.sca.itest.services; + +public class AComponentImpl implements AComponent { + + public String foo() { + return "AComponent"; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.java b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.java new file mode 100644 index 0000000000..d04bd1b985 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponent.java @@ -0,0 +1,25 @@ +/* + * 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.services; + +public interface BComponent { + + String foo(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.java new file mode 100644 index 0000000000..01df89a8fa --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/BComponentImpl.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.itest.services; + +import org.oasisopen.sca.annotation.Service; + +@Service(BComponent.class) +public class BComponentImpl implements BComponent { + + public String foo() { + return "BComponent"; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponent.java b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponent.java new file mode 100644 index 0000000000..07397e4502 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponent.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.services; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface CComponent { + String foo(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponentImpl.java new file mode 100644 index 0000000000..8713e5ab22 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/CComponentImpl.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 org.apache.tuscany.sca.itest.services; + +public class CComponentImpl implements CComponent { + + public String foo() { + return "CComponent"; + } + +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.java b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.java new file mode 100644 index 0000000000..842a85e000 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/D1Component.java @@ -0,0 +1,24 @@ +/* + * 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.services; + +public interface D1Component { + String foo1(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.java b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.java new file mode 100644 index 0000000000..8a3923b351 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponent.java @@ -0,0 +1,24 @@ +/* + * 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.services; + +public interface DComponent { + String foo(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponentImpl.java b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponentImpl.java new file mode 100644 index 0000000000..e52692fbf4 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/java/org/apache/tuscany/sca/itest/services/DComponentImpl.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 org.apache.tuscany.sca.itest.services; + +import org.oasisopen.sca.annotation.Service; + +@Service({DComponent.class, D1Component.class}) +public class DComponentImpl implements DComponent, D1Component { + + public String foo() { + return "DComponent"; + } + + public String foo1() { + return "DComponent"; + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/services/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e21261d8d0 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/services/src/main/resources/ServicesTest.composite b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/resources/ServicesTest.composite new file mode 100644 index 0000000000..e7d56032ea --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/services/src/main/resources/ServicesTest.composite @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tags/java/sca/2.0-M4-RC2/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java new file mode 100644 index 0000000000..da779b2c54 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/services/src/test/java/org/apache/tuscany/sca/itest/services/ServicesTestCase.java @@ -0,0 +1,108 @@ +/* + * 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.services; + +import static org.junit.Assert.assertEquals; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.oasisopen.sca.ServiceRuntimeException; + +public class ServicesTestCase { + private static Node node; + + @BeforeClass + public static void init() throws Exception { + String location = ContributionLocationHelper.getContributionLocation("ServicesTest.composite"); + node = NodeFactory.newInstance().createNode("ServicesTest.composite", new Contribution("c1", location)); + node.start(); + } + + @AfterClass + public static void destroy() throws Exception { + node.stop(); + } + + @Test + public void testAService() { + AComponent a1 = node.getService(AComponent.class, "AComponent1"); + assertEquals("AComponent", a1.foo()); + + AComponent a2 = node.getService(AComponent.class, "AComponent2/AComponent"); + assertEquals("AComponent", a2.foo()); + } + + @Test + public void testBService() { + BComponent a1 = node.getService(BComponent.class, "BComponent1"); + assertEquals("BComponent", a1.foo()); + + BComponent a2 = node.getService(BComponent.class, "BComponent2/BComponent"); + assertEquals("BComponent", a2.foo()); + } + + @Test + public void testCService() { + CComponent a1 = node.getService(CComponent.class, "CComponent1"); + assertEquals("CComponent", a1.foo()); + + CComponent a2 = node.getService(CComponent.class, "CComponent2/CComponent"); + assertEquals("CComponent", a2.foo()); + } + + @Test + public void testDService() { + DComponent a1 = node.getService(DComponent.class, "DComponent1/DComponent"); + assertEquals("DComponent", a1.foo()); + + D1Component a2 = node.getService(D1Component.class, "DComponent1/D1Component"); + assertEquals("DComponent", a2.foo1()); + + try { + node.getService(DComponent.class, "DComponent1"); + Assert.fail("The service name is required"); + } catch (ServiceRuntimeException e) { + Assert.assertTrue("The service name is required", true); + } + + DComponent a3 = node.getService(DComponent.class, "DComponent2/DComponent"); + assertEquals("DComponent", a3.foo()); + + D1Component a4 = node.getService(D1Component.class, "DComponent2/D1Component"); + assertEquals("DComponent", a4.foo1()); + + } + + public static void main(String[] args) throws Exception { + ServicesTestCase.init(); + ServicesTestCase tester = new ServicesTestCase(); + tester.testAService(); + tester.testBService(); + tester.testCService(); + tester.testDService(); + ServicesTestCase.destroy(); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/wires/pom.xml b/tags/java/sca/2.0-M4-RC2/itest/wires/pom.xml new file mode 100644 index 0000000000..48578c1bd5 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/wires/pom.xml @@ -0,0 +1,53 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M4 + ../pom.xml + + itest-wires + Apache Tuscany SCA iTest Wires Basic + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-M4 + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M4 + test + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M4 + test + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClient.java b/tags/java/sca/2.0-M4-RC2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClient.java new file mode 100644 index 0000000000..f5a4337254 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClient.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 org.apache.tuscany.sca.itest; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the client interface for the wires tests + */ +@Remotable +public interface WireClient { + + /** + * This tests the wires. + */ + void runTests(); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.java b/tags/java/sca/2.0-M4-RC2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.java new file mode 100644 index 0000000000..82f0e26d58 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireClientImpl.java @@ -0,0 +1,51 @@ +/* + * 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; + +import org.junit.Assert; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * This is the client implementation for the wires tests + */ +@Service(WireClient.class) +public class WireClientImpl implements WireClient { + /** + * This is our injected reference to the WireService + */ + @Reference + protected WireService aWireService; + + /** + * This tests the wire reference + */ + public void runTests() { + // Make sure the wire has injected a reference + Assert.assertNotNull(aWireService); + + // Test the injected reference + String msg = aWireService.sayHello("MCC"); + + // Validate the response + Assert.assertNotNull(msg); + Assert.assertEquals("Hello MCC", msg); + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireService.java b/tags/java/sca/2.0-M4-RC2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireService.java new file mode 100644 index 0000000000..67df1e3a52 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireService.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; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * Sample Wire Service + */ +@Remotable +public interface WireService { + /** + * Returns "Hello " + aName + * + * @param aName The name to say hello + * @return "Hello " + aName + */ + String sayHello(String aName); +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireServiceImpl.java b/tags/java/sca/2.0-M4-RC2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireServiceImpl.java new file mode 100644 index 0000000000..f0308252ba --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/wires/src/main/java/org/apache/tuscany/sca/itest/WireServiceImpl.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.itest; + +import org.oasisopen.sca.annotation.Service; + +/** + * Sample WireService Implementation + */ +@Service(WireService.class) +public class WireServiceImpl implements WireService { + + /** + * Returns "Hello " + aName + * + * @param aName The name to say hello + * @return "Hello " + aName + */ + public String sayHello(String aName) { + return "Hello " + aName; + } +} diff --git a/tags/java/sca/2.0-M4-RC2/itest/wires/src/main/resources/WireTest.composite b/tags/java/sca/2.0-M4-RC2/itest/wires/src/main/resources/WireTest.composite new file mode 100644 index 0000000000..614beaec00 --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/wires/src/main/resources/WireTest.composite @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/java/sca/2.0-M4-RC2/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.java b/tags/java/sca/2.0-M4-RC2/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.java new file mode 100644 index 0000000000..2a0095cabc --- /dev/null +++ b/tags/java/sca/2.0-M4-RC2/itest/wires/src/test/java/org/apache/tuscany/sca/itest/WireTestCase.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.itest; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * This test case will attempt to use a wire + */ +public class WireTestCase { + + /** + * The Node we are using + */ + private Node node; + + /** + * The client the tests should use + */ + private WireClient aWireClient; + + /** + * Run the wire tests + */ + @Test + public void testWire() { + aWireClient.runTests(); + } + + /** + * Load the Wire composite and look up the client. + */ + + @Before + public void setUp() throws Exception { + String location = ContributionLocationHelper.getContributionLocation("WireTest.composite"); + node = NodeFactory.newInstance().createNode("WireTest.composite", new Contribution("c1", location)); + node.start(); + aWireClient = node.getService(WireClient.class, "WireClient"); + Assert.assertNotNull(aWireClient); + + aWireClient = node.getService(WireClient.class, "AnotherWireClient"); + Assert.assertNotNull(aWireClient); + } + + /** + * Shutdown the SCA node + */ + + @After + public void tearDown() throws Exception { + node.stop(); + } +} -- cgit v1.2.3