diff options
Diffstat (limited to 'sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing')
30 files changed, 1254 insertions, 0 deletions
diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/download-tomcat/pom.xml b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/download-tomcat/pom.xml new file mode 100644 index 0000000000..981f0875bf --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/download-tomcat/pom.xml @@ -0,0 +1,82 @@ +<?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-distribution-tomcat-testing</artifactId> + <version>2.0-Beta2-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>download-tomcat</artifactId> + <packaging>war</packaging> + <name>Apache Tuscany SCA Tomcat Integration Testing Download Tomcat</name> + + <properties> + <tomcat.version>6.0.18</tomcat.version> + </properties> + + <build> + + + <plugins> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>tomcat-maven-plugin</artifactId> + <version>1.0-beta-1</version> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>wagon-maven-plugin</artifactId> + <version>1.0-beta-1</version> + <executions> + <execution> + <id>download-tomcat</id> + <phase>pre-integration-test</phase> + <goals> + <goal>download-single</goal> + </goals> + <configuration> + <url>http://archive.apache.org</url> + <fromFile>dist/tomcat/tomcat-6/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip</fromFile> + <toDir>download</toDir> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + + +<profiles> + <profile> + <activation> + <file> + <exists>download/apache-tomcat-6.0.18.zip</exists> + </file> + </activation> + </profile> +</profiles> + + +</project> diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-client-webapp/pom.xml b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-client-webapp/pom.xml new file mode 100644 index 0000000000..44689e02a5 --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-client-webapp/pom.xml @@ -0,0 +1,47 @@ +<?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-distribution-tomcat-testing</artifactId> + <version>2.0-Beta2-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>helloworld-client-webapp</artifactId> + <packaging>war</packaging> + <name>Apache Tuscany SCA Tomcat Integration Testing Helloworld Client Webapp</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>2.0-Beta2-SNAPSHOT</version> + <scope>provided</scope> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + </build> + +</project> + diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-client-webapp/src/main/java/testing/HelloworldService.java b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-client-webapp/src/main/java/testing/HelloworldService.java new file mode 100644 index 0000000000..0be22979c2 --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-client-webapp/src/main/java/testing/HelloworldService.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package testing; + +// TODO: should the webapp need to include the service interface? + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloworldService { + + String sayHello(String name); + +} diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.composite b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.composite new file mode 100644 index 0000000000..d6db86cf64 --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.composite @@ -0,0 +1,30 @@ +<?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://docs.oasis-open.org/ns/opencsa/sca/200912" + targetNamespace="http://testing" + name="jsp-client-webapp"> + + <!-- TODO: should the component name be unique in the domain? i guess so --> + <component name="WebComponent"> + <implementation.web web-uri=""/> + <reference name="service" target="HelloworldComponent"/> + </component> + +</composite> diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.xml b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..411d8a3146 --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,31 @@ +<?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. +--> +<web-app version="2.4" + xmlns="http://java.sun.com/xml/ns/j2ee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" > + + <display-name>jsp-client-webapp</display-name> + + <welcome-file-list id="WelcomeFileList"> + <welcome-file>hello.jsp</welcome-file> + </welcome-file-list> + +</web-app> diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/hello.jsp b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/hello.jsp new file mode 100644 index 0000000000..d520375993 --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/hello.jsp @@ -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.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib uri="http://www.osoa.org/sca/sca_jsp.tld" prefix="sca" %>
+
+<sca:reference name="service" type="testing.HelloworldService" />
+
+<html>
+ <body >
+
+ <h2>jsp-client-webapp</h2>
+
+ Calling HelloworldService sayHello("world") returns:
+
+ <p>
+
+ <%= service.sayHello("world") %>
+
+ </body>
+</html>
diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-reference-contribution/pom.xml b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-reference-contribution/pom.xml new file mode 100644 index 0000000000..854b8f6d32 --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-reference-contribution/pom.xml @@ -0,0 +1,45 @@ +<?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-distribution-tomcat-testing</artifactId>
+ <version>2.0-Beta2-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>helloworld-reference-contribution</artifactId>
+ <name>Apache Tuscany SCA Tomcat Integration Testing Helloworld Reference Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>2.0-Beta2-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-reference-contribution/src/main/java/testing/HelloworldRefImpl.java b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-reference-contribution/src/main/java/testing/HelloworldRefImpl.java new file mode 100644 index 0000000000..c2d0bcb4dc --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-reference-contribution/src/main/java/testing/HelloworldRefImpl.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 testing;
+
+import org.oasisopen.sca.annotation.Service;
+import org.oasisopen.sca.annotation.Reference;
+import org.oasisopen.sca.annotation.EagerInit;
+
+@Service(HelloworldService.class)
+public class HelloworldRefImpl implements HelloworldService {
+
+ @Reference
+ public HelloworldService service;
+
+ public String sayHello(String name) {
+ if (service == null) {
+ return "ERROR, @Reference is null!";
+ } else {
+ return "Hello ref says: " + service.sayHello(name);
+ }
+ }
+}
diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-reference-contribution/src/main/java/testing/HelloworldService.java b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-reference-contribution/src/main/java/testing/HelloworldService.java new file mode 100644 index 0000000000..b035a772be --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-reference-contribution/src/main/java/testing/HelloworldService.java @@ -0,0 +1,28 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package testing;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface HelloworldService {
+
+ String sayHello(String name);
+
+}
diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-reference-contribution/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-reference-contribution/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..693325c13d --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-reference-contribution/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ +<?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.
+-->
+<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:testing="http://org.apache.tuscany.tomcat.testing">
+ <deployable composite="testing:helloworld-reference-contribution"/>
+</contribution>
\ No newline at end of file diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-reference-contribution/src/main/resources/helloworld.composite b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-reference-contribution/src/main/resources/helloworld.composite new file mode 100644 index 0000000000..b07cf6078c --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-reference-contribution/src/main/resources/helloworld.composite @@ -0,0 +1,29 @@ +<?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://docs.oasis-open.org/ns/opencsa/sca/200912"
+ targetNamespace="http://org.apache.tuscany.tomcat.testing"
+ name="helloworld-reference-contribution">
+
+ <component name="HelloworldRefComponent">
+ <implementation.java class="testing.HelloworldRefImpl"/>
+ <reference name="service" target="HelloworldComponent" />
+ </component>
+
+</composite>
diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-jsp/pom.xml b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-jsp/pom.xml new file mode 100644 index 0000000000..6e597f2a47 --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-jsp/pom.xml @@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-distribution-tomcat-testing</artifactId>
+ <version>2.0-Beta2-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>helloworld-scaclient-jsp</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany SCA Tomcat Integration Testing Helloworld Webapp Using SCAClient in a JSP</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>2.0-Beta2-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
+
+
diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-jsp/src/main/java/testing/HelloworldService.java b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-jsp/src/main/java/testing/HelloworldService.java new file mode 100644 index 0000000000..b035a772be --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-jsp/src/main/java/testing/HelloworldService.java @@ -0,0 +1,28 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package testing;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface HelloworldService {
+
+ String sayHello(String name);
+
+}
diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-jsp/src/main/webapp/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-jsp/src/main/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..7839933b3a --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-jsp/src/main/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,28 @@ +<?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.
+-->
+<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:testing="http://org.apache.tuscany.tomcat.testing">
+
+ <!-- TODO: There's nothing in here as this file is only present so that the
+ Tuscany Tomcat integration code gets triggered when this webapp
+ ias deployed and adds Tuscany to the Webapp classpath so that the
+ SCAClient implementation is available -->
+
+</contribution>
diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-jsp/src/main/webapp/WEB-INF/web.xml b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-jsp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..f2e3441d5e --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-jsp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,31 @@ +<?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.
+-->
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
+
+ <display-name>jsp-client-webapp</display-name>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>hello.jsp</welcome-file>
+ </welcome-file-list>
+
+</web-app>
diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-jsp/src/main/webapp/hello.jsp b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-jsp/src/main/webapp/hello.jsp new file mode 100644 index 0000000000..45ae96cb82 --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-jsp/src/main/webapp/hello.jsp @@ -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.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+<%@ page import="org.oasisopen.sca.client.SCAClientFactory"%>
+<%@ page import="testing.HelloworldService" %>
+<%@ page import="java.net.URI" %>
+
+<%
+ HelloworldService service = SCAClientFactory.newInstance(URI.create("default")).getService(HelloworldService.class, "HelloworldComponent");
+%>
+
+<html>
+ <body >
+
+ <h2>helloworld-scaclient-jsp</h2>
+
+ Calling HelloworldService sayHello("world") returns:
+
+ <p>
+
+ <%= service.sayHello("world") %>
+
+ </body>
+</html>
diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-servlet/pom.xml b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-servlet/pom.xml new file mode 100644 index 0000000000..fcc6bbcb5a --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-servlet/pom.xml @@ -0,0 +1,53 @@ +<?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-distribution-tomcat-testing</artifactId>
+ <version>2.0-Beta2-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>helloworld-scaclient-servlet</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany SCA Tomcat Integration Testing Helloworld Webapp Using SCAClient in a Servlet</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>2.0-Beta2-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
+
diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-servlet/src/main/java/testing/HelloworldService.java b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-servlet/src/main/java/testing/HelloworldService.java new file mode 100644 index 0000000000..b035a772be --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-servlet/src/main/java/testing/HelloworldService.java @@ -0,0 +1,28 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package testing;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface HelloworldService {
+
+ String sayHello(String name);
+
+}
diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-servlet/src/main/java/testing/HelloworldServlet.java b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-servlet/src/main/java/testing/HelloworldServlet.java new file mode 100644 index 0000000000..5be51fab61 --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-servlet/src/main/java/testing/HelloworldServlet.java @@ -0,0 +1,64 @@ +/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package testing;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.net.URI;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.oasisopen.sca.NoSuchDomainException;
+import org.oasisopen.sca.NoSuchServiceException;
+import org.oasisopen.sca.client.SCAClientFactory;
+
+/**
+ */
+public class HelloworldServlet extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException {
+ try {
+
+ String component = request.getParameter("component");
+ HelloworldService service = SCAClientFactory.newInstance(URI.create("default")).getService(HelloworldService.class, component);
+
+ String name = request.getParameter("name");
+ String greeting = service.sayHello(name);
+
+ Writer out = response.getWriter();
+ out.write("<html><head><title>Apache Tuscany Helloworld Servlet Sample</title></head><body>");
+ out.write("<h2>Apache Tuscany Helloworld Servlet Sample</h2>");
+ out.write("<br><strong>Component " + component + " says: </strong>" + greeting);
+ out.write("</body></html>");
+ out.flush();
+ out.close();
+
+ } catch (NoSuchDomainException e) {
+ e.printStackTrace();
+ } catch (NoSuchServiceException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-servlet/src/main/webapp/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-servlet/src/main/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..7839933b3a --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-servlet/src/main/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,28 @@ +<?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.
+-->
+<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:testing="http://org.apache.tuscany.tomcat.testing">
+
+ <!-- TODO: There's nothing in here as this file is only present so that the
+ Tuscany Tomcat integration code gets triggered when this webapp
+ ias deployed and adds Tuscany to the Webapp classpath so that the
+ SCAClient implementation is available -->
+
+</contribution>
diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-servlet/src/main/webapp/WEB-INF/web.xml b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-servlet/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..d424d4b71b --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-servlet/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,41 @@ +<?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.
+-->
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
+
+ <display-name>helloworld-scaclient2-webapp</display-name>
+
+ <servlet>
+ <servlet-name>HelloworldServlet</servlet-name>
+ <servlet-class>testing.HelloworldServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>HelloworldServlet</servlet-name>
+ <url-pattern>/HelloworldServlet</url-pattern>
+ </servlet-mapping>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>hello.html</welcome-file>
+ </welcome-file-list>
+
+</web-app>
diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-servlet/src/main/webapp/hello.html b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-servlet/src/main/webapp/hello.html new file mode 100644 index 0000000000..5398cb5274 --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-scaclient-servlet/src/main/webapp/hello.html @@ -0,0 +1,52 @@ +<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<html>
+
+<head>
+<title>helloworld-scaclient2-webapp</title>
+</head>
+
+<body>
+
+<h2>helloworld-scaclient-servlet</h2>
+
+<form action="HelloworldServlet" method="post">
+ <table>
+ <tr>
+
+ <td><select name="component" size="1">
+ <option>HelloworldComponent</option>
+ <option>HelloworldRefComponent</option>
+ </select></td>
+
+ <td>Enter your name:</td>
+ <td>
+ <input type="text" name="name" width="10">
+ </td>
+ </tr>
+ <tr>
+ <td align="left" colspan="2">
+ <button name="submit" type="submit">Say hello</button>
+ </td>
+ </tr>
+ </table>
+</form>
+
+</body>
+</html>
\ No newline at end of file diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-service-contribution/pom.xml b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-service-contribution/pom.xml new file mode 100644 index 0000000000..c7299b33b5 --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-service-contribution/pom.xml @@ -0,0 +1,45 @@ +<?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-distribution-tomcat-testing</artifactId> + <version>2.0-Beta2-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>helloworld-service-contribution</artifactId> + <name>Apache Tuscany SCA Tomcat Integration Testing Helloworld Service Contribution</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>2.0-Beta2-SNAPSHOT</version> + <scope>provided</scope> + </dependency> + + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + </build> +</project> diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldImpl.java b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldImpl.java new file mode 100644 index 0000000000..564b2e332f --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldImpl.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package testing; + +import org.oasisopen.sca.annotation.Init; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; +import org.oasisopen.sca.annotation.EagerInit; + +@Service(HelloworldService.class) +@Scope("COMPOSITE") @EagerInit +public class HelloworldImpl implements HelloworldService { + + public String sayHello(String name) { + return "Hello " + name; + } + + @Init + public void init() { + System.out.println("HelloworldImpl eager init: " + sayHello("world")); + } +} diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldService.java b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldService.java new file mode 100644 index 0000000000..eec9d63da8 --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package testing; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloworldService { + + String sayHello(String name); + +} diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/META-INF/sca-contribution.xml b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..4e0eca6068 --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ +<?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. +--> +<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" + xmlns:testing="http://org.apache.tuscany.tomcat.testing"> + <deployable composite="testing:helloworld-service-contribution"/> +</contribution>
\ No newline at end of file diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/helloworld.composite b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/helloworld.composite new file mode 100644 index 0000000000..82b2cc7ce7 --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/helloworld.composite @@ -0,0 +1,28 @@ +<?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://docs.oasis-open.org/ns/opencsa/sca/200912" + targetNamespace="http://org.apache.tuscany.tomcat.testing" + name="helloworld-service-contribution"> + + <component name="HelloworldComponent"> + <implementation.java class="testing.HelloworldImpl"/> + </component> + +</composite> diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/legal-checks/pom.xml b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/legal-checks/pom.xml new file mode 100644 index 0000000000..0220e99e6e --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/legal-checks/pom.xml @@ -0,0 +1,42 @@ +<?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-distribution-tomcat-testing</artifactId> + <version>2.0-Beta2-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>war-legal-checks</artifactId> + <name>Apache Tuscany SCA WAR Distribution Legal Checks</name> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.8.1</version> + <scope>compile</scope> + </dependency> + </dependencies> + + <build> + </build> +</project> diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/legal-checks/src/test/java/itest/JarsInLICENSETestCase.java b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/legal-checks/src/test/java/itest/JarsInLICENSETestCase.java new file mode 100644 index 0000000000..04e6a0bc5c --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/legal-checks/src/test/java/itest/JarsInLICENSETestCase.java @@ -0,0 +1,147 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package itest; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.StringTokenizer; + +import org.junit.Test; + +/** + * Checks that all jar files included in the distribution are mentioned in the LICENSE file + * and that all jars mentioned in the LICENSE are in the distribution. + */ +public class JarsInLICENSETestCase { + + @Test + public void testJars() throws Exception { + File distroRoot = getUnzipedDistroRoot(); + + File licenseFile = new File(distroRoot, "LICENSE"); + if (!licenseFile.exists()) { + throw new IllegalStateException("can't find LICENSE file at: " + licenseFile.getAbsoluteFile().toString()); + } + + File libDirectory = distroRoot; + if (!libDirectory.exists()) { + throw new IllegalStateException("can't find modules folder at: " + libDirectory.getAbsoluteFile().toString()); + } + + List<String> jars = getJarsInDistro(libDirectory); + + List<String> bad2 = getLICENSEJarsNotInDistro(licenseFile, jars); + if (bad2.size() > 0) { + System.err.println("Jars in LICENSE but not in Distribution: " + bad2); + } + + List<String> bad1 = getJarsNotInLICENSE(jars, licenseFile); + if (bad1.size() > 0) { + System.err.println("Jars in distribution but not in LICENSE: " + bad1); + } + + if (bad1.size() > 0 || bad2.size() > 0) { + throw new IllegalStateException("LICENSE problems, check log"); + } + } + + private List<String> getLICENSEJarsNotInDistro(File licenseFile, List<String> jars) throws IOException { + List<String> badJars = new ArrayList<String>(); + BufferedReader reader = new BufferedReader(new FileReader(licenseFile)); + String line = null; + while ((line = reader.readLine()) != null) { + line = line.trim(); + if (line.contains(".jar")) { + StringTokenizer st = new StringTokenizer(line); + while (st.hasMoreTokens()) { + String s = st.nextToken(); + if (s.contains(".jar")) { + if (s.startsWith("(")) { + s = s.substring(1); + } + if (s.endsWith(",") || s.endsWith(":")) { + s = s.substring(0, s.length()-1); + } + if (s.endsWith(")")) { + s = s.substring(0, s.length()-1); + } + if (!jars.contains(s) && !s.startsWith("tuscany-")) { + badJars.add(s); + } + } + } + } + } + return badJars; + } + + private List<String> getJarsNotInLICENSE(List<String> jars, File licenseFile) throws IOException { + List<String> badJars = new ArrayList<String>(); + String licenseText = readLICENSE(licenseFile); + for (String jar : jars) { + if (!licenseText.contains(jar)) { + if (jar.startsWith("tuscany-")) { + // ignore tuscany jars as they're not mentioned in the LICENSE file + } else { + badJars.add(jar); + } + } + } + return badJars; + } + + private List<String> getJarsInDistro(File directory) { + List<String> jars = new ArrayList<String>(); + for (String fn : directory.list()){ + if (fn.endsWith(".jar")) { + jars.add(fn); + } else { + File f = new File(directory, fn); + if (f.isDirectory()) { + jars.addAll(getJarsInDistro(f)); + } + } + } + return jars; + } + + private File getUnzipedDistroRoot() { + return new File("../../tomcat-war/target/tuscany"); + } + + private static String readLICENSE(File licenseFile) throws java.io.IOException { + StringBuffer fileData = new StringBuffer(); + BufferedReader reader = new BufferedReader(new FileReader(licenseFile)); + char[] buf = new char[1024]; + int numRead = 0; + while ((numRead = reader.read(buf)) != -1) { + String readData = String.valueOf(buf, 0, numRead); + fileData.append(readData); + buf = new char[1024]; + } + reader.close(); + return fileData.toString(); + } + +} diff --git a/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/pom.xml b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/pom.xml new file mode 100644 index 0000000000..5192ba00e0 --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta2/distribution/tomcat/testing/pom.xml @@ -0,0 +1,42 @@ +<?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-distribution-tomcat</artifactId> + <relativePath>../pom.xml</relativePath> + <version>2.0-Beta2-SNAPSHOT</version> + </parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-distribution-tomcat-testing</artifactId> + <packaging>pom</packaging> + <name>Apache Tuscany SCA Distribution Tomcat Testing</name> + + <modules> + <module>helloworld-service-contribution</module> + <module>helloworld-reference-contribution</module> + <module>helloworld-scaclient-jsp</module> + <module>helloworld-scaclient-servlet</module> + <module>helloworld-client-webapp</module> + <module>legal-checks</module> + </modules> + +</project> |