1 20 package org.apache.cactus.integration.ant.container.resin; 21 22 import org.apache.cactus.integration.ant.AntTestCase; 23 import org.apache.tools.ant.BuildException; 24 25 30 public final class TestResin3xTask extends AntTestCase 31 { 32 35 private boolean isResinInstalled; 36 37 39 42 public TestResin3xTask() 43 { 44 super("org/apache/cactus/integration/ant/container/resin/" 45 + "test-resin3x.xml"); 46 } 47 48 50 53 protected void setUp() throws Exception 54 { 55 super.setUp(); 56 57 getProject().addTaskDefinition("resin3x", Resin3xTask.class); 58 59 String resin3xHome = System.getProperty("cactus.home.resin3x"); 62 if (resin3xHome != null) 63 { 64 getProject().setProperty("cactus.home.resin3x", resin3xHome); 65 this.isResinInstalled = true; 66 } 67 68 getProject().setProperty("cactus.port", 71 System.getProperty("cactus.port", "8080")); 72 73 String cloverEnabled = System.getProperty("clover.enable"); 75 if (cloverEnabled != null) 76 { 77 getProject().setProperty("clover.enable", cloverEnabled); 78 getProject().setProperty("clover.jar", 79 System.getProperty("clover.jar")); 80 } 81 } 82 83 85 89 public void testExecuteWhenNoDirSpecified() 90 { 91 try 92 { 93 executeTestTarget(); 94 fail("Expected BuildException"); 95 } 96 catch (BuildException expected) 97 { 98 assertEquals("You must specify the mandatory [dir] attribute", 99 expected.getMessage()); 100 } 101 } 102 103 107 public void testExecuteWhenNoActionSpecified() 108 { 109 if (this.isResinInstalled) 110 { 111 try 112 { 113 executeTestTarget(); 114 fail("Expected BuildException"); 115 } 116 catch (BuildException expected) 117 { 118 assertEquals("You must specify an [action] attribute", 119 expected.getMessage()); 120 } 121 } 122 } 123 124 128 public void testExecuteWhenWrongActionSpecified() 129 { 130 if (this.isResinInstalled) 131 { 132 try 133 { 134 executeTestTarget(); 135 fail("Expected BuildException"); 136 } 137 catch (BuildException expected) 138 { 139 assertEquals("Valid actions are: [start] and [stop]", 140 expected.getMessage()); 141 } 142 } 143 } 144 145 150 public void testExecuteStartWithNoDeployableAndNoTestURL() 151 { 152 if (this.isResinInstalled) 153 { 154 executeTestTarget(); 155 } 156 } 157 158 163 public void testExecuteStartWithWarDeployableAndNoTestURL() 164 { 165 if (this.isResinInstalled) 166 { 167 executeTestTarget(); 168 } 169 } 170 171 176 public void testExecuteStartWithNoDeployableAndWithTestURL() 177 { 178 if (this.isResinInstalled) 179 { 180 executeTestTarget(); 181 } 182 } 183 } 184 | Popular Tags |