1 20 package org.apache.cactus.integration.ant; 21 22 import org.apache.tools.ant.BuildException; 23 24 29 public final class TestCactusTask extends AntTestCase 30 { 31 32 34 37 public TestCactusTask() 38 { 39 super("org/apache/cactus/integration/ant/test-cactus.xml"); 40 } 41 42 44 47 protected void setUp() throws Exception 48 { 49 super.setUp(); 50 51 getProject().addTaskDefinition("cactus", CactusTask.class); 52 } 53 54 56 62 public void testNeitherWarFileNorEarFileSet() throws Exception 63 { 64 try 65 { 66 executeTestTarget(); 67 fail("Expected BuildException"); 68 } 69 catch (BuildException expected) 70 { 71 assertEquals("You must specify either the [warfile] or the " 72 + "[earfile] attribute", expected.getMessage()); 73 } 74 } 75 76 82 public void testWarFileNotExisting() throws Exception 83 { 84 try 85 { 86 executeTestTarget(); 87 fail("Expected BuildException"); 88 } 89 catch (BuildException expected) 90 { 91 assertTrue(true); 92 } 93 } 94 95 101 public void testWarFileNotCactified() throws Exception 102 { 103 try 104 { 105 executeTestTarget(); 106 fail("Expected BuildException"); 107 } 108 catch (BuildException expected) 109 { 110 assertEquals("The WAR has not been cactified", 111 expected.getMessage()); 112 } 113 } 114 115 121 public void testWarFileCactified() throws Exception 122 { 123 executeTestTarget(); 124 } 125 126 132 public void testEarFileEmpty() throws Exception 133 { 134 try 135 { 136 executeTestTarget(); 137 fail("Expected BuildException"); 138 } 139 catch (BuildException expected) 140 { 141 assertTrue(true); 142 } 143 } 144 145 152 public void testEarFileNotCactified() throws Exception 153 { 154 try 155 { 156 executeTestTarget(); 157 fail("Expected BuildException"); 158 } 159 catch (BuildException expected) 160 { 161 assertTrue(true); 162 } 163 } 164 165 171 public void testEarFileCactified() throws Exception 172 { 173 executeTestTarget(); 174 } 175 176 } 177 | Popular Tags |