1 28 29 package com.idaremedia.antx.flowcontrol.tests; 30 31 import com.idaremedia.antx.ut.HTC; 32 33 import org.apache.tools.ant.Project; 34 35 44 45 public abstract class StepCallerTestSkeleton extends HTC 46 { 47 50 protected StepCallerTestSkeleton(String groupId, String methodName) 51 { 52 super(groupId,methodName); 53 } 54 55 59 protected abstract String getDefaultConfigureXMLFileName(); 60 61 protected void setUp() throws Exception 62 { 63 configureProjectFromResource(getDefaultConfigureXMLFileName()); 64 Project P= getProject(); 65 PS= P.getProperty("PS"); 66 AT= P.getProperty("at"); 67 } 68 69 final int verifyTargetsRanInOrder(final String PFX, final int I, final int N, int ilastmatch) 70 { 71 String log= getLog(); 72 for (int i=I;i<=N;i++) { 73 String match = PS+PFX+i+AT; 74 int imatch = log.indexOf(match,ilastmatch); 75 assertTrue("Expecting Log to contain \""+match+"\" from ["+ilastmatch+ 76 "] but Log was \"" + log + "\"", 77 imatch>=0); 78 ilastmatch = imatch; 79 } 80 return ilastmatch; 81 } 82 83 84 final int verifyTargetsInheritedParent(final int I, final int N, int ilastInheritedMatch) 85 { 86 String log= getLog(); 87 String inheritedMatch = PS+"mama"+AT; 88 for (int i=I;i<=N;i++) { 89 String localMatch = PS+"f"+i+AT; 90 int iLocalMatch = log.indexOf(localMatch); 91 int iInheritedMatch = log.indexOf(inheritedMatch, ilastInheritedMatch); 92 assertTrue("Expecting Log to contain \""+inheritedMatch+"\" from ["+ilastInheritedMatch+ 93 "] but Log was \"" + log + "\"", 94 iInheritedMatch>=0); 95 assertTrue("Expecting Log not to contain \""+localMatch+"\" from [0"+ 96 "] but Log was \"" + log + "\"", 97 iLocalMatch<0); 98 ilastInheritedMatch = iInheritedMatch; 99 } 100 return ilastInheritedMatch; 101 } 102 103 final void verifyHaltedBeforeF2Run(String targetName, String T2) 104 { 105 require_(targetName!=null,"chkHalted- nonzro target"); 106 expectBuildException(targetName, 107 "HaltIfError on first broken step"); 108 assertPropertyEquals("abandoned.ship","yes"); 109 verifyOccurances(getLog(),T2,0); 110 } 111 112 116 public void checkBaseline() 117 { 118 assertNotNil(PS,"PS"); 120 assertNotNil(AT,"at"); 121 } 122 123 public void testBaseline() 124 { 125 checkBaseline(); 126 } 127 128 protected String PS,AT; 129 } 130 131 132 | Popular Tags |