vmassol     2004/06/12 07:10:26

  Added:       abbot/xdocs changes.xml goals.xml using.xml properties.xml
                        navigation.xml index.xml
               abbot/src/plugin-test/sample-local .cvsignore maven.xml
                        project.xml project.properties
               abbot/src/plugin-resources jnlp.jsl
               abbot/src/plugin-test/sample-webstart
                        build.properties.sample maven.xml project.xml
                        project.properties .cvsignore
               abbot/src/plugin-test maven.xml project.properties
                        project.xml
               abbot/src/test/org/apache/maven/abbot
                        AbbotTestRunnerMainTest.java SampleTest.java
                        AbbotTestAllTest.java
               abbot/src/main/org/apache/maven/abbot
                        AbbotWebstartTestRunner.java AbbotTestAll.java
               abbot/src/plugin-test/sample-local/src/abbot
                        TestLocalSample.xml
               abbot/src/plugin-test/sample-local/conf keys
               abbot/src/plugin-test/sample-webstart/src/webapp sample.jnlp
               abbot/src/plugin-test/sample-webstart/conf keys
               abbot/src/plugin-test/sample-webstart/src/abbot
                        TestWebstartSample.xml
               abbot/src/plugin-test/sample-webstart/src/webapp/WEB-INF
                        web.xml
               
abbot/src/plugin-test/sample-local/src/java/org/apache/maven/abbot/sample
                        Main.java
  Log:
  Moving abbot plugin from plugins sandbox to plugins proper
  
  Revision  Changes    Path
  1.1                  maven-plugins/abbot/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  <?xml version="1.0"?>
  <document>
    <properties>
      <title>Changes</title>
      <author email="[EMAIL PROTECTED]">Vincent Massol</author>
    </properties>
  
    <body>
  
      <release version="1.0" date="in CVS">
        <action dev="vmassol" type="add">
          Initial creation by Christian Blavier and Vincent Massol. 
          See the feature list on the Abbot plugin web site
          for a full list of what the plugin does.
        </action>
      </release>
  
    </body>
  </document>
  
  
  
  
  1.1                  maven-plugins/abbot/xdocs/goals.xml
  
  Index: goals.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <document>
    <properties>
      <title>Maven Abbot plugin goals</title>
      <author email="[EMAIL PROTECTED]">Vincent Massol</author>
    </properties>
    <body>
      <goals>
        <goal>
          <name>abbot</name>
          <description>
            Default goal. Does the same as <code>abbot:test</code>.
          </description>
        </goal>
        <goal>
          <name>abbot:test</name>
          <description>
            Runs Abbot tests (Costello XML scripts).
          </description>
        </goal>
        <goal>
          <name>abbot:test-webstart</name>
          <description>
            Runs Abbot tests (Costello XML scripts) against an already 
            installed WebStart application.
          </description>
        </goal>
        <goal>
          <name>abbot:editor</name>
          <description>
            Start the Abbot Costello editor.
          </description>
        </goal>
        <goal>
          <name>abbot:editor-webstart</name>
          <description>
            Start the Abbot Costello editor, using the jars from an already
            installed WebStart application.
          </description>
        </goal>
      </goals>
    </body>
  </document>
  
  
  1.1                  maven-plugins/abbot/xdocs/using.xml
  
  Index: using.xml
  ===================================================================
  <?xml version="1.0"?>
  <document>
  
    <properties>
      <title>Using the Abbot plugin</title>
      <author email="[EMAIL PROTECTED]">Vincent Massol</author>
    </properties>
  
    <body>
  
      <section name="Using the Abbot plugin">
        <p>
          There are 2 possible ways to use the plugin:
        </p>
        <ul>
          <li>
            Using the <code>abbot:test</code> goal. You would call this goal
            from inside your application project. This project needs to
            define all your application required dependencies in its
            <code>project.xml</code>.
          </li>
          <li>
            Using the <code>abbot:test-webstart</code> goal. You would call
            this goal if you wish to test a WebStart application that is
            already installed on some server. In this mode your project does 
            not require to define any dependency.
          </li>
        </ul>
      </section>
  
      <section name="Using the abbot:test goal">
        <section name="Pre-requisites">
          <p>
            The following environmental dependencies need to be present before
            executing the Abbot plugin:
          </p>
          <ul>
            <li>
              The <code>MRJToolkitStubs</code> jar has to be installed in your 
              local Maven repository under the <code>apple</code> groupId. It 
              is required for the Costello editor.
            </li>
          </ul>
        </section>
      </section>
  
      <section name="Using the abbot:test-webapp goal">
        <section name="Pre-requisites">
          <p>
            The following environmental dependencies need to be present before
            executing the Abbot plugin:
          </p>
          <ul>
            <li>
              The <code>MRJToolkitStubs</code> jar has to be installed in your 
              local Maven repository under the <code>apple</code> groupId. It 
              is required for the Costello editor.
            </li>
            <li>
              The <code>JAVAWS_HOME</code> environment variable has to be set and
              it must point to the location where webstart is installed on your
              machine.
            </li>
            <li>
              Some mandatory environment-dependent properties need to be 
              defined. See the <a href="properties.html">Properties</a> 
              page for the details.
            </li>
          </ul>
        </section>
        <section name="Limitations">
          <p>
            The following limitations are known for the 
            <code>abbot:test-webstart</code> goal:
          </p>
          <ul>
            <li>
              You need to provide a key to sign your webstart jars. This is 
              required as we're packaging local filesystem jars
              into the application's JNLP and we need to have the permissions
              to do so (granted if the jar are signed).
            </li>
          </ul>
        </section>
      </section>
  
    </body>
  
  </document>
  
  
  
  1.1                  maven-plugins/abbot/xdocs/properties.xml
  
  Index: properties.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  
  <document>
    <properties>
      <title>Maven Abbot plugin properties</title>
      <author email="[EMAIL PROTECTED]">Vincent Massol</author>
    </properties>
    <body>
      <section name="Abbot plugin properties">
  <source><![CDATA[
  # -------------------------------------------------------------------
  # Properties required for all the abbot plugin goals 
  # -------------------------------------------------------------------
  
  # Location of abbot source scripts
  maven.abbot.src.dir = ${maven.src.dir}/abbot
  
  # (optional) Explicit comma-separated list of Abbot source scripts
  # to execute. If not defined, the plugin will execute all .xml files
  # located in maven.abbot.src.dir
  # maven.abbot.src.files = 
  
  # Decide whether or not to recurse in maven.abbot.src.dir to find 
  # Abbot .xml source scripts.
  maven.abbot.recurse = true
  
  # Location where the abbot plugin puts build files related to abbot
  maven.abbot.dest.dir = ${maven.build.dir}/abbot
  
  # Location where abbot junit test results will be located
  maven.abbot.reports.dir = ${maven.build.dir}/abbot-reports
  
  maven.abbot.printSummary = ${maven.junit.printSummary}
  maven.abbot.dir = ${maven.junit.dir}
  maven.abbot.sysproperties = ${maven.junit.sysproperties}
  maven.abbot.jvmargs = ${maven.junit.jvmargs}
  maven.abbot.format = ${maven.junit.format}
  maven.abbot.usefile = ${maven.junit.usefile}
  
  # (optional) Name of the test suite beeing executed. This name will be used 
  # to name the generated JUnit test report. If not specified the report name
  # will be TEST-org.apache.maven.abbot.AbbotTestAll. This is useful when 
  # you're calling the Abbot plugin several times in a row as otherwise the 
  # reports will overwrite each other.
  #maven.abbot.suite.name = MyTestSuite
  
  # Decide whether to turn on webstart debugging.
  maven.abbot.debug = false
  
  # -------------------------------------------------------------------
  # Properties required only for the abbot:test goal
  # -------------------------------------------------------------------
  
  # Name of the JUnit test to execute that will trigger the execution
  # of the Abbot scripts. This name should not be changed unless you
  # want to provide your own Abbot script wrapper.
  maven.abbot.include = org.apache.maven.abbot.AbbotTestAll
  
  # -------------------------------------------------------------------
  # Properties required only for the abbot:test-webstart goal
  # -------------------------------------------------------------------
  
  # The following properties are mandatories. They depend on your
  # execution environment and must be set in your build.properties file
  # or equivalent:
  #
  # - JAVAWS_HOME: You MUST define this environment variable and have it 
  #   point to where Java Webstart is installed on your machine. 
  #   For example: c:\apps\j2sdk1.4.2_01\jre\javaws
  # - maven.abbot.remotejnlp: This property points to the JNLP file of 
  #   the application you're testing.
  # - maven.abbot.javaws.systemhome: Java webstart system cache location
  # - maven.abbot.javaws.userhome:  Java webstart user cache location
  
  maven.abbot.webstart.jnlp.original = original.jnlp
  maven.abbot.webstart.jnlp.modified = modified.jnlp
  maven.abbot.webstart.main.jar = abbot-main.jar
  maven.abbot.webstart.main.class = org.apache.maven.abbot.AbbotWebstartTestRunner
  
  # Note: For now we only support signing jars. The reason is that we need
  # to add the Abbot jars to the JNLP file and as we're taking these jars 
  # from the local file system we need to have the permissions and thus we 
  # need signed jars to get these permissions.
  maven.abbot.sign = true
  ]]></source>
      </section>
    </body>
  </document>
  
  
  1.1                  maven-plugins/abbot/xdocs/navigation.xml
  
  Index: navigation.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <project name="Maven Abbot plugin">
  
    <title>Maven Abbot plugin</title>
  
    <body>
      <links>
        <item name="Maven" href="http://maven.apache.org/"/>
        <item name="Abbot" href="http://abbot.sourceforge.net/"/>
      </links>
      <menu name="Overview">
        <item name="Using" href="/using.html"/>
        <item name="Goals" href="/goals.html"/>
        <item name="Properties" href="/properties.html"/>
      </menu>
    </body>
  </project>
  
  
  
  1.1                  maven-plugins/abbot/xdocs/index.xml
  
  Index: index.xml
  ===================================================================
  <?xml version="1.0"?>
  <document>
  
    <properties>
      <title>Maven Abbot plugin</title>
      <author email="[EMAIL PROTECTED]">Vincent Massol</author>
    </properties>
  
    <body>
      <section name="What is the Abbot plugin?">
        <p>
          Provides the following features:
        </p>
        <ul>
          <li>
            Ability to start the Abbot Costello editor using either jars
            defined in the POM or the jars from an already installed
            WebStart application.
          </li>
          <li>
            Ability to execute Abbot XML scripts through the Ant &lt;junit&gt;
            task
          </li>
          <li>
            Ability to execute Abbot XML scripts on an already installed 
            WebStart application (end-to-end functional testing)
          </li>
        </ul>
      </section>
      <section name="Using the plugin">
        <p>
          See the <a href="using.html">usage tutorial</a>.
        </p>
      </section>
      
    </body>
  
  </document>
  
  
  
  1.1                  maven-plugins/abbot/src/plugin-test/sample-local/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  target
  
  
  
  1.1                  maven-plugins/abbot/src/plugin-test/sample-local/maven.xml
  
  Index: maven.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <project xmlns:ant="jelly:ant">
  
    <postGoal name="jar:jar">
      <ant:signjar jar="${maven.build.dir}/${maven.final.name}.jar" 
        keystore="${maven.abbot.sign.keystore}"
        storepass="${maven.abbot.sign.storepass}"
        alias="${maven.abbot.sign.alias}"/>    
    </postGoal>
    
    <goal name="dist" prereqs="jar:install,abbot:test"/>
  
  </project>
  
  
  
  1.1                  maven-plugins/abbot/src/plugin-test/sample-local/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0"?>
  <project>
    <extend>${basedir}/../project.xml</extend>  
    <id>maven-abbot-plugin-test-sample-local</id>
    <name>Maven Abbot plugin Local Sample Test</name>
    <description>Run Abbot tests on local sample</description>
    <shortDescription>Run Abbot tests on local sample</shortDescription>
  </project>
  
  
  
  
  1.1                  
maven-plugins/abbot/src/plugin-test/sample-local/project.properties
  
  Index: project.properties
  ===================================================================
  # -------------------------------------------------------------------
  # Copyright 2001-2004 The Apache Software Foundation.
  # 
  # Licensed 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.
  # -------------------------------------------------------------------
  
  # -------------------------------------------------------------------
  # P R O J E C T  P R O P E R T I E S
  # -------------------------------------------------------------------
  
  maven.abbot.sign.keystore = file:${basedir}/conf/keys
  maven.abbot.sign.storepass = abbot-plugin
  maven.abbot.sign.alias = abbot-plugin
  
  
  
  1.1                  maven-plugins/abbot/src/plugin-resources/jnlp.jsl
  
  Index: jnlp.jsl
  ===================================================================
  <?xml version="1.0"?>

  

  <!--

  /* ====================================================================

   *   Copyright 2004 The Apache Software Foundation.

   *

   *   Licensed 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.

   * ====================================================================

   */

  -->

  

  <jsl:stylesheet

        select="$doc"

    xmlns:j="jelly:core"

    xmlns:jsl="jelly:jsl"

    xmlns:x="jelly:xml"

    xmlns:u="jelly:util"

    xmlns:ant="jelly:ant"

    xmlns:doc="doc"

    xmlns="dummy"

    trim="true">

    

    <!-- Entry point (first matching template) -->

    <jsl:template match="/jnlp">

        <x:element name="jnlp">

                <x:attribute name="spec"> <x:expr select="@spec"/> </x:attribute>

                <x:attribute name="codebase"> <x:expr select="@codebase"/> 
</x:attribute>

                <jsl:applyTemplates select="//information"/>

                <jsl:applyTemplates select="//security"/>

                <jsl:applyTemplates select="//resources"/>

                <jsl:applyTemplates select="//application-desc"/>

        </x:element>

    </jsl:template>

    

    <!-- Copy information data "as-is" -->

    <jsl:template match="information">

      <x:copyOf select="."/>

    </jsl:template>

  

    <!-- Copy security data "as-is" -->

    <jsl:template match="security">

      <x:copyOf select="."/>

    </jsl:template>

  

    <!-- Transform jnlp resources -->         

    <jsl:template match="resources">

  

      <resources>

        <!-- Copy j2se anchor -->

        <x:copyOf select="j2se"/>

                        

        <!-- Copy the former "main jar" reference, without main attribute -->

        <jsl:applyTemplates select="[EMAIL PROTECTED]"/>

                        

        <!-- Copy all the other jars references -->

        <x:copyOf select="jar[not(@main)]"/>

                        

        <!-- Add references to all jar in ${maven.abbot.webstart.dependencies} -->

        <j:forEach var="dep" items="${plugin.getDependencies()}">

          <j:if test="${dep.getProperty('abbot.webstart')}">

            <j:set var="filename" value="${dep.GroupId}-${dep.ArtifactId}"/>

            <j:if test="${maven.abbot.sign}">

              <x:element name="jar">

                <x:attribute 
name="href">file:${maven.abbot.dest.dir}/${filename}.jar</x:attribute>

              </x:element>

            </j:if>

            <j:if test="${maven.abbot.sign == false}">

              <x:element name="jar">

                <x:attribute name="href">${dep.getDependancyPath()}</x:attribute>

              </x:element>

            </j:if>    

            </j:if>  

          </j:forEach>

  

        <!-- Add reference to the new "main jar" -->

        <x:element name="jar">

          <x:attribute name="main">true</x:attribute>

          <x:attribute 
name="href">file:${maven.abbot.dest.dir}/${maven.abbot.webstart.main.jar}</x:attribute>

        </x:element>

  

        <!-- Copy all existing sys properties -->

        <x:copyOf select="property"/>

  

        <!-- Add some other properties -->

        <x:element name="property">

          <x:attribute name="name">maven.abbot.src.dir</x:attribute>

          <x:attribute name="value">${maven.abbot.src.dir}</x:attribute>

        </x:element>

        <j:if test="${context.getVariable('maven.abbot.src.files') != null}">

          <x:element name="property">

            <x:attribute name="name">maven.abbot.src.files</x:attribute>

            <x:attribute name="value">${maven.abbot.src.files}</x:attribute>

          </x:element>

        </j:if>

        <x:element name="property">

          <x:attribute name="name">maven.abbot.reports.dir</x:attribute>

          <x:attribute name="value">${maven.abbot.reports.dir}</x:attribute>

        </x:element>

        <j:if test="${context.getVariable('maven.abbot.suite.name') != null}">

          <x:element name="property">

            <x:attribute name="name">maven.abbot.suite.name</x:attribute>

            <x:attribute name="value">${maven.abbot.suite.name}</x:attribute>

          </x:element>

        </j:if>

  

        <!-- Add debug properties if debug mode is turned on -->

        <j:if test="${maven.abbot.debug}">

          <!-- Note: For some unknown reason, adding the "+TraceSecurity" option

               hangs Java Web Start (at least on 1.4.2_01) -->

          <property name="javaws.debug.0" value="+TraceCache"/>    

          <property name="javaws.debug.1" value="+TraceDiskCache"/>    

          <property name="javaws.debug.2" value="+TraceDownload"/>    

          <property name="javaws.debug.3" value="+TraceXMLParsing"/> 

        </j:if>

  

      </resources>

  

    </jsl:template>

  

    <!-- Copy jar anchor without its main attribute -->

    <jsl:template match="[EMAIL PROTECTED]">

      <x:element name="jar">

        <x:attribute name="href"> <x:expr select="@href"/> </x:attribute>

      </x:element>

    </jsl:template>

  

    <!-- Change the main class -->

    <jsl:template match="application-desc">

      <application-desc main-class="${maven.abbot.webstart.main.class}">

      </application-desc>       

    </jsl:template>      

  

  </jsl:stylesheet>

  
  
  
  1.1                  
maven-plugins/abbot/src/plugin-test/sample-webstart/build.properties.sample
  
  Index: build.properties.sample
  ===================================================================
  # -------------------------------------------------------------------

  # Copyright 2001-2004 The Apache Software Foundation.

  # 

  # Licensed 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.

  # -------------------------------------------------------------------

  

  # Copy this file to a build.properties file and edit to match your local

  # environment.

  #

  # Note: You MUST also define the JAVAWS_HOME environment variable and have it

  # point to where Java Webstart is installed on your machine. 

  # For example: c:\apps\j2sdk1.4.2_01\jre\javaws

  

  # Locations where your Java web start caches are located.

  # For example on Windows XP:

  maven.abbot.javaws.systemhome = C:/WINDOWS/Sun/Java/Deployment

  maven.abbot.javaws.userhome = C:/Documents and Settings/[replace with user 
name]/Application Data/Sun/Java/Deployment

  

  

  
  
  
  1.1                  maven-plugins/abbot/src/plugin-test/sample-webstart/maven.xml
  
  Index: maven.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <project xmlns:j="jelly:core" xmlns:ant="jelly:ant">
  
    <goal name="dist">
  
      <!-- Start Jetty -->
      <j:thread>
        <attainGoal name="jetty:run-war"/>
      </j:thread>
      <ant:waitfor>
        <ant:http 
url="http://localhost:8081/maven-abbot-plugin-test-sample-webstart/sample.jnlp"/>
      </ant:waitfor>
  
      <!-- Start Abbot webstart tests -->
      <attainGoal name="abbot:test-webstart"/>
  
    </goal>
  
  </project>
  
  
  
  1.1                  maven-plugins/abbot/src/plugin-test/sample-webstart/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0"?>
  <project>
    <extend>${basedir}/../project.xml</extend>  
    <id>maven-abbot-plugin-test-sample-webstart</id>
    <name>Maven Abbot plugin Webstart Sample Test</name>
    <description>Run Abbot tests on webstart sample</description>
    <shortDescription>Run Abbot tests on webstart sample</shortDescription>
    <dependencies>
      <dependency>
        <groupId>maven</groupId>
        <artifactId>maven-abbot-plugin-test-sample-local</artifactId>
        <version>1.0</version>
        <properties>
          <war.target.path>.</war.target.path>>
        </properties>
      </dependency>
      <dependency>
        <groupId>maven</groupId>
        <artifactId>maven-jetty-plugin</artifactId>
        <version>1.0</version>
        <type>plugin</type>
      </dependency>
    </dependencies>
  </project>
  
  
  
  1.1                  
maven-plugins/abbot/src/plugin-test/sample-webstart/project.properties
  
  Index: project.properties
  ===================================================================
  # -------------------------------------------------------------------
  # Copyright 2001-2004 The Apache Software Foundation.
  # 
  # Licensed 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.
  # -------------------------------------------------------------------
  
  maven.jetty.port = 8081
  maven.abbot.sign = true
  maven.abbot.sign.force = false
  maven.abbot.remotejnlp = 
http://localhost:8081/maven-abbot-plugin-test-sample-webstart/sample.jnlp
  
  maven.abbot.sign.keystore = file:${basedir}/conf/keys
  maven.abbot.sign.storepass = abbot-plugin
  maven.abbot.sign.alias = abbot-plugin
  
  
  
  1.1                  maven-plugins/abbot/src/plugin-test/sample-webstart/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  target
  build.properties
  
  
  
  1.1                  maven-plugins/abbot/src/plugin-test/maven.xml
  
  Index: maven.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <project xmlns:j="jelly:core">
  
    <!-- Note: We're not naming this goal testPlugin voluntarily. The 
         reason is that in order for the test to run fine, the user must
         create a build.properties file in sample-webstart. The test also
         runs only on windows for now, WebStart must be installed and some
         environment varibale must be set. -->
  
    <goal name="testPlugin-manual">
        <j:set var="goal" value="dist"/>
      <attainGoal name="multiproject:goal"/>
    </goal>
  
  </project>
  
  
  
  1.1                  maven-plugins/abbot/src/plugin-test/project.properties
  
  Index: project.properties
  ===================================================================
  # -------------------------------------------------------------------
  # Copyright 2001-2004 The Apache Software Foundation.
  # 
  # Licensed 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.
  # -------------------------------------------------------------------
  
  # -------------------------------------------------------------------
  # P R O J E C T  P R O P E R T I E S
  # -------------------------------------------------------------------
  
  # MUST specify these, even though they are the defaults, so we can run inside
  # reactor where they were already set.
  maven.multiproject.basedir=${basedir}
  maven.multiproject.includes=*/project.xml
  maven.multiproject.excludes=
  
  
  
  1.1                  maven-plugins/abbot/src/plugin-test/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0"?>
  <project>
    <pomVersion>3</pomVersion>
    <groupId>maven</groupId>
    <currentVersion>1.0</currentVersion>
    <url>http://maven.apache.org/reference/plugins/abbot/</url>
    
<issueTrackingUrl>http://jira.codehaus.org/BrowseProject.jspa?id=xxxxx</issueTrackingUrl>
    <siteDirectory>/www/maven.apache.org/reference/plugins/abbot/</siteDirectory>
    <repository>
      <connection>scm:cvs:pserver:[EMAIL 
PROTECTED]:/home/cvspublic:maven-plugins/abbot/</connection>
      <url>http://cvs.apache.org/viewcvs/maven-plugins/abbot/</url>
    </repository>
    <developers>
      <developer>
        <name>Christian Blavier</name>
        <id>cblavier</id>
        <email>[EMAIL PROTECTED]</email>
        <organization>BNP Paribas</organization>
        <roles>
          <role>Creator</role>
          <role>Java Developer</role>
          <role>Lead Developer</role>
        </roles>
      </developer>
      <developer>
        <name>Vincent Massol</name>
        <id>vmassol</id>
        <email>[EMAIL PROTECTED]</email>
        <organization>Pivolis</organization>
        <roles>
          <role>Creator</role>
          <role>Java Developer</role>
          <role>Release Manager</role>
          <role>Lead Developer</role>
        </roles>
      </developer>
    </developers>
    <build>
      <sourceDirectory>${basedir}/src/java</sourceDirectory>
    </build>
  </project>
  
  
  
  1.1                  
maven-plugins/abbot/src/test/org/apache/maven/abbot/AbbotTestRunnerMainTest.java
  
  Index: AbbotTestRunnerMainTest.java
  ===================================================================
  package org.apache.maven.abbot;
  
  /* ====================================================================
   *   Copyright 2004 The Apache Software Foundation.
   *
   *   Licensed 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.
   * ====================================================================
   */
  
  import junit.framework.TestCase;
  
  /**
   * Unit tests for [EMAIL PROTECTED] AbbotWebstartTestRunner}.
   */
  public class AbbotTestRunnerMainTest extends TestCase
  {
      public void testExecuteOk() throws Exception
      {
          AbbotWebstartTestRunner runner = new AbbotWebstartTestRunner();
          runner.execute(SampleTest.class.getName(),
              System.getProperty("maven.abbot.reports.dir", ""));
      }
  }
  
  
  
  1.1                  
maven-plugins/abbot/src/test/org/apache/maven/abbot/SampleTest.java
  
  Index: SampleTest.java
  ===================================================================
  package org.apache.maven.abbot;
  
  /* ====================================================================
   *   Copyright 2004 The Apache Software Foundation.
   *
   *   Licensed 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.
   * ====================================================================
   */
  
  import junit.framework.TestCase;
  
  /**
   * Dummy test to verify that [EMAIL PROTECTED] AbbotWebstartTestRunner#execute}
   * can execute it properly.
   */
  public class SampleTest extends TestCase
  {
      public void testXXX()
      {
          assertTrue("Should have been true...", true);
      }
  }
  
  
  
  1.1                  
maven-plugins/abbot/src/test/org/apache/maven/abbot/AbbotTestAllTest.java
  
  Index: AbbotTestAllTest.java
  ===================================================================
  package org.apache.maven.abbot;
  
  /* ====================================================================
   *   Copyright 2004 The Apache Software Foundation.
   *
   *   Licensed 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.
   * ====================================================================
   */
  
  import junit.extensions.abbot.ScriptFixture;
  import junit.framework.Test;
  import junit.framework.TestCase;
  
  /**
   * Unit tests for [EMAIL PROTECTED] AbbotTestAll}.
   */
  public class AbbotTestAllTest extends TestCase
  {
      public void testGetScriptFileNamesNoPropertyDefined()
      {
          assertNull("The maven.abbot.src.files property must not be set for "
              + "this test", System.getProperty("maven.abbot.src.files"));
          String[] result = AbbotTestAll.getScriptFileNames();
          assertNull(result);        
      }
  
      public void testGetScriptFileNamesEmptyFileList()
      {
          System.setProperty("maven.abbot.src.files", "");
          String[] result = AbbotTestAll.getScriptFileNames();
          assertNull(result);        
      }
  
      public void testGetScriptFileNamesSingleFile()
      {
          System.setProperty("maven.abbot.src.files", "c:/some/file");
          String[] result = AbbotTestAll.getScriptFileNames();
          assertEquals(1, result.length);        
          assertEquals("c:/some/file", result[0]);        
      }
  
      public void testGetScriptFileNamesTwoFiles()
      {
          System.setProperty("maven.abbot.src.files", 
              "c:/some/file,c:/other/file");
          String[] result = AbbotTestAll.getScriptFileNames();
          assertEquals(2, result.length);        
          assertEquals("c:/some/file", result[0]);        
          assertEquals("c:/other/file", result[1]);        
      }
  
      /**
       * Verify we can construct a valid 
       * [EMAIL PROTECTED] junit.extensions.abbot.ScriptTestSuite} object when
       * executing a single script.
       */
      public void testConstructionOfScriptTestSuiteWithUniqueScript()
      {
          System.setProperty("maven.abbot.src.files", "c:/some/file.xml");
  
          Test suite = AbbotTestAll.suite();
  
          assertNotNull(suite);
          assertEquals(AbbotTestAll.MavenScriptTestSuite.class.getName(), 
              suite.getClass().getName());
  
          AbbotTestAll.MavenScriptTestSuite mavenSuite = 
              (AbbotTestAll.MavenScriptTestSuite) suite;
          assertEquals(1, mavenSuite.testCount());
  
          Test test = (Test) mavenSuite.tests().nextElement();
          assertEquals(ScriptFixture.class.getName(), test.getClass().getName());
      }
  
  }
  
  
  
  1.1                  
maven-plugins/abbot/src/main/org/apache/maven/abbot/AbbotWebstartTestRunner.java
  
  Index: AbbotWebstartTestRunner.java
  ===================================================================
  package org.apache.maven.abbot;
  
  /* ====================================================================
   *   Copyright 2004 The Apache Software Foundation.
   *
   *   Licensed 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.
   * ====================================================================
   */
  
  import java.io.File;
  
  import org.apache.tools.ant.Project;
  import org.apache.tools.ant.taskdefs.optional.junit.FormatterElement;
  import org.apache.tools.ant.taskdefs.optional.junit.JUnitTask;
  import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest;
  
  /**
   * Proxy for testing webstart application with Abbot. It replaces the main
   * class of the application to test and uses the JUnit Ant task test runner
   * to execute the Abbot tests. In order to use this class, it must be 
   * referenced as the main class in the JNLP file. 
   * 
   * @version $Id: AbbotWebstartTestRunner.java,v 1.1 2004/06/12 14:10:25 vmassol Exp $
   */
  public class AbbotWebstartTestRunner
  {
      /**
       * Name of the generic TestCase to execute. That test will execute all the
       * XML Abbot scripts.
       */
      private static final String GENERIC_TEST = AbbotTestAll.class.getName();
  
      /**
       * Directory where junit reports are to be generated.
       */
      private static final String REPORT_DIR = 
          System.getProperty("maven.abbot.reports.dir", "");
  
      /**
       * Name given by the user to the suite of tests being executed. The Abbot
       * test report will be name after the content of this property. This is
       * useful when you're calling the Abbot plugin several times in a row as
       * otherwise the reports will overwrite each other.
       */
      private static final String TESTSUITE_NAME = 
          System.getProperty("maven.abbot.suite.name");
      
      /**
       * Entry point for starting the Ant JUnit test runner which will start
       * all our Abbot script tests. 
       * 
       * @param args the parameters that we need to use to start the Ant test
       *        runner
       * @throws Exception in case of unanticipated error
       */
      public static void main(String[] args) throws Exception
      {
          AbbotWebstartTestRunner main = new AbbotWebstartTestRunner();
          main.execute(GENERIC_TEST, REPORT_DIR);
      }
      
      /**
       * Execute the JUnit test runner using the Ant JUnitTask task. 
       * 
       * Note: We absolutely need to call System.exit() as all webstart 
       * applications are required to do so. This is required for the
       * application to close at the end of the tests
       * (see http://www.vamphq.com/jwsfaq.html#linger).
       * 
       * @param testName the name of the generic test that will in turn run all
       *        the Abbot XML scripts
       * @param reportdir directory where junit reports are to be generated
       * @throws Exception in case of unanticipated error
       */
      public void execute(String testName, String reportDir)
      {
          try
          {
              executeAntJunitTestRunner(testName, reportDir);
              System.exit(0);
          }
          catch (Throwable t)
          {
              System.exit(1);
          }
      }
      
      /**
       * Execute the JUnit test runner using the Ant JUnitTask task.
       * 
       * @param testName the name of the generic test that will in turn run all
       *        the Abbot XML scripts
       * @param reportdir directory where junit reports are to be generated
       * @throws Exception in case of unanticipated error
       */
      private void executeAntJunitTestRunner(String testName, String reportDir)
        throws Exception
      {
          Project project = new Project();
            project.init();
            
            JUnitTask junit = new JUnitTask();
            junit.setProject(project);
  
            // Do not fork so that we use the same classpath that was used to
            // start this class.
            junit.setFork(false);
            
            // Set properties of the JUnit Ant task
  
            // Set formatter
            junit.addFormatter(createFormatterElement("xml"));
            junit.addFormatter(createFormatterElement("plain"));
            
            // Add tests to run
            JUnitTest test = new JUnitTest(testName);
            test.setTodir(new File(reportDir));
  
          // Sets the name of the report file is the user has specified a name.
          // Otherwise the name of the AbbotTestAll class will be used.
          if (TESTSUITE_NAME != null)
          {
                test.setOutfile(TESTSUITE_NAME);
          }
          junit.addTest(test);
  
            // Other settings
            junit.setHaltonerror(true);
            junit.setHaltonfailure(true);
            
            // Execute the task...
            junit.execute();        
      }
      
      /**
       * @param type the formatter type ("xml", "plain" or "brief")
       * @return a properly set [EMAIL PROTECTED] FormatterElement} object 
       */
      private FormatterElement createFormatterElement(String type)
      {
            FormatterElement formatterElement = new FormatterElement();
            FormatterElement.TypeAttribute typeAttribute =
                new FormatterElement.TypeAttribute();
            typeAttribute.setValue(type);
            formatterElement.setType(typeAttribute);
            return formatterElement;
      }
  }
  
  
  
  1.1                  
maven-plugins/abbot/src/main/org/apache/maven/abbot/AbbotTestAll.java
  
  Index: AbbotTestAll.java
  ===================================================================
  package org.apache.maven.abbot;
  
  /* ====================================================================
   *   Copyright 2004 The Apache Software Foundation.
   *
   *   Licensed 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.
   * ====================================================================
   */
  
  import junit.extensions.abbot.ScriptFixture;
  import junit.extensions.abbot.ScriptTestSuite;
  import junit.framework.Test;
  import java.io.File;
  import java.util.ArrayList;
  import java.util.List;
  import java.util.StringTokenizer;
  
  /**
   * TestAll is the entry point for all Abbot functional tests.
   * It executes all xml files located in the passed src/abbot/ dir.
   */
  public class AbbotTestAll extends ScriptFixture
  {
      /**
       * Location of Abbot scripts
       */
      private static final String TESTPATH = 
          System.getProperty("maven.abbot.src.dir");
  
      /**
       * Should we recurse in the directory where Abbot scripts are located?
       */
      private static final boolean RECURSE =
          Boolean.getBoolean("maven.abbot.recurse");
  
      /**
       * Custom ScriptTestSuite to only accept xml files.
       */
      public static class MavenScriptTestSuite extends ScriptTestSuite
      {
          public MavenScriptTestSuite(Class fixtureClass, String dirName, 
              boolean recurse)
          {
              super(fixtureClass, dirName, recurse);
          }
  
          public MavenScriptTestSuite(Class fixtureClass, String[] filenames)
          {
              super(fixtureClass, filenames);
          }
  
          public boolean accept(File file)
                {
                    return file.getName().endsWith(".xml");
                }        
      }
      
      /**
       * Return test suite containing all scripts.
       */
      public static Test suite()
      {
          MavenScriptTestSuite suite;
          String[] files = getScriptFileNames();
          
          if (files == null)
          {        
              suite = new MavenScriptTestSuite(ScriptFixture.class, TESTPATH, 
                  RECURSE);
          }
          else
          {
              suite = new MavenScriptTestSuite(ScriptFixture.class, files);
          }
          
          return suite;
      }
  
      /**
       * @see ScriptFixture#ScriptFixture(java.lang.String)
       */
      public AbbotTestAll(String name)
      {
          super(name);
      }
  
      /**
       * @return the file list (as a String array) specified by the optional 
       *         <code>maven.abbot.src.files</code> Maven property or null
       *         if the property is not defined. Also returns null if there
       *         are no files defined in the <code>maven.abbot.src.files</code>
       *         property. 
       */
      protected static String[] getScriptFileNames()
      {
          String files = System.getProperty("maven.abbot.src.files");
          String[] result = null;
  
          if (files != null)
          {
              List fileList = new ArrayList();
              StringTokenizer st = new StringTokenizer(files, ",");
              while (st.hasMoreTokens())
              {
                  fileList.add(st.nextToken());
              }
  
              if (!fileList.isEmpty())
              {
                  result = (String[]) fileList.toArray(new String[0]);
              }
          }
  
          return result;
      }
          
  }
  
  
  
  1.1                  
maven-plugins/abbot/src/plugin-test/sample-local/src/abbot/TestLocalSample.xml
  
  Index: TestLocalSample.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <AWTTestScript>
    <component class="javax.swing.JButton" id="Click Here" index="0" parent="JPanel 
Instance" text="Click Here" window="TestFrame Instance" />
    <component class="javax.swing.JLayeredPane" id="JLayeredPane Instance" index="1" 
parent="JRootPane Instance" window="TestFrame Instance" />
    <component class="javax.swing.JPanel" id="JPanel Instance" index="0" 
parent="JLayeredPane Instance" window="TestFrame Instance" />
    <component class="javax.swing.JRootPane" id="JRootPane Instance" index="0" 
parent="TestFrame Instance" />
    <component class="javax.swing.JTextField" id="JTextField Instance" index="1" 
parent="JPanel Instance" window="TestFrame Instance" />
    <component class="org.apache.maven.abbot.sample.Main" id="TestFrame Instance" 
root="true" title="" />
    <launch args="[]" class="org.apache.maven.abbot.sample.Main" classpath="." 
desc="Sample test" method="main" />
    <assert component="JTextField Instance" method="getText" value="initial" />
    <sequence>
      <action args="Click Here" class="javax.swing.AbstractButton" 
method="actionClick" />
      <action args="TestFrame Instance" class="java.awt.Window" method="actionClose" />
    </sequence>
    <assert component="JTextField Instance" method="getText" value="modified" />
    <terminate/>
  </AWTTestScript>
  
  
  
  
  1.1                  maven-plugins/abbot/src/plugin-test/sample-local/conf/keys
  
        <<Binary file>>
  
  
  1.1                  
maven-plugins/abbot/src/plugin-test/sample-webstart/src/webapp/sample.jnlp
  
  Index: sample.jnlp
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>

  

  <jnlp href="sample.jnlp" spec="1.0+" 
codebase="http://localhost:8081/maven-abbot-plugin-test-sample-webstart/";>

    <information>

      <title>Sample webstart application</title>

      <vendor>Apache Software Foundation</vendor>

      <homepage href="index.html"/>

      <description>Sample webstart application</description>

      <description kind="short">Sample webstart application</description>

    </information>

    <security>

        <all-permissions/>

    </security>

    <resources>

      <j2se version="1.3+"/>

      <jar href="maven-abbot-plugin-test-sample-local-1.0.jar"/>

    </resources>

    <application-desc main-class="org.apache.maven.abbot.sample.Main"/>

  </jnlp>
  
  
  1.1                  maven-plugins/abbot/src/plugin-test/sample-webstart/conf/keys
  
        <<Binary file>>
  
  
  1.1                  
maven-plugins/abbot/src/plugin-test/sample-webstart/src/abbot/TestWebstartSample.xml
  
  Index: TestWebstartSample.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <AWTTestScript>
    <component class="javax.swing.JButton" id="Click Here" index="0" parent="JPanel 
Instance" text="Click Here" window="TestFrame Instance" />
    <component class="javax.swing.JLayeredPane" id="JLayeredPane Instance" index="1" 
parent="JRootPane Instance" window="TestFrame Instance" />
    <component class="javax.swing.JPanel" id="JPanel Instance" index="0" 
parent="JLayeredPane Instance" window="TestFrame Instance" />
    <component class="javax.swing.JRootPane" id="JRootPane Instance" index="0" 
parent="TestFrame Instance" />
    <component class="javax.swing.JTextField" id="JTextField Instance" index="1" 
parent="JPanel Instance" window="TestFrame Instance" />
    <component class="org.apache.maven.abbot.sample.Main" id="TestFrame Instance" 
root="true" title="" />
    <launch args="[]" class="org.apache.maven.abbot.sample.Main" classpath="." 
desc="Sample test" method="main" />
    <assert component="JTextField Instance" method="getText" value="initial" />
    <sequence>
      <action args="Click Here" class="javax.swing.AbstractButton" 
method="actionClick" />
      <action args="TestFrame Instance" class="java.awt.Window" method="actionClose" />
    </sequence>
    <assert component="JTextField Instance" method="getText" value="modified" />
    <terminate/>
  </AWTTestScript>
  
  
  
  1.1                  
maven-plugins/abbot/src/plugin-test/sample-webstart/src/webapp/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!DOCTYPE web-app
      PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
      "http://java.sun.com/dtd/web-app_2_3.dtd";>
  
  <web-app>
  </web-app>
  
  
  
  1.1                  
maven-plugins/abbot/src/plugin-test/sample-local/src/java/org/apache/maven/abbot/sample/Main.java
  
  Index: Main.java
  ===================================================================
  package org.apache.maven.abbot.sample;
  
  /* ====================================================================
   *   Copyright 2004 The Apache Software Foundation.
   *
   *   Licensed 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.
   * ====================================================================
   */
  
  import javax.swing.JFrame;
  import java.awt.FlowLayout;
  import javax.swing.JButton;
  import javax.swing.JTextField;
  import java.awt.event.ActionListener;
  import java.awt.event.ActionEvent;
  
  public class Main extends JFrame
  {
    public JButton button;
    public JTextField textField;
  
    public Main()
    {
      getContentPane().setLayout(new FlowLayout());
      textField = new JTextField("initial");
      button = new JButton("Click Here");
      button.addActionListener(new ActionListener()
          {
                public void actionPerformed(ActionEvent e)
                {
                    textField.setText("modified");
                }
          }
      );
      getContentPane().add(button);
      getContentPane().add(textField);
      this.pack();
    }
  
    public static void main(String[] argv)
    {
      Main frame = new Main();
      frame.show();
    }
  
  }
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to