1 20 package org.apache.cactus.integration.ant.deployment.webapp; 21 22 import java.io.File ; 23 24 import junit.framework.TestCase; 25 26 31 public final class TestWarArchive extends TestCase 32 { 33 34 36 43 public void testContainsClassInWebinfClasses() throws Exception 44 { 45 WarArchive war = new DefaultWarArchive(getTestInput( 46 "org/apache/cactus/integration/ant/deployment/containsclass.war")); 47 assertTrue(war.containsClass("test.Test")); 48 } 49 50 57 public void testContainsClassInWebinfLib() throws Exception 58 { 59 WarArchive war = new DefaultWarArchive(getTestInput( 60 "org/apache/cactus/integration/ant/deployment/" 61 + "containsclasslib.war")); 62 assertTrue(war.containsClass("test.Test")); 63 } 64 65 71 public void testContainsClassEmpty() throws Exception 72 { 73 WarArchive war = new DefaultWarArchive(getTestInput( 74 "org/apache/cactus/integration/ant/deployment/empty.war")); 75 assertTrue(!war.containsClass("test.Test")); 76 } 77 78 80 88 private File getTestInput(String theFileName) 89 { 90 String testInputDirProperty = System.getProperty("testinput.dir"); 91 assertTrue("The system property 'testinput.dir' must be set", 92 testInputDirProperty != null); 93 File testInputDir = new File (testInputDirProperty); 94 assertTrue("The system property 'testinput.dir' must point to an " 95 + "existing directory", testInputDir.isDirectory()); 96 File testInputFile = new File (testInputDir, theFileName); 97 assertTrue("The test input " + theFileName + " does not exist", 98 testInputFile.exists()); 99 return testInputFile; 100 } 101 102 } 103 | Popular Tags |