diff options
Diffstat (limited to 'sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld')
9 files changed, 334 insertions, 0 deletions
diff --git a/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/AbstractHelloWorldTestCase.java b/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/AbstractHelloWorldTestCase.java new file mode 100644 index 0000000000..5d5344cd13 --- /dev/null +++ b/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/AbstractHelloWorldTestCase.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.implementation.spring.itests.helloworld; + +import org.apache.tuscany.sca.implementation.spring.itests.AbstractSCATestCase; + +/** + * 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 testCalculator() throws Exception { + assertEquals("Hello petra", service.sayHello("petra")); + } + + @Override + protected Class<HelloWorld> getServiceClass() { + return HelloWorld.class; + } +} diff --git a/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/HelloWorld.java b/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/HelloWorld.java new file mode 100644 index 0000000000..0b7d2525cf --- /dev/null +++ b/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/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.implementation.spring.itests.helloworld; + +import org.osoa.sca.annotations.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/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/HelloWorldImpl.java b/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..249067ab2d --- /dev/null +++ b/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/HelloWorldImpl.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.implementation.spring.itests.helloworld; + +/** + * A simple proxy Java class which implements the HelloWorld interface but which uses + * a reference "delegate" to actually provide the HelloWorld service + * + */ +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/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/HelloWorldProxy.java b/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/HelloWorldProxy.java new file mode 100644 index 0000000000..43bb685e32 --- /dev/null +++ b/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/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.implementation.spring.itests.helloworld; + +import org.osoa.sca.annotations.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/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitHelloWorldTestCase.java b/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitHelloWorldTestCase.java new file mode 100644 index 0000000000..94f7e83f30 --- /dev/null +++ b/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitHelloWorldTestCase.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.implementation.spring.itests.helloworld; + +/** + * 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 <implementation.spring.../> element references an application context that + * uses an explicit sca: element to identify the service offered by the Spring application + * + */ +public class SpringExplicitHelloWorldTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name +} diff --git a/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitReferenceTestCase.java b/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitReferenceTestCase.java new file mode 100644 index 0000000000..9603b50704 --- /dev/null +++ b/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringExplicitReferenceTestCase.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.implementation.spring.itests.helloworld; + +/** + * 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 <implementation.spring.../> element references an application context that + * uses an explicit sca:reference element to identify the reference made by the Spring application + * + */ +public class SpringExplicitReferenceTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name +} diff --git a/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringHelloWorldTestCase.java b/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringHelloWorldTestCase.java new file mode 100644 index 0000000000..83a6898502 --- /dev/null +++ b/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringHelloWorldTestCase.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.implementation.spring.itests.helloworld; + +/** + * 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 SpringHelloWorldTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name +} diff --git a/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringImplicitReferenceTestCase.java b/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringImplicitReferenceTestCase.java new file mode 100644 index 0000000000..4aaac6fa6a --- /dev/null +++ b/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringImplicitReferenceTestCase.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.implementation.spring.itests.helloworld; + +/** + * 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 <implementation.spring.../> 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. + * + */ +public class SpringImplicitReferenceTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name +} + + diff --git a/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringSCAPropertyTestCase.java b/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringSCAPropertyTestCase.java new file mode 100644 index 0000000000..1a93b1a8f9 --- /dev/null +++ b/sca-java-1.x/tags/1.2/modules/implementation-spring/src/test/java/org/apache/tuscany/sca/implementation/spring/itests/helloworld/SpringSCAPropertyTestCase.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.implementation.spring.itests.helloworld; + +/** + * 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 <implementation.spring.../> 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 + * + */ +public class SpringSCAPropertyTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name +} + |