Hi David,

I'm trying to run the usual ant build script that grabs the itest artifacts
from the Maven repository and tries to run them against OpenEJB standalone
and in Tomcat. I'm getting a java.lang.NoClassDefFoundError:
org/apache/xbean/finder/ClassFinder error. (Full log and build script
attached). Is this a problem?

Jon

On Wed, Mar 24, 2010 at 7:45 AM, David Blevins <[email protected]>wrote:

> Ok, finally got some binaries up.  Took a few spins but finally got
> something up with good signatures.
>
> The branch to become a tag:
>
>  http://svn.apache.org/repos/asf/openejb/branches/openejb-3.0.2/
>
> The binaries:
>
>  https://repository.apache.org/content/repositories/orgapacheopenejb-014/
>
> So assuming these binaries pass the TCK, here is my +1 vote.
>
> Vote open for 72 hours or as long as it takes to get some TCK numbers
> against the proposed binaries.
>
>
> -David
>
>
Buildfile: build.xml

test:

openejb.test.setup:

download.uptodate:

download.file:

download.uptodate:

download.file:

download.uptodate:

download.file:

openejb.test:

openejb.unpack:
   [delete] Deleting directory /Users/jon/openejbtest/target/openejb-3.0.2
    [unjar] Expanding: 
/Users/jon/openejbtest/repo/openejb/distributions/3.0.2/openejb.zip into 
/Users/jon/openejbtest/target
     [copy] Copying 1 file to /Users/jon/openejbtest/target/openejb-3.0.2/apps

openejb.start:
     [echo] Starting OpenEJB 3.0.2...
     [echo]                  started

itests.openejb.run:
     [java] _________________________________________________
     [java] |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
     [java] 
     [java] Running EJB compliance tests on Remote Server
     [java] _________________________________________________
     [java] .........................................
     [java] .........................................
     [java] .........................................
     [java] .........................................
     [java] .........................................
     [java] Exception in thread "main" java.lang.NoClassDefFoundError: 
org/apache/xbean/finder/ClassFinder
     [java]     at 
org.apache.openejb.test.TestClient.processFieldInjections(TestClient.java:65)
     [java]     at 
org.apache.openejb.test.stateless.AnnotatedFieldInjectionStatelessTestClient.setUp(AnnotatedFieldInjectionStatelessTestClient.java:36)
     [java]     at 
org.apache.openejb.test.stateless.AnnotatedFieldInjectionStatelessPojoHomeIntfcTests.setUp(AnnotatedFieldInjectionStatelessPojoHomeIntfcTests.java:38)
     [java]     at 
org.apache.openejb.test.NumberedTestCase.run(NumberedTestCase.java:93)
     [java]     at org.apache.openejb.test.TestSuite.run(TestSuite.java:49)
     [java]     at junit.framework.TestSuite.runTest(TestSuite.java:232)
     [java]     at junit.framework.TestSuite.run(TestSuite.java:227)
     [java]     at junit.textui.TestRunner.doRun(TestRunner.java:116)
     [java]     at junit.textui.TestRunner.start(TestRunner.java:180)
     [java]     at org.apache.openejb.test.TestRunner.start(TestRunner.java:198)
     [java]     at org.apache.openejb.test.TestRunner.main(TestRunner.java:86)
     [java]     at org.apache.openejb.test.Main.main(Main.java:31)
     [java] Caused by: java.lang.ClassNotFoundException: 
org.apache.xbean.finder.ClassFinder
     [java]     at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
     [java]     at java.security.AccessController.doPrivileged(Native Method)
     [java]     at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
     [java]     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
     [java]     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
     [java]     ... 12 more
     [java] .....................................

openejb.stop:
     [echo] Stopping OpenEJB 3.0.2...
     [echo]                   sleeping for 1 sec
     [echo]                   stopped

test:tomcat6:

tomcat.test.setup:

download.uptodate:

download.file:
    [mkdir] Created dir: /Users/jon/openejbtest/repo/tomcat/distributions/6.0.14
      [get] Getting: 
http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.14/bin/apache-tomcat-6.0.14.zip
      [get] To: 
/Users/jon/openejbtest/repo/tomcat/distributions/6.0.14/tomcat.zip

download.uptodate:

download.file:

download.uptodate:

download.file:

download.uptodate:

download.file:

tomcat.test:

tomcat.unpack:
    [unjar] Expanding: 
/Users/jon/openejbtest/repo/tomcat/distributions/6.0.14/tomcat.zip into 
/Users/jon/openejbtest/target
     [copy] Copying 1 file to 
/Users/jon/openejbtest/target/apache-tomcat-6.0.14/webapps
     [copy] Copying 1 file to 
/Users/jon/openejbtest/target/apache-tomcat-6.0.14/webapps

tomcat.start:
     [echo] Starting Tomcat 6.0.14...
     [echo]                   sleeping for 1 sec
     [echo]                   started

itests.tomcat.run:
     [java] _________________________________________________
     [java] |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
     [java] 
     [java] Running EJB compliance tests on HTTP/Tomcat Server
     [java] _________________________________________________
     [java] .........................................
     [java] .........................................
     [java] .........................................
     [java] .........................................
     [java] .........................................
     [java] .........................................
     [java] Exception in thread "main" java.lang.NoClassDefFoundError: 
org/apache/xbean/finder/ClassFinder
     [java]     at 
org.apache.openejb.test.TestClient.processFieldInjections(TestClient.java:65)
     [java]     at 
org.apache.openejb.test.stateless.AnnotatedFieldInjectionStatelessTestClient.setUp(AnnotatedFieldInjectionStatelessTestClient.java:36)
     [java]     at 
org.apache.openejb.test.stateless.AnnotatedFieldInjectionStatelessPojoHomeIntfcTests.setUp(AnnotatedFieldInjectionStatelessPojoHomeIntfcTests.java:38)
     [java]     at 
org.apache.openejb.test.NumberedTestCase.run(NumberedTestCase.java:93)
     [java]     at org.apache.openejb.test.TestSuite.run(TestSuite.java:49)
     [java]     at junit.framework.TestSuite.runTest(TestSuite.java:232)
     [java]     at junit.framework.TestSuite.run(TestSuite.java:227)
     [java]     at junit.textui.TestRunner.doRun(TestRunner.java:116)
     [java]     at junit.textui.TestRunner.start(TestRunner.java:180)
     [java]     at org.apache.openejb.test.TestRunner.start(TestRunner.java:198)
     [java]     at org.apache.openejb.test.TestRunner.main(TestRunner.java:86)
     [java]     at org.apache.openejb.test.Main.main(Main.java:31)
     [java] Caused by: java.lang.ClassNotFoundException: 
org.apache.xbean.finder.ClassFinder
     [java]     at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
     [java]     at java.security.AccessController.doPrivileged(Native Method)
     [java]     at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
     [java]     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
     [java]     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
     [java]     ... 12 more
     [java] ...................
      [get] Getting: http://localhost:8080/openejb/installer?action=Install
      [get] To: /Users/jon/openejbtest/target/installer.out

tomcat.stop:
     [echo] Stopping Tomcat 6.0.14...
     [echo]                   sleeping for 1 sec
     [echo]                   stopped

tomcat.start:
     [echo] Starting Tomcat 6.0.14...
     [echo]                   sleeping for 1 sec
     [echo]                   started

itests.tomcat.run:
     [java] _________________________________________________
     [java] |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
     [java] 
     [java] Running EJB compliance tests on HTTP/Tomcat Server
     [java] _________________________________________________
     [java] .........................................
     [java] .........................................
     [java] .........................................
     [java] .........................................
     [java] .........................................
     [java] .........................................
     [java] Exception in thread "main" java.lang.NoClassDefFoundError: 
org/apache/xbean/finder/ClassFinder
     [java]     at 
org.apache.openejb.test.TestClient.processFieldInjections(TestClient.java:65)
     [java]     at 
org.apache.openejb.test.stateless.AnnotatedFieldInjectionStatelessTestClient.setUp(AnnotatedFieldInjectionStatelessTestClient.java:36)
     [java]     at 
org.apache.openejb.test.stateless.AnnotatedFieldInjectionStatelessPojoHomeIntfcTests.setUp(AnnotatedFieldInjectionStatelessPojoHomeIntfcTests.java:38)
     [java]     at 
org.apache.openejb.test.NumberedTestCase.run(NumberedTestCase.java:93)
     [java]     at org.apache.openejb.test.TestSuite.run(TestSuite.java:49)
     [java]     at junit.framework.TestSuite.runTest(TestSuite.java:232)
     [java]     at junit.framework.TestSuite.run(TestSuite.java:227)
     [java]     at junit.textui.TestRunner.doRun(TestRunner.java:116)
     [java]     at junit.textui.TestRunner.start(TestRunner.java:180)
     [java]     at org.apache.openejb.test.TestRunner.start(TestRunner.java:198)
     [java]     at org.apache.openejb.test.TestRunner.main(TestRunner.java:86)
     [java]     at org.apache.openejb.test.Main.main(Main.java:31)
     [java] Caused by: java.lang.ClassNotFoundException: 
org.apache.xbean.finder.ClassFinder
     [java]     at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
     [java]     at java.security.AccessController.doPrivileged(Native Method)
     [java]     at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
     [java]     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
     [java]     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
     [java]     ... 12 more
     [java] ...................

tomcat.stop:
     [echo] Stopping Tomcat 6.0.14...
     [echo]                   sleeping for 1 sec
     [echo]                   stopped
     [echo] Sleeping for 1 sec to avoid Windows failures

test:tomcat55:

tomcat.test.setup:

download.uptodate:

download.file:
    [mkdir] Created dir: /Users/jon/openejbtest/repo/tomcat/distributions/5.5.26
      [get] Getting: 
http://archive.apache.org/dist/tomcat/tomcat-5/v5.5.26/bin/apache-tomcat-5.5.26.zip
      [get] To: 
/Users/jon/openejbtest/repo/tomcat/distributions/5.5.26/tomcat.zip

download.uptodate:

download.file:

download.uptodate:

download.file:

download.uptodate:

download.file:

tomcat.test:

tomcat.unpack:
    [unjar] Expanding: 
/Users/jon/openejbtest/repo/tomcat/distributions/5.5.26/tomcat.zip into 
/Users/jon/openejbtest/target
     [copy] Copying 1 file to 
/Users/jon/openejbtest/target/apache-tomcat-5.5.26/webapps
     [copy] Copying 1 file to 
/Users/jon/openejbtest/target/apache-tomcat-5.5.26/webapps

tomcat.start:
     [echo] Starting Tomcat 5.5.26...
     [echo]                   sleeping for 1 sec
     [echo]                   started

itests.tomcat.run:
     [java] _________________________________________________
     [java] |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
     [java] 
     [java] Running EJB compliance tests on HTTP/Tomcat Server
     [java] _________________________________________________
     [java] .........................................
     [java] .........................................
     [java] .........................................
     [java] .........................................
     [java] .........................................
     [java] .........................................
     [java] Exception in thread "main" java.lang.NoClassDefFoundError: 
org/apache/xbean/finder/ClassFinder
     [java]     at 
org.apache.openejb.test.TestClient.processFieldInjections(TestClient.java:65)
     [java]     at 
org.apache.openejb.test.stateless.AnnotatedFieldInjectionStatelessTestClient.setUp(AnnotatedFieldInjectionStatelessTestClient.java:36)
     [java]     at 
org.apache.openejb.test.stateless.AnnotatedFieldInjectionStatelessPojoHomeIntfcTests.setUp(AnnotatedFieldInjectionStatelessPojoHomeIntfcTests.java:38)
     [java]     at 
org.apache.openejb.test.NumberedTestCase.run(NumberedTestCase.java:93)
     [java]     at org.apache.openejb.test.TestSuite.run(TestSuite.java:49)
     [java]     at junit.framework.TestSuite.runTest(TestSuite.java:232)
     [java]     at junit.framework.TestSuite.run(TestSuite.java:227)
     [java]     at junit.textui.TestRunner.doRun(TestRunner.java:116)
     [java]     at junit.textui.TestRunner.start(TestRunner.java:180)
     [java]     at org.apache.openejb.test.TestRunner.start(TestRunner.java:198)
     [java]     at org.apache.openejb.test.TestRunner.main(TestRunner.java:86)
     [java]     at org.apache.openejb.test.Main.main(Main.java:31)
     [java] Caused by: java.lang.ClassNotFoundException: 
org.apache.xbean.finder.ClassFinder
     [java]     at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
     [java]     at java.security.AccessController.doPrivileged(Native Method)
     [java]     at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
     [java]     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
     [java]     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
     [java]     ... 12 more
     [java] ...................
      [get] Getting: http://localhost:8080/openejb/installer?action=Install
      [get] To: /Users/jon/openejbtest/target/installer.out

tomcat.stop:
     [echo] Stopping Tomcat 5.5.26...
     [echo]                   sleeping for 1 sec
     [echo]                   stopped

tomcat.start:
     [echo] Starting Tomcat 5.5.26...
     [echo]                   sleeping for 1 sec
     [echo]                   started

itests.tomcat.run:
     [java] _________________________________________________
     [java] |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
     [java] 
     [java] Running EJB compliance tests on HTTP/Tomcat Server
     [java] _________________________________________________
     [java] .........................................
     [java] .........................................
     [java] .........................................
     [java] .........................................
     [java] .........................................
     [java] .........................................
     [java] Exception in thread "main" java.lang.NoClassDefFoundError: 
org/apache/xbean/finder/ClassFinder
     [java]     at 
org.apache.openejb.test.TestClient.processFieldInjections(TestClient.java:65)
     [java]     at 
org.apache.openejb.test.stateless.AnnotatedFieldInjectionStatelessTestClient.setUp(AnnotatedFieldInjectionStatelessTestClient.java:36)
     [java]     at 
org.apache.openejb.test.stateless.AnnotatedFieldInjectionStatelessPojoHomeIntfcTests.setUp(AnnotatedFieldInjectionStatelessPojoHomeIntfcTests.java:38)
     [java]     at 
org.apache.openejb.test.NumberedTestCase.run(NumberedTestCase.java:93)
     [java]     at org.apache.openejb.test.TestSuite.run(TestSuite.java:49)
     [java]     at junit.framework.TestSuite.runTest(TestSuite.java:232)
     [java]     at junit.framework.TestSuite.run(TestSuite.java:227)
     [java]     at junit.textui.TestRunner.doRun(TestRunner.java:116)
     [java]     at junit.textui.TestRunner.start(TestRunner.java:180)
     [java]     at org.apache.openejb.test.TestRunner.start(TestRunner.java:198)
     [java]     at org.apache.openejb.test.TestRunner.main(TestRunner.java:86)
     [java]     at org.apache.openejb.test.Main.main(Main.java:31)
     [java] ...................
     [java] Caused by: java.lang.ClassNotFoundException: 
org.apache.xbean.finder.ClassFinder
     [java]     at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
     [java]     at java.security.AccessController.doPrivileged(Native Method)
     [java]     at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
     [java]     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
     [java]     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
     [java]     ... 12 more

tomcat.stop:
     [echo] Stopping Tomcat 5.5.26...
     [echo]                   sleeping for 1 sec
     [echo]                   stopped
     [echo] Sleeping for 1 sec to avoid Windows failures

BUILD SUCCESSFUL
Total time: 4 minutes 48 seconds
<?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.
-->
<!-- $Revision: 579817 $ $Date: 2007-09-26 14:56:30 -0700 (Wed, 26 Sep 2007) $ -->
<project name="Test OpenEJB" default="test" basedir=".">
    <description>
        Tests OpenEJB distribution using the OpenEJB iTest suite.
    </description>

    <property name="openejb.version" value="3.0.2"/>
    <property name="repo" location="${basedir}/repo"/>
    <property name="maven.repo" value="https://repository.apache.org/content/repositories/orgapacheopenejb-014/"/>
    <property name="target.dir" location="${basedir}/target"/>
    <property name="windows.sleep" value="5"/>
    <property name="unix.sleep" value="1"/>


    <target name="clean">
        <delete dir="${basedir}/activemq-data"/>
        <delete dir="${target.dir}"/>
    </target>

    <target name="test">
        <antcall target="openejb.test"/>
        <antcall target="test:tomcat6"/>
        <antcall target="test:tomcat55"/>
    </target>

    <target name="test:all">
        <antcall target="openejb.test"/>
        <antcall target="test:tomcat6:all"/>
        <antcall target="test:tomcat55:all"/>
    </target>

    <target name="test:tomcat6">
        <antcall target="tomcat.test">
            <param name="tomcat.version" value="6.0.14"/>
        </antcall>
    </target>

    <target name="test:tomcat6:all">
        <antcall target="tomcat.test">
            <param name="tomcat.version" value="6.0.14"/>
        </antcall>
        <antcall target="tomcat.test">
            <param name="tomcat.version" value="6.0.13"/>
        </antcall>
        <antcall target="tomcat.test">
            <param name="tomcat.version" value="6.0.10"/>
        </antcall>
        <antcall target="tomcat.test">
            <param name="tomcat.version" value="6.0.9"/>
        </antcall>
    </target>

    <target name="test:tomcat55">
        <antcall target="tomcat.test">
            <param name="tomcat.version" value="5.5.26"/>
        </antcall>
    </target>

    <target name="test:tomcat55:all">
        <antcall target="tomcat.test">
            <param name="tomcat.version" value="5.5.26"/>
        </antcall>
        <antcall target="tomcat.test">
            <param name="tomcat.version" value="5.5.25"/>
        </antcall>
        <antcall target="tomcat.test">
            <param name="tomcat.version" value="5.5.23"/>
        </antcall>
        <antcall target="tomcat.test">
            <param name="tomcat.version" value="5.5.20"/>
        </antcall>
    </target>

    <target name="openejb.test" depends="openejb.test.setup">
        <!-- unpack openejb -->
        <antcall target="openejb.unpack"/>

        <!-- copy openejb-itests-app.jar to apps dir -->
        <copy file="${itests.app.file}" todir="${openejb.home}/apps"/>

        <!-- start openejb -->
        <antcall target="openejb.start"/>

        <!-- run itests -->
        <antcall target="itests.openejb.run"/>

        <!-- stop openejb -->
        <antcall target="openejb.stop"/>
    </target>

    <target name="openejb.unpack">
        <delete dir="${openejb.home}"/>
        <mkdir dir="${target.dir}"/>
        <unjar src="${openejb.app.file}" dest="${target.dir}"/>
        <chmod perm="u+x">
            <fileset dir="${openejb.home}/bin">
                <include name="openejb"/>
                <include name="**/*.sh"/>
            </fileset>
        </chmod>
    </target>

    <target name="openejb.start">
        <echo message="Starting OpenEJB ${openejb.version}..."/>
        <exec executable="${openejb.home}/bin/openejb.bat" spawn="true" osfamily="windows">
            <env key="OPENEJB_HOME" value="${openejb.home}"/>
            <arg value="start"/>
        </exec>
        <exec executable="${openejb.home}/bin/openejb" spawn="true" osfamily="unix">
            <arg value="start"/>
        </exec>
        <waitfor maxwait="1" maxwaitunit="minute">
            <and>
                <socket server="localhost" port="4200"/>
                <socket server="localhost" port="4201"/>
                <socket server="localhost" port="4202"/>
                <socket server="localhost" port="4204"/>
                <socket server="localhost" port="61616"/>
            </and>
        </waitfor>
        <echo message="                 started"/>
    </target>

    <target name="openejb.stop">
        <echo message="Stopping OpenEJB ${openejb.version}..."/>
        <exec executable="${openejb.home}/bin/openejb.bat" osfamily="windows">
            <env key="OPENEJB_HOME" value="${openejb.home}"/>
            <arg value="stop"/>
        </exec>
        <exec executable="${openejb.home}/bin/openejb" osfamily="unix">
            <arg value="stop"/>
        </exec>
        <waitfor maxwait="1" maxwaitunit="minute">
            <not>
                <or>
                    <socket server="localhost" port="4200"/>
                    <socket server="localhost" port="4201"/>
                    <socket server="localhost" port="4202"/>
                    <socket server="localhost" port="4204"/>
                    <socket server="localhost" port="61616"/>
                </or>
            </not>
        </waitfor>

        <condition property="sleep" value="${unix.sleep}" else="${windows.sleep}">
            <os family="unix"/>
        </condition>
        <echo message="                  sleeping for ${sleep} sec"/>
        <sleep seconds="${sleep}"/>

        <echo message="                  stopped"/>
    </target>


    <target name="tomcat.test" depends="tomcat.test.setup">
        <!-- unpack tomcat -->
        <antcall target="tomcat.unpack"/>

        <!-- copy openejb.war to webapps dir -->
        <copy file="${openejb.war.file}" todir="${tomcat.home}/webapps"/>

        <!-- install itests.war -->
        <copy file="${itests.war.file}" todir="${tomcat.home}/webapps"/>

        <!-- start tomcat -->
        <antcall target="tomcat.start"/>

        <!-- run itests (Servlet started mode) -->
        <antcall target="itests.tomcat.run"/>

        <!-- run installer -->
        <get src="http://localhost:8080/openejb/installer?action=Install"; dest="${target.dir}/installer.out"/>

        <!-- stop tomcat -->
        <antcall target="tomcat.stop"/>

        <!-- run itests (Listener started mode) -->
        <antcall target="tomcat.start"/>

        <!-- run itests -->
        <antcall target="itests.tomcat.run"/>

        <!-- stop tomcat -->
        <antcall target="tomcat.stop"/>

        <!-- Make sure all resources are collected on windows -->
        <condition property="sleep" value="1" else="30">
            <os family="unix"/>
        </condition>
        <echo message="Sleeping for ${sleep} sec to avoid Windows failures"/>
        <sleep seconds="${sleep}"/>
    </target>

    <target name="tomcat.unpack">
        <delete dir="${tomcat.home}"/>
        <mkdir dir="${target.dir}"/>
        <unjar src="${tomcat.file}" dest="${target.dir}"/>
        <chmod dir="${tomcat.home}/bin" perm="u+x" includes="**/*.sh"/>
    </target>

    <target name="tomcat.start">
        <echo message="Starting Tomcat ${tomcat.version}..."/>
        <exec executable="${tomcat.home}/bin/startup.bat" spawn="true" osfamily="windows">
            <env key="CATALINA_HOME" value="${tomcat.home}"/>
        </exec>
        <exec executable="${tomcat.home}/bin/startup.sh" osfamily="unix"/>
        <waitfor maxwait="1" maxwaitunit="minute">
            <and>
                <socket server="localhost" port="8080"/>
                <socket server="localhost" port="8005"/>
                <socket server="localhost" port="8009"/>
                <http url="http://localhost:8080/openejb/installer"/>
            </and>
        </waitfor>

        <condition property="sleep" value="${unix.sleep}" else="${windows.sleep}">
            <os family="unix"/>
        </condition>
        <echo message="                  sleeping for ${sleep} sec"/>
        <sleep seconds="${sleep}"/>

        <echo message="                  started"/>
    </target>

    <target name="tomcat.stop">
        <echo message="Stopping Tomcat ${tomcat.version}..."/>
        <exec executable="${tomcat.home}/bin/shutdown.bat" osfamily="windows">
            <env key="CATALINA_HOME" value="${tomcat.home}"/>
        </exec>
        <exec executable="${tomcat.home}/bin/shutdown.sh" osfamily="unix"/>
        <waitfor maxwait="1" maxwaitunit="minute">
            <not>
                <or>
                    <http url="http://localhost:8080"/>
                    <socket server="localhost" port="8080"/>
                    <socket server="localhost" port="8005"/>
                    <socket server="localhost" port="8009"/>
                    <socket server="localhost" port="61616"/>
                </or>
            </not>
        </waitfor>

        <condition property="sleep" value="${unix.sleep}" else="${windows.sleep}">
            <os family="unix"/>
        </condition>
        <echo message="                  sleeping for ${sleep} sec"/>
        <sleep seconds="${sleep}"/>

        <echo message="                  stopped"/>
    </target>

    <target name="itests.openejb.run">
        <java jar="${itests.client.file}" fork="yes">
            <sysproperty key="openejb.home" value="${openejb.home}"/>
            <arg value="remote"/>
        </java>
    </target>

    <target name="itests.tomcat.run">
        <java jar="${itests.client.file}" fork="yes">
            <sysproperty key="openejb.home" value="${openejb.home}"/>
            <arg value="tomcat"/>
        </java>
    </target>

    <target name="openejb.test.setup">
        <property name="openejb.app.url" value="${maven.repo}/org/apache/openejb/openejb-standalone/${openejb.version}/openejb-standalone-${openejb.version}.zip"/>
        <property name="openejb.app.file" value="${repo}/openejb/distributions/${openejb.version}/openejb.zip"/>

        <property name="itests.app.url" value="${maven.repo}/org/apache/openejb/openejb-itests-app/${openejb.version}/openejb-itests-app-${openejb.version}.jar"/>
        <property name="itests.app.file" value="${repo}/openejb/distributions/${openejb.version}/openejb-itests-app.jar"/>

        <property name="itests.client.url" value="${maven.repo}/org/apache/openejb/openejb-itests-standalone-client/${openejb.version}/openejb-itests-standalone-client-${openejb.version}.jar"/>
        <property name="itests.client.file" value="${repo}/openejb/distributions/${openejb.version}/openejb-itests-standalone-client.jar"/>

        <property name="openejb.home" value="${target.dir}/openejb-${openejb.version}"/>

        <antcall target="download.file">
            <param name="download.url" value="${openejb.app.url}"/>
            <param name="download.file" value="${openejb.app.file}"/>
        </antcall>
        <antcall target="download.file">
            <param name="download.url" value="${itests.app.url}"/>
            <param name="download.file" value="${itests.app.file}"/>
        </antcall>
        <antcall target="download.file">
            <param name="download.url" value="${itests.client.url}"/>
            <param name="download.file" value="${itests.client.file}"/>
        </antcall>
    </target>

    <target name="tomcat.test.setup">
        <property name="openejb.war.url" value="${maven.repo}/org/apache/openejb/openejb-tomcat-webapp/${openejb.version}/openejb-tomcat-webapp-${openejb.version}.war"/>
        <property name="openejb.war.file" value="${repo}/openejb/distributions/${openejb.version}/openejb.war"/>

        <property name="itests.war.url" value="${maven.repo}/org/apache/openejb/openejb-itests-web/${openejb.version}/openejb-itests-web-${openejb.version}.war"/>
        <property name="itests.war.file" value="${repo}/openejb/distributions/${openejb.version}/itests.war"/>

        <property name="itests.client.url" value="${maven.repo}/org/apache/openejb/openejb-itests-standalone-client/${openejb.version}/openejb-itests-standalone-client-${openejb.version}.jar"/>
        <property name="itests.client.file" value="${repo}/openejb/distributions/${openejb.version}/openejb-itests-standalone-client.jar"/>

        <condition property="tomcat.url" value="http://archive.apache.org/dist/tomcat/tomcat-6/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip";>
            <matches pattern="^6\." string="${tomcat.version}"/>
        </condition>
        <condition property="tomcat.url" value="http://archive.apache.org/dist/tomcat/tomcat-5/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip";>
            <matches pattern="^5\.5" string="${tomcat.version}"/>
        </condition>
        <fail message="Unknown Tomcat version ${tomcat.version}" unless="tomcat.url"/>
        <property name="tomcat.file" value="${repo}/tomcat/distributions/${tomcat.version}/tomcat.zip"/>

        <property name="tomcat.home" value="${target.dir}/apache-tomcat-${tomcat.version}"/>

        <antcall target="download.file">
            <param name="download.url" value="${tomcat.url}"/>
            <param name="download.file" value="${tomcat.file}"/>
        </antcall>
        <antcall target="download.file">
            <param name="download.url" value="${openejb.war.url}"/>
            <param name="download.file" value="${openejb.war.file}"/>
        </antcall>
        <antcall target="download.file">
            <param name="download.url" value="${itests.war.url}"/>
            <param name="download.file" value="${itests.war.file}"/>
        </antcall>
        <antcall target="download.file">
            <param name="download.url" value="${itests.client.url}"/>
            <param name="download.file" value="${itests.client.file}"/>
        </antcall>
    </target>

    <target name="download.uptodate">
        <available file="${download.file}" property="download.uptodate"/>
    </target>

    <target name="download.file" depends="download.uptodate" unless="download.uptodate">
        <dirname property="download.dir" file="${download.file}"/>
        <mkdir dir="${download.dir}"/>
        <get src="${download.url}" dest="${download.file}"/>
    </target>
</project>

Reply via email to