1 28 29 package com.idaremedia.antx.flowcontrol.tests; 30 31 import org.apache.tools.ant.Project; 32 import org.apache.tools.ant.Target; 33 34 import junit.framework.TestSuite; 35 36 import com.idaremedia.antx.apis.Requester; 37 import com.idaremedia.antx.flowcontrol.call.AnyTargetCaller; 38 import com.idaremedia.antx.flowcontrol.wrap.LocalExecutionBubble; 39 import com.idaremedia.antx.ownhelpers.ProjectPropertiesNet; 40 import com.idaremedia.antx.print.EchoItemsTask; 41 import com.idaremedia.antx.ut.HTC; 42 import com.idaremedia.antx.ut.HTCUtils; 43 44 45 56 57 public final class LocalExecutionBubbleTest extends HTC 58 { 59 62 public LocalExecutionBubbleTest(String methodName) 63 { 64 super("LocalExecutionBubble::",methodName); 65 } 66 67 68 69 72 public static TestSuite suite() 73 { 74 return new TestSuite(LocalExecutionBubbleTest.class); 75 } 76 77 78 81 public static TestSuite baseline() 82 { 83 return suite(); 84 } 85 86 87 90 public static void main(String [] argv) 91 { 92 HTCUtils.quickCheck(suite()); 93 } 94 95 96 100 protected void setUp() throws Exception 101 { 102 configureProjectFromResource("localcall.xml"); 103 } 104 105 106 107 private void aboutToExecute(Project P) 108 { 109 P.setProperty("root.property","root.property"); 110 P.setUserProperty("root.user.property","root.user.property"); 111 112 assertNil(P.getReference("root.ref")); 113 assertNil(P.getProperty("local.property")); 114 assertNil(P.getProperty("local.user.property")); 115 } 116 117 118 119 private void finishExecute(Project P, boolean dumpLog) 120 { 121 if (dumpLog) { 122 println("FUUUUULLLL LOG:",getFullLog()); 123 } 124 assertNil(P.getReference("root.ref"), "root.ref(out)"); 125 assertNil(P.getProperty("local.property"), "local.property(out)"); 126 assertNil(P.getProperty("local.user.property"), "local.user.property(out)"); 127 } 128 129 130 131 private EchoItemsTask newPrintTask(Project P) 132 { 133 Target target = (Target)P.getTargets().get("echoTarget"); 134 assertNotNil(target,"echoTarget"); 135 EchoItemsTask task = new EchoItemsTask(); 136 task.setOwningTarget(target); 137 task.setProject(P); 138 task.init(); 139 task.setProperties("all"); 140 task.setReferences("all"); 141 return task; 142 } 143 144 145 private AnyTargetCaller newCallTask(Project P) 146 { 147 Target target = (Target)P.getTargets().get("callTarget"); 148 assertNotNil(target,"callTarget"); 149 AnyTargetCaller task = new AnyTargetCaller(P, "callTarget"); 150 task.setOwningTarget((Target)P.getTargets().get(P.getDefaultTarget())); 151 task.init(); 152 return task; 153 } 154 155 159 public void checkBaseline() 160 { 161 Project P = getProject(); 163 assertNotNil(P.getReference(ProjectPropertiesNet.ANT_HELPER_REFID),"ant.ProjectHelper"); 164 Target target = (Target)P.getTargets().get(P.getDefaultTarget()); 165 assertNotNil(target,"Default Target"); 166 } 167 168 169 public void testBaseline() 170 { 171 checkBaseline(); 172 } 173 174 175 179 public void testBubbleWrap_AntX04() 180 { 181 Project P = getProject(); 182 183 aboutToExecute(P); 184 185 EchoItemsTask task = newPrintTask(P); 186 Requester taskLink = new Requester.ForComponent(task); 187 LocalExecutionBubble bubble = new LocalExecutionBubble(); 188 bubble.setCarefulObjectChecks(true); 189 190 bubble.enter(taskLink); 191 P.setProperty("local.property","local.property"); 192 P.setUserProperty("local.user.property","local.user.property"); 193 P.setProperty("root.property","local.property"); 194 P.setUserProperty("root.user.property","local.user.property"); 195 P.addReference("root.ref.0",new Long (1000)); 196 task.execute(); 197 bubble.leave(taskLink); 198 199 task.execute(); 200 finishExecute(P,true); 201 } 202 203 204 205 209 public void testBubbleWrapWithChildProject_AntX04() 210 { 211 Project P = getProject(); 212 213 aboutToExecute(P); 214 215 AnyTargetCaller task = newCallTask(P); 216 Requester taskLink = new Requester.ForComponent(task); 217 LocalExecutionBubble bubble = new LocalExecutionBubble(); 218 bubble.setCarefulObjectChecks(true); 219 220 bubble.enter(taskLink); 221 P.setProperty("local.property","local.property"); 222 P.setUserProperty("local.user.property","local.user.property"); 223 P.setProperty("root.property","local.property"); 224 P.setUserProperty("root.user.property","local.user.property"); 225 P.addReference("root.ref.0",new Long (1000)); 226 task.execute(); 227 bubble.leave(taskLink); 228 finishExecute(P,false); 229 230 newPrintTask(P).execute(); 231 println("FUUUUULLLL LOG:",getFullLog()); 232 } 233 234 235 236 public void testCallLocal_AntX04() 237 { 238 runTarget("testCallLocalTargets_AntX04"); 239 } 240 241 public void testCallLocalParameterizedTargets_AntX04() 242 { 243 runTarget("testCallLocalParameterizedTargets_AntX04"); 244 } 245 246 public void testCallLocalSteps_AntX04() 247 { 248 runTarget("testCallLocalSteps_AntX04"); 249 } 250 251 public void testCallLocalParameterizedSteps_AntX04() 252 { 253 runTarget("testCallLocalParameterizedSteps_AntX04"); 254 } 255 256 public void testCallLocalOverlayUndone_AntX04() 257 { 258 runTarget("testCallLocalOverlayUndone_AntX04"); 259 } 260 261 public void testCallLocalOverlayUndoneSteps_AntX04() 262 { 263 runTarget("testCallLocalOverlayUndoneSteps_AntX04"); 264 } 265 266 267 public void testIsolatedSimple_AntX04() 268 { 269 runTarget("testIsolatedSimple_AntX04"); 270 } 271 272 public void testIsolatedWarnings_AntX04() 273 { 274 runTarget("testIsolatedWarnings_AntX04"); 275 } 276 277 public void testNestedIsolatedBlocks_AntX04() 278 { 279 runTarget("testNestedIsolatedBlocks_AntX04"); 280 } 281 282 public void testResetFixture_AntX04() 283 { 284 runTarget("testResetFixture_AntX04"); 285 } 286 287 public void testWorksWithOverlay_AntX04() 288 { 289 runTarget("testWorksWithOverlay_AntX04"); 290 } 291 292 public void testLocalsPushPopped_AntX05() 293 { 294 runTarget("testLocalsPushPopped_AntX05"); 295 } 296 297 public void testIsolateLocalVars_AntX05() 298 { 299 runTarget("testIsolateLocalVars_AntX05"); 300 } 301 302 public void testIsolateLocalProperties_AntX05() 303 { 304 runTarget("testIsolateLocalProperties_AntX05"); 305 } 306 307 public void testBlockAllowsAllUnlessNamed_AntX05() 308 { 309 runTarget("testBlockAllowsAllUnlessNamed_AntX05"); 310 } 311 312 public void testPassthruLocalProperties_AntX05() 313 { 314 runTarget("testPassthruLocalProperties_AntX05"); 315 } 316 317 public void testConditionalFixture_AntX05() 318 { 319 runTarget("testConditionalFixture_AntX05"); 320 } 321 } 322 323 324 325 | Popular Tags |