1 28 29 package com.idaremedia.antx.tests; 30 31 import junit.framework.TestSuite; 32 33 import com.idaremedia.antx.ut.HTC; 34 import com.idaremedia.antx.ut.HTCUtils; 35 36 47 48 public class PreferRuleTest extends HTC 49 { 50 51 public static final String TEST_CATEGORY="CLASS"; 52 53 54 57 public PreferRuleTest(String methodName) 58 { 59 super("PreferTask::",methodName); 60 } 61 62 63 66 public static TestSuite suite() 67 { 68 return new TestSuite(PreferRuleTest.class); 69 } 70 71 72 75 public static TestSuite baseline() 76 { 77 return suite(); 78 } 79 80 81 84 public static void main(String [] argv) 85 { 86 HTCUtils.quickCheck(suite()); 87 } 88 89 90 94 protected void setUp() throws Exception 95 { 96 configureProjectFromResource("prefer.xml"); 97 } 98 99 103 public void checkBaseline() 104 { 105 } 107 108 public void testBaseline() 109 { 110 checkBaseline(); 111 } 112 113 public void testFailEmptyElement() 114 { 115 expectBuildExceptionContaining("undefined","Empty Assertion","At least one condition"); 116 } 117 118 public void testUsingMsgId() 119 { 120 expectLogContaining("uses.msgid","Teensy Weensy Spider"); 121 assertPropertyEquals("truth.not","huh?"); 122 } 123 124 public void testHttpAlive() 125 { 126 runTargetNoOutput("testHttpAlive"); 127 println("########",getFullLog()); 128 assertPropertyEquals("www.disable",null); 129 } 130 131 public void testSimpleTruths() 132 { 133 runTargetNoOutput("simple.truths"); 134 135 assertPropertyEquals("truth.istrue",null); 136 assertPropertyEquals("truth.isfalse",null); 137 assertPropertyEquals("truth.isset",null); 138 assertPropertyEquals("truth.welcome",null); 139 assertPropertyEquals("truth.isnotset",null); 140 assertPropertyEquals("truth.varset",null); 141 assertPropertyEquals("broken.varnotset",null); 142 143 assertPropertyEquals("truth.notwhitespace",null); 144 assertPropertyEquals("truth.antfile",null); 145 assertPropertyEquals("truth.isnumeric",null); 146 assertPropertyEquals("truth.isbool",null); 147 assertPropertyEquals("truth.ishexnumeric",null); 148 assertPropertyEquals("truth.varisbool",null); 149 150 assertPropertyEquals("truth.file",null); 151 assertPropertyEquals("truth.dir",null); 152 assertPropertyEquals("truth.resource",null); 153 assertPropertyEquals("truth.isclass",null); 154 155 assertPropertyEquals("broken.allset",null); 156 assertPropertyEquals("broken.noneset",null); 157 assertPropertyEquals("broken.anyset",null); 158 } 159 160 public void testPropertyOverwriteImmediate() 161 { 162 runTarget("testPropertyOverwriteImmediate"); 163 assertPropertyEquals("my.required.property","default-value"); 164 } 165 166 public void testPropertyOverwriteLikeVelcro() 167 { 168 runTarget("testPropertyOverwriteLikeVelcro"); 169 } 170 171 public void testVariableUpdates() 172 { 173 runTarget("testVariableUpdates"); 174 } 175 176 177 public void testRulesRunAllPreferences_AntX03() 178 { 179 runTargetDumpFullLog("testPreferRulesTallyAll"); 180 } 181 182 public void testGoodReferrals_AntX02() 183 { 184 runTargetNoOutput("testReferrals"); 185 assertPropertyEquals("broken.referral0",null); 186 } 187 188 public void testCircularReferrals_AntX02() 189 { 190 String log= runExpecting("testCircularReferrals","CircularReferral"); 191 assertTrue(log.indexOf("rule chain contains a circular dependency")>-1,"Circular problem found"); 192 } 193 194 public void testIncompatibleReferrals_AntX02() 195 { 196 String log= runExpecting("testIncompatibleReferrals","IncompatibleReferral"); 197 assertTrue(log.indexOf("must be compatible with effect")>-1,"Incompatibility found"); 198 } 199 200 public void testMatches_AntX02() 201 { 202 runTarget("testMatches"); 203 } 204 205 206 public void testFalsePrefers_AntX03() 207 { 208 runTarget("testFalsePrefers_AntX03"); 209 assertPropertyEquals("neg.istrue","huh?"); 210 assertPropertyEquals("neg.isfalse","huh?"); 211 assertPropertyEquals("neg.isset","huh?"); 212 assertPropertyEquals("neg.isnotset","huh?"); 213 assertPropertyEquals("neg.varset","huh?"); 214 assertPropertyEquals("neg.varnotset","huh?"); 215 assertPropertyEquals("neg.allset","huh?"); 216 assertPropertyEquals("neg.noneset","huh?"); 217 } 218 219 220 public void testFalseMessageNoiseLevels_AntX03() 221 { 222 runTarget("testFalseMessageNoiseLevels_AntX03"); 223 } 224 225 226 public void testRulesAndCallerUpdateProperties_AntX03() 227 { 228 runTarget("testRulesAndCallerUpdateProperties_AntX03"); 229 } 230 } 231 232 233 234 | Popular Tags |