Title: [2534] trunk/openejb3/openejb-assembly: Maven/jelly script for mostly automating tests of openejb assemblies
Revision
2534
Author
dblevins
Date
2006-03-10 03:44:10 -0500 (Fri, 10 Mar 2006)

Log Message

Maven/jelly script for mostly automating tests of openejb assemblies
New assembly of an executable test client

Modified Paths

Added Paths

Diff

Added: trunk/openejb3/openejb-assembly/maven.xml (2533 => 2534)

--- trunk/openejb3/openejb-assembly/maven.xml	2006-03-10 07:56:03 UTC (rev 2533)
+++ trunk/openejb3/openejb-assembly/maven.xml	2006-03-10 08:44:10 UTC (rev 2534)
@@ -0,0 +1,248 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Revision: 2513 $ $Date: 2006-02-25 21:53:47 -0800 (Sat, 25 Feb 2006) $ -->
+
+<project default="default"
+    xmlns:j="jelly:core"
+    xmlns:u="jelly:util">
+
+    <!--======================-->
+    <!--   Tomcat profiles    -->
+    <!--======================-->
+
+    <goal name="tomcat55">
+      <j:set var="tomcat.branch" value="5"/>
+      <j:set var="tomcat.version" value="5.5.15"/>
+      <j:set var="tomcat.prefix" value="apache"/>
+      <attainGoal name="tomcat.env"/>
+    </goal>
+
+    <goal name="tomcat50">
+      <j:set var="tomcat.branch" value="5"/>
+      <j:set var="tomcat.version" value="5.0.30"/>
+      <j:set var="tomcat.prefix" value="jakarta"/>
+      <attainGoal name="tomcat.env"/>
+    </goal>
+
+    <goal name="tomcat4">
+      <j:set var="tomcat.branch" value="4"/>
+      <j:set var="tomcat.version" value="4.1.31"/>
+      <j:set var="tomcat.prefix" value="jakarta"/>
+      <attainGoal name="tomcat.env"/>
+    </goal>
+
+    <goal name="tomcat.env">
+      <j:set var="targetDir" value="${basedir}/target/"/>
+      <j:set var="tomcat.home" value="${targetDir}/${tomcat.prefix}-tomcat-${tomcat.version}"/>
+      <j:set var="openejb.home" value="${targetDir}/openejb-${openejb.version}" />
+    </goal>
+
+    <!--======================-->
+    <!--   Setup/cleanup      -->
+    <!--======================-->
+
+    <goal name="setup:tomcat">
+      <j:set var="targetDir" value="${basedir}/target/"/>
+
+      <j:set var="tomcat.download" value="http://www.ibiblio.org/pub/mirrors/apache/tomcat/tomcat-${tomcat.branch}/v${tomcat.version}/bin/${tomcat.prefix}-tomcat-${tomcat.version}.zip"/>
+
+      <j:set var="tomcat.src" value="${maven.repo.local}/tomcat/distributions/${tomcat.prefix}-tomcat-${tomcat.version}.zip"/>
+      <j:set var="tomcat.dist" value="${maven.repo.local}/tomcat/distributions/${tomcat.prefix}-tomcat-${tomcat.version}.zip"/>
+      <j:set var="tomcat.home" value="${targetDir}/${tomcat.prefix}-tomcat-${tomcat.version}"/>
+      <j:set var="openejb.home" value="${targetDir}/openejb-${openejb.version}" />
+
+      <!-- Download tomcat if it isn't in the repo -->
+      <u:file var="fileAsFile" name="${tomcat.dist}"/>
+      <j:if test="${!(fileAsFile.exists())}">
+        <mkdir dir="${maven.repo.local}/tomcat/distributions"/>
+        <get src="" dest="${tomcat.dist}"/>
+      </j:if>
+
+      <!-- Unzip if not unzipped -->
+      <u:file var="fileAsFile" name="${tomcat.home}"/>
+      <j:if test="${!(fileAsFile.exists())}">
+        <unjar src="" dest="${targetDir}"/>
+        <chmod dir="${tomcat.home}/bin" perm="u+x" includes="**/*.sh"/>
+      </j:if>
+    </goal>
+
+    <goal name="setup:tomcat-src">
+      <j:set var="targetDir" value="${basedir}/src/"/>
+
+      <j:set var="tomcat.download" value="http://www.ibiblio.org/pub/mirrors/apache/tomcat/tomcat-${tomcat.branch}/v${tomcat.version}/src/${tomcat.prefix}-tomcat-${tomcat.version}-src.zip"/>
+      <j:set var="tomcat.dist" value="${maven.repo.local}/tomcat/distributions/${tomcat.prefix}-tomcat-${tomcat.version}-src.zip"/>
+
+      <!-- Download tomcat if it isn't in the repo -->
+      <u:file var="fileAsFile" name="${tomcat.dist}"/>
+      <j:if test="${!(fileAsFile.exists())}">
+        <mkdir dir="${maven.repo.local}/tomcat/distributions"/>
+        <get src="" dest="${tomcat.dist}"/>
+      </j:if>
+
+      <unjar src="" dest="${basedir}"/>
+    </goal>
+
+    <goal name="delete:tomcat">
+      <delete dir="${tomcat.home}"/>
+    </goal>
+
+    <!--======================-->
+    <!--   Start/stop         -->
+    <!--======================-->
+
+    <goal name="start:tomcat">
+      <j:choose>
+        <j:when test="${systemScope['os.name'].startsWith('Windows')}">
+          <exec executable="${tomcat.home}/bin/startup.bat" os="Windows NT,Windows 2000,Windows XP">
+            <env key="CATALINA_HOME" value="${tomcat.home}"/>
+          </exec>
+        </j:when>
+        <j:otherwise>
+          <exec executable="${tomcat.home}/bin/startup.sh"/>
+        </j:otherwise>
+      </j:choose>
+    </goal>
+
+    <goal name="start:tomcat-debug">
+      <j:choose>
+        <j:when test="${systemScope['os.name'].startsWith('Windows')}">
+          <exec executable="${tomcat.home}/bin/startup.bat" os="Windows NT,Windows 2000,Windows XP">
+            <env key="JAVA_OPTS" value="-Dopenejb.home=${openejb.home} -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>
+            <env key="CATALINA_HOME" value="${tomcat.home}"/>
+          </exec>
+        </j:when>
+        <j:otherwise>
+          <exec executable="${tomcat.home}/bin/startup.sh">
+            <env key="JAVA_OPTS" value="-Dopenejb.home=${openejb.home} -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>
+          </exec>
+        </j:otherwise>
+      </j:choose>
+    </goal>
+
+    <goal name="stop:tomcat">
+      <j:choose>
+        <j:when test="${systemScope['os.name'].startsWith('Windows')}">
+          <exec executable="${tomcat.home}/bin/shutdown.bat"
+                os="Windows NT,Windows 2000,Windows XP">
+            <env key="CATALINA_HOME" value="${tomcat.home}"/>
+          </exec>
+        </j:when>
+        <j:otherwise>
+          <exec executable="${tomcat.home}/bin/shutdown.sh" />
+        </j:otherwise>
+      </j:choose>
+    </goal>
+
+
+    <!--======================-->
+    <!--   Deploy             -->
+    <!--======================-->
+
+    <goal name="setup:loader-webapp">
+      <!-- Unzip webapp and set openejb.home -->
+      <mkdir dir="${tomcat.home}/webapps/openejb"/>
+      <unjar src="" dest="${tomcat.home}/webapps/openejb"/>
+      <replace file="${tomcat.home}/webapps/openejb/WEB-INF/web.xml" token="@OPENEJB_HOME@" value="${openejb.home}"/>
+    </goal>
+
+    <goal name="setup:itests-webapp">
+      <!-- Unzip webapp and set openejb.home -->
+      <mkdir dir="${tomcat.home}/webapps/itests"/>
+      <unjar src="" dest="${tomcat.home}/webapps/itests"/>
+      <replace file="${tomcat.home}/webapps/itests/WEB-INF/web.xml" token="@OPENEJB_HOME@" value="${openejb.home}"/>
+    </goal>
+
+    <goal name="setup:webapp-example">
+      <j:set var="targetDir" value="${basedir}/target/"/>
+      <j:set var="tomcat.home" value="${targetDir}/${tomcat.prefix}-tomcat-${tomcat.version}"/>
+      <j:set var="openejb.home" value="${targetDir}/openejb-${openejb.version}" />
+      <!-- Unzip webapp and set openejb.home -->
+      <mkdir dir="${tomcat.home}/webapps/openejb"/>
+      <unjar src="" dest="${tomcat.home}/webapps/movies"/>
+      <replace file="${tomcat.home}/webapps/movies/WEB-INF/web.xml" token="@OPENEJB_HOME@" value="${openejb.home}"/>
+    </goal>
+
+
+    <!--======================-->
+    <!--   Testing profiles   -->
+    <!--======================-->
+
+    <goal name="test:local">
+      <java jar="target/openejb-${openejb.version}-test.jar" fork="yes">
+        <sysproperty key="openejb.home" value="target/openejb-${openejb.version}"/>
+        <arg value="local"/>
+      </java>
+    </goal>
+
+    <goal name="test:remote">
+      <java jar="target/openejb-${openejb.version}-test.jar" fork="yes">
+        <sysproperty key="openejb.home" value="target/openejb-${openejb.version}"/>
+        <arg value="remote"/>
+      </java>
+    </goal>
+
+    <goal name="test:http">
+      <java jar="target/openejb-${openejb.version}-test.jar" fork="yes">
+        <sysproperty key="openejb.home" value="target/openejb-${openejb.version}"/>
+        <arg value="http"/>
+      </java>
+    </goal>
+
+    <goal name="test:tomcat">
+      <attainGoal name="setup:tomcat"/>
+      <attainGoal name="setup:loader-webapp"/>
+      <!--<attainGoal name="start:tomcat"/>-->
+      <java jar="target/openejb-${openejb.version}-test.jar" fork="yes">
+        <sysproperty key="openejb.home" value="target/openejb-${openejb.version}"/>
+        <sysproperty key="tomcat.home" value="${tomcat.home}"/>
+        <sysproperty key="remote.servlet.url" value="http://127.0.0.1:8080/openejb/remote"/>
+        <arg value="tomcat"/>
+      </java>
+      <!--<attainGoal name="stop:tomcat"/>-->
+    </goal>
+
+    <goal name="test:tomcat-webapp">
+      <attainGoal name="setup:tomcat"/>
+      <attainGoal name="setup:itests-webapp"/>
+      <!--<attainGoal name="start:tomcat"/>-->
+      <java jar="target/openejb-${openejb.version}-test.jar" fork="yes">
+        <sysproperty key="openejb.home" value="target/openejb-${openejb.version}"/>
+        <sysproperty key="tomcat.home" value="${tomcat.home}"/>
+        <sysproperty key="remote.serlvet.url" value="http://127.0.0.1:8080/itests/remote"/>
+        <arg value="tomcat"/>
+      </java>
+      <!--<attainGoal name="stop:tomcat"/>-->
+    </goal>
+
+    <goal name="test:tomcat-all">
+      <attainGoal name="tomcat4"/>
+      <attainGoal name="test:tomcat"/>
+      <attainGoal name="delete:tomcat"/>
+      <attainGoal name="test:tomcat-webapp"/>
+      <attainGoal name="delete:tomcat"/>
+
+      <attainGoal name="tomcat50"/>
+      <attainGoal name="test:tomcat"/>
+      <attainGoal name="delete:tomcat"/>
+      <attainGoal name="test:tomcat-webapp"/>
+      <attainGoal name="delete:tomcat"/>
+      <j:if test="${systemScope['java.version'].startsWith('1.5')}">
+        <attainGoal name="tomcat55"/>
+        <attainGoal name="test:tomcat"/>
+        <attainGoal name="delete:tomcat"/>
+        <attainGoal name="test:tomcat-webapp"/>
+        <attainGoal name="delete:tomcat"/>
+      </j:if>
+    </goal>
+
+    <goal name="test:all">
+      <attainGoal name="test:local"/>
+      <attainGoal name="test:remote"/>
+      <attainGoal name="test:http"/>
+      <attainGoal name="test:tomcat-all"/>
+    </goal>
+<!-- Try this if things get rough
+java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 -jar target/openejb-1.0-SNAPSHOT/lib/openejb-core-1.0-SNAPSHOT.jar start
+-->
+
+</project>

Modified: trunk/openejb3/openejb-assembly/pom.xml (2533 => 2534)

--- trunk/openejb3/openejb-assembly/pom.xml	2006-03-10 07:56:03 UTC (rev 2533)
+++ trunk/openejb3/openejb-assembly/pom.xml	2006-03-10 08:44:10 UTC (rev 2534)
@@ -39,7 +39,16 @@
           </execution>
         </executions>
         <configuration>
-          <descriptor>src/main/assembly/bin.xml</descriptor>
+          <descriptors>
+            <descriptor>src/main/assembly/bin.xml</descriptor>
+            <descriptor>src/main/assembly/test.xml</descriptor>
+          </descriptors>
+          <finalName>openejb-itest-application</finalName>
+          <archive>
+            <manifest>
+              <mainClass>org.openejb.test.Main</mainClass>
+            </manifest>
+          </archive>
           <finalName>openejb-3.0-SNAPSHOT</finalName>
         </configuration>
       </plugin>
@@ -67,10 +76,26 @@
       <version>3.0-SNAPSHOT</version>
     </dependency>
     <dependency>
+      <groupId>org.openejb</groupId>
+      <artifactId>openejb-http</artifactId>
+      <version>3.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.openejb</groupId>
+      <artifactId>openejb-telnet</artifactId>
+      <version>3.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <version>3.8.1</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.openejb</groupId>
+      <artifactId>openejb-itests</artifactId>
+      <version>3.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 </project>

Modified: trunk/openejb3/openejb-assembly/src/main/assembly/bin.xml (2533 => 2534)

--- trunk/openejb3/openejb-assembly/src/main/assembly/bin.xml	2006-03-10 07:56:03 UTC (rev 2533)
+++ trunk/openejb3/openejb-assembly/src/main/assembly/bin.xml	2006-03-10 08:44:10 UTC (rev 2534)
@@ -3,7 +3,7 @@
   <formats>
     <format>tar.gz</format>
     <!--<format>tar.bz2</format>-->
-    <!--<format>zip</format>-->
+    <format>zip</format>
   </formats>
   <fileSets>
     <fileSet>

Added: trunk/openejb3/openejb-assembly/src/main/assembly/test.xml (2533 => 2534)

--- trunk/openejb3/openejb-assembly/src/main/assembly/test.xml	2006-03-10 07:56:03 UTC (rev 2533)
+++ trunk/openejb3/openejb-assembly/src/main/assembly/test.xml	2006-03-10 08:44:10 UTC (rev 2534)
@@ -0,0 +1,22 @@
+<assembly>
+  <id>test</id>
+  <formats>
+    <format>jar</format>
+  </formats>
+  <includeBaseDirectory>false</includeBaseDirectory>
+  <dependencySets>
+    <dependencySet>
+      <outputDirectory>/</outputDirectory>
+      <unpack>true</unpack>
+      <includes>
+          <include>org.apache.geronimo.specs:geronimo-ejb_3.0_spec</include>
+          <include>org.apache.geronimo.specs:geronimo-jta_1.0.1B_spec</include>
+          <include>junit:junit</include>
+          <include>org.openejb:openejb-itests</include>
+          <include>org.openejb:openejb-client</include>
+      </includes>
+      <scope>test</scope>
+    </dependencySet>
+  </dependencySets>
+</assembly>
+

Reply via email to