Author: markt Date: Mon Nov 25 22:22:22 2013 New Revision: 1545425 URL: http://svn.apache.org/r1545425 Log: Backport automatic deployment changes part 7 More deployment tests
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:r1482723 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=1545425&r1=1545424&r2=1545425&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:22:22 2013 @@ -708,32 +708,43 @@ public class TestHostConfigAutomaticDepl @Test public void testDeleteDirRemoveDir() throws Exception { doTestDelete(false, false, false, false, true, DIR, false, false, false, - false, null); + null); } @Test public void testDeleteWarRemoveWar() throws Exception { doTestDelete(false, false, false, true, false, WAR, false, false, false, - false, null); + null); } @Test public void testDeleteWarDirRemoveDir() throws Exception { - doTestDelete(false, false, false, true, true, DIR, false, false, true, - true, WAR_COOKIE_NAME); + doTestDelete(false, false, false, true, true, DIR, false, true, true, + WAR_COOKIE_NAME); } @Test public void testDeleteWarDirRemoveWar() throws Exception { doTestDelete(false, false, false, true, true, WAR, false, false, false, - false, null); + null); + } + + @Test + public void testDeleteXmlRemoveXml() throws Exception { + doTestDelete(true, false, false, false, false, XML, false, false, false, + null); + } + + // @Test Disable as this currently fails + public void testDeleteXmlDirRemoveDir() throws Exception { + doTestDelete(true, false, false, false, true, DIR, true, false, false, + null); } private void doTestDelete(boolean startXml, boolean startExternalWar, boolean startExternalDir, boolean startWar, boolean startDir, - int toDelete, boolean resultXml, boolean resultExternal, - boolean resultWar, boolean resultDir, String resultCookieName) - throws Exception { + int toDelete, boolean resultXml, boolean resultWar, + boolean resultDir, String resultCookieName) throws Exception { Tomcat tomcat = getTomcatInstance(); StandardHost host = (StandardHost) tomcat.getHost(); @@ -849,13 +860,36 @@ public class TestHostConfigAutomaticDepl Context ctxt = (Context) host.findChild(APP_NAME.getName()); // Check the results - if (!resultXml && !resultWar && !resultDir) { - // App should have been undeployed + if (resultXml) { + if (xml == null) { + Assert.fail(); + } else { + Assert.assertTrue(xml.isFile()); + } + } + if (resultWar) { + if (war == null) { + Assert.fail(); + } else { + Assert.assertTrue(war.isFile()); + } + } + if (resultDir) { + if (dir == null) { + Assert.fail(); + } else { + Assert.assertTrue(dir.isDirectory()); + } + } + + if (!resultXml && (startExternalWar || startExternalDir)) { + Assert.assertNull(ctxt); + } + if (!resultWar && !resultDir) { Assert.assertNull(ctxt); - return; } - if (resultWar) { + if (ctxt != null) { Assert.assertEquals(resultCookieName, ctxt.getSessionCookieName()); } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org