You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ol...@apache.org on 2011/09/21 23:57:05 UTC

svn commit: r1173884 - in /tomcat/maven-plugin/trunk: ./ tomcat-maven-plugin-it/ tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/ tomcat6-maven-plugin/

Author: olamy
Date: Wed Sep 21 21:57:04 2011
New Revision: 1173884

URL: http://svn.apache.org/viewvc?rev=1173884&view=rev
Log:
prepare a reusable set of integration for both versions of the plugin

Added:
    tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractSimpleWarProjectIT.java
      - copied, changed from r1171301, tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/SimpleWarProjectIT.java
    tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractTomcatRunMultiConfigIT.java
      - copied, changed from r1171301, tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/TomcatRunMultiConfigIT.java
    tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractUsageContextpathIT.java
      - copied, changed from r1171301, tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/SimpleWarProjectIT.java
Removed:
    tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/SimpleWarProjectIT.java
    tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/TomcatRunMultiConfigIT.java
Modified:
    tomcat/maven-plugin/trunk/pom.xml
    tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/pom.xml
    tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractWarProjectIT.java
    tomcat/maven-plugin/trunk/tomcat6-maven-plugin/pom.xml

Modified: tomcat/maven-plugin/trunk/pom.xml
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/pom.xml?rev=1173884&r1=1173883&r2=1173884&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/pom.xml (original)
+++ tomcat/maven-plugin/trunk/pom.xml Wed Sep 21 21:57:04 2011
@@ -107,7 +107,7 @@
 
   <modules>
     <module>tomcat6-maven-plugin</module>
-    <!-- Module tomcat-maven-plugin-it is activated with the profile integration-test -->
+    <module>tomcat-maven-plugin-it</module>
   </modules>
 
   <dependencyManagement>
@@ -173,7 +173,7 @@
       <dependency>
         <groupId>org.apache.maven.shared</groupId>
         <artifactId>maven-verifier</artifactId>
-        <version>1.2</version>
+        <version>1.3</version>
       </dependency>
       <dependency>
         <groupId>org.apache.httpcomponents</groupId>
@@ -195,6 +195,11 @@
         <artifactId>logback-classic</artifactId>
         <version>0.9.24</version>
       </dependency>
+      <dependency>
+        <groupId>org.apache.tomcat.maven</groupId>
+        <artifactId>tomcat-maven-plugin-it</artifactId>
+        <version>${project.version}</version>
+      </dependency>
       
     </dependencies>
   </dependencyManagement>
@@ -232,6 +237,11 @@
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-plugin-plugin</artifactId>
+          <version>2.6</version>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-deploy-plugin</artifactId>
           <version>2.5</version>
           <dependencies>
@@ -275,33 +285,26 @@
     </site>
   </distributionManagement>
 
-  <profiles>
-    <profile>
-      <id>run-its</id>
-      <!-- The integration tests require that the test artifacts are installed
-           first to a local repository. -->
-      <modules>
-        <module>tomcat-maven-plugin-it</module>
-      </modules>
-      <build>
-        <plugins>
-          <plugin>
-            <!-- For integration tests the plugin needs to be installed before
-                 the integration tests are executed -->
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-install-plugin</artifactId>
-            <executions>
-              <execution>
-                <goals>
-                  <goal>install</goal>
-                </goals>
-                <phase>pre-integration-test</phase>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>    
-  </profiles>
+  <reporting>
+    <plugins>
+      <plugin>
+        <artifactId>maven-pmd-plugin</artifactId>
+        <version>2.4</version>
+        <configuration>
+          <targetJdk>${maven.compiler.target}</targetJdk>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-plugin-plugin</artifactId>
+        <version>2.6</version>
+        <configuration>
+          <requirements>
+            <jdk>${maven.compiler.target}</jdk>
+          </requirements>
+        </configuration>
+      </plugin>
+    </plugins>
+  </reporting>
 
 </project>

Modified: tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/pom.xml
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/pom.xml?rev=1173884&r1=1173883&r2=1173884&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/pom.xml (original)
+++ tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/pom.xml Wed Sep 21 21:57:04 2011
@@ -32,72 +32,13 @@
   <packaging>jar</packaging>
   <name>Tomcat Maven Plugin Integration Tests</name>
 
-  <description>
-    Integration Tests for the Tomcat-Maven-Plugin. To run the tests start this module with
-    profile "integration-test":
-
-    mvn clean verify -P integration-test
-
-    To ensure that every dependency is installed before to your local repository you might
-    call the parent POM with:
-
-    mvn clean verify -am -P integration-test -pl tomcat-maven-plugin-it
-  </description>
-
   <properties>
-    <!-- Nothing to deploy - just tests -->
-    <maven.deploy.skip>true</maven.deploy.skip>
     <!-- The time to wait between startup and shutdown of tomcat. Realized by a test which waits for the specified
          time. -->
     <it.sleep.time>2000</it.sleep.time>
     <maven.resources.escapeString>\</maven.resources.escapeString>
   </properties>
 
-  <build>
-    <defaultGoal>verify</defaultGoal>
-
-    <plugins>
-
-      <!-- Don't run "normal" tests -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <skipTests>true</skipTests>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-failsafe-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>integration-test</id>
-            <goals>
-              <goal>integration-test</goal>
-            </goals>
-          </execution>
-          <execution>
-            <id>verify</id>
-            <goals>
-              <goal>verify</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-
-    <testResources>
-      <testResource>
-        <directory>src/test/project-resources</directory>
-        <filtering>true</filtering>
-      </testResource>
-      <testResource>
-        <directory>src/test/resources</directory>
-        <filtering>false</filtering>
-      </testResource>
-    </testResources>
-  </build>
-
   <dependencies>
     <!-- Test dependencies -->
     <dependency>
@@ -112,14 +53,6 @@
       <groupId>org.apache.maven.shared</groupId>
       <artifactId>maven-verifier</artifactId>
     </dependency>
-    <!-- No real dependency - just to ensure the correct build order by dependency resolution -->
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>tomcat6-maven-plugin</artifactId>
-      <version>${project.version}</version>
-      <type>maven-plugin</type>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.apache.httpcomponents</groupId>
       <artifactId>httpclient</artifactId>

Copied: tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractSimpleWarProjectIT.java (from r1171301, tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/SimpleWarProjectIT.java)
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractSimpleWarProjectIT.java?p2=tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractSimpleWarProjectIT.java&p1=tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/SimpleWarProjectIT.java&r1=1171301&r2=1173884&rev=1173884&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/SimpleWarProjectIT.java (original)
+++ tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractSimpleWarProjectIT.java Wed Sep 21 21:57:04 2011
@@ -34,10 +34,10 @@ import static org.junit.Assert.assertTru
 /**
  * @author Mark Michaelis
  */
-public class SimpleWarProjectIT
+public abstract class AbstractSimpleWarProjectIT
     extends AbstractWarProjectIT
 {
-    private static final Logger LOG = LoggerFactory.getLogger( SimpleWarProjectIT.class );
+    private static final Logger LOG = LoggerFactory.getLogger( AbstractSimpleWarProjectIT.class );
 
     @Override
     protected String getWebappUrl()

Copied: tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractTomcatRunMultiConfigIT.java (from r1171301, tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/TomcatRunMultiConfigIT.java)
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractTomcatRunMultiConfigIT.java?p2=tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractTomcatRunMultiConfigIT.java&p1=tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/TomcatRunMultiConfigIT.java&r1=1171301&r2=1173884&rev=1173884&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/TomcatRunMultiConfigIT.java (original)
+++ tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractTomcatRunMultiConfigIT.java Wed Sep 21 21:57:04 2011
@@ -37,10 +37,10 @@ import static org.junit.Assert.assertTru
  *
  * @author Mark Michaelis
  */
-public final class TomcatRunMultiConfigIT
+public final class AbstractTomcatRunMultiConfigIT
     extends AbstractWarProjectIT
 {
-    private static final Logger LOG = LoggerFactory.getLogger( TomcatRunMultiConfigIT.class );
+    private static final Logger LOG = LoggerFactory.getLogger( AbstractTomcatRunMultiConfigIT.class );
 
     private static final String URL_QUERY = "\u3053\u3093\u306b\u3061\u306f";
 

Copied: tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractUsageContextpathIT.java (from r1171301, tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/SimpleWarProjectIT.java)
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractUsageContextpathIT.java?p2=tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractUsageContextpathIT.java&p1=tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/SimpleWarProjectIT.java&r1=1171301&r2=1173884&rev=1173884&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/SimpleWarProjectIT.java (original)
+++ tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractUsageContextpathIT.java Wed Sep 21 21:57:04 2011
@@ -20,35 +20,40 @@ package org.codehaus.mojo.tomcat.it;
  */
 
 
-
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.File;
-
 import static junitx.framework.StringAssert.assertContains;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
 
 /**
+ * Tests the example "Using a different context path" as the WAR gets deployed below the contextpath /lorem.
+ *
  * @author Mark Michaelis
  */
-public class SimpleWarProjectIT
+public final class AbstractUsageContextpathIT
     extends AbstractWarProjectIT
 {
-    private static final Logger LOG = LoggerFactory.getLogger( SimpleWarProjectIT.class );
+    private static final Logger LOG = LoggerFactory.getLogger( AbstractUsageContextpathIT.class );
+
+    private static final String WEBAPP_URL = "http://localhost:8080/lorem/index.html";
+
+    /**
+     * ArtifactId of the sample WAR project.
+     */
+    private static final String WAR_ARTIFACT_ID = "usage-contextpath";
 
     @Override
     protected String getWebappUrl()
     {
-        return "http://localhost:8080/";
+        return WEBAPP_URL;
     }
 
     @Override
     protected String getWarArtifactId()
     {
-        return "simple-war-project";
+        return WAR_ARTIFACT_ID;
     }
 
     @Test
@@ -57,10 +62,8 @@ public class SimpleWarProjectIT
     {
         final String responseBody = executeVerifyWithGet();
         assertNotNull( "Received message body must not be null.", responseBody );
-        assertContains( "Response must match expected content.", "It works !!", responseBody );
+        assertContains( "Response must match expected content.", "Success!", responseBody );
 
-        assertTrue( "Tomcat folder should exist in target folder of project at " + webappHome,
-                    new File( webappHome, "target/tomcat" ).exists() );
         LOG.info( "Error Free Log check" );
         verifier.verifyErrorFreeLog();
     }

Modified: tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractWarProjectIT.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractWarProjectIT.java?rev=1173884&r1=1173883&r2=1173884&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractWarProjectIT.java (original)
+++ tomcat/maven-plugin/trunk/tomcat-maven-plugin-it/src/test/java/org/codehaus/mojo/tomcat/it/AbstractWarProjectIT.java Wed Sep 21 21:57:04 2011
@@ -90,6 +90,7 @@ public abstract class AbstractWarProject
 
         webappHome = ResourceExtractor.simpleExtractResources( getClass(), "/" + getWarArtifactId() );
         verifier = new Verifier( webappHome.getAbsolutePath() );
+
         verifier.deleteArtifact( "org.codehaus.mojo.tomcat.it", getWarArtifactId(), "1.0-SNAPSHOT", "war" );
     }
 

Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/pom.xml?rev=1173884&r1=1173883&r2=1173884&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/pom.xml (original)
+++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/pom.xml Wed Sep 21 21:57:04 2011
@@ -144,6 +144,10 @@
       <version>${tomcat.version}</version>
       <scope>runtime</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.tomcat.maven</groupId>
+      <artifactId>tomcat-maven-plugin-it</artifactId>
+    </dependency>
   </dependencies>
 
   <build>
@@ -160,29 +164,41 @@
           </execution>
         </executions>
       </plugin>
-    </plugins>
-  </build>
-
-  <reporting>
-    <plugins>
-      <plugin>
-        <artifactId>maven-pmd-plugin</artifactId>
-        <version>2.4</version>
-        <configuration>
-          <targetJdk>${compileSource}</targetJdk>
-        </configuration>
-      </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-plugin-plugin</artifactId>
-        <version>2.5</version>
+        <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
-          <requirements>
-            <jdk>${maven.compiler.target}</jdk>
-          </requirements>
+          <excludes>
+            <exclude>**/**IT*</exclude>
+          </excludes>
         </configuration>
       </plugin>
     </plugins>
-  </reporting>
+  </build>
+
+
+  <profiles>
+    <profile>
+      <id>run-its</id>
 
+      <build>
+        <plugins>
+          <plugin>
+            <!-- For integration tests the plugin needs to be installed before
+                 the integration tests are executed -->
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-install-plugin</artifactId>
+            <executions>
+              <execution>
+                <goals>
+                  <goal>install</goal>
+                </goals>
+                <phase>pre-integration-test</phase>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+   </profiles>
 </project>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org