You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/11/25 21:52:55 UTC

svn commit: r1545404 - in /tomcat/tc7.0.x/trunk: ./ test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java

Author: markt
Date: Mon Nov 25 20:52:54 2013
New Revision: 1545404

URL: http://svn.apache.org/r1545404
Log:
Backport automatic deployment changes part 4
Add tests for WAR+XML based deployments.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1482313

Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java?rev=1545404&r1=1545403&r2=1545404&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java (original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/startup/TestHostConfigAutomaticDeployment.java Mon Nov 25 20:52:54 2013
@@ -55,7 +55,7 @@ public class TestHostConfigAutomaticDepl
             new File("test/deployment/dirContext");
 
     private static final String XML_COOKIE_NAME = "XML_CONTEXT";
-    //private static final String WAR_COOKIE_NAME = "WAR_CONTEXT";
+    private static final String WAR_COOKIE_NAME = "WAR_CONTEXT";
     //private static final String DIR_COOKIE_NAME = "DIR_CONTEXT";
 
     private File external;
@@ -346,6 +346,79 @@ public class TestHostConfigAutomaticDepl
     }
 
 
+    /*
+     * Expected behaviour for deployment of a WAR with an embedded XML file.
+     * deployXML  copyXML  unpackWARs      XML  WAR  DIR
+     *     N        Y/N        N            N    Y    N
+     *     N        Y/N        Y            N    Y    Y
+     *     Y         N         N            N    Y    N
+     *     Y         N         Y            N    Y    Y
+     *     Y         Y         N            Y    Y    N
+     *     Y         Y         Y            Y    Y    Y
+     */
+    @Test
+    public void testDeploymentWarXmlFFF() throws Exception {
+        initTestDeploymentWarXml();
+        doTestDeployment(false, false, false,
+                LifecycleState.STARTED, null, false, true, false);
+    }
+
+    @Test
+    public void testDeploymentWarXmlFFT() throws Exception {
+        initTestDeploymentWarXml();
+        doTestDeployment(false, false, true,
+                LifecycleState.STARTED, null, false, true, true);
+    }
+
+    @Test
+    public void testDeploymentWarXmlFTF() throws Exception {
+        initTestDeploymentWarXml();
+        doTestDeployment(false, true, false,
+                LifecycleState.STARTED, null, false, true, false);
+    }
+
+    @Test
+    public void testDeploymentWarXmlFTT() throws Exception {
+        initTestDeploymentWarXml();
+        doTestDeployment(false, true, true,
+                LifecycleState.STARTED, null, false, true, true);
+    }
+
+    @Test
+    public void testDeploymentWarXmlTFF() throws Exception {
+        initTestDeploymentWarXml();
+        doTestDeployment(true, false, false,
+                LifecycleState.STARTED, WAR_COOKIE_NAME, false, true, false);
+    }
+
+    @Test
+    public void testDeploymentWarXmlTFT() throws Exception {
+        initTestDeploymentWarXml();
+        doTestDeployment(true, false, true,
+                LifecycleState.STARTED, WAR_COOKIE_NAME, false, true, true);
+    }
+
+    @Test
+    public void testDeploymentWarXmlTTF() throws Exception {
+        initTestDeploymentWarXml();
+        doTestDeployment(true, true, false,
+                LifecycleState.STARTED, WAR_COOKIE_NAME, true, true, false);
+    }
+
+    @Test
+    public void testDeploymentWarXmlTTT() throws Exception {
+        initTestDeploymentWarXml();
+        doTestDeployment(true, true, true,
+                LifecycleState.STARTED, WAR_COOKIE_NAME, true, true, true);
+    }
+
+    private void initTestDeploymentWarXml() throws IOException {
+        // Copy the test DIR file to the external directory
+        File dest = new File(getAppBaseFile(getTomcatInstance().getHost()),
+                APP_NAME.getBaseName() + ".war");
+        Files.copy(WAR_XML_SOURCE.toPath(), dest.toPath());
+    }
+
 
     private void doTestDeployment(boolean deployXML, boolean copyXML,
             boolean unpackWARs, LifecycleState resultState, String cookieName,
@@ -391,6 +464,7 @@ public class TestHostConfigAutomaticDepl
                 Boolean.valueOf(resultDir), Boolean.valueOf(dir.isDirectory()));
     }
 
+
     private static void recurrsiveCopy(final Path src, final Path dest)
             throws IOException {
 



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