diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-23 09:37:01 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-23 09:37:01 +0000 |
commit | 719fe27e65588eeb2e4d34f349162d54a0b6bf92 (patch) | |
tree | 6000c3560a2b1b7bd19a06a2f2e76aa098a53c63 | |
parent | e0c21c136abfd0c26d0d99d2258db15654adf92d (diff) |
TUSCANY-3097 Add test to see if the application composites of modules inside an EAR are processed (they shouldn't be)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@787603 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
15 files changed, 645 insertions, 1 deletions
diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/ear-appcomp-contrib-implicit-war-appcomp/pom.xml b/branches/sca-java-1.x/itest/contribution-jee-samples/ear-appcomp-contrib-implicit-war-appcomp/pom.xml new file mode 100644 index 0000000000..74687aedbf --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/ear-appcomp-contrib-implicit-war-appcomp/pom.xml @@ -0,0 +1,103 @@ +<?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-30-ear-appcomp-contrib-implicit-war-appcomp</artifactId> + <name>Apache Tuscany SCA iTest Contribution Java EE Samples 30</name> + <packaging>ear</packaging> + + <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.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-12-ejb-appcomp-contrib-implicit</artifactId> + <version>1.6-SNAPSHOT</version> + <type>ejb</type> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>itest-contribution-jee-samples-06-war-appcomp-contrib-implicit</artifactId> + <version>1.6-SNAPSHOT</version> + <type>war</type> + <scope>provided</scope> + </dependency> + + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <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-12-ejb-appcomp-contrib-implicit</artifactId> + <bundleDir>/</bundleDir> + </ejbModule> + <webModule> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>itest-contribution-jee-samples-06-war-appcomp-contrib-implicit</artifactId> + <bundleDir>/</bundleDir> + </webModule> + </modules> + </configuration> + </plugin> + </plugins> + <finalName>${artifactId}</finalName> + </build> +</project> diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/ear-appcomp-contrib-implicit-war-appcomp/src/main/application/META-INF/application.composite b/branches/sca-java-1.x/itest/contribution-jee-samples/ear-appcomp-contrib-implicit-war-appcomp/src/main/application/META-INF/application.composite new file mode 100644 index 0000000000..3b1555f567 --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/ear-appcomp-contrib-implicit-war-appcomp/src/main/application/META-INF/application.composite @@ -0,0 +1,48 @@ +<?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"> + + <component name="HelloworldServiceComponent"> + <implementation.ejb ejb-link="itest-contribution-jee-samples-12-ejb-appcomp-contrib-implicit.jar#HelloworldServiceBean"/> + <service name="HelloworldService8"> + <interface.java interface="sample.ejb3.HelloworldService8"/> + <binding.sca/> + </service> + <reference name="hwReference" target="HelloworldServiceJavaComponent"/> + <property name="hwProperty">EJB</property> + </component> + + <service name="TheService" promote="HelloworldServiceComponent/HelloworldService8"/> + + <reference name="TheReference" promote="HelloworldServiceComponent/hwReference"/> + + <component name="HelloworldServiceJavaComponent"> + <implementation.java class="sample.java.HelloworldServiceJavaImpl"/> + <property name="hwProperty">Java</property> + </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/ear-appcomp-contrib-implicit/src/main/resources/isthisignored.composite b/branches/sca-java-1.x/itest/contribution-jee-samples/ear-appcomp-contrib-implicit/src/main/resources/isthisignored.composite new file mode 100644 index 0000000000..90872041b0 --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/ear-appcomp-contrib-implicit/src/main/resources/isthisignored.composite @@ -0,0 +1,49 @@ +<?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"> + + <component name="CalculatorServiceComponent"> + <implementation.java class="calculator.CalculatorServiceImpl"/> + <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> + +</composite> diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/ejb-appcomp-contrib-implicit/src/main/resources/META-INF/openejb-jar.xml b/branches/sca-java-1.x/itest/contribution-jee-samples/ejb-appcomp-contrib-implicit/src/main/resources/META-INF/openejb-jar.xml index 7428735903..9a97cbd535 100644 --- a/branches/sca-java-1.x/itest/contribution-jee-samples/ejb-appcomp-contrib-implicit/src/main/resources/META-INF/openejb-jar.xml +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/ejb-appcomp-contrib-implicit/src/main/resources/META-INF/openejb-jar.xml @@ -21,7 +21,7 @@ <dep:environment> <dep:moduleId> <dep:groupId>test</dep:groupId> - <dep:artifactId>itest-contribution-jee-samples-7-ejb-nonenhanced</dep:artifactId> + <dep:artifactId>itest-contribution-jee-samples-12-ejb-appcomp-contrib-implicit</dep:artifactId> <dep:version>1.0</dep:version> <dep:type>jar</dep:type> </dep:moduleId> diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/ejb-enhanced/src/main/resources/isthisignored.composite b/branches/sca-java-1.x/itest/contribution-jee-samples/ejb-enhanced/src/main/resources/isthisignored.composite new file mode 100644 index 0000000000..90872041b0 --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/ejb-enhanced/src/main/resources/isthisignored.composite @@ -0,0 +1,49 @@ +<?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"> + + <component name="CalculatorServiceComponent"> + <implementation.java class="calculator.CalculatorServiceImpl"/> + <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> + +</composite> 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 bb7194c6ba..62f44f9aef 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 @@ -47,8 +47,10 @@ <module>ejb-appcomp-contrib-implicit</module> <module>ear-nonenhanced</module> <module>ear-appcomp-contrib-implicit</module> + <module>ear-appcomp-contrib-implicit-war-appcomp</module> <module>scajar-ear-nonenhanced</module> <module>scajar-ear-appcomp</module> + <module>scajar-ear-appcomp-war-appcomp</module> <module>scazip-ejb-appcomp</module> <module>scazip-war-appcomp</module> </modules> diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp-war-appcomp/pom.xml b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp-war-appcomp/pom.xml new file mode 100644 index 0000000000..7852f46dd3 --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp-war-appcomp/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>tuscany-sca</artifactId> + <version>1.6-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <artifactId>itest-contribution-jee-samples-43-scajar-ear-appcomp-war-appcomp</artifactId> + <name>Apache Tuscany SCA iTest Contribution Java EE Samples 43</name> + + <repositories> + <repository> + <id>apache.incubator</id> + <url>http://people.apache.org/repo/m2-incubating-repository</url> + </repository> + </repositories> + + <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.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.6-SNAPSHOT</version> + <scope>runtime</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>junit</groupId> + <artifactId>junit</artifactId> + <version>4.5</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + </build> +</project> diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp-war-appcomp/src/main/java/sample/ejb3/HelloworldService.java b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp-war-appcomp/src/main/java/sample/ejb3/HelloworldService.java new file mode 100644 index 0000000000..0194d1870c --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp-war-appcomp/src/main/java/sample/ejb3/HelloworldService.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package sample.ejb3; + +import javax.ejb.Remote; + +/** + * HelloworldService EJB interface. + * + * @version $Rev$ $Date$ + */ + +@Remote +public interface HelloworldService { + String getGreetings(String name); +} diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp-war-appcomp/src/main/java/sample/java/HelloworldServiceJava.java b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp-war-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-war-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-war-appcomp/src/main/java/sample/pojo/HelloworldClient2.java b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp-war-appcomp/src/main/java/sample/pojo/HelloworldClient2.java new file mode 100644 index 0000000000..8adb6a5995 --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp-war-appcomp/src/main/java/sample/pojo/HelloworldClient2.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package sample.pojo; + +public interface HelloworldClient2 { + + String getGreetings(String name); + +} diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp-war-appcomp/src/main/java/sample/pojo/HelloworldClient2Impl.java b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp-war-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-war-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-war-appcomp/src/main/java/sample/pojo/HelloworldTargetImpl.java b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp-war-appcomp/src/main/java/sample/pojo/HelloworldTargetImpl.java new file mode 100644 index 0000000000..05885cead7 --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp-war-appcomp/src/main/java/sample/pojo/HelloworldTargetImpl.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package sample.pojo; + +import sample.java.HelloworldServiceJava; + +public class HelloworldTargetImpl implements HelloworldServiceJava { + + public String getGreetings(String name){ + return "Hello " + name; + } + +} diff --git a/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp-war-appcomp/src/main/resources/helloworld.composite b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp-war-appcomp/src/main/resources/helloworld.composite new file mode 100644 index 0000000000..e9346fb2bb --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee-samples/scajar-ear-appcomp-war-appcomp/src/main/resources/helloworld.composite @@ -0,0 +1,40 @@ +<?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"> + + <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-30-ear-appcomp-contrib-implicit-war-appcomp.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/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestExternalEarModelResolver.java b/branches/sca-java-1.x/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestExternalEarModelResolver.java index eda6aad177..34bf3702d3 100644 --- a/branches/sca-java-1.x/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestExternalEarModelResolver.java +++ b/branches/sca-java-1.x/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestExternalEarModelResolver.java @@ -93,6 +93,8 @@ public class TestExternalEarModelResolver implements ModelResolver { earLocation = new File("../contribution-jee-samples/ear-nonenhanced/target/itest-contribution-jee-samples-13-ear-nonenhanced.ear").toURL(); } else if ( uri.toString().equals("itest-contribution-jee-samples-29-ear-appcomp-contrib-implicit.ear")){ earLocation = new File("../contribution-jee-samples/ear-appcomp-contrib-implicit/target/itest-contribution-jee-samples-29-ear-appcomp-contrib-implicit.ear").toURL(); + } else if ( uri.toString().equals("itest-contribution-jee-samples-30-ear-appcomp-contrib-implicit-war-appcomp.ear")){ + earLocation = new File("../contribution-jee-samples/ear-appcomp-contrib-implicit-war-appcomp/target/itest-contribution-jee-samples-30-ear-appcomp-contrib-implicit-war-appcomp.ear").toURL(); } else { return unresolved; } diff --git a/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/SCAJarEarAppcompWarAppcompTestCase.java b/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/SCAJarEarAppcompWarAppcompTestCase.java new file mode 100644 index 0000000000..9f50ea573c --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/SCAJarEarAppcompWarAppcompTestCase.java @@ -0,0 +1,125 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.test.contribution.jee; + +import java.io.File; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.assembly.Component; +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.assembly.Reference; +import org.apache.tuscany.sca.assembly.Service; +import org.apache.tuscany.sca.assembly.builder.CompositeBuilder; +import org.apache.tuscany.sca.contribution.Artifact; +import org.apache.tuscany.sca.contribution.Contribution; +import org.apache.tuscany.sca.contribution.jee.ExternalEarInfo; +import org.apache.tuscany.sca.contribution.jee.JavaEEApplicationInfo; +import org.apache.tuscany.sca.contribution.jee.JavaEEIntrospector; +import org.apache.tuscany.sca.contribution.jee.impl.JavaEEApplicationInfoImpl; +import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver; +import org.apache.tuscany.sca.contribution.resolver.ModelResolver; +import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint; +import org.apache.tuscany.sca.contribution.service.ContributionService; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain; +import org.apache.tuscany.sca.implementation.ejb.EJBImplementation; +import org.apache.tuscany.sca.implementation.jee.JEEImplementation; +import org.apache.tuscany.sca.implementation.web.WebImplementation; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; + +import sample.pojo.HelloworldClient2; + + +public class SCAJarEarAppcompWarAppcompTestCase { + + private static final String CONTRIBUTION_001_ID = "contribution001/"; + + private ClassLoader cl; + private EmbeddedSCADomain domain; + private ContributionService contributionService; + + @Before + public void setUp() throws Exception { + //Create a test embedded SCA domain + cl = getClass().getClassLoader(); + domain = new EmbeddedSCADomain(cl, "http://localhost"); + + //Start the domain + domain.start(); + + //get a reference to the contribution service + contributionService = domain.getContributionService(); + } + + /** + * SCAJAR - It's an SCA contribution in a JAR with no nested archives + * but which references a... + * EAR - It's an JEE EAR file + * appcomp - It has an application composite in it + * WAR - It has a WAR (and and EAR) in it + * appcomp - It has an application composite in it which should be ignored + */ + @Test + public void testSCAJarEarAppcomp() throws Exception { + + URL contributionLocation = new File("../contribution-jee-samples/scajar-ear-appcomp-war-appcomp/target/itest-contribution-jee-samples-43-scajar-ear-appcomp-war-appcomp.jar").toURL(); + Contribution contribution = contributionService.contribute(CONTRIBUTION_001_ID, contributionLocation, false); + + Assert.assertNotNull(contribution); + + Composite composite = null; + for (Artifact artifact : contribution.getArtifacts()){ + if (artifact.getModel() instanceof Composite){ + composite = (Composite) artifact.getModel(); + } + } + + Assert.assertNotNull(composite); + + 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 Java", client.getGreetings("Fred")); + + domain.stop(); + + } + +} |