Added: tuscany/java/sca/itest/implementation-spring/src/main/resources/implementation/policies/CalculatorJass.config URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/main/resources/implementation/policies/CalculatorJass.config?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/main/resources/implementation/policies/CalculatorJass.config (added) +++ tuscany/java/sca/itest/implementation-spring/src/main/resources/implementation/policies/CalculatorJass.config Mon Apr 20 13:16:35 2009 @@ -0,0 +1,3 @@ +Calculator { + calculator.security.JaasLoginModule required debug=true; +};
Added: tuscany/java/sca/itest/implementation-spring/src/main/resources/implementation/policies/CalculatorLogMessages.properties URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/main/resources/implementation/policies/CalculatorLogMessages.properties?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/main/resources/implementation/policies/CalculatorLogMessages.properties (added) +++ tuscany/java/sca/itest/implementation-spring/src/main/resources/implementation/policies/CalculatorLogMessages.properties Mon Apr 20 13:16:35 2009 @@ -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 Added: tuscany/java/sca/itest/implementation-spring/src/main/resources/implementation/policies/ImplementationPolicies.composite URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/main/resources/implementation/policies/ImplementationPolicies.composite?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/main/resources/implementation/policies/ImplementationPolicies.composite (added) +++ tuscany/java/sca/itest/implementation-spring/src/main/resources/implementation/policies/ImplementationPolicies.composite Mon Apr 20 13:16:35 2009 @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://sample" + xmlns:sample="http://sample" + name="ImplementationPolicies" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"> + + <component name="CalculatorServiceComponent"> + <implementation.spring location="META-INF/sca/implementation-policies/CalculatorService-context.xml"> + <operation name="divide" requires="tuscany:logging"/> + <operation name="subtract" requires="tuscany:logging"/> + </implementation.spring> + <reference name="addService" target="AddServiceComponent" /> + <reference name="subtractService" target="SubtractServiceComponent" /> + <reference name="multiplyService" target="MultiplyServiceComponent" /> + <reference name="divideService" target="DivideServiceComponent" /> + </component> + + <component name="AddServiceComponent"> + <implementation.java class="calculator.AddServiceImpl"/> + </component> + + <component name="SubtractServiceComponent"> + <implementation.java class="calculator.SubtractServiceImpl"/> + </component> + + <component name="MultiplyServiceComponent"> + <implementation.java class="calculator.MultiplyServiceImpl" requires="tuscany:jaasAuthentication"/> + </component> + + <component name="DivideServiceComponent"> + <implementation.java class="calculator.DivideServiceImpl"/> + </component> + + <component name="AnotherCalculatorServiceComponent"> + <implementation.spring location="META-INF/sca/implementation-policies/CalculatorService-context.xml" requires="tuscany:logging"/> + <reference name="addService" target="AddServiceComponent" /> + <reference name="subtractService" target="SubtractServiceComponent" /> + <reference name="multiplyService" target="MultiplyServiceComponent" /> + <reference name="divideService" target="DivideServiceComponent" /> + </component> + +</composite> Added: tuscany/java/sca/itest/implementation-spring/src/main/resources/implementation/policies/definitions.xml URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/main/resources/implementation/policies/definitions.xml?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/main/resources/implementation/policies/definitions.xml (added) +++ tuscany/java/sca/itest/implementation-spring/src/main/resources/implementation/policies/definitions.xml Mon Apr 20 13:16:35 2009 @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="ASCII"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0" + xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" + xmlns:calc="http://calculator"> + + <!-- PolicySets --> + <policySet name="JaasPolicy" provides="tuscany:jaasAuthentication" appliesTo="sca:implementation.java" + xmlns="http://www.osoa.org/xmlns/sca/1.0"> + <tuscany:jaasAuthentication> + <tuscany:configurationName>Calculator</tuscany:configurationName> + <tuscany:callbackHandler>calculator.security.CalculatorCallbackHandler</tuscany:callbackHandler> + </tuscany:jaasAuthentication> + </policySet> + + <!-- PolicySets --> + <policySet name="JDKLoggingPolicy" provides="tuscany:logging" appliesTo="sca:implementation.spring" + xmlns="http://www.osoa.org/xmlns/sca/1.0"> + <tuscany:jdkLogger name="calculator"> + <logLevel>FINER</logLevel> + </tuscany:jdkLogger> + </policySet> +</definitions> \ No newline at end of file Added: tuscany/java/sca/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorld.composite URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorld.composite?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorld.composite (added) +++ tuscany/java/sca/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorld.composite Mon Apr 20 13:16:35 2009 @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + name="SpringHelloWorld"> + + <component name="ClientComponent"> + <implementation.java class="org.apache.tuscany.sca.itest.spring.HelloWorldProxy"/> + <reference name="delegate" target="HelloWorldComponent"/> + </component> + + <component name="HelloWorldComponent"> + <implementation.spring location="META-INF/sca/SpringDelegationHelloWorld-context.xml"/> + </component> + +</composite> Added: tuscany/java/sca/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite (added) +++ tuscany/java/sca/itest/implementation-spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite Mon Apr 20 13:16:35 2009 @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + name="SpringHelloWorld"> + + <component name="ClientComponent"> + <implementation.java class="org.apache.tuscany.sca.itest.spring.HelloWorldProxy"/> + <reference name="delegate" target="HelloWorldComponent"/> + </component> + + <component name="HelloWorldComponent"> + <implementation.spring location="META-INF/sca/SpringHelloWorld-context.xml"/> + </component> + +</composite> Added: tuscany/java/sca/itest/implementation-spring/src/main/resources/spring/annotations/Calculator.composite URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/main/resources/spring/annotations/Calculator.composite?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/main/resources/spring/annotations/Calculator.composite (added) +++ tuscany/java/sca/itest/implementation-spring/src/main/resources/spring/annotations/Calculator.composite Mon Apr 20 13:16:35 2009 @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://sample" + xmlns:sample="http://sample" + name="Calculator" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"> + + <component name="CalculatorServiceComponent"> + <implementation.spring location="META-INF/sca/spring-annotation/CalculatorService-context.xml"/> + <property name="message">HelloWorld</property> + <reference name="addService" target="AddServiceComponent" /> + <reference name="subtractService" target="SubtractServiceComponent" /> + <reference name="multiplyService" target="MultiplyServiceComponent" /> + <reference name="divideService" target="DivideServiceComponent" /> + </component> + + <component name="AddServiceComponent"> + <implementation.java class="calculator.AddServiceImpl"/> + </component> + + <component name="SubtractServiceComponent"> + <implementation.java class="calculator.SubtractServiceImpl"/> + </component> + + <component name="MultiplyServiceComponent"> + <implementation.java class="calculator.MultiplyServiceImpl"/> + </component> + + <component name="DivideServiceComponent"> + <implementation.java class="calculator.DivideServiceImpl"/> + </component> + + <!--<component name="AnotherCalculatorServiceComponent"> + <implementation.spring location="META-INF/sca/spring-annotation/CalculatorService-context.xml"/> + <property name="message">HelloWorld</property> + <reference name="addService" target="AddServiceComponent" /> + <reference name="subtractService" target="SubtractServiceComponent" /> + <reference name="multiplyService" target="MultiplyServiceComponent" /> + <reference name="divideService" target="DivideServiceComponent" /> + </component> + +--></composite> Added: tuscany/java/sca/itest/implementation-spring/src/test/java/context/access/CalculatorClient.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/test/java/context/access/CalculatorClient.java?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/test/java/context/access/CalculatorClient.java (added) +++ tuscany/java/sca/itest/implementation-spring/src/test/java/context/access/CalculatorClient.java Mon Apr 20 13:16:35 2009 @@ -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 context.access; + +import org.apache.tuscany.sca.node.Client; +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.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 { + + String location = ContributionLocationHelper.getContributionLocation("context/access/ContextAccess.composite"); + Node node = NodeFactory.newInstance().createNode("context/access/ContextAccess.composite", new Contribution("c1", location)); + 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(); + } + +} Added: tuscany/java/sca/itest/implementation-spring/src/test/java/context/access/ContextAccessTestCase.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/test/java/context/access/ContextAccessTestCase.java?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/test/java/context/access/ContextAccessTestCase.java (added) +++ tuscany/java/sca/itest/implementation-spring/src/test/java/context/access/ContextAccessTestCase.java Mon Apr 20 13:16:35 2009 @@ -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[] {""}); + } +} Added: tuscany/java/sca/itest/implementation-spring/src/test/java/context/imports/CalculatorClient.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/test/java/context/imports/CalculatorClient.java?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/test/java/context/imports/CalculatorClient.java (added) +++ tuscany/java/sca/itest/implementation-spring/src/test/java/context/imports/CalculatorClient.java Mon Apr 20 13:16:35 2009 @@ -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 context.imports; + +import org.apache.tuscany.sca.node.Client; +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.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 { + + String location = ContributionLocationHelper.getContributionLocation("context/imports/ContextImports.composite"); + Node node = NodeFactory.newInstance().createNode("context/imports/ContextImports.composite", new Contribution("c1", location)); + 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(); + } + +} Added: tuscany/java/sca/itest/implementation-spring/src/test/java/context/imports/ContextImportsTestCase.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/test/java/context/imports/ContextImportsTestCase.java?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/test/java/context/imports/ContextImportsTestCase.java (added) +++ tuscany/java/sca/itest/implementation-spring/src/test/java/context/imports/ContextImportsTestCase.java Mon Apr 20 13:16:35 2009 @@ -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[] {""}); + } +} Added: tuscany/java/sca/itest/implementation-spring/src/test/java/context/multiple/MultipleContextTestCase.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/test/java/context/multiple/MultipleContextTestCase.java?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/test/java/context/multiple/MultipleContextTestCase.java (added) +++ tuscany/java/sca/itest/implementation-spring/src/test/java/context/multiple/MultipleContextTestCase.java Mon Apr 20 13:16:35 2009 @@ -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"}); + } +} Added: tuscany/java/sca/itest/implementation-spring/src/test/java/context/multiple/StockQuoteServer.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/test/java/context/multiple/StockQuoteServer.java?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/test/java/context/multiple/StockQuoteServer.java (added) +++ tuscany/java/sca/itest/implementation-spring/src/test/java/context/multiple/StockQuoteServer.java Mon Apr 20 13:16:35 2009 @@ -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.multiple; + +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 { + + System.out.println("Starting the Sample SCA StockQuote Service..."); + + String location = ContributionLocationHelper.getContributionLocation("context/multiple/MultipleContext.composite"); + Node node = NodeFactory.newInstance().createNode("MultipleContext.composite", new Contribution("c1", location)); + 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"); + } +} Added: tuscany/java/sca/itest/implementation-spring/src/test/java/implementation/policies/CalculatorClient.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/test/java/implementation/policies/CalculatorClient.java?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/test/java/implementation/policies/CalculatorClient.java (added) +++ tuscany/java/sca/itest/implementation-spring/src/test/java/implementation/policies/CalculatorClient.java Mon Apr 20 13:16:35 2009 @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package implementation.policies; + +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.ContributionLocationHelper; +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()); + } + + String location = ContributionLocationHelper.getContributionLocation("implementation/policies/ImplementationPolicies.composite"); + Node node = NodeFactory.newInstance().createNode("ImplementationPolicies.composite", new Contribution("c1", location)); + 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"); + } + +} Added: tuscany/java/sca/itest/implementation-spring/src/test/java/implementation/policies/ImplementationPoliciesTestCase.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/test/java/implementation/policies/ImplementationPoliciesTestCase.java?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/test/java/implementation/policies/ImplementationPoliciesTestCase.java (added) +++ tuscany/java/sca/itest/implementation-spring/src/test/java/implementation/policies/ImplementationPoliciesTestCase.java Mon Apr 20 13:16:35 2009 @@ -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[] {""}); + } +} Added: tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.java?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.java (added) +++ tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.java Mon Apr 20 13:16:35 2009 @@ -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; + + +/** + * Basic "hello world" style test case for testing Spring component implementation + * + */ +public abstract class AbstractHelloWorldTestCase extends AbstractSCATestCase<HelloWorld> { + + /** + * Calls the hello world service and checks that it gives the right response... + */ + public void testHello() throws Exception { + assertEquals("Hello petra", service.sayHello("petra")); + } + + @Override + protected Class<HelloWorld> getServiceClass() { + return HelloWorld.class; + } +} Added: tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java (added) +++ tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java Mon Apr 20 13:16:35 2009 @@ -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.spring; + +import junit.framework.TestCase; +import org.apache.tuscany.sca.node.Client; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; + +public abstract class AbstractSCATestCase<T> extends TestCase { + + protected Node node; + protected T service; + + @Override + protected void setUp() throws Exception { + NodeFactory factory = NodeFactory.newInstance(); + node = factory.createNode(getCompositeName()); + node.start(); + service = ((Client)node).getService(getServiceClass(), "ClientComponent"); + } + + abstract protected Class<T> getServiceClass(); + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + protected String getCompositeName() { + String className = this.getClass().getName(); + String compositeName = className.substring(0, className.length() - 8).replace('.', '/') + ".composite"; + System.out.println("Using composite: " + compositeName); + return compositeName; + } + +} Added: tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.java?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.java (added) +++ tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.java Mon Apr 20 13:16:35 2009 @@ -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); + +} Added: tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.java?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.java (added) +++ tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.java Mon Apr 20 13:16:35 2009 @@ -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); + } + +} Added: tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorldTestCase.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorldTestCase.java?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorldTestCase.java (added) +++ tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringDelegationHelloWorldTestCase.java Mon Apr 20 13:16:35 2009 @@ -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.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 +} Added: tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.java?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.java (added) +++ tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.java Mon Apr 20 13:16:35 2009 @@ -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.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 +} Added: tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.java?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.java (added) +++ tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.java Mon Apr 20 13:16:35 2009 @@ -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 Added: tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldDelegatorBean.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldDelegatorBean.java?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldDelegatorBean.java (added) +++ tuscany/java/sca/itest/implementation-spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldDelegatorBean.java Mon Apr 20 13:16:35 2009 @@ -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); + } + +} Added: tuscany/java/sca/itest/implementation-spring/src/test/java/spring/annotations/CalculatorClient.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/test/java/spring/annotations/CalculatorClient.java?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/test/java/spring/annotations/CalculatorClient.java (added) +++ tuscany/java/sca/itest/implementation-spring/src/test/java/spring/annotations/CalculatorClient.java Mon Apr 20 13:16:35 2009 @@ -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 spring.annotations; + +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; +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 { + + String location = ContributionLocationHelper.getContributionLocation("spring/annotations/Calculator.composite"); + Node node = NodeFactory.newInstance().createNode("Calculator.composite", new Contribution("c1", location)); + 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)); + + /*calculatorService = + ((SCAClient)node).getService(CalculatorService.class, "AnotherCalculatorServiceComponent"); + + 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"); + } + +} Added: tuscany/java/sca/itest/implementation-spring/src/test/java/spring/annotations/SpringAnnotationsTestCase.java URL: http://svn.apache.org/viewvc/tuscany/java/sca/itest/implementation-spring/src/test/java/spring/annotations/SpringAnnotationsTestCase.java?rev=766686&view=auto ============================================================================== --- tuscany/java/sca/itest/implementation-spring/src/test/java/spring/annotations/SpringAnnotationsTestCase.java (added) +++ tuscany/java/sca/itest/implementation-spring/src/test/java/spring/annotations/SpringAnnotationsTestCase.java Mon Apr 20 13:16:35 2009 @@ -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[] {""}); + } +}
