This is an automated email from the ASF dual-hosted git repository.

rmaucher pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/tomcat-maven-plugin.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 2e27936  Fix tests weirdness
2e27936 is described below

commit 2e279368b06a976c4e2cc4fe6abf540f09418e97
Author: remm <[email protected]>
AuthorDate: Tue Apr 21 13:38:55 2026 +0200

    Fix tests weirdness
    
    Mostly sharing a single docBase is not a good move.
---
 .../org/apache/tomcat/maven/it/TomcatContextGoalsIT.java |  5 ++++-
 .../container-goals-test/src/main/tomcatconf/server.xml  |  3 +--
 src/test/resources/context-goals-test/pom.xml            | 16 +++++++++++++---
 .../context-goals-test/src/main/tomcatconf/server.xml    |  3 +--
 .../src/main/tomcatconf/server.xml                       |  2 +-
 src/test/resources/deploy-war-project/pom.xml            |  3 +++
 .../deploy-war-project/src/main/tomcatconf/server.xml    |  2 +-
 7 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/src/test/java/org/apache/tomcat/maven/it/TomcatContextGoalsIT.java 
b/src/test/java/org/apache/tomcat/maven/it/TomcatContextGoalsIT.java
index b3fe7c8..8089d5d 100644
--- a/src/test/java/org/apache/tomcat/maven/it/TomcatContextGoalsIT.java
+++ b/src/test/java/org/apache/tomcat/maven/it/TomcatContextGoalsIT.java
@@ -22,6 +22,8 @@ import org.junit.Test;
 
 import java.io.File;
 
+import static junitx.framework.StringAssert.assertContains;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 public class TomcatContextGoalsIT extends AbstractWarProjectIT {
@@ -38,13 +40,14 @@ public class TomcatContextGoalsIT extends 
AbstractWarProjectIT {
     @Test
     public void testContextGoals() throws Exception {
         final String responseBody = executeVerifyWithGet();
+        assertNotNull("Received message body must not be null.", responseBody);
+        assertContains("Response must match expected content.", "It works !!", 
responseBody);
 
         assertTrue("Tomcat folder should exist in target folder of project at 
" + webappHome,
                 new File(webappHome, "target/tomcat").exists());
 
         logger.info("Verifying context goals output");
         verifier.verifyTextInLog("OK - Deployed application at context path 
[/foo]");
-        verifier.verifyTextInLog("OK - Undeployed application at context path 
[/foo]");
         verifier.verifyTextInLog("OK - Session information for application at 
context path [/foo]");
         verifier.verifyTextInLog("OK - Reloaded application at context path 
[/foo]");
         verifier.verifyTextInLog("OK - Stopped application at context path 
[/foo]");
diff --git 
a/src/test/resources/container-goals-test/src/main/tomcatconf/server.xml 
b/src/test/resources/container-goals-test/src/main/tomcatconf/server.xml
index 4a67442..a891c12 100644
--- a/src/test/resources/container-goals-test/src/main/tomcatconf/server.xml
+++ b/src/test/resources/container-goals-test/src/main/tomcatconf/server.xml
@@ -37,8 +37,7 @@
                 buffered="false" />
             <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
                 resourceName="UserDatabase" />
-            <Host name="localhost"
-                
appBase="${project.build.directory}/test-classes/deploy-war-project/target/tomcat/webapps">
+            <Host name="localhost" appBase="webapps">
                 <Context path="/manager" privileged="true"
                     docBase="${managerWebAppPath}/manager" />
             </Host>
diff --git a/src/test/resources/context-goals-test/pom.xml 
b/src/test/resources/context-goals-test/pom.xml
index 8f8f799..f8b3b80 100644
--- a/src/test/resources/context-goals-test/pom.xml
+++ b/src/test/resources/context-goals-test/pom.xml
@@ -64,6 +64,19 @@
                             
<tomcatUsers>src/main/tomcatconf/tomcat-users.xml</tomcatUsers>
                         </configuration>
                     </execution>
+                    <execution>
+                        <id>tomcat-deploy</id>
+                        <phase>integration-test</phase>
+                        <goals>
+                            <goal>deploy</goal>
+                        </goals>
+                        <configuration>
+                            
<url>http://localhost:${its.http.port}/manager</url>
+                            <username>tomcat</username>
+                            <password>tomcat</password>
+                            <path>/foo</path>
+                        </configuration>
+                    </execution>
                     <execution>
                         <id>tomcat-context-goals</id>
                         <phase>integration-test</phase>
@@ -73,9 +86,6 @@
                             <goal>start</goal>
                             <goal>reload</goal>
                             <goal>sessions</goal>
-                            <goal>redeploy</goal>
-                            <goal>undeploy</goal>
-                            <goal>deploy</goal>
                         </goals>
                         <configuration>
                             
<url>http://localhost:${its.http.port}/manager</url>
diff --git 
a/src/test/resources/context-goals-test/src/main/tomcatconf/server.xml 
b/src/test/resources/context-goals-test/src/main/tomcatconf/server.xml
index 4a67442..a891c12 100644
--- a/src/test/resources/context-goals-test/src/main/tomcatconf/server.xml
+++ b/src/test/resources/context-goals-test/src/main/tomcatconf/server.xml
@@ -37,8 +37,7 @@
                 buffered="false" />
             <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
                 resourceName="UserDatabase" />
-            <Host name="localhost"
-                
appBase="${project.build.directory}/test-classes/deploy-war-project/target/tomcat/webapps">
+            <Host name="localhost" appBase="webapps">
                 <Context path="/manager" privileged="true"
                     docBase="${managerWebAppPath}/manager" />
             </Host>
diff --git 
a/src/test/resources/deploy-only-war-project/src/main/tomcatconf/server.xml 
b/src/test/resources/deploy-only-war-project/src/main/tomcatconf/server.xml
index d9c2e45..3882125 100644
--- a/src/test/resources/deploy-only-war-project/src/main/tomcatconf/server.xml
+++ b/src/test/resources/deploy-only-war-project/src/main/tomcatconf/server.xml
@@ -35,7 +35,7 @@
              
pattern="%t-ip:%a-protocol::%H-status:%s-localPort:%p-path:%U-time:%D ms" 
buffered="false"/>
       <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
              resourceName="UserDatabase" />
-      <Host name="localhost" 
appBase="${project.build.directory}/test-classes/deploy-only-war-project/target/tomcat/webapps">
+      <Host name="localhost" appBase="webapps">
         <Context path="/manager" privileged="true" 
docBase="${managerWebAppPath}/manager"/>
       </Host>
     </Engine>
diff --git a/src/test/resources/deploy-war-project/pom.xml 
b/src/test/resources/deploy-war-project/pom.xml
index f135d87..eb0e630 100644
--- a/src/test/resources/deploy-war-project/pom.xml
+++ b/src/test/resources/deploy-war-project/pom.xml
@@ -69,6 +69,9 @@
                         <phase>integration-test</phase>
                         <goals>
                             <goal>deploy</goal>
+                            <goal>redeploy</goal>
+                            <goal>undeploy</goal>
+                            <goal>deploy</goal>
                         </goals>
                         <configuration>
                             
<url>http://localhost:${its.http.port}/manager</url>
diff --git 
a/src/test/resources/deploy-war-project/src/main/tomcatconf/server.xml 
b/src/test/resources/deploy-war-project/src/main/tomcatconf/server.xml
index d6dd7f5..3882125 100644
--- a/src/test/resources/deploy-war-project/src/main/tomcatconf/server.xml
+++ b/src/test/resources/deploy-war-project/src/main/tomcatconf/server.xml
@@ -35,7 +35,7 @@
              
pattern="%t-ip:%a-protocol::%H-status:%s-localPort:%p-path:%U-time:%D ms" 
buffered="false"/>
       <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
              resourceName="UserDatabase" />
-      <Host name="localhost" 
appBase="${project.build.directory}/test-classes/deploy-war-project/target/tomcat/webapps">
+      <Host name="localhost" appBase="webapps">
         <Context path="/manager" privileged="true" 
docBase="${managerWebAppPath}/manager"/>
       </Host>
     </Engine>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to