[445] | 1 | //------------------------------------------------------------------------------------------------- |
---|
| 2 | // Module : $RCSfile: DefaultIterationDetectionRuleTest.java,v $ |
---|
| 3 | // Version : $Revision: 0.0 $ $Author: patrick $ $Date: 28.04.2012 $ |
---|
| 4 | // Project : TaskTreeTemporalRelationship |
---|
| 5 | // Creation : 2012 by patrick |
---|
| 6 | // Copyright : Patrick Harms, 2012 |
---|
| 7 | //------------------------------------------------------------------------------------------------- |
---|
| 8 | package de.ugoe.cs.quest.tasktrees.temporalrelation; |
---|
| 9 | |
---|
| 10 | import org.junit.Test; |
---|
| 11 | |
---|
[452] | 12 | import de.ugoe.cs.quest.eventcore.guimodel.GUIElement; |
---|
| 13 | import de.ugoe.cs.quest.eventcore.userinteraction.Interaction; |
---|
[445] | 14 | import de.ugoe.cs.quest.tasktrees.testutils.DummyGUIElement; |
---|
| 15 | import de.ugoe.cs.quest.tasktrees.testutils.DummyInteraction; |
---|
| 16 | import de.ugoe.cs.quest.tasktrees.testutils.TaskTreeChecker; |
---|
| 17 | |
---|
| 18 | //------------------------------------------------------------------------------------------------- |
---|
| 19 | /** |
---|
| 20 | * TODO comment |
---|
| 21 | * |
---|
| 22 | * @version $Revision: $ $Date: 28.04.2012$ |
---|
| 23 | * @author 2012, last modified by $Author: patrick$ |
---|
| 24 | */ |
---|
| 25 | //------------------------------------------------------------------------------------------------- |
---|
| 26 | public class DefaultIterationDetectionRuleTest extends AbstractTemporalRelationshipTC |
---|
| 27 | { |
---|
| 28 | |
---|
| 29 | //----------------------------------------------------------------------------------------------- |
---|
| 30 | /** |
---|
| 31 | * |
---|
| 32 | */ |
---|
| 33 | //----------------------------------------------------------------------------------------------- |
---|
| 34 | @Test |
---|
| 35 | public void testInteractionIterationDetection() throws Exception |
---|
| 36 | { |
---|
| 37 | GUIElement element1 = new DummyGUIElement("elem1"); |
---|
| 38 | Interaction interaction1 = new DummyInteraction("bla", 1); |
---|
| 39 | simulateInteraction(element1, interaction1); |
---|
| 40 | new TaskTreeChecker().assertTaskMap |
---|
| 41 | ("Sequence sequence1 {" + |
---|
| 42 | " Interaction bla {}" + |
---|
| 43 | "}", getTaskTree().getTaskMap()); |
---|
| 44 | |
---|
| 45 | simulateInteraction(element1, interaction1); |
---|
| 46 | new TaskTreeChecker().assertTaskMap |
---|
| 47 | ("Sequence sequence1 {" + |
---|
| 48 | " Iteration iteration1 {" + |
---|
| 49 | " Interaction bla {}" + |
---|
| 50 | " }" + |
---|
| 51 | "}", getTaskTree().getTaskMap()); |
---|
| 52 | |
---|
| 53 | simulateInteraction(element1, interaction1); |
---|
| 54 | new TaskTreeChecker().assertTaskMap |
---|
| 55 | ("Sequence sequence1 {" + |
---|
| 56 | " Iteration iteration1 {" + |
---|
| 57 | " Interaction bla {}" + |
---|
| 58 | " }" + |
---|
| 59 | "}", getTaskTree().getTaskMap()); |
---|
| 60 | |
---|
| 61 | for (int i = 0; i < 10; i++) |
---|
| 62 | { |
---|
| 63 | simulateInteraction(element1, interaction1); |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | new TaskTreeChecker().assertTaskMap |
---|
| 67 | ("Sequence sequence1 {" + |
---|
| 68 | " Iteration iteration1 {" + |
---|
| 69 | " Interaction bla {}" + |
---|
| 70 | " }" + |
---|
| 71 | "}", getTaskTree().getTaskMap()); |
---|
| 72 | |
---|
| 73 | // now test with preceding and trailing other interactions |
---|
| 74 | Interaction interaction2 = new DummyInteraction("bli", 1); |
---|
| 75 | Interaction interaction3 = new DummyInteraction("blup", 1); |
---|
| 76 | |
---|
| 77 | simulateInteraction(element1, interaction2); |
---|
| 78 | simulateInteraction(element1, interaction3); |
---|
| 79 | for (int i = 0; i < 10; i++) |
---|
| 80 | { |
---|
| 81 | simulateInteraction(element1, interaction1); |
---|
| 82 | } |
---|
| 83 | simulateInteraction(element1, interaction3); |
---|
| 84 | simulateInteraction(element1, interaction2); |
---|
| 85 | |
---|
| 86 | new TaskTreeChecker().assertTaskMap |
---|
| 87 | ("Sequence sequence1 {" + |
---|
| 88 | " Iteration iteration1 {" + |
---|
| 89 | " Interaction bla {}" + |
---|
| 90 | " }" + |
---|
| 91 | " Interaction bli {}" + |
---|
| 92 | " Interaction blup {}" + |
---|
| 93 | " Iteration iteration2 {" + |
---|
| 94 | " Interaction bla {}" + |
---|
| 95 | " }" + |
---|
| 96 | " Interaction blup {}" + |
---|
| 97 | " Interaction bli {}" + |
---|
| 98 | "}", getTaskTree().getTaskMap()); |
---|
| 99 | |
---|
| 100 | // now test with iterations of iterations |
---|
| 101 | |
---|
| 102 | for (int i = 0; i < 10; i++) |
---|
| 103 | { |
---|
| 104 | for (int j = 0; j < 5; j++) |
---|
| 105 | { |
---|
| 106 | simulateInteraction(element1, interaction1); |
---|
| 107 | } |
---|
| 108 | for (int j = 0; j < 5; j++) |
---|
| 109 | { |
---|
| 110 | simulateInteraction(element1, interaction2); |
---|
| 111 | } |
---|
| 112 | for (int j = 0; j < 5; j++) |
---|
| 113 | { |
---|
| 114 | simulateInteraction(element1, interaction3); |
---|
| 115 | } |
---|
| 116 | } |
---|
| 117 | |
---|
| 118 | new TaskTreeChecker().assertTaskMap |
---|
| 119 | ("Sequence sequence1 {" + |
---|
| 120 | " Iteration iteration1 {" + |
---|
| 121 | " Interaction bla {}" + |
---|
| 122 | " }" + |
---|
| 123 | " Interaction bli {}" + |
---|
| 124 | " Interaction blup {}" + |
---|
| 125 | " Iteration iteration2 {" + |
---|
| 126 | " Interaction bla {}" + |
---|
| 127 | " }" + |
---|
| 128 | " Interaction blup {}" + |
---|
| 129 | " Interaction bli {}" + |
---|
| 130 | " Iteration iteration3 {" + |
---|
| 131 | " Sequence sequence2 {" + |
---|
| 132 | " Iteration iteration4 {" + |
---|
| 133 | " Interaction bla {}" + |
---|
| 134 | " }" + |
---|
| 135 | " Iteration iteration5 {" + |
---|
| 136 | " Interaction bli {}" + |
---|
| 137 | " }" + |
---|
| 138 | " Iteration iteration6 {" + |
---|
| 139 | " Interaction blup {}" + |
---|
| 140 | " }" + |
---|
| 141 | " }" + |
---|
| 142 | " }" + |
---|
| 143 | "}", getTaskTree().getTaskMap()); |
---|
| 144 | |
---|
| 145 | } |
---|
| 146 | |
---|
| 147 | //----------------------------------------------------------------------------------------------- |
---|
| 148 | /** |
---|
| 149 | * |
---|
| 150 | */ |
---|
| 151 | //----------------------------------------------------------------------------------------------- |
---|
| 152 | @Test |
---|
| 153 | public void testSequenceIterationDetection() throws Exception |
---|
| 154 | { |
---|
| 155 | GUIElement element1 = new DummyGUIElement("elem1"); |
---|
| 156 | Interaction interaction1 = new DummyInteraction("bla", 1); |
---|
| 157 | Interaction interaction2 = new DummyInteraction("bli", 1); |
---|
| 158 | Interaction interaction3 = new DummyInteraction("blup", 1); |
---|
| 159 | simulateInteraction(element1, interaction1); |
---|
| 160 | simulateInteraction(element1, interaction2); |
---|
| 161 | simulateInteraction(element1, interaction3); |
---|
| 162 | new TaskTreeChecker().assertTaskMap |
---|
| 163 | ("Sequence sequence1 {" + |
---|
| 164 | " Interaction bla {}" + |
---|
| 165 | " Interaction bli {}" + |
---|
| 166 | " Interaction blup {}" + |
---|
| 167 | "}", getTaskTree().getTaskMap()); |
---|
| 168 | |
---|
| 169 | simulateInteraction(element1, interaction1); |
---|
| 170 | simulateInteraction(element1, interaction2); |
---|
| 171 | simulateInteraction(element1, interaction3); |
---|
| 172 | new TaskTreeChecker().assertTaskMap |
---|
| 173 | ("Sequence sequence1 {" + |
---|
| 174 | " Iteration iteration1 {" + |
---|
| 175 | " Sequence sequence2 {" + |
---|
| 176 | " Interaction bla {}" + |
---|
| 177 | " Interaction bli {}" + |
---|
| 178 | " Interaction blup {}" + |
---|
| 179 | " }" + |
---|
| 180 | " }" + |
---|
| 181 | "}", getTaskTree().getTaskMap()); |
---|
| 182 | |
---|
| 183 | simulateInteraction(element1, interaction1); |
---|
| 184 | simulateInteraction(element1, interaction2); |
---|
| 185 | simulateInteraction(element1, interaction3); |
---|
| 186 | new TaskTreeChecker().assertTaskMap |
---|
| 187 | ("Sequence sequence1 {" + |
---|
| 188 | " Iteration iteration1 {" + |
---|
| 189 | " Sequence sequence2 {" + |
---|
| 190 | " Interaction bla {}" + |
---|
| 191 | " Interaction bli {}" + |
---|
| 192 | " Interaction blup {}" + |
---|
| 193 | " }" + |
---|
| 194 | " }" + |
---|
| 195 | "}", getTaskTree().getTaskMap()); |
---|
| 196 | |
---|
| 197 | for (int i = 0; i < 10; i++) |
---|
| 198 | { |
---|
| 199 | simulateInteraction(element1, interaction1); |
---|
| 200 | simulateInteraction(element1, interaction2); |
---|
| 201 | simulateInteraction(element1, interaction3); |
---|
| 202 | } |
---|
| 203 | |
---|
| 204 | new TaskTreeChecker().assertTaskMap |
---|
| 205 | ("Sequence sequence1 {" + |
---|
| 206 | " Iteration iteration1 {" + |
---|
| 207 | " Sequence sequence2 {" + |
---|
| 208 | " Interaction bla {}" + |
---|
| 209 | " Interaction bli {}" + |
---|
| 210 | " Interaction blup {}" + |
---|
| 211 | " }" + |
---|
| 212 | " }" + |
---|
| 213 | "}", getTaskTree().getTaskMap()); |
---|
| 214 | |
---|
| 215 | // now test with preceding and trailing other interactions |
---|
| 216 | Interaction interaction4 = new DummyInteraction("ble", 1); |
---|
| 217 | Interaction interaction5 = new DummyInteraction("blo", 1); |
---|
| 218 | Interaction interaction6 = new DummyInteraction("blu", 1); |
---|
| 219 | simulateInteraction(element1, interaction4); |
---|
| 220 | simulateInteraction(element1, interaction5); |
---|
| 221 | simulateInteraction(element1, interaction6); |
---|
| 222 | for (int i = 0; i < 10; i++) |
---|
| 223 | { |
---|
| 224 | simulateInteraction(element1, interaction1); |
---|
| 225 | simulateInteraction(element1, interaction2); |
---|
| 226 | simulateInteraction(element1, interaction3); |
---|
| 227 | } |
---|
| 228 | simulateInteraction(element1, interaction6); |
---|
| 229 | simulateInteraction(element1, interaction5); |
---|
| 230 | simulateInteraction(element1, interaction4); |
---|
| 231 | |
---|
| 232 | new TaskTreeChecker().assertTaskMap |
---|
| 233 | ("Sequence sequence1 {" + |
---|
| 234 | " Iteration iteration1 {" + |
---|
| 235 | " Sequence sequence2 {" + |
---|
| 236 | " Interaction bla {}" + |
---|
| 237 | " Interaction bli {}" + |
---|
| 238 | " Interaction blup {}" + |
---|
| 239 | " }" + |
---|
| 240 | " }" + |
---|
| 241 | " Interaction ble {}" + |
---|
| 242 | " Interaction blo {}" + |
---|
| 243 | " Interaction blu {}" + |
---|
| 244 | " Iteration iteration2 {" + |
---|
| 245 | " Sequence sequence3 {" + |
---|
| 246 | " Interaction bla {}" + |
---|
| 247 | " Interaction bli {}" + |
---|
| 248 | " Interaction blup {}" + |
---|
| 249 | " }" + |
---|
| 250 | " }" + |
---|
| 251 | " Interaction blu {}" + |
---|
| 252 | " Interaction blo {}" + |
---|
| 253 | " Interaction ble {}" + |
---|
| 254 | "}", getTaskTree().getTaskMap()); |
---|
| 255 | |
---|
| 256 | // now test with iterations of iterations |
---|
| 257 | for (int i = 0; i < 10; i++) |
---|
| 258 | { |
---|
| 259 | for (int j = 0; j < 5; j++) |
---|
| 260 | { |
---|
| 261 | simulateInteraction(element1, interaction1); |
---|
| 262 | simulateInteraction(element1, interaction2); |
---|
| 263 | simulateInteraction(element1, interaction3); |
---|
| 264 | } |
---|
| 265 | for (int j = 0; j < 5; j++) |
---|
| 266 | { |
---|
| 267 | simulateInteraction(element1, interaction2); |
---|
| 268 | simulateInteraction(element1, interaction1); |
---|
| 269 | simulateInteraction(element1, interaction3); |
---|
| 270 | } |
---|
| 271 | for (int j = 0; j < 5; j++) |
---|
| 272 | { |
---|
| 273 | simulateInteraction(element1, interaction1); |
---|
| 274 | simulateInteraction(element1, interaction2); |
---|
| 275 | simulateInteraction(element1, interaction3); |
---|
| 276 | } |
---|
| 277 | } |
---|
| 278 | |
---|
| 279 | new TaskTreeChecker().assertTaskMap |
---|
| 280 | ("Sequence sequence1 {" + |
---|
| 281 | " Iteration iteration1 {" + |
---|
| 282 | " Sequence sequence2 {" + |
---|
| 283 | " Interaction bla {}" + |
---|
| 284 | " Interaction bli {}" + |
---|
| 285 | " Interaction blup {}" + |
---|
| 286 | " }" + |
---|
| 287 | " }" + |
---|
| 288 | " Interaction ble {}" + |
---|
| 289 | " Interaction blo {}" + |
---|
| 290 | " Interaction blu {}" + |
---|
| 291 | " Iteration iteration2 {" + |
---|
| 292 | " Sequence sequence3 {" + |
---|
| 293 | " Interaction bla {}" + |
---|
| 294 | " Interaction bli {}" + |
---|
| 295 | " Interaction blup {}" + |
---|
| 296 | " }" + |
---|
| 297 | " }" + |
---|
| 298 | " Interaction blu {}" + |
---|
| 299 | " Interaction blo {}" + |
---|
| 300 | " Interaction ble {}" + |
---|
| 301 | " Iteration iteration3 {" + |
---|
| 302 | " Sequence sequence4 {" + |
---|
| 303 | " Iteration iteration4 {" + |
---|
| 304 | " Sequence sequence4 {" + |
---|
| 305 | " Interaction bla {}" + |
---|
| 306 | " Interaction bli {}" + |
---|
| 307 | " Interaction blup {}" + |
---|
| 308 | " }" + |
---|
| 309 | " }" + |
---|
| 310 | " Iteration iteration5 {" + |
---|
| 311 | " Sequence sequence5 {" + |
---|
| 312 | " Interaction bli {}" + |
---|
| 313 | " Interaction bla {}" + |
---|
| 314 | " Interaction blup {}" + |
---|
| 315 | " }" + |
---|
| 316 | " }" + |
---|
| 317 | " Iteration iteration6 {" + |
---|
| 318 | " Sequence sequence6 {" + |
---|
| 319 | " Interaction bla {}" + |
---|
| 320 | " Interaction bli {}" + |
---|
| 321 | " Interaction blup {}" + |
---|
| 322 | " }" + |
---|
| 323 | " }" + |
---|
| 324 | " }" + |
---|
| 325 | " }" + |
---|
| 326 | "}", getTaskTree().getTaskMap()); |
---|
| 327 | } |
---|
| 328 | |
---|
| 329 | } |
---|