summaryrefslogtreecommitdiffstats
path: root/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing
diff options
context:
space:
mode:
Diffstat (limited to 'tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing')
-rw-r--r--tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/download-tomcat/pom.xml63
-rw-r--r--tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-client-webapp/pom.xml47
-rw-r--r--tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-client-webapp/src/main/java/testing/HelloworldService.java27
-rw-r--r--tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.composite30
-rw-r--r--tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.xml31
-rw-r--r--tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/hello.jsp36
-rw-r--r--tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-service-contribution/pom.xml45
-rw-r--r--tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldImpl.java36
-rw-r--r--tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldService.java25
-rw-r--r--tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/META-INF/sca-contribution.xml23
-rw-r--r--tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/helloworld.composite28
-rw-r--r--tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/legal-checks/pom.xml36
-rw-r--r--tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/legal-checks/src/test/java/itest/JarsInLICENSETestCase.java147
-rw-r--r--tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/pom.xml39
14 files changed, 613 insertions, 0 deletions
diff --git a/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/download-tomcat/pom.xml b/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/download-tomcat/pom.xml
new file mode 100644
index 0000000000..7de867b27b
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/download-tomcat/pom.xml
@@ -0,0 +1,63 @@
+<?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-M4</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>download-tomcat</artifactId>
+ <packaging>pom</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>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>
+ <!-- Note: the url should be "archive.apache.org" but that is truncating the file at 4808k,
+ no idea why but it sounds like an infra problem - https://issues.apache.org/jira/browse/INFRA-1910 -->
+ <url>http://www.eu.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>
+
+</project>
diff --git a/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-client-webapp/pom.xml b/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-client-webapp/pom.xml
new file mode 100644
index 0000000000..1e6de85863
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC2/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-M4</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-M4</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
+
diff --git a/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-client-webapp/src/main/java/testing/HelloworldService.java b/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-client-webapp/src/main/java/testing/HelloworldService.java
new file mode 100644
index 0000000000..8c67e05aa7
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-client-webapp/src/main/java/testing/HelloworldService.java
@@ -0,0 +1,27 @@
+/*
+ * 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?
+
+public interface HelloworldService {
+
+ String sayHello(String name);
+
+}
diff --git a/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.composite b/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.composite
new file mode 100644
index 0000000000..c03a70c58a
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC2/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/200903"
+ 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/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.xml b/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..411d8a3146
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC2/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/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/hello.jsp b/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-client-webapp/src/main/webapp/hello.jsp
new file mode 100644
index 0000000000..d520375993
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC2/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/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-service-contribution/pom.xml b/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-service-contribution/pom.xml
new file mode 100644
index 0000000000..74920f6823
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC2/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-M4</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-M4</version>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldImpl.java b/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldImpl.java
new file mode 100644
index 0000000000..c9c6ff66d6
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldImpl.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package testing;
+
+import org.oasisopen.sca.annotation.Init;
+import org.oasisopen.sca.annotation.Scope;
+import org.oasisopen.sca.annotation.EagerInit;
+
+@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/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldService.java b/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldService.java
new file mode 100644
index 0000000000..65e95f275c
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-service-contribution/src/main/java/testing/HelloworldService.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 testing;
+
+public interface HelloworldService {
+
+ String sayHello(String name);
+
+}
diff --git a/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/META-INF/sca-contribution.xml b/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..9bdfd4e58b
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC2/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/200903"
+ xmlns:testing="http://org.apache.tuscany.tomcat.testing">
+ <deployable composite="testing:helloworld-service-contribution"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/helloworld.composite b/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/helloworld-service-contribution/src/main/resources/helloworld.composite
new file mode 100644
index 0000000000..2d6ce9419b
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC2/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/200903"
+ targetNamespace="http://org.apache.tuscany.tomcat.testing"
+ name="helloworld-service-contribution">
+
+ <component name="HelloworldComponent">
+ <implementation.java class="testing.HelloworldImpl"/>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/legal-checks/pom.xml b/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/legal-checks/pom.xml
new file mode 100644
index 0000000000..453e9063e5
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/legal-checks/pom.xml
@@ -0,0 +1,36 @@
+<?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-distribution</artifactId>
+ <version>2.0-M4</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>war-legal-checks</artifactId>
+ <name>Apache Tuscany SCA WAR Distribution Legal Checks</name>
+
+ <dependencies>
+ </dependencies>
+
+ <build>
+ </build>
+</project>
diff --git a/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/legal-checks/src/test/java/itest/JarsInLICENSETestCase.java b/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/legal-checks/src/test/java/itest/JarsInLICENSETestCase.java
new file mode 100644
index 0000000000..05f16f603d
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC2/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.dir");
+ }
+
+ 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/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/pom.xml b/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/pom.xml
new file mode 100644
index 0000000000..47cf0ed2d6
--- /dev/null
+++ b/tags/java/sca/2.0-M4-RC2/distribution/tomcat/testing/pom.xml
@@ -0,0 +1,39 @@
+<?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-M4</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-client-webapp</module>
+ <module>legal-checks</module>
+ </modules>
+
+</project>