diff options
Diffstat (limited to 'branches/sca-java-1.x')
21 files changed, 448 insertions, 32 deletions
diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/ear-appcomp-contrib-implicit/pom.xml b/branches/sca-java-1.x/itest/contribution-jee-samples/ear-appcomp-contrib-implicit/pom.xml index d1f77dfae0..930d4f9183 100644 --- a/branches/sca-java-1.x/itest/contribution-jee-samples/ear-appcomp-contrib-implicit/pom.xml +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/ear-appcomp-contrib-implicit/pom.xml @@ -48,6 +48,13 @@ <dependency> <groupId>org.apache.tuscany.sca</groupId> + <artifactId>itest-contribution-jee-samples-00-jar-shared</artifactId> + <version>1.6-SNAPSHOT</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> <artifactId>itest-contribution-jee-samples-7-ejb-nonenhanced</artifactId> <version>1.6-SNAPSHOT</version> <type>ejb</type> @@ -71,6 +78,12 @@ <artifactId>maven-ear-plugin</artifactId> <configuration> <modules> + <jarModule> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>itest-contribution-jee-samples-00-jar-shared</artifactId> + <includeInApplicationXml>true</includeInApplicationXml> + <bundleDir>/</bundleDir> + </jarModule> <ejbModule> <groupId>org.apache.tuscany.sca</groupId> <artifactId>itest-contribution-jee-samples-7-ejb-nonenhanced</artifactId> diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/ear-appcomp-contrib-implicit/src/main/application/META-INF/application.composite b/branches/sca-java-1.x/itest/contribution-jee-samples/ear-appcomp-contrib-implicit/src/main/application/META-INF/application.composite index fa9a66af7f..890431360b 100644 --- a/branches/sca-java-1.x/itest/contribution-jee-samples/ear-appcomp-contrib-implicit/src/main/application/META-INF/application.composite +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/ear-appcomp-contrib-implicit/src/main/application/META-INF/application.composite @@ -23,13 +23,21 @@ name="Calculator"> <component name="HelloworldServiceComponent"> - <implementation.ejb ejb-link="itest-contribution-jee-samples-7-ejb-nonenhanced.jar#HelloworldServiceBean"/> - <service name="HelloworldService"> - <interface.java interface="sample.ejb3.HelloworldService"/> + <implementation.ejb ejb-link="itest-contribution-jee-samples-7-ejb-nonenhanced.jar#HelloworldService7Bean"/> + <service name="HelloworldService7"> + <interface.java interface="sample.ejb3.HelloworldService7"/> <binding.sca/> </service> </component> - <service name="TheService" promote="HelloworldServiceComponent/HelloworldService"/> + <service name="TheService" promote="HelloworldServiceComponent/HelloworldService7"/> + + <component name="HelloworldServiceJavaComponent"> + <implementation.java class="sample.java.HelloworldServiceJavaImpl"/> + </component> + + <service name="JavaService" promote="HelloworldServiceJavaComponent/HelloworldServiceJava"/> + + <reference name="JavaReference" promote="HelloworldServiceJavaComponent/hwReference"/> </composite> diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/ejb-nonenhanced/src/main/java/sample/ejb3/HelloworldLocal7.java b/branches/sca-java-1.x/itest/contribution-jee-samples/ejb-nonenhanced/src/main/java/sample/ejb3/HelloworldLocal7.java new file mode 100644 index 0000000000..4df5cd37de --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/ejb-nonenhanced/src/main/java/sample/ejb3/HelloworldLocal7.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 sample.ejb3; + +import javax.ejb.Local; + +/** + * HelloworldService EJB interface. + * + * @version $Rev$ $Date$ + */ + +@Local +public interface HelloworldLocal7 { + String getGreetingsLocal(String name); +} diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/ejb-nonenhanced/src/main/java/sample/ejb3/HelloworldService.java b/branches/sca-java-1.x/itest/contribution-jee-samples/ejb-nonenhanced/src/main/java/sample/ejb3/HelloworldService7.java index 0194d1870c..41ecddb62e 100644 --- a/branches/sca-java-1.x/itest/contribution-jee-samples/ejb-nonenhanced/src/main/java/sample/ejb3/HelloworldService.java +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/ejb-nonenhanced/src/main/java/sample/ejb3/HelloworldService7.java @@ -28,6 +28,6 @@ import javax.ejb.Remote; */ @Remote -public interface HelloworldService { +public interface HelloworldService7 { String getGreetings(String name); } diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/ejb-nonenhanced/src/main/java/sample/ejb3/HelloworldService7Bean.java b/branches/sca-java-1.x/itest/contribution-jee-samples/ejb-nonenhanced/src/main/java/sample/ejb3/HelloworldService7Bean.java new file mode 100644 index 0000000000..403ead623c --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/ejb-nonenhanced/src/main/java/sample/ejb3/HelloworldService7Bean.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 sample.ejb3; + +import javax.ejb.Stateless; + +/** + * HelloworldService EJB implementation with no SCA enhancement + + */ +@Stateless +public class HelloworldService7Bean implements HelloworldService7, HelloworldLocal7 { + + public String getGreetings(String name) { + String greeting = "Hello remote " + name; + System.out.println(greeting); + return greeting; + } + + public String getGreetingsLocal(String name) { + String greeting = "Hello local " + name; + System.out.println(greeting); + return greeting; + } + +} diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/jar-shared/pom.xml b/branches/sca-java-1.x/itest/contribution-jee-samples/jar-shared/pom.xml new file mode 100644 index 0000000000..f32ff8f6ab --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/jar-shared/pom.xml @@ -0,0 +1,72 @@ +<?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. +--> + +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>itest-contribution-jee-samples</artifactId> + <version>1.6-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>itest-contribution-jee-samples-00-jar-shared</artifactId> + <name>Apache Tuscany SCA iTest Contribution Java EE Samples 00</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>1.6-SNAPSHOT</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-ejb_3.0_spec</artifactId> + <version>1.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-annotation_1.0_spec</artifactId> + <version>1.1.1</version> + <scope>provided</scope> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.2</version> + <configuration> + <archive> + <manifest> + <mainClass>sample.java.JarMain</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/jar-shared/src/main/java/sample/java/HelloworldServiceJava.java b/branches/sca-java-1.x/itest/contribution-jee-samples/jar-shared/src/main/java/sample/java/HelloworldServiceJava.java new file mode 100644 index 0000000000..5a08769550 --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/jar-shared/src/main/java/sample/java/HelloworldServiceJava.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 sample.java; + +import org.osoa.sca.annotations.Remotable; + +/** + * HelloworldService EJB interface. + * + * @version $Rev$ $Date$ + */ + +@Remotable +public interface HelloworldServiceJava { + String getGreetings(String name); +} diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/ejb-nonenhanced/src/main/java/sample/ejb3/HelloworldServiceBean.java b/branches/sca-java-1.x/itest/contribution-jee-samples/jar-shared/src/main/java/sample/java/HelloworldServiceJavaImpl.java index 1bf293ec85..59182b2e73 100644 --- a/branches/sca-java-1.x/itest/contribution-jee-samples/ejb-nonenhanced/src/main/java/sample/ejb3/HelloworldServiceBean.java +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/jar-shared/src/main/java/sample/java/HelloworldServiceJavaImpl.java @@ -15,21 +15,18 @@ * limitations under the License. */ -package sample.ejb3; +package sample.java; -import javax.ejb.Stateless; +import org.osoa.sca.annotations.Reference; -/** - * HelloworldService EJB implementation with no SCA enhancement - - */ -@Stateless -public class HelloworldServiceBean implements HelloworldService { +public class HelloworldServiceJavaImpl implements HelloworldServiceJava { + + @Reference + protected HelloworldServiceJava hwReference; public String getGreetings(String name) { - String greeting = "Hello " + name; + String greeting = hwReference.getGreetings(name); System.out.println(greeting); return greeting; } - } diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/jar-shared/src/main/java/sample/java/JarMain.java b/branches/sca-java-1.x/itest/contribution-jee-samples/jar-shared/src/main/java/sample/java/JarMain.java new file mode 100644 index 0000000000..81793e47e6 --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/jar-shared/src/main/java/sample/java/JarMain.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 sample.java; + +public class JarMain { + + public static void main(String[] args) { + System.out.println("JarMain called"); + } +} diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/pom.xml b/branches/sca-java-1.x/itest/contribution-jee-samples/pom.xml index b1da60f201..25c1caeee1 100644 --- a/branches/sca-java-1.x/itest/contribution-jee-samples/pom.xml +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/pom.xml @@ -39,6 +39,7 @@ <activeByDefault>true</activeByDefault> </activation> <modules> + <module>jar-shared</module> <module>war-nonenhanced</module> <module>war-appcomp-contrib-implicit</module> <module>ejb-nonenhanced</module> diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp/src/main/java/sample/java/HelloworldServiceJava.java b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp/src/main/java/sample/java/HelloworldServiceJava.java new file mode 100644 index 0000000000..1fad282a75 --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp/src/main/java/sample/java/HelloworldServiceJava.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 sample.java; + +import org.osoa.sca.annotations.Remotable; + + +@Remotable +public interface HelloworldServiceJava { + String getGreetings(String name); +} diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp/src/main/java/sample/pojo/HelloworldClient.java b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp/src/main/java/sample/pojo/HelloworldClient2.java index 6f37c9b272..8adb6a5995 100644 --- a/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp/src/main/java/sample/pojo/HelloworldClient.java +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp/src/main/java/sample/pojo/HelloworldClient2.java @@ -18,7 +18,7 @@ */ package sample.pojo; -public interface HelloworldClient { +public interface HelloworldClient2 { String getGreetings(String name); diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp/src/main/java/sample/pojo/HelloworldClient2Impl.java b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp/src/main/java/sample/pojo/HelloworldClient2Impl.java new file mode 100644 index 0000000000..ae16263505 --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp/src/main/java/sample/pojo/HelloworldClient2Impl.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 sample.pojo; + +import org.osoa.sca.annotations.Reference; + +import sample.ejb3.HelloworldService; +import sample.java.HelloworldServiceJava; + +public class HelloworldClient2Impl implements HelloworldClient2 { + + @Reference + protected HelloworldService hwService; + + @Reference + protected HelloworldServiceJava hwJavaService; + + public String getGreetings(String name){ + //return hwService.getGreetings(name) + hwJavaService.getGreetings(name); + return hwJavaService.getGreetings(name); + } + +} diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp/src/main/java/sample/pojo/HelloworldClientImpl.java b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp/src/main/java/sample/pojo/HelloworldTargetImpl.java index a38c4a773f..05885cead7 100644 --- a/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp/src/main/java/sample/pojo/HelloworldClientImpl.java +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp/src/main/java/sample/pojo/HelloworldTargetImpl.java @@ -18,17 +18,12 @@ */ package sample.pojo; -import org.osoa.sca.annotations.Reference; +import sample.java.HelloworldServiceJava; -import sample.ejb3.HelloworldService; - -public class HelloworldClientImpl implements HelloworldClient { - - @Reference - protected HelloworldService hwService; +public class HelloworldTargetImpl implements HelloworldServiceJava { public String getGreetings(String name){ - return hwService.getGreetings(name); + return "Hello " + name; } } diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp/src/main/resources/helloworld.composite b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp/src/main/resources/helloworld.composite index f0b6f16b28..ebd8377725 100644 --- a/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp/src/main/resources/helloworld.composite +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp/src/main/resources/helloworld.composite @@ -22,13 +22,19 @@ xmlns:sample="http://sample" name="Calculator"> - <component name="HelloworlClientComponent"> - <implementation.java class="sample.pojo.HelloworldClientImpl"/> + <component name="HelloworldClientComponent"> + <implementation.java class="sample.pojo.HelloworldClient2Impl"/> <reference name="hwService" target="HelloworldServiceComponent/TheService" /> + <reference name="hwJavaService" target="HelloworldServiceComponent/JavaService" /> </component> <component name="HelloworldServiceComponent"> <implementation.jee archive="itest-contribution-jee-samples-29-ear-appcomp-contrib-implicit.ear"/> + <reference name="JavaReference" target="HelloworldTargetComponent"/> </component> + + <component name="HelloworldTargetComponent"> + <implementation.java class="sample.pojo.HelloworldTargetImpl"/> + </component> </composite> diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-nonenhanced/src/main/resources/helloworld.composite b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-nonenhanced/src/main/resources/helloworld.composite index 2b62742209..e665eb5d3e 100644 --- a/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-nonenhanced/src/main/resources/helloworld.composite +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-nonenhanced/src/main/resources/helloworld.composite @@ -24,7 +24,7 @@ <component name="HelloworlClientComponent"> <implementation.java class="sample.pojo.HelloworldClientImpl"/> - <reference name="hwService" target="HelloworldServiceComponent/HelloworldServiceBean_HelloworldService" /> + <reference name="hwService" target="HelloworldServiceComponent/HelloworldService7Bean_HelloworldService" /> </component> <component name="HelloworldServiceComponent"> diff --git a/branches/sca-java-1.x/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestEJBImplementationProvider.java b/branches/sca-java-1.x/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestEJBImplementationProvider.java new file mode 100644 index 0000000000..e7e1d90797 --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestEJBImplementationProvider.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.test.contribution.jee; + +import org.apache.tuscany.sca.implementation.ejb.EJBImplementation; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.provider.ImplementationProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; + + +class TestEJBImplementationProvider implements ImplementationProvider { + + TestEJBImplementationProvider(RuntimeComponent component, EJBImplementation ejbImplementation) { + } + + public Invoker createInvoker(RuntimeComponentService service, Operation operation) { + return null; + } + + public boolean supportsOneWayInvocation() { + return false; + } + + public void start() { + } + + public void stop() { + } + +} diff --git a/branches/sca-java-1.x/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestEJBImplementationProviderFactory.java b/branches/sca-java-1.x/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestEJBImplementationProviderFactory.java new file mode 100644 index 0000000000..4660fee7fd --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestEJBImplementationProviderFactory.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.test.contribution.jee; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.implementation.ejb.EJBImplementation; +import org.apache.tuscany.sca.provider.ImplementationProvider; +import org.apache.tuscany.sca.provider.ImplementationProviderFactory; +import org.apache.tuscany.sca.runtime.RuntimeComponent; + +/** + * A factory for resource implementation providers. + * + * @version $Rev$ $Date$ + */ +public class TestEJBImplementationProviderFactory implements ImplementationProviderFactory<EJBImplementation> { + + /** + * Constructs a resource implementation. + */ + public TestEJBImplementationProviderFactory(ExtensionPointRegistry extensionPoints) { + } + + public ImplementationProvider createImplementationProvider(RuntimeComponent component, EJBImplementation implementation) { + return new TestEJBImplementationProvider(component, implementation); + } + + public Class<EJBImplementation> getModelType() { + return EJBImplementation.class; + } +} diff --git a/branches/sca-java-1.x/itest/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/branches/sca-java-1.x/itest/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory new file mode 100644 index 0000000000..adc93d9015 --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Implementation class for the implementation extension
+org.apache.tuscany.sca.test.contribution.jee.TestEJBImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.ejb.EJBImplementation
diff --git a/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/SCAJarEarAppcompTestCase.java b/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/SCAJarEarAppcompTestCase.java index d9c0e857b7..4d704162ef 100644 --- a/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/SCAJarEarAppcompTestCase.java +++ b/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/SCAJarEarAppcompTestCase.java @@ -52,6 +52,8 @@ import org.junit.Before; import org.junit.Ignore; import org.junit.Test; +import sample.pojo.HelloworldClient2; + public class SCAJarEarAppcompTestCase { @@ -82,7 +84,7 @@ public class SCAJarEarAppcompTestCase { * */ @Test - public void testSCAJarEarNonenhanced() throws Exception { + public void testSCAJarEarAppcomp() throws Exception { URL contributionLocation = new File("../contribution-jee-samples/scajar-ear-appcomp/target/itest-contribution-jee-samples-41-scajar-ear-appcomp.jar").toURL(); Contribution contribution = contributionService.contribute(CONTRIBUTION_001_ID, contributionLocation, false); @@ -98,14 +100,24 @@ public class SCAJarEarAppcompTestCase { Assert.assertNotNull(composite); - Assert.assertEquals(2, composite.getComponents().size()); - Assert.assertEquals(1, composite.getComponents().get(1).getImplementation().getServices().size()); + domain.getDomainComposite().getIncludes().add(composite); + + Assert.assertEquals(3, composite.getComponents().size()); + Assert.assertEquals(2, composite.getComponents().get(1).getImplementation().getServices().size()); Assert.assertEquals("TheService", composite.getComponents().get(1).getImplementation().getServices().get(0).getName()); domain.buildComposite(composite); // assert that the build process has worked Assert.assertNotNull(composite); + + domain.getCompositeActivator().activate(composite); + domain.getCompositeActivator().start(composite); + + HelloworldClient2 client = domain.getService(HelloworldClient2.class, "HelloworldClientComponent"); + Assert.assertEquals("Hello Fred", client.getGreetings("Fred")); + + domain.stop(); } diff --git a/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/SCAJarEarNonenhancedTestCase.java b/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/SCAJarEarNonenhancedTestCase.java index 0a527b6bda..334f5eca1b 100644 --- a/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/SCAJarEarNonenhancedTestCase.java +++ b/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/SCAJarEarNonenhancedTestCase.java @@ -127,8 +127,8 @@ public class SCAJarEarNonenhancedTestCase { Assert.assertNotNull(composite); Assert.assertEquals(2, composite.getComponents().size()); - Assert.assertEquals(1, composite.getComponents().get(1).getImplementation().getServices().size()); - Assert.assertEquals("HelloworldServiceBean_HelloworldService", composite.getComponents().get(1).getImplementation().getServices().get(0).getName()); + Assert.assertEquals(2, composite.getComponents().get(1).getImplementation().getServices().size()); + Assert.assertEquals("HelloworldService7Bean_HelloworldService7", composite.getComponents().get(1).getImplementation().getServices().get(0).getName()); domain.buildComposite(composite); |