Author: markt
Date: Mon Nov 25 22:34:26 2013
New Revision: 1545431

URL: http://svn.apache.org/r1545431
Log:
Backport automatic deployment changes part 8
Complete the deletion tests.
Note some tests commenting out pending the back-port of the necessary fixes

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:r1482835,1482854

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=1545431&r1=1545430&r2=1545431&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 22:34:26 2013
@@ -735,9 +735,95 @@ public class TestHostConfigAutomaticDepl
                 null);
     }
 
-    // @Test Disable as this currently fails
+    //@Test
+    // TODO
     public void testDeleteXmlDirRemoveDir() throws Exception {
         doTestDelete(true, false, false, false, true, DIR, true, false, false,
+                XML_COOKIE_NAME);
+    }
+
+    //@Test
+    // TODO
+    public void testDeleteXmlDirRemoveXml() throws Exception {
+        doTestDelete(true, false, false, false, true, XML, false, false, false,
+                null);
+    }
+
+    //@Test
+    // TODO
+    public void testDeleteXmlExtwarRemoveExt() throws Exception {
+        doTestDelete(true, true, false, false, false, EXT, true, false, false,
+                XML_COOKIE_NAME);
+    }
+
+    @Test
+    public void testDeleteXmlExtdirRemoveExt() throws Exception {
+        doTestDelete(true, false, true, false, false, EXT, true, false, false,
+                XML_COOKIE_NAME);
+    }
+
+    @Test
+    public void testDeleteXmlExtwarRemoveXml() throws Exception {
+        doTestDelete(true, true, false, false, false, XML, false, false, false,
+                null);
+    }
+
+    @Test
+    public void testDeleteXmlExtdirRemoveXml() throws Exception {
+        doTestDelete(true, false, true, false, false, XML, false, false, false,
+                null);
+    }
+
+    @Test
+    public void testDeleteXmlExtwarDirRemoveDir() throws Exception {
+        doTestDelete(true, true, false, false, true, DIR, true, false, true,
+                XML_COOKIE_NAME);
+    }
+
+    @Test
+    public void testDeleteXmlExtwarDirRemoveExt() throws Exception {
+        doTestDelete(true, true, false, false, true, EXT, true, false, false,
+                XML_COOKIE_NAME);
+    }
+
+    @Test
+    public void testDeleteXmlExtwarDirRemoveXml() throws Exception {
+        doTestDelete(true, true, false, false, true, XML, false, false, false,
+                null);
+    }
+
+    //@Test
+    // TODO
+    public void testDeleteXmlWarRemoveWar() throws Exception {
+        doTestDelete(true, false, false, true, false, WAR, true, false, false,
+                XML_COOKIE_NAME);
+    }
+
+    //@Test
+    // TODO
+    public void testDeleteXmlWarRemoveXml() throws Exception {
+        doTestDelete(true, false, false, true, false, XML, false, false, false,
+                null);
+    }
+
+    //@Test
+    // TODO
+    public void testDeleteXmlWarDirRemoveDir() throws Exception {
+        doTestDelete(true, false, false, true, true, DIR, true, true, true,
+                XML_COOKIE_NAME);
+    }
+
+    //@Test
+    // TODO
+    public void testDeleteXmlWarDirRemoveWar() throws Exception {
+        doTestDelete(true, false, false, true, true, WAR, true, false, false,
+                XML_COOKIE_NAME);
+    }
+
+    //@Test
+    // TODO
+    public void testDeleteXmlWarDirRemoveXml() throws Exception {
+        doTestDelete(true, false, false, true, true, XML, false, false, false,
                 null);
     }
 
@@ -755,7 +841,7 @@ public class TestHostConfigAutomaticDepl
         File war = null;
         File dir = null;
 
-        if (startXml) {
+        if (startXml && !startExternalWar && !startExternalDir) {
             xml = new File(getConfigBaseFile(host), APP_NAME + ".xml");
             File parent = xml.getParentFile();
             if (!parent.isDirectory()) {
@@ -825,7 +911,7 @@ public class TestHostConfigAutomaticDepl
             recurrsiveCopy(DIR_XML_SOURCE, dir);
         }
 
-        if (startWar && !startDir) {
+        if ((startWar || startExternalWar) && !startDir) {
             host.setUnpackWARs(false);
             // WARDirContext always locks the WAR file so need to use
             // anti-resource locking to enable the WAR to be deleted
@@ -860,6 +946,31 @@ public class TestHostConfigAutomaticDepl
         Context ctxt = (Context) host.findChild(APP_NAME.getName());
 
         // Check the results
+        // External WAR and DIR should only be deleted if the test is testing
+        // behaviour when the external resource is deleted
+        if (toDelete == EXT) {
+            if (ext == null) {
+                Assert.fail();
+            } else {
+                Assert.assertFalse(ext.exists());
+            }
+        } else {
+            if (startExternalWar) {
+                if (ext == null) {
+                    Assert.fail();
+                } else {
+                    Assert.assertTrue(ext.isFile());
+                }
+            }
+            if (startExternalDir) {
+                if (ext == null) {
+                    Assert.fail();
+                } else {
+                    Assert.assertTrue(ext.isDirectory());
+                }
+            }
+        }
+
         if (resultXml) {
             if (xml == null) {
                 Assert.fail();
@@ -886,7 +997,11 @@ public class TestHostConfigAutomaticDepl
             Assert.assertNull(ctxt);
         }
         if (!resultWar && !resultDir) {
-            Assert.assertNull(ctxt);
+            if (resultXml) {
+                Assert.assertEquals(LifecycleState.FAILED, ctxt.getState());
+            } else {
+                Assert.assertNull(ctxt);
+            }
         }
 
         if (ctxt != null) {



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

Reply via email to