1 20 package org.apache.cactus.integration.ant; 21 22 import org.apache.tools.ant.BuildException; 23 24 29 public final class TestRunServerTestsTask extends AntTestCase 30 { 31 32 34 37 public TestRunServerTestsTask() 38 { 39 super("org/apache/cactus/integration/ant/test-runservertests.xml"); 40 } 41 42 44 47 protected void setUp() throws Exception 48 { 49 super.setUp(); 50 51 getProject().addTaskDefinition("runservertests", 52 RunServerTestsTask.class); 53 } 54 55 57 64 public void testStartNotSet() throws Exception 65 { 66 try 67 { 68 executeTestTarget(); 69 fail("Expected BuildException"); 70 } 71 catch (BuildException expected) 72 { 73 assertEquals("You must specify either a nested [start] element or " 74 + "the [starttarget] attribute", expected.getMessage()); 75 } 76 } 77 78 84 public void testStartTimeout() throws Exception 85 { 86 try 87 { 88 executeTestTarget(); 89 fail("Expected BuildException"); 90 } 91 catch (BuildException expected) 92 { 93 assertEquals("Failed to start the container after more than [0] " 94 + "ms.", expected.getMessage()); 95 } 96 assertTargetExecuted("startDummy"); 97 } 98 99 106 public void testStopNotSet() throws Exception 107 { 108 try 109 { 110 executeTestTarget(); 111 fail("Expected BuildException"); 112 } 113 catch (BuildException expected) 114 { 115 assertEquals("You must specify either a nested [stop] element or " 116 + "the [stoptarget] attribute", expected.getMessage()); 117 } 118 } 119 120 127 public void testTestNotSet() throws Exception 128 { 129 try 130 { 131 executeTestTarget(); 132 fail("Expected BuildException"); 133 } 134 catch (BuildException expected) 135 { 136 assertEquals("You must specify either a nested [test] element or " 137 + "the [testtarget] attribute", expected.getMessage()); 138 } 139 } 140 141 147 public void testTestUrlNotSet() throws Exception 148 { 149 try 150 { 151 executeTestTarget(); 152 fail("Expected BuildException"); 153 } 154 catch (BuildException expected) 155 { 156 assertEquals("The [testurl] attribute must be specified", 157 expected.getMessage()); 158 } 159 } 160 161 167 public void testNonHttpTestUrl() throws Exception 168 { 169 try 170 { 171 executeTestTarget(); 172 fail("Expected BuildException"); 173 } 174 catch (IllegalArgumentException expected) 175 { 176 assertEquals("Not a HTTP URL", expected.getMessage()); 177 } 178 } 179 180 } 181 | Popular Tags |