You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2010/09/02 01:24:19 UTC

svn commit: r991763 - in /openejb/trunk/openejb3/assembly: ./ itest-runner/ itest-runner/src/ itest-runner/src/test/ itest-runner/src/test/groovy/ itest-runner/src/test/groovy/commands/ openejb-tomcat/openejb-tomcat-bundle/ openejb-tomcat/openejb-tomca...

Author: jgallimore
Date: Wed Sep  1 23:24:19 2010
New Revision: 991763

URL: http://svn.apache.org/viewvc?rev=991763&view=rev
Log:
OPENEJB-1350 added Groovy script to execute itests

Added:
    openejb/trunk/openejb3/assembly/itest-runner/   (with props)
    openejb/trunk/openejb3/assembly/itest-runner/pom.xml
    openejb/trunk/openejb3/assembly/itest-runner/src/
    openejb/trunk/openejb3/assembly/itest-runner/src/test/
    openejb/trunk/openejb3/assembly/itest-runner/src/test/groovy/
    openejb/trunk/openejb3/assembly/itest-runner/src/test/groovy/commands/
    openejb/trunk/openejb3/assembly/itest-runner/src/test/groovy/commands/SetupCommand.groovy
Modified:
    openejb/trunk/openejb3/assembly/openejb-tomcat/openejb-tomcat-bundle/pom.xml
    openejb/trunk/openejb3/assembly/openejb-tomcat/openejb-tomcat-catalina/src/main/java/org/apache/openejb/tomcat/catalina/TomcatThreadContextListener.java
    openejb/trunk/openejb3/assembly/pom.xml

Propchange: openejb/trunk/openejb3/assembly/itest-runner/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  1 23:24:19 2010
@@ -0,0 +1,2 @@
+target
+

Added: openejb/trunk/openejb3/assembly/itest-runner/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/assembly/itest-runner/pom.xml?rev=991763&view=auto
==============================================================================
--- openejb/trunk/openejb3/assembly/itest-runner/pom.xml (added)
+++ openejb/trunk/openejb3/assembly/itest-runner/pom.xml Wed Sep  1 23:24:19 2010
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<artifactId>assembly</artifactId>
+		<groupId>org.apache.openejb</groupId>
+		<version>3.2-SNAPSHOT</version>
+	</parent>
+	<groupId>org.apache.openejb</groupId>
+	<artifactId>itest-runner</artifactId>
+	<version>3.2-SNAPSHOT</version>
+	<name>OpenEJB :: Assembly :: iTest-Runner</name>
+	<url>http://maven.apache.org</url>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.codehaus.gmaven</groupId>
+				<artifactId>gmaven-plugin</artifactId>
+
+				<executions>
+					<execution>
+						<id>setup-environment</id>
+						<phase>integration-test</phase>
+						<goals>
+							<goal>execute</goal>
+						</goals>
+						<configuration>
+							<source>
+								new commands.SetupCommand(this).execute()
+              				</source>
+              				<skip>${maven.test.skip}</skip>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-dependency-plugin</artifactId>
+
+				<executions>
+					<execution>
+						<id>unpack</id>
+						<phase>pre-integration-test</phase>
+						<goals>
+							<goal>unpack</goal>
+						</goals>
+						<configuration>
+							<artifactItems>
+								<artifactItem>
+									<groupId>org.apache.openejb</groupId>
+									<artifactId>openejb-tomcat-bundle</artifactId>
+									<version>3.2-SNAPSHOT</version>
+									<type>zip</type>
+									<outputDirectory>${project.build.directory}</outputDirectory>
+								</artifactItem>
+							</artifactItems>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+		<pluginManagement>
+			<plugins>
+				<plugin>
+					<groupId>org.codehaus.gmaven</groupId>
+					<artifactId>gmaven-plugin</artifactId>
+					<version>1.3</version>
+					<configuration>
+						<scriptpath>
+							<element>${pom.basedir}/src/test/groovy</element>
+						</scriptpath>
+						<classpath>
+							<element>
+								<groupId>jline</groupId>
+								<artifactId>jline</artifactId>
+								<version>0.9.94</version>
+							</element>
+						</classpath>
+						<defaults>
+							<testSectionsFile>${pom.basedir}/sections.properties</testSectionsFile>
+							<logOutputDirectory>${project.build.directory}/logs</logOutputDirectory>
+							<backupLogs>true</backupLogs>
+						</defaults>
+					</configuration>
+				</plugin>
+			</plugins>
+		</pluginManagement>
+	</build>
+	<dependencies>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>3.8.1</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>jline</groupId>
+			<artifactId>jline</artifactId>
+			<version>0.9.94</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-lang</groupId>
+			<artifactId>commons-lang</artifactId>
+			<version>2.5</version>
+		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+			<version>1.6.1</version>
+			<type>jar</type>
+			<scope>compile</scope>
+		</dependency>
+	</dependencies>
+	<properties>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+		<tomcat.version>6.0.29</tomcat.version>
+		<localRepository>${settings.localRepository}</localRepository>
+		<openejb.home>${project.build.directory}/apache-tomcat-${tomcatVersion}</openejb.home>
+		<skipTests>${maven.test.skip}</skipTests>
+	</properties>
+</project>

Added: openejb/trunk/openejb3/assembly/itest-runner/src/test/groovy/commands/SetupCommand.groovy
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/assembly/itest-runner/src/test/groovy/commands/SetupCommand.groovy?rev=991763&view=auto
==============================================================================
--- openejb/trunk/openejb3/assembly/itest-runner/src/test/groovy/commands/SetupCommand.groovy (added)
+++ openejb/trunk/openejb3/assembly/itest-runner/src/test/groovy/commands/SetupCommand.groovy Wed Sep  1 23:24:19 2010
@@ -0,0 +1,131 @@
+/*
+ * 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 commands
+
+import org.apache.commons.lang.SystemUtils
+
+class SetupCommand
+{
+	def log;
+	def ant;
+	def project;
+	
+    def SetupCommand(source) {
+		this.log = source.log;
+		this.project = source.project
+		this.ant = new AntBuilder();
+    }
+	
+	def get(name) {
+		assert name != null
+
+		def value = project.properties.getProperty(name)
+
+		log.debug("Get property: $name=$value")
+
+		return value
+	}
+
+	def get(name, defaultValue) {
+		def value = get(name)
+
+		if (value == null) {
+			value = defaultValue
+		}
+
+		return value
+	}
+	
+	def getBoolean(name, defaultValue) {
+		def value = get(name, defaultValue)
+		return Boolean.valueOf("$value")
+	}
+    
+	def require(name) {
+		assert name != null
+
+		log.debug("Require property: $name")
+
+		if (!project.properties.containsKey(name) && !System.properties.containsKey(name)) {
+			throw new Exception("Missing required property: $name")
+		}
+
+		def value = get(name)
+
+		if (value == 'null') {
+			throw new Exception("Missing required property: $name (resolved to null)")
+		}
+
+		return value
+	}
+	
+    def execute() {
+		def tomcatVersion = require('tomcat.version');
+		def localRepo = require('localRepository');
+		def openejbHome = require('openejb.home');
+		
+		if (getBoolean('skipTests', false)) {
+			log.info('Skipping itests.')
+			return
+		}
+		
+		ant.echo("Removing ejb-example application from exploded bundle")
+		ant.delete(dir: "${project.build.directory}/apache-tomcat-${tomcatVersion}/webapps/ejb-examples")
+
+		ant.echo("Assigning execute privileges to scripts in Tomcat bin directory")
+		ant.chmod(dir: "${project.build.directory}/apache-tomcat-${tomcatVersion}/bin", perm: "u+x", includes: "**/*.sh")
+		
+		ant.echo("Deploying the itests war")
+		ant.unzip(src: "${localRepo}/org/apache/openejb/openejb-itests-web/${project.version}/openejb-itests-web-${project.version}.war",
+					dest: "${project.build.directory}/apache-tomcat-${tomcatVersion}/webapps/itests")
+		
+		ant.echo("Starting Tomcat...")
+		ant.exec(executable: "${project.build.directory}/apache-tomcat-${tomcatVersion}/bin/startup.sh")
+		
+		ant.waitfor(maxwait: 1, maxwaitunit: "minute") {
+			ant.and() {
+				ant.socket(server: "localhost", port: "8080")
+				ant.socket(server: "localhost", port: "8005")
+				ant.socket(server: "localhost", port: "8009")
+			}
+		}
+		
+		ant.echo("Tomcat started. Running itests...")
+		ant.java(jar: "${localRepo}/org/apache/openejb/openejb-itests-standalone-client/${project.version}/openejb-itests-standalone-client-${project.version}.jar", fork: "yes") {
+			sysproperty(key: "openejb.home", value: "${openejbHome}")
+			arg(value: "tomcat")
+		}
+
+		ant.echo("Tomcat itests complete, stopping Tomcat")
+		ant.exec(executable: "${project.build.directory}/apache-tomcat-${tomcatVersion}/bin/shutdown.sh")
+		ant.waitfor(maxwait: 1, maxwaitunit: "minute") {
+			ant.not() {
+				ant.or() {
+					ant.socket(server: "localhost", port: "8080")
+					ant.socket(server: "localhost", port: "8005")
+					ant.socket(server: "localhost", port: "8009")
+					ant.socket(server: "localhost", port: "61616")
+				}
+			}
+		}
+		
+		ant.echo("Tomcat stopped, itest run complete")
+    }
+}

Modified: openejb/trunk/openejb3/assembly/openejb-tomcat/openejb-tomcat-bundle/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/assembly/openejb-tomcat/openejb-tomcat-bundle/pom.xml?rev=991763&r1=991762&r2=991763&view=diff
==============================================================================
--- openejb/trunk/openejb3/assembly/openejb-tomcat/openejb-tomcat-bundle/pom.xml (original)
+++ openejb/trunk/openejb3/assembly/openejb-tomcat/openejb-tomcat-bundle/pom.xml Wed Sep  1 23:24:19 2010
@@ -1,141 +1,142 @@
 <?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.
--->
-
-<!-- $Rev: 600338 $ $Date: 2007-12-02 09:08:04 -0800 (Sun, 02 Dec 2007) $ -->
+		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.
+	-->
+
+	<!--
+		$Rev: 600338 $ $Date: 2007-12-02 09:08:04 -0800 (Sun, 02 Dec 2007) $
+	-->
 
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <parent>
-        <artifactId>openejb-tomcat</artifactId>
-        <groupId>org.apache.openejb</groupId>
-        <version>3.2-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>openejb-tomcat-bundle</artifactId>
-    <packaging>jar</packaging>
-    <name>OpenEJB :: Assembly :: Tomcat :: Bundle</name>
-    <properties>
-        <tomcat.version>6.0.29</tomcat.version>
-        <examples.version>1.1-SNAPSHOT</examples.version>
-    </properties>
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.openejb</groupId>
-            <artifactId>openejb-loader</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.openejb</groupId>
-            <artifactId>openejb-tomcat-common</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.tomcat</groupId>
-            <artifactId>catalina</artifactId>
-        </dependency>
-    </dependencies>
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-antrun-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>download-tomcat</id>
-                        <phase>compile</phase>
-                        <configuration>
-                            <tasks>
-                                <property name="OUTPUT_DIR" value="${basedir}/target"/>
-                                <property name="LOCAL_M2_REPO" value="${settings.localRepository}"/>
-                                <property name="tomcat.version" value="${tomcat.version}"/>
-                                <property name="openejb.version" value="${project.version}"/>
-                                <property name="examples.version" value="${examples.version}"/>
-
-                                <ant antfile="${basedir}/build.xml">
-                                    <target name="downloadtomcat"/>
-                                </ant>
-                            </tasks>
-                        </configuration>
-                        <goals>
-                            <goal>run</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>exec-maven-plugin</artifactId>
-                <version>1.1</version>
-                <executions>
-                    <execution>
-                        <id>execute-installer</id>
-                        <phase>prepare-package</phase>
-                        <configuration>
-                            <mainClass>org.apache.openejb.tomcat.TomcatBundleInstaller</mainClass>
-                            <arguments>
-                                <argument>
-                                    ${basedir}/target/bundle/extracted/apache-tomcat-${tomcat.version}/webapps/openejb
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<parent>
+		<artifactId>openejb-tomcat</artifactId>
+		<groupId>org.apache.openejb</groupId>
+		<version>3.2-SNAPSHOT</version>
+	</parent>
+	<modelVersion>4.0.0</modelVersion>
+	<artifactId>openejb-tomcat-bundle</artifactId>
+	<packaging>jar</packaging>
+	<name>OpenEJB :: Assembly :: Tomcat :: Bundle</name>
+	<properties>
+		<tomcat.version>6.0.29</tomcat.version>
+		<examples.version>1.1-SNAPSHOT</examples.version>
+	</properties>
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.openejb</groupId>
+			<artifactId>openejb-loader</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.openejb</groupId>
+			<artifactId>openejb-tomcat-common</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.tomcat</groupId>
+			<artifactId>catalina</artifactId>
+		</dependency>
+	</dependencies>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-antrun-plugin</artifactId>
+				<executions>
+					<execution>
+						<id>download-tomcat</id>
+						<phase>compile</phase>
+						<configuration>
+							<tasks>
+								<property name="OUTPUT_DIR" value="${basedir}/target" />
+								<property name="LOCAL_M2_REPO" value="${settings.localRepository}" />
+								<property name="tomcat.version" value="${tomcat.version}" />
+								<property name="openejb.version" value="${project.version}" />
+								<property name="examples.version" value="${examples.version}" />
+
+								<ant antfile="${basedir}/build.xml">
+									<target name="downloadtomcat" />
+								</ant>
+							</tasks>
+						</configuration>
+						<goals>
+							<goal>run</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<groupId>org.codehaus.mojo</groupId>
+				<artifactId>exec-maven-plugin</artifactId>
+				<version>1.1</version>
+				<executions>
+					<execution>
+						<id>execute-installer</id>
+						<phase>prepare-package</phase>
+						<configuration>
+							<mainClass>org.apache.openejb.tomcat.TomcatBundleInstaller</mainClass>
+							<arguments>
+								<argument>
+									${basedir}/target/bundle/extracted/apache-tomcat-${tomcat.version}/webapps/openejb
                                 </argument>
-                            </arguments>
-                            <systemProperties>
-                                <systemProperty>
-                                    <key>catalina.home</key>
-                                    <value>
-                                        ${basedir}/target/bundle/extracted/apache-tomcat-${tomcat.version}
+							</arguments>
+							<systemProperties>
+								<systemProperty>
+									<key>catalina.home</key>
+									<value>
+										${basedir}/target/bundle/extracted/apache-tomcat-${tomcat.version}
                                     </value>
-                                </systemProperty>
-                                <systemProperty>
-                                    <key>catalina.base</key>
-                                    <value>
-                                        ${basedir}/target/bundle/extracted/apache-tomcat-${tomcat.version}
+								</systemProperty>
+								<systemProperty>
+									<key>catalina.base</key>
+									<value>
+										${basedir}/target/bundle/extracted/apache-tomcat-${tomcat.version}
                                     </value>
-                                </systemProperty>
-                            </systemProperties>
-                        </configuration>
-                        <goals>
-                            <goal>java</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>war</id>
-                        <phase>package</phase>
-                        <configuration>
-                            <finalName>${project.artifactId}-${tomcat.version}-${project.version}</finalName>
-                        </configuration>
-                        <goals>
-                            <goal>attached</goal>
-                        </goals>
-                    </execution>
-                </executions>
-                <configuration>
-                    <appendAssemblyId>false</appendAssemblyId>
-                    <descriptors>
-                        <descriptor>src/main/assembly/bundle.xml</descriptor>
-                    </descriptors>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
+								</systemProperty>
+							</systemProperties>
+						</configuration>
+						<goals>
+							<goal>java</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<artifactId>maven-assembly-plugin</artifactId>
+				<executions>
+					<execution>
+						<id>war</id>
+						<phase>package</phase>
+						<configuration>
+							<finalName>${project.artifactId}-${tomcat.version}-${project.version}</finalName>
+						</configuration>
+						<goals>
+							<goal>attached</goal>
+						</goals>
+					</execution>
+				</executions>
+				<configuration>
+					<appendAssemblyId>false</appendAssemblyId>
+					<descriptors>
+						<descriptor>src/main/assembly/bundle.xml</descriptor>
+					</descriptors>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
 </project>
 

Modified: openejb/trunk/openejb3/assembly/openejb-tomcat/openejb-tomcat-catalina/src/main/java/org/apache/openejb/tomcat/catalina/TomcatThreadContextListener.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/assembly/openejb-tomcat/openejb-tomcat-catalina/src/main/java/org/apache/openejb/tomcat/catalina/TomcatThreadContextListener.java?rev=991763&r1=991762&r2=991763&view=diff
==============================================================================
--- openejb/trunk/openejb3/assembly/openejb-tomcat/openejb-tomcat-catalina/src/main/java/org/apache/openejb/tomcat/catalina/TomcatThreadContextListener.java (original)
+++ openejb/trunk/openejb3/assembly/openejb-tomcat/openejb-tomcat-catalina/src/main/java/org/apache/openejb/tomcat/catalina/TomcatThreadContextListener.java Wed Sep  1 23:24:19 2010
@@ -57,14 +57,14 @@ public class TomcatThreadContextListener
         try {
             // someone decided to make the getThreadName package protected so we have to use reflection
             method = ContextBindings.class.getDeclaredMethod("getThreadName");
-            accessible = method.isAccessible();
+//            accessible = method.isAccessible();
             method.setAccessible(true);
         } catch (NoSuchMethodException e) {
             logger.error("Expected ContextBinding to have the method getThreadName()");
-        } finally {
-            if (!accessible) {
-                method.setAccessible(accessible);
-            }
+//        } finally {
+//            if (!accessible) {
+//                method.setAccessible(accessible);
+//            }
         }
     }
 

Modified: openejb/trunk/openejb3/assembly/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/assembly/pom.xml?rev=991763&r1=991762&r2=991763&view=diff
==============================================================================
--- openejb/trunk/openejb3/assembly/pom.xml (original)
+++ openejb/trunk/openejb3/assembly/pom.xml Wed Sep  1 23:24:19 2010
@@ -37,6 +37,8 @@
     <module>openejb-jetty</module>
     <module>openejb-webapp</module>
     <module>javaee-api-libs</module>
+    <!-- don't run this just yet, its in progress -->
+    <!-- <module>itest-runner</module> -->
   </modules>
 </project>