Changeset 1106 for trunk/autoquest-core-tasktrees-test/src/test
- Timestamp:
- 02/21/13 18:37:24 (12 years ago)
- Location:
- trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/AbstractTemporalRelationshipTC.java
r927 r1106 15 15 package de.ugoe.cs.autoquest.tasktrees.temporalrelation; 16 16 17 import static org.junit.Assert.fail; 18 import static org.junit.Assert.assertTrue; 19 import static org.junit.Assert.assertNotNull; 20 21 import java.lang.reflect.Constructor; 22 import java.lang.reflect.InvocationTargetException; 17 23 import java.util.ArrayList; 24 import java.util.LinkedList; 18 25 import java.util.List; 26 import java.util.Stack; 19 27 import java.util.logging.Level; 20 28 … … 23 31 import de.ugoe.cs.autoquest.eventcore.IEventTarget; 24 32 import de.ugoe.cs.autoquest.eventcore.IEventType; 33 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEquality; 25 34 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEqualityRuleManager; 26 import de.ugoe.cs.autoquest.tasktrees.temporalrelation.TemporalRelationshipRuleManager;27 35 import de.ugoe.cs.autoquest.tasktrees.testutils.Utilities; 28 36 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; … … 30 38 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTree; 31 39 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeBuilder; 40 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; 32 41 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNodeFactory; 33 42 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeBuilder; 34 43 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNodeFactory; 44 import de.ugoe.cs.util.console.Console; 35 45 import de.ugoe.cs.util.console.TextConsole; 36 46 … … 57 67 58 68 /** 59 *60 */69 * 70 */ 61 71 @Before 62 72 public void setUp() { … … 70 80 protected void simulateEvent(IEventType eventType, IEventTarget eventTarget) { 71 81 events.add(taskTreeNodeFactory.createNewEventTask(eventType, eventTarget)); 82 Console.reset(); 72 83 } 73 84 … … 83 94 } 84 95 85 TemporalRelationshipRuleManager ruleManager = 86 new TemporalRelationshipRuleManager(nodeEqualityRuleManager);96 TemporalRelationshipRuleManager ruleManager = new TemporalRelationshipRuleManager 97 (nodeEqualityRuleManager, taskTreeNodeFactory, taskTreeBuilder); 87 98 88 99 ruleManager.init(); 89 ruleManager.applyRules(sequence , taskTreeBuilder, taskTreeNodeFactory, true);100 ruleManager.applyRules(sequence); 90 101 91 102 return taskTreeNodeFactory.createTaskTree(sequence); 92 103 } 93 104 105 /** 106 * 107 * @return 108 */ 109 protected ITaskTree getTaskTree(Class<? extends TemporalRelationshipRule> ruleClass, 110 NodeEquality nodeEquality) 111 { 112 ISequence sequence = taskTreeNodeFactory.createNewSequence(); 113 114 for (IEventTask task : events) { 115 taskTreeBuilder.addChild(sequence, task); 116 } 117 118 TemporalRelationshipRule rule = null; 119 120 CONSTRUCTOR_ITERATION: 121 for (Constructor<?> constructor : ruleClass.getDeclaredConstructors()) { 122 List<Object> parameters = new LinkedList<Object>(); 123 124 for (Class<?> type : constructor.getParameterTypes()) { 125 if (ITaskTreeNodeFactory.class.equals(type)) { 126 parameters.add(taskTreeNodeFactory); 127 } 128 else if (ITaskTreeBuilder.class.equals(type)) { 129 parameters.add(taskTreeBuilder); 130 } 131 else if (NodeEqualityRuleManager.class.equals(type)) { 132 parameters.add(nodeEqualityRuleManager); 133 } 134 else if (NodeEquality.class.equals(type)) { 135 if (nodeEquality != null) { 136 parameters.add(nodeEquality); 137 } 138 else { 139 parameters.add(NodeEquality.LEXICALLY_EQUAL); 140 } 141 } 142 else { 143 continue CONSTRUCTOR_ITERATION; 144 } 145 } 146 147 try { 148 rule = (TemporalRelationshipRule) constructor.newInstance(parameters.toArray()); 149 } 150 catch (IllegalArgumentException e) { 151 e.printStackTrace(); 152 fail("could not invoke the constructor " + constructor); 153 } 154 catch (InstantiationException e) { 155 e.printStackTrace(); 156 fail("could not invoke the constructor " + constructor); 157 } 158 catch (IllegalAccessException e) { 159 e.printStackTrace(); 160 fail("could not invoke the constructor " + constructor); 161 } 162 catch (InvocationTargetException e) { 163 e.printStackTrace(); 164 fail("could not invoke the constructor " + constructor); 165 } 166 } 167 168 if (rule == null) { 169 fail("no matching constructor found to instantiate rule " + ruleClass); 170 } 171 172 RuleApplicationResult result; 173 RuleApplicationStatus status; 174 175 Stack<ITaskTreeNode> toBeAppliedOn = new Stack<ITaskTreeNode>(); 176 toBeAppliedOn.push(sequence); 177 178 do { 179 result = rule.apply(toBeAppliedOn.peek(), true); 180 181 if (result != null) { 182 status = result.getRuleApplicationStatus(); 183 assertNotNull(status); 184 } 185 else { 186 status = RuleApplicationStatus.RULE_NOT_APPLIED; 187 } 188 189 assertTrue(status != RuleApplicationStatus.RULE_APPLICATION_FEASIBLE); 190 191 if ((result != null) && (result.getNewlyCreatedParentNodes() != null)) { 192 for (int i = result.getNewlyCreatedParentNodes().size() - 1; i >= 0; i--) { 193 toBeAppliedOn.push(result.getNewlyCreatedParentNodes().get(i)); 194 } 195 } 196 197 if (status == RuleApplicationStatus.RULE_NOT_APPLIED) { 198 toBeAppliedOn.pop(); 199 } 200 201 } 202 while ((!toBeAppliedOn.isEmpty()) || 203 (status == RuleApplicationStatus.RULE_APPLICATION_FINISHED)); 204 205 return taskTreeNodeFactory.createTaskTree(sequence); 206 } 207 94 208 } -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/DefaultGuiElementSequenceDetectionRuleTest.java
r987 r1106 62 62 " Event blu {}" + 63 63 " Event bla {}" + 64 "}", getTaskTree( ));64 "}", getTaskTree(DefaultGuiElementSequenceDetectionRule.class, null)); 65 65 } 66 66 … … 103 103 " Event bla {}" + 104 104 " }" + 105 "}", getTaskTree( ));105 "}", getTaskTree(DefaultGuiElementSequenceDetectionRule.class, null)); 106 106 } 107 107 … … 162 162 " Event blo {}" + 163 163 " }" + 164 "}", getTaskTree( ));164 "}", getTaskTree(DefaultGuiElementSequenceDetectionRule.class, null)); 165 165 } 166 166 … … 192 192 simulateEvent(new DummyInteraction("9", 1), eventTargetG); 193 193 194 new TaskTreeChecker( true).assertTaskTree194 new TaskTreeChecker().assertTaskTree 195 195 ("Sequence sequence0 {" + 196 196 " Sequence sequence1 {" + … … 233 233 " }" + 234 234 " }" + 235 "}", getTaskTree( ));235 "}", getTaskTree(DefaultGuiElementSequenceDetectionRule.class, null)); 236 236 } 237 237 -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/DefaultGuiEventSequenceDetectionRuleTest.java
r927 r1106 17 17 import org.junit.Test; 18 18 19 import de.ugoe.cs.autoquest.eventcore. IEventTarget;19 import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement; 20 20 import de.ugoe.cs.autoquest.tasktrees.TaskTreeChecker; 21 21 import de.ugoe.cs.autoquest.test.DummyGUIElement; … … 34 34 */ 35 35 @Test 36 public void testOneInteractionOnOneElement() { 37 simulateEvent(new DummyInteraction("bla", 1), new DummyGUIElement("elem1")); 36 public void test_01() { 37 IGUIElement elem1 = new DummyGUIElement("elem1"); 38 simulateEvent(new StartSequenceInteraction("start", 1), elem1); 39 simulateEvent(new FinishSequenceInteraction("end", 1), elem1); 38 40 39 41 new TaskTreeChecker().assertTaskTree 40 42 ("Sequence sequence {" + 43 " Event start {}" + 44 " Event end {}" + 45 "}", getTaskTree(DefaultGuiEventSequenceDetectionRule.class, null)); 46 } 47 48 49 /** 50 * 51 */ 52 @Test 53 public void test_02() { 54 IGUIElement elem1 = new DummyGUIElement("elem1"); 55 simulateEvent(new StartSequenceInteraction("start", 1), elem1); 56 simulateEvent(new DummyInteraction("bla", 1), elem1); 57 simulateEvent(new FinishSequenceInteraction("end", 1), elem1); 58 59 new TaskTreeChecker().assertTaskTree 60 ("Sequence sequence {" + 61 " Event start {}" + 41 62 " Event bla {}" + 42 "}", getTaskTree()); 43 } 44 45 /** 46 * 47 */ 48 @Test 49 public void testManyInteractionsOnOneElement() { 50 IEventTarget eventTarget = new DummyGUIElement("elem1"); 51 simulateEvent(new DummyInteraction("bla", 1), eventTarget); 52 simulateEvent(new DummyInteraction("bli", 1), eventTarget); 53 simulateEvent(new DummyInteraction("blo", 1), eventTarget); 54 simulateEvent(new DummyInteraction("blu", 1), eventTarget); 55 simulateEvent(new DummyInteraction("bla", 1), eventTarget); 56 57 new TaskTreeChecker().assertTaskTree 58 ("Sequence sequence {" + 59 " Event bla {}" + 60 " Event bli {}" + 61 " Event blo {}" + 62 " Event blu {}" + 63 " Event bla {}" + 64 "}", getTaskTree()); 65 } 66 67 /** 68 * 69 */ 70 @Test 71 public void testOneInteractionOnManyElements() { 72 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 73 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 74 IEventTarget eventTarget3 = new DummyGUIElement("elem3"); 75 IEventTarget eventTarget4 = new DummyGUIElement("elem4"); 76 IEventTarget eventTarget5 = new DummyGUIElement("elem5"); 77 IEventTarget eventTarget6 = new DummyGUIElement("elem6"); 78 simulateEvent(new DummyInteraction("bla", 1), eventTarget1); 79 simulateEvent(new DummyInteraction("bli", 1), eventTarget2); 80 simulateEvent(new DummyInteraction("bla", 1), eventTarget3); 81 simulateEvent(new DummyInteraction("bli", 1), eventTarget4); 82 simulateEvent(new DummyInteraction("blo", 1), eventTarget5); 83 simulateEvent(new DummyInteraction("bla", 1), eventTarget6); 63 " Event end {}" + 64 "}", getTaskTree(DefaultGuiEventSequenceDetectionRule.class, null)); 65 } 66 67 /** 68 * 69 */ 70 @Test 71 public void test_03() { 72 IGUIElement elem1 = new DummyGUIElement("elem1"); 73 simulateEvent(new StartSequenceInteraction("start", 1), elem1); 74 simulateEvent(new DummyInteraction("bla", 1), elem1); 75 simulateEvent(new DummyInteraction("bli", 1), elem1); 76 simulateEvent(new DummyInteraction("blup", 1), elem1); 77 simulateEvent(new FinishSequenceInteraction("end", 1), elem1); 78 simulateEvent(new StartSequenceInteraction("start", 1), elem1); 79 simulateEvent(new DummyInteraction("bla", 1), elem1); 80 simulateEvent(new DummyInteraction("bli", 1), elem1); 81 simulateEvent(new FinishSequenceInteraction("end", 1), elem1); 84 82 85 83 new TaskTreeChecker().assertTaskTree 86 84 ("Sequence sequence0 {" + 87 85 " Sequence sequence1 {" + 88 " Event bla {}" + 86 " Event start {}" + 87 " Event bla {}" + 88 " Event bli {}" + 89 " Event blup {}" + 90 " Event end {}" + 89 91 " }" + 90 92 " Sequence sequence2 {" + 93 " Event start {}" + 94 " Event bla {}" + 91 95 " Event bli {}" + 92 " }" + 93 " Sequence sequence3 {" + 94 " Event bla {}" + 95 " }" + 96 " Sequence sequence4 {" + 97 " Event bli {}" + 98 " }" + 99 " Sequence sequence5 {" + 100 " Event blo {}" + 101 " }" + 102 " Sequence sequence6 {" + 103 " Event bla {}" + 104 " }" + 105 "}", getTaskTree()); 106 } 107 108 /** 109 * 110 */ 111 @Test 112 public void testManyInteractionsOnManyElements() { 113 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 114 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 115 IEventTarget eventTarget3 = new DummyGUIElement("elem3"); 116 IEventTarget eventTarget4 = new DummyGUIElement("elem4"); 117 IEventTarget eventTarget5 = new DummyGUIElement("elem5"); 118 IEventTarget eventTarget6 = new DummyGUIElement("elem6"); 119 simulateEvent(new DummyInteraction("bla", 1), eventTarget1); 120 simulateEvent(new DummyInteraction("bli", 1), eventTarget1); 121 simulateEvent(new DummyInteraction("bla", 1), eventTarget1); 122 simulateEvent(new DummyInteraction("bli", 1), eventTarget2); 123 simulateEvent(new DummyInteraction("blo", 1), eventTarget2); 124 simulateEvent(new DummyInteraction("bla", 1), eventTarget3); 125 simulateEvent(new DummyInteraction("bli", 1), eventTarget4); 126 simulateEvent(new DummyInteraction("bla", 1), eventTarget4); 127 simulateEvent(new DummyInteraction("bli", 1), eventTarget4); 128 simulateEvent(new DummyInteraction("blo", 1), eventTarget4); 129 simulateEvent(new DummyInteraction("bla", 1), eventTarget5); 130 simulateEvent(new DummyInteraction("bli", 1), eventTarget6); 131 simulateEvent(new DummyInteraction("bla", 1), eventTarget6); 132 simulateEvent(new DummyInteraction("bli", 1), eventTarget6); 133 simulateEvent(new DummyInteraction("blo", 1), eventTarget6); 96 " Event end {}" + 97 " }" + 98 "}", getTaskTree(DefaultGuiEventSequenceDetectionRule.class, null)); 99 } 100 101 /** 102 * 103 */ 104 @Test 105 public void test_04() { 106 IGUIElement elem1 = new DummyGUIElement("elem1"); 107 simulateEvent(new StartAndFinishSequenceInteraction("startFinish", 1), elem1); 108 simulateEvent(new DummyInteraction("bla", 1), elem1); 109 simulateEvent(new DummyInteraction("bli", 1), elem1); 110 simulateEvent(new DummyInteraction("blup", 1), elem1); 111 simulateEvent(new StartAndFinishSequenceInteraction("startFinish", 1), elem1); 112 simulateEvent(new DummyInteraction("bla", 1), elem1); 113 simulateEvent(new DummyInteraction("bli", 1), elem1); 114 simulateEvent(new StartAndFinishSequenceInteraction("startFinish", 1), elem1); 134 115 135 116 new TaskTreeChecker().assertTaskTree 136 117 ("Sequence sequence0 {" + 137 118 " Sequence sequence1 {" + 119 " Event startFinish {}" + 138 120 " Event bla {}" + 139 121 " Event bli {}" + 140 " Event bl a{}" +122 " Event blup {}" + 141 123 " }" + 142 124 " Sequence sequence2 {" + 125 " Event startFinish {}" + 126 " Event bla {}" + 143 127 " Event bli {}" + 144 " Event blo {}" + 145 " }" + 146 " Sequence sequence3 {" + 147 " Event bla {}" + 148 " }" + 149 " Sequence sequence4 {" + 150 " Event bli {}" + 151 " Event bla {}" + 152 " Event bli {}" + 153 " Event blo {}" + 154 " }" + 155 " Sequence sequence5 {" + 156 " Event bla {}" + 157 " }" + 158 " Sequence sequence6 {" + 159 " Event bli {}" + 160 " Event bla {}" + 161 " Event bli {}" + 162 " Event blo {}" + 163 " }" + 164 "}", getTaskTree()); 165 } 166 128 " }" + 129 " Event startFinish {}" + 130 "}", getTaskTree(DefaultGuiEventSequenceDetectionRule.class, null)); 131 } 132 133 /** 134 * 135 */ 136 @Test 137 public void test_05() { 138 IGUIElement elem1 = new DummyGUIElement("elem1"); 139 simulateEvent(new StartSequenceInteraction("start", 1), elem1); 140 simulateEvent(new DummyInteraction("bla", 1), elem1); 141 simulateEvent(new StartSequenceInteraction("start", 1), elem1); 142 simulateEvent(new StartSequenceInteraction("start", 1), elem1); 143 simulateEvent(new DummyInteraction("bli", 1), elem1); 144 simulateEvent(new DummyInteraction("blup", 1), elem1); 145 simulateEvent(new FinishSequenceInteraction("finish", 1), elem1); 146 simulateEvent(new DummyInteraction("bla", 1), elem1); 147 simulateEvent(new DummyInteraction("bli", 1), elem1); 148 simulateEvent(new FinishSequenceInteraction("finish", 1), elem1); 149 simulateEvent(new StartSequenceInteraction("start", 1), elem1); 150 simulateEvent(new StartSequenceInteraction("start", 1), elem1); 151 simulateEvent(new StartSequenceInteraction("start", 1), elem1); 152 simulateEvent(new DummyInteraction("blup", 1), elem1); 153 simulateEvent(new FinishSequenceInteraction("finish", 1), elem1); 154 simulateEvent(new FinishSequenceInteraction("finish", 1), elem1); 155 simulateEvent(new FinishSequenceInteraction("finish", 1), elem1); 156 simulateEvent(new FinishSequenceInteraction("finish", 1), elem1); 157 simulateEvent(new FinishSequenceInteraction("finish", 1), elem1); 158 159 new TaskTreeChecker().assertTaskTree 160 ("Sequence sequence0 {" + 161 " Sequence sequence1 {" + 162 " Event start {}" + 163 " Event bla {}" + 164 " Sequence sequence2 {" + 165 " Event start {}" + 166 " Sequence sequence3 {" + 167 " Event start {}" + 168 " Event bli {}" + 169 " Event blup {}" + 170 " Event finish {}" + 171 " }" + 172 " Event bla {}" + 173 " Event bli {}" + 174 " Event finish {}" + 175 " }" + 176 " Sequence sequence4 {" + 177 " Event start {}" + 178 " Sequence sequence5 {" + 179 " Event start {}" + 180 " Sequence sequence6 {" + 181 " Event start {}" + 182 " Event blup {}" + 183 " Event finish {}" + 184 " }" + 185 " Event finish {}" + 186 " }" + 187 " Event finish {}" + 188 " }" + 189 " Event finish {}" + 190 " }" + 191 " Event finish {}" + 192 "}", getTaskTree(DefaultGuiEventSequenceDetectionRule.class, null)); 193 } 194 195 /** 196 * 197 */ 198 @Test 199 public void test_06() { 200 IGUIElement elem1 = new DummyGUIElement("elem1"); 201 simulateEvent(new StartSequenceInteraction("start", 1), elem1); 202 simulateEvent(new DummyInteraction("bla", 1), elem1); 203 simulateEvent(new StartSequenceInteraction("start", 1), elem1); 204 simulateEvent(new StartSequenceInteraction("start", 1), elem1); 205 simulateEvent(new DummyInteraction("bli", 1), elem1); 206 simulateEvent(new DummyInteraction("blup", 1), elem1); 207 simulateEvent(new StartAndFinishSequenceInteraction("startFinish", 1), elem1); 208 simulateEvent(new DummyInteraction("bla", 1), elem1); 209 simulateEvent(new DummyInteraction("bli", 1), elem1); 210 simulateEvent(new FinishSequenceInteraction("finish", 1), elem1); 211 simulateEvent(new StartSequenceInteraction("start", 1), elem1); 212 simulateEvent(new StartSequenceInteraction("start", 1), elem1); 213 simulateEvent(new StartSequenceInteraction("start", 1), elem1); 214 simulateEvent(new DummyInteraction("blup", 1), elem1); 215 simulateEvent(new StartAndFinishSequenceInteraction("startFinish", 1), elem1); 216 simulateEvent(new FinishSequenceInteraction("finish", 1), elem1); 217 simulateEvent(new FinishSequenceInteraction("finish", 1), elem1); 218 simulateEvent(new FinishSequenceInteraction("finish", 1), elem1); 219 simulateEvent(new FinishSequenceInteraction("finish", 1), elem1); 220 simulateEvent(new FinishSequenceInteraction("finish", 1), elem1); 221 simulateEvent(new FinishSequenceInteraction("finish", 1), elem1); 222 223 new TaskTreeChecker().assertTaskTree 224 ("Sequence sequence0 {" + 225 " Sequence sequence1 {" + 226 " Event start {}" + 227 " Event bla {}" + 228 " Sequence sequence2 {" + 229 " Event start {}" + 230 " Sequence sequence3 {" + 231 " Event start {}" + 232 " Event bli {}" + 233 " Event blup {}" + 234 " }" + 235 " Sequence sequence4 {" + 236 " Event startFinish {}" + 237 " Event bla {}" + 238 " Event bli {}" + 239 " Event finish {}" + 240 " }" + 241 " Sequence sequence5 {" + 242 " Event start {}" + 243 " Sequence sequence6 {" + 244 " Event start {}" + 245 " Sequence sequence7 {" + 246 " Event start {}" + 247 " Event blup {}" + 248 " }" + 249 " Sequence sequence8 {" + 250 " Event startFinish {}" + 251 " Event finish {}" + 252 " }" + 253 " Event finish {}" + 254 " }" + 255 " Event finish {}" + 256 " }" + 257 " Event finish {}" + 258 " }" + 259 " Event finish {}" + 260 " }" + 261 " Event finish {}" + 262 "}", getTaskTree(DefaultGuiEventSequenceDetectionRule.class, null)); 263 } 264 265 /** 266 * 267 */ 268 private class StartSequenceInteraction extends DummyInteraction { 269 270 /** */ 271 private static final long serialVersionUID = 1L; 272 273 /** 274 * 275 */ 276 public StartSequenceInteraction(String interactionType, int interactionNumber) { 277 super(interactionType, interactionNumber); 278 } 279 280 /* (non-Javadoc) 281 * @see de.ugoe.cs.autoquest.test.DummyInteraction#startsLogicalSequence() 282 */ 283 @Override 284 public boolean startsLogicalSequence() { 285 return true; 286 } 287 288 } 289 290 /** 291 * 292 */ 293 private class FinishSequenceInteraction extends DummyInteraction { 294 295 /** */ 296 private static final long serialVersionUID = 1L; 297 298 /** 299 * 300 */ 301 public FinishSequenceInteraction(String interactionType, int interactionNumber) { 302 super(interactionType, interactionNumber); 303 } 304 305 /* (non-Javadoc) 306 * @see de.ugoe.cs.autoquest.test.DummyInteraction#finishesLogicalSequence() 307 */ 308 @Override 309 public boolean finishesLogicalSequence() { 310 return true; 311 } 312 313 } 314 315 /** 316 * 317 */ 318 private class StartAndFinishSequenceInteraction extends DummyInteraction { 319 320 /** */ 321 private static final long serialVersionUID = 1L; 322 323 /** 324 * 325 */ 326 public StartAndFinishSequenceInteraction(String interactionType, int interactionNumber) { 327 super(interactionType, interactionNumber); 328 } 329 330 /* (non-Javadoc) 331 * @see de.ugoe.cs.autoquest.test.DummyInteraction#startsLogicalSequence() 332 */ 333 @Override 334 public boolean startsLogicalSequence() { 335 return true; 336 } 337 338 /* (non-Javadoc) 339 * @see de.ugoe.cs.autoquest.test.DummyInteraction#finishesLogicalSequence() 340 */ 341 @Override 342 public boolean finishesLogicalSequence() { 343 return true; 344 } 345 346 } 167 347 } -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/DefaultIterationDetectionRuleTest.java
r927 r1106 42 42 ("Sequence sequence1 {" + 43 43 " Event bla {}" + 44 "}", getTaskTree( ));45 46 simulateEvent(event1, element1); 47 new TaskTreeChecker().assertTaskTree 48 ("Sequence sequence1 {" + 49 " Iteration iteration1 {" + 50 " Event bla {}" + 51 " }" + 52 "}", getTaskTree( ));53 54 simulateEvent(event1, element1); 55 new TaskTreeChecker().assertTaskTree 56 ("Sequence sequence1 {" + 57 " Iteration iteration1 {" + 58 " Event bla {}" + 59 " }" + 60 "}", getTaskTree( ));44 "}", getTaskTree(DefaultIterationDetectionRule.class, null)); 45 46 simulateEvent(event1, element1); 47 new TaskTreeChecker().assertTaskTree 48 ("Sequence sequence1 {" + 49 " Iteration iteration1 {" + 50 " Event bla {}" + 51 " }" + 52 "}", getTaskTree(DefaultIterationDetectionRule.class, null)); 53 54 simulateEvent(event1, element1); 55 new TaskTreeChecker().assertTaskTree 56 ("Sequence sequence1 {" + 57 " Iteration iteration1 {" + 58 " Event bla {}" + 59 " }" + 60 "}", getTaskTree(DefaultIterationDetectionRule.class, null)); 61 61 62 62 for (int i = 0; i < 10; i++) { … … 69 69 " Event bla {}" + 70 70 " }" + 71 "}", getTaskTree( ));71 "}", getTaskTree(DefaultIterationDetectionRule.class, null)); 72 72 73 73 // now test with preceding and trailing other events … … 95 95 " Event blup {}" + 96 96 " Event bli {}" + 97 "}", getTaskTree( ));97 "}", getTaskTree(DefaultIterationDetectionRule.class, null)); 98 98 99 99 // now test with iterations of iterations … … 136 136 " }" + 137 137 " }" + 138 "}", getTaskTree( ));138 "}", getTaskTree(DefaultIterationDetectionRule.class, null)); 139 139 140 140 } … … 157 157 " Event bli {}" + 158 158 " Event blup {}" + 159 "}", getTaskTree( ));160 161 simulateEvent(event1, element1); 162 simulateEvent(event2, element1); 163 simulateEvent(event3, element1); 164 new TaskTreeChecker().assertTaskTree 165 ("Sequence sequence1 {" + 166 " Iteration iteration1 {" + 167 " Sequence sequence2 {" + 168 " Event bla {}" + 169 " Event bli {}" + 170 " Event blup {}" + 171 " }" + 172 " }" + 173 "}", getTaskTree( ));174 175 simulateEvent(event1, element1); 176 simulateEvent(event2, element1); 177 simulateEvent(event3, element1); 178 new TaskTreeChecker().assertTaskTree 179 ("Sequence sequence1 {" + 180 " Iteration iteration1 {" + 181 " Sequence sequence2 {" + 182 " Event bla {}" + 183 " Event bli {}" + 184 " Event blup {}" + 185 " }" + 186 " }" + 187 "}", getTaskTree( ));159 "}", getTaskTree(DefaultIterationDetectionRule.class, null)); 160 161 simulateEvent(event1, element1); 162 simulateEvent(event2, element1); 163 simulateEvent(event3, element1); 164 new TaskTreeChecker().assertTaskTree 165 ("Sequence sequence1 {" + 166 " Iteration iteration1 {" + 167 " Sequence sequence2 {" + 168 " Event bla {}" + 169 " Event bli {}" + 170 " Event blup {}" + 171 " }" + 172 " }" + 173 "}", getTaskTree(DefaultIterationDetectionRule.class, null)); 174 175 simulateEvent(event1, element1); 176 simulateEvent(event2, element1); 177 simulateEvent(event3, element1); 178 new TaskTreeChecker().assertTaskTree 179 ("Sequence sequence1 {" + 180 " Iteration iteration1 {" + 181 " Sequence sequence2 {" + 182 " Event bla {}" + 183 " Event bli {}" + 184 " Event blup {}" + 185 " }" + 186 " }" + 187 "}", getTaskTree(DefaultIterationDetectionRule.class, null)); 188 188 189 189 for (int i = 0; i < 10; i++) { … … 202 202 " }" + 203 203 " }" + 204 "}", getTaskTree( ));204 "}", getTaskTree(DefaultIterationDetectionRule.class, null)); 205 205 206 206 // now test with preceding and trailing other events … … 242 242 " Event blo {}" + 243 243 " Event ble {}" + 244 "}", getTaskTree( ));244 "}", getTaskTree(DefaultIterationDetectionRule.class, null)); 245 245 246 246 // now test with iterations of iterations … … 310 310 " }" + 311 311 " }" + 312 "}", getTaskTree( ));312 "}", getTaskTree(DefaultIterationDetectionRule.class, null)); 313 313 } 314 314 -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/TrackBarSelectionDetectionRuleTest.java
r974 r1106 46 46 " }" + 47 47 " }" + 48 "}", getTaskTree( ));49 50 simulateEvent(new ValueSelection<Integer>(2), element1); 51 new TaskTreeChecker().assertTaskTree 52 ("Sequence sequence1 {" + 53 " Iteration iteration1 {" + 54 " Selection selection1 {" + 55 " Event ValueSelection(\"1\") {}" + 56 " Event ValueSelection(\"2\") {}" + 57 " }" + 58 " }" + 59 "}", getTaskTree( ));60 61 simulateEvent(new ValueSelection<Integer>(3), element1); 62 new TaskTreeChecker().assertTaskTree 63 ("Sequence sequence1 {" + 64 " Iteration iteration1 {" + 65 " Selection selection1 {" + 66 " Event ValueSelection(\"1\") {}" + 67 " Event ValueSelection(\"2\") {}" + 68 " Event ValueSelection(\"3\") {}" + 69 " }" + 70 " }" + 71 "}", getTaskTree( ));72 73 simulateEvent(new ValueSelection<Integer>(2), element1); 74 new TaskTreeChecker().assertTaskTree 75 ("Sequence sequence1 {" + 76 " Iteration iteration1 {" + 77 " Selection selection1 {" + 78 " Event ValueSelection(\"1\") {}" + 79 " Event ValueSelection(\"2\") {}" + 80 " Event ValueSelection(\"3\") {}" + 81 " }" + 82 " }" + 83 "}", getTaskTree( ));84 85 simulateEvent(new ValueSelection<Integer>(3), element1); 86 new TaskTreeChecker().assertTaskTree 87 ("Sequence sequence1 {" + 88 " Iteration iteration1 {" + 89 " Selection selection1 {" + 90 " Event ValueSelection(\"1\") {}" + 91 " Event ValueSelection(\"2\") {}" + 92 " Event ValueSelection(\"3\") {}" + 93 " }" + 94 " }" + 95 "}", getTaskTree( ));48 "}", getTaskTree(TrackBarSelectionDetectionRule.class, null)); 49 50 simulateEvent(new ValueSelection<Integer>(2), element1); 51 new TaskTreeChecker().assertTaskTree 52 ("Sequence sequence1 {" + 53 " Iteration iteration1 {" + 54 " Selection selection1 {" + 55 " Event ValueSelection(\"1\") {}" + 56 " Event ValueSelection(\"2\") {}" + 57 " }" + 58 " }" + 59 "}", getTaskTree(TrackBarSelectionDetectionRule.class, null)); 60 61 simulateEvent(new ValueSelection<Integer>(3), element1); 62 new TaskTreeChecker().assertTaskTree 63 ("Sequence sequence1 {" + 64 " Iteration iteration1 {" + 65 " Selection selection1 {" + 66 " Event ValueSelection(\"1\") {}" + 67 " Event ValueSelection(\"2\") {}" + 68 " Event ValueSelection(\"3\") {}" + 69 " }" + 70 " }" + 71 "}", getTaskTree(TrackBarSelectionDetectionRule.class, null)); 72 73 simulateEvent(new ValueSelection<Integer>(2), element1); 74 new TaskTreeChecker().assertTaskTree 75 ("Sequence sequence1 {" + 76 " Iteration iteration1 {" + 77 " Selection selection1 {" + 78 " Event ValueSelection(\"1\") {}" + 79 " Event ValueSelection(\"2\") {}" + 80 " Event ValueSelection(\"3\") {}" + 81 " }" + 82 " }" + 83 "}", getTaskTree(TrackBarSelectionDetectionRule.class, null)); 84 85 simulateEvent(new ValueSelection<Integer>(3), element1); 86 new TaskTreeChecker().assertTaskTree 87 ("Sequence sequence1 {" + 88 " Iteration iteration1 {" + 89 " Selection selection1 {" + 90 " Event ValueSelection(\"1\") {}" + 91 " Event ValueSelection(\"2\") {}" + 92 " Event ValueSelection(\"3\") {}" + 93 " }" + 94 " }" + 95 "}", getTaskTree(TrackBarSelectionDetectionRule.class, null)); 96 96 97 97 } … … 151 151 " }" + 152 152 " }" + 153 "}", getTaskTree( ));153 "}", getTaskTree(TrackBarSelectionDetectionRule.class, null)); 154 154 } 155 155 … … 176 176 ("Sequence sequence1 {" + 177 177 " Iteration iteration1 {" + 178 " Sequence sequence2 {" + 179 " Sequence sequence3 {" + 180 " Iteration iteration2 {" + 181 " Selection selection1 {" + 182 " Event ValueSelection(\"1\") {}" + 183 " Event ValueSelection(\"3\") {}" + 184 " Event ValueSelection(\"2\") {}" + 185 " }" + 186 " }" + 187 " }" + 188 " Sequence sequence4 {" + 189 " Iteration iteration3 {" + 190 " Selection selection2 {" + 191 " Event ValueSelection(\"2\") {}" + 192 " Event ValueSelection(\"1\") {}" + 193 " }" + 194 " }" + 195 " }" + 196 " }" + 197 " }" + 198 "}", getTaskTree()); 178 " Selection selection1 {" + 179 " Event ValueSelection(\"1\") {}" + 180 " Event ValueSelection(\"2\") {}" + 181 " Event ValueSelection(\"3\") {}" + 182 " }" + 183 " }" + 184 " Iteration iteration2 {" + 185 " Selection selection2 {" + 186 " Event ValueSelection(\"2\") {}" + 187 " Event ValueSelection(\"1\") {}" + 188 " }" + 189 " }" + 190 " Iteration iteration3 {" + 191 " Selection selection3 {" + 192 " Event ValueSelection(\"3\") {}" + 193 " Event ValueSelection(\"2\") {}" + 194 " }" + 195 " }" + 196 " Iteration iteration4 {" + 197 " Selection selection4 {" + 198 " Event ValueSelection(\"1\") {}" + 199 " }" + 200 " }" + 201 "}", getTaskTree(TrackBarSelectionDetectionRule.class, null)); 199 202 } 200 203
Note: See TracChangeset
for help on using the changeset viewer.