- Timestamp:
- 04/04/13 16:06:07 (12 years ago)
- Location:
- trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees
- Files:
-
- 9 deleted
- 4 edited
- 9 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/manager/TaskTreeManagerTest.java
r1132 r1146 29 29 import de.ugoe.cs.autoquest.test.DummyGUIElement; 30 30 import de.ugoe.cs.autoquest.test.DummyInteraction; 31 import de.ugoe.cs.util.console.Console; 31 32 import de.ugoe.cs.util.console.TextConsole; 32 33 … … 47 48 @Before 48 49 public void setUp() { 50 Console.reset(); 49 51 new TextConsole(Level.FINEST); 50 52 manager = new TaskTreeManager(); … … 66 68 public void testOneEventOnOneElement() { 67 69 simulateEvent(new DummyInteraction("bla", 1), new DummyGUIElement("elem1")); 68 new TaskTreeChecker().assertTaskTree 69 ("Sequence root {" + 70 " Sequence session {" + 71 " Event bla {}" + 72 " }" + 73 "}", manager.getTaskTree()); 70 new TaskTreeChecker().assertTaskInstanceList 71 ("UserSession session {" + 72 " Event bla {}" + 73 "}", manager.getTaskModel().getUserSessions().get(0)); 74 74 } 75 75 … … 84 84 simulateEvent(new DummyInteraction("blo", 1), eventTarget); 85 85 simulateEvent(new DummyInteraction("blu", 1), eventTarget); 86 simulateEvent(new DummyInteraction("bla", 1), eventTarget); 87 88 new TaskTreeChecker().assertTaskTree 89 ("Sequence root {" + 90 " Sequence session {" + 91 " Event bla {}" + 92 " Event bli {}" + 93 " Event blo {}" + 94 " Event blu {}" + 95 " Event bla {}" + 96 " }" + 97 "}", manager.getTaskTree()); 86 simulateEvent(new DummyInteraction("ble", 1), eventTarget); 87 88 new TaskTreeChecker().assertTaskInstanceList 89 ("UserSession session {" + 90 " Event bla {}" + 91 " Event bli {}" + 92 " Event blo {}" + 93 " Event blu {}" + 94 " Event ble {}" + 95 "}", manager.getTaskModel().getUserSessions().get(0)); 98 96 } 99 97 … … 111 109 simulateEvent(new DummyInteraction("bla", 1), eventTarget1); 112 110 simulateEvent(new DummyInteraction("bli", 1), eventTarget2); 113 simulateEvent(new DummyInteraction("bla", 1), eventTarget3); 114 simulateEvent(new DummyInteraction("bli", 1), eventTarget4); 115 simulateEvent(new DummyInteraction("blo", 1), eventTarget5); 116 simulateEvent(new DummyInteraction("bla", 1), eventTarget6); 117 118 new TaskTreeChecker().assertTaskTree 119 ("Sequence root {" + 120 " Sequence session {" + 121 " Event bla {}" + 122 " Event bli {}" + 123 " Event bla {}" + 124 " Event bli {}" + 125 " Event blo {}" + 126 " Event bla {}" + 127 " }" + 128 "}", manager.getTaskTree()); 111 simulateEvent(new DummyInteraction("blo", 1), eventTarget3); 112 simulateEvent(new DummyInteraction("blu", 1), eventTarget4); 113 simulateEvent(new DummyInteraction("ble", 1), eventTarget5); 114 simulateEvent(new DummyInteraction("blum", 1), eventTarget6); 115 116 new TaskTreeChecker(true).assertTaskInstanceList 117 ("UserSession session {" + 118 " Event bla {}" + 119 " Event bli {}" + 120 " Event blo {}" + 121 " Event blu {}" + 122 " Event ble {}" + 123 " Event blum {}" + 124 "}", manager.getTaskModel().getUserSessions().get(0)); 129 125 } 130 126 … … 142 138 simulateEvent(new DummyInteraction("bla", 1), eventTarget1); 143 139 simulateEvent(new DummyInteraction("bli", 1), eventTarget1); 144 simulateEvent(new DummyInteraction("bl a", 1), eventTarget1);145 simulateEvent(new DummyInteraction("bl i", 1), eventTarget2);140 simulateEvent(new DummyInteraction("blup", 1), eventTarget1); 141 simulateEvent(new DummyInteraction("ble", 1), eventTarget2); 146 142 simulateEvent(new DummyInteraction("blo", 1), eventTarget2); 147 simulateEvent(new DummyInteraction("bla", 1), eventTarget3); 148 simulateEvent(new DummyInteraction("bli", 1), eventTarget4); 149 simulateEvent(new DummyInteraction("bla", 1), eventTarget4); 150 simulateEvent(new DummyInteraction("bli", 1), eventTarget4); 151 simulateEvent(new DummyInteraction("blo", 1), eventTarget4); 152 simulateEvent(new DummyInteraction("bla", 1), eventTarget5); 153 simulateEvent(new DummyInteraction("bli", 1), eventTarget6); 154 simulateEvent(new DummyInteraction("bla", 1), eventTarget6); 155 simulateEvent(new DummyInteraction("bli", 1), eventTarget6); 156 simulateEvent(new DummyInteraction("blo", 1), eventTarget6); 157 158 new TaskTreeChecker().assertTaskTree 159 ("Sequence root {" + 160 " Sequence session {" + 161 " Event bla {}" + 162 " Event bli {}" + 163 " Event bla {}" + 164 " Event bli {}" + 165 " Event blo {}" + 166 " Event bla {}" + 167 " Event bli {}" + 168 " Event bla {}" + 169 " Event bli {}" + 170 " Event blo {}" + 171 " Event bla {}" + 172 " Event bli {}" + 173 " Event bla {}" + 174 " Event bli {}" + 175 " Event blo {}" + 176 " }" + 177 "}", manager.getTaskTree()); 143 simulateEvent(new DummyInteraction("blau", 1), eventTarget3); 144 simulateEvent(new DummyInteraction("blass", 1), eventTarget4); 145 simulateEvent(new DummyInteraction("blum", 1), eventTarget4); 146 simulateEvent(new DummyInteraction("blim", 1), eventTarget4); 147 simulateEvent(new DummyInteraction("blom", 1), eventTarget4); 148 simulateEvent(new DummyInteraction("blam", 1), eventTarget5); 149 simulateEvent(new DummyInteraction("blip", 1), eventTarget6); 150 simulateEvent(new DummyInteraction("blap", 1), eventTarget6); 151 simulateEvent(new DummyInteraction("blep", 1), eventTarget6); 152 simulateEvent(new DummyInteraction("blop", 1), eventTarget6); 153 154 new TaskTreeChecker().assertTaskInstanceList 155 ("UserSession session {" + 156 " Event bla {}" + 157 " Event bli {}" + 158 " Event blup {}" + 159 " Event ble {}" + 160 " Event blo {}" + 161 " Event blau {}" + 162 " Event blass {}" + 163 " Event blum {}" + 164 " Event blim {}" + 165 " Event blom {}" + 166 " Event blam {}" + 167 " Event blip {}" + 168 " Event blap {}" + 169 " Event blep {}" + 170 " Event blop {}" + 171 "}", manager.getTaskModel().getUserSessions().get(0)); 178 172 } 179 173 … … 187 181 simulateEvent(event1, eventTarget1); 188 182 simulateEvent(event1, eventTarget1); 189 new TaskTreeChecker().assertTaskTree 190 ("Sequence root {" + 191 " Sequence session {" + 192 " Iteration iteration1 {" + 193 " Event bla {}" + 194 " }" + 183 new TaskTreeChecker().assertTaskInstanceList 184 ("UserSession session {" + 185 " Iteration iteration1 {" + 186 " Event bla {}" + 187 " Event bla {}" + 195 188 " }" + 196 "}", manager.getTask Tree());189 "}", manager.getTaskModel().getUserSessions().get(0)); 197 190 } 198 191 … … 208 201 } 209 202 210 new TaskTreeChecker().assertTaskTree 211 ("Sequence root {" + 212 " Sequence session {" + 213 " Iteration iteration1 {" + 214 " Event bla {}" + 215 " }" + 203 new TaskTreeChecker().assertTaskInstanceList 204 ("UserSession session {" + 205 " Iteration iteration1 {" + 206 " Event bla {}" + 207 " Event bla {}" + 208 " Event bla {}" + 209 " Event bla {}" + 210 " Event bla {}" + 211 " Event bla {}" + 212 " Event bla {}" + 213 " Event bla {}" + 214 " Event bla {}" + 215 " Event bla {}" + 216 216 " }" + 217 "}", manager.getTask Tree());217 "}", manager.getTaskModel().getUserSessions().get(0)); 218 218 } 219 219 … … 229 229 IEventType event2 = new DummyInteraction("bli", 1); 230 230 IEventType event3 = new DummyInteraction("blup", 1); 231 IEventType event4 = new DummyInteraction("ble", 1); 232 IEventType event5 = new DummyInteraction("blo", 1); 231 233 232 234 simulateEvent(event2, eventTarget1); … … 235 237 simulateEvent(event1, eventTarget1); 236 238 } 237 simulateEvent(event3, eventTarget1); 238 simulateEvent(event2, eventTarget1); 239 240 new TaskTreeChecker().assertTaskTree 241 ("Sequence root {" + 242 " Sequence session {" + 243 " Event bli {}" + 244 " Event blup {}" + 245 " Iteration iteration2 {" + 246 " Event bla {}" + 247 " }" + 248 " Event blup {}" + 249 " Event bli {}" + 239 simulateEvent(event4, eventTarget1); 240 simulateEvent(event5, eventTarget1); 241 242 new TaskTreeChecker().assertTaskInstanceList 243 ("UserSession session {" + 244 " Event bli {}" + 245 " Event blup {}" + 246 " Iteration iteration2 {" + 247 " Event bla {}" + 248 " Event bla {}" + 249 " Event bla {}" + 250 " Event bla {}" + 251 " Event bla {}" + 252 " Event bla {}" + 253 " Event bla {}" + 254 " Event bla {}" + 255 " Event bla {}" + 256 " Event bla {}" + 250 257 " }" + 251 "}", manager.getTaskTree()); 258 " Event ble {}" + 259 " Event blo {}" + 260 "}", manager.getTaskModel().getUserSessions().get(0)); 252 261 253 262 } … … 264 273 265 274 // now test with iterations of iterations 266 for (int i = 0; i < 10; i++) {275 for (int i = 0; i < 5; i++) { 267 276 for (int j = 0; j < 5; j++) { 268 277 simulateEvent(event1, eventTarget1); … … 276 285 } 277 286 278 new TaskTreeChecker().assertTaskTree 279 ("Sequence root {" + 280 " Sequence session {" + 281 " Iteration iteration2 {" + 282 " Sequence sequence1 {" + 283 " Iteration iteration3 {" + 284 " Event bla {}" + 285 " }" + 286 " Iteration iteration4 {" + 287 " Event bli {}" + 288 " }" + 289 " Iteration iteration5 {" + 290 " Event blup {}" + 291 " }" + 287 new TaskTreeChecker().assertTaskInstanceList 288 ("UserSession session {" + 289 " Iteration iteration2 {" + 290 " Sequence sequence1 {" + 291 " Iteration iteration3 {" + 292 " Event bla {}" + 293 " Event bla {}" + 294 " Event bla {}" + 295 " Event bla {}" + 296 " Event bla {}" + 297 " }" + 298 " Iteration iteration4 {" + 299 " Event bli {}" + 300 " Event bli {}" + 301 " Event bli {}" + 302 " Event bli {}" + 303 " Event bli {}" + 304 " }" + 305 " Iteration iteration5 {" + 306 " Event blup {}" + 307 " Event blup {}" + 308 " Event blup {}" + 309 " Event blup {}" + 310 " Event blup {}" + 311 " }" + 312 " }" + 313 " Sequence sequence1 {" + 314 " Iteration iteration3 {" + 315 " Event bla {}" + 316 " Event bla {}" + 317 " Event bla {}" + 318 " Event bla {}" + 319 " Event bla {}" + 320 " }" + 321 " Iteration iteration4 {" + 322 " Event bli {}" + 323 " Event bli {}" + 324 " Event bli {}" + 325 " Event bli {}" + 326 " Event bli {}" + 327 " }" + 328 " Iteration iteration5 {" + 329 " Event blup {}" + 330 " Event blup {}" + 331 " Event blup {}" + 332 " Event blup {}" + 333 " Event blup {}" + 334 " }" + 335 " }" + 336 " Sequence sequence1 {" + 337 " Iteration iteration3 {" + 338 " Event bla {}" + 339 " Event bla {}" + 340 " Event bla {}" + 341 " Event bla {}" + 342 " Event bla {}" + 343 " }" + 344 " Iteration iteration4 {" + 345 " Event bli {}" + 346 " Event bli {}" + 347 " Event bli {}" + 348 " Event bli {}" + 349 " Event bli {}" + 350 " }" + 351 " Iteration iteration5 {" + 352 " Event blup {}" + 353 " Event blup {}" + 354 " Event blup {}" + 355 " Event blup {}" + 356 " Event blup {}" + 357 " }" + 358 " }" + 359 " Sequence sequence1 {" + 360 " Iteration iteration3 {" + 361 " Event bla {}" + 362 " Event bla {}" + 363 " Event bla {}" + 364 " Event bla {}" + 365 " Event bla {}" + 366 " }" + 367 " Iteration iteration4 {" + 368 " Event bli {}" + 369 " Event bli {}" + 370 " Event bli {}" + 371 " Event bli {}" + 372 " Event bli {}" + 373 " }" + 374 " Iteration iteration5 {" + 375 " Event blup {}" + 376 " Event blup {}" + 377 " Event blup {}" + 378 " Event blup {}" + 379 " Event blup {}" + 380 " }" + 381 " }" + 382 " Sequence sequence1 {" + 383 " Iteration iteration3 {" + 384 " Event bla {}" + 385 " Event bla {}" + 386 " Event bla {}" + 387 " Event bla {}" + 388 " Event bla {}" + 389 " }" + 390 " Iteration iteration4 {" + 391 " Event bli {}" + 392 " Event bli {}" + 393 " Event bli {}" + 394 " Event bli {}" + 395 " Event bli {}" + 396 " }" + 397 " Iteration iteration5 {" + 398 " Event blup {}" + 399 " Event blup {}" + 400 " Event blup {}" + 401 " Event blup {}" + 402 " Event blup {}" + 292 403 " }" + 293 404 " }" + 294 405 " }" + 295 "}", manager.getTask Tree());406 "}", manager.getTaskModel().getUserSessions().get(0)); 296 407 297 408 } … … 315 426 simulateEvent(event3, eventTarget1); 316 427 317 new TaskTreeChecker().assertTaskTree 318 ("Sequence root {" + 319 " Sequence session {" + 320 " Iteration iteration1 {" + 321 " Sequence sequence2 {" + 322 " Event bla {}" + 323 " Event bli {}" + 324 " Event blup {}" + 325 " }" + 428 new TaskTreeChecker().assertTaskInstanceList 429 ("UserSession session {" + 430 " Iteration iteration1 {" + 431 " Sequence sequence2 {" + 432 " Event bla {}" + 433 " Event bli {}" + 434 " Event blup {}" + 435 " }" + 436 " Sequence sequence2 {" + 437 " Event bla {}" + 438 " Event bli {}" + 439 " Event blup {}" + 326 440 " }" + 327 441 " }" + 328 "}", manager.getTask Tree());442 "}", manager.getTaskModel().getUserSessions().get(0)); 329 443 } 330 444 … … 345 459 } 346 460 347 new TaskTreeChecker().assertTaskTree 348 ("Sequence root {" + 349 " Sequence session {" + 350 " Iteration iteration1 {" + 351 " Sequence sequence2 {" + 352 " Event bla {}" + 353 " Event bli {}" + 354 " Event blup {}" + 355 " }" + 461 new TaskTreeChecker().assertTaskInstanceList 462 ("UserSession session {" + 463 " Iteration iteration1 {" + 464 " Sequence sequence2 {" + 465 " Event bla {}" + 466 " Event bli {}" + 467 " Event blup {}" + 468 " }" + 469 " Sequence sequence2 {" + 470 " Event bla {}" + 471 " Event bli {}" + 472 " Event blup {}" + 473 " }" + 474 " Sequence sequence2 {" + 475 " Event bla {}" + 476 " Event bli {}" + 477 " Event blup {}" + 478 " }" + 479 " Sequence sequence2 {" + 480 " Event bla {}" + 481 " Event bli {}" + 482 " Event blup {}" + 483 " }" + 484 " Sequence sequence2 {" + 485 " Event bla {}" + 486 " Event bli {}" + 487 " Event blup {}" + 488 " }" + 489 " Sequence sequence2 {" + 490 " Event bla {}" + 491 " Event bli {}" + 492 " Event blup {}" + 493 " }" + 494 " Sequence sequence2 {" + 495 " Event bla {}" + 496 " Event bli {}" + 497 " Event blup {}" + 498 " }" + 499 " Sequence sequence2 {" + 500 " Event bla {}" + 501 " Event bli {}" + 502 " Event blup {}" + 503 " }" + 504 " Sequence sequence2 {" + 505 " Event bla {}" + 506 " Event bli {}" + 507 " Event blup {}" + 508 " }" + 509 " Sequence sequence2 {" + 510 " Event bla {}" + 511 " Event bli {}" + 512 " Event blup {}" + 356 513 " }" + 357 514 " }" + 358 "}", manager.getTask Tree());515 "}", manager.getTaskModel().getUserSessions().get(0)); 359 516 } 360 517 … … 375 532 376 533 simulateEvent(event4, eventTarget1); 377 simulateEvent(event5, eventTarget1); 378 simulateEvent(event6, eventTarget1); 379 for (int i = 0; i < 10; i++) { 534 for (int i = 0; i < 5; i++) { 380 535 simulateEvent(event1, eventTarget1); 381 536 simulateEvent(event2, eventTarget1); 382 537 simulateEvent(event3, eventTarget1); 383 538 } 539 simulateEvent(event5, eventTarget1); 384 540 simulateEvent(event6, eventTarget1); 385 simulateEvent(event5, eventTarget1); 386 simulateEvent(event4, eventTarget1); 387 388 new TaskTreeChecker().assertTaskTree 389 ("Sequence root {" + 390 " Sequence session {" + 391 " Event ble {}" + 392 " Event blo {}" + 393 " Event blu {}" + 394 " Iteration iteration2 {" + 395 " Sequence sequence3 {" + 396 " Event bla {}" + 397 " Event bli {}" + 398 " Event blup {}" + 399 " }" + 400 " }" + 401 " Event blu {}" + 402 " Event blo {}" + 403 " Event ble {}" + 541 542 new TaskTreeChecker().assertTaskInstanceList 543 ("UserSession session {" + 544 " Event ble {}" + 545 " Iteration iteration2 {" + 546 " Sequence sequence3 {" + 547 " Event bla {}" + 548 " Event bli {}" + 549 " Event blup {}" + 550 " }" + 551 " Sequence sequence3 {" + 552 " Event bla {}" + 553 " Event bli {}" + 554 " Event blup {}" + 555 " }" + 556 " Sequence sequence3 {" + 557 " Event bla {}" + 558 " Event bli {}" + 559 " Event blup {}" + 560 " }" + 561 " Sequence sequence3 {" + 562 " Event bla {}" + 563 " Event bli {}" + 564 " Event blup {}" + 565 " }" + 566 " Sequence sequence3 {" + 567 " Event bla {}" + 568 " Event bli {}" + 569 " Event blup {}" + 570 " }" + 404 571 " }" + 405 "}", manager.getTaskTree()); 572 " Event blo {}" + 573 " Event blu {}" + 574 "}", manager.getTaskModel().getUserSessions().get(0)); 406 575 } 407 576 … … 418 587 IEventType event5 = new DummyInteraction("blau", 1); 419 588 IEventType event6 = new DummyInteraction("blass", 1); 589 IEventType event7 = new DummyInteraction("ble", 1); 590 IEventType event8 = new DummyInteraction("blum", 1); 591 IEventType event9 = new DummyInteraction("blop", 1); 420 592 421 593 // now test with iterations of iterations 422 for (int i = 0; i < 10; i++) {594 for (int i = 0; i < 5; i++) { 423 595 for (int j = 0; j < 5; j++) { 424 596 simulateEvent(event1, eventTarget1); … … 432 604 } 433 605 for (int j = 0; j < 5; j++) { 434 simulateEvent(event 1, eventTarget1);435 simulateEvent(event 3, eventTarget1);436 simulateEvent(event 5, eventTarget1);606 simulateEvent(event7, eventTarget1); 607 simulateEvent(event8, eventTarget1); 608 simulateEvent(event9, eventTarget1); 437 609 } 438 610 } 439 611 440 new TaskTreeChecker().assertTaskTree 441 ("Sequence root {" + 442 " Sequence session {" + 443 " Iteration iteration3 {" + 444 " Sequence sequence4 {" + 445 " Iteration iteration4 {" + 446 " Sequence sequence4 {" + 447 " Event bla {}" + 448 " Event bli {}" + 449 " Event blup {}" + 450 " }" + 451 " }" + 452 " Iteration iteration5 {" + 453 " Sequence sequence5 {" + 454 " Event blo {}" + 455 " Event blau {}" + 456 " Event blass {}" + 457 " }" + 458 " }" + 459 " Iteration iteration6 {" + 460 " Sequence sequence6 {" + 461 " Event bla {}" + 462 " Event blup {}" + 463 " Event blau {}" + 464 " }" + 612 new TaskTreeChecker().assertTaskInstanceList 613 ("UserSession session {" + 614 " Iteration iteration3 {" + 615 " Sequence sequence1 {" + 616 " Iteration iteration4 {" + 617 " Sequence sequence4 {" + 618 " Event bla {}" + 619 " Event bli {}" + 620 " Event blup {}" + 621 " }" + 622 " Sequence sequence4 {" + 623 " Event bla {}" + 624 " Event bli {}" + 625 " Event blup {}" + 626 " }" + 627 " Sequence sequence4 {" + 628 " Event bla {}" + 629 " Event bli {}" + 630 " Event blup {}" + 631 " }" + 632 " Sequence sequence4 {" + 633 " Event bla {}" + 634 " Event bli {}" + 635 " Event blup {}" + 636 " }" + 637 " Sequence sequence4 {" + 638 " Event bla {}" + 639 " Event bli {}" + 640 " Event blup {}" + 641 " }" + 642 " }" + 643 " Iteration iteration5 {" + 644 " Sequence sequence5 {" + 645 " Event blo {}" + 646 " Event blau {}" + 647 " Event blass {}" + 648 " }" + 649 " Sequence sequence5 {" + 650 " Event blo {}" + 651 " Event blau {}" + 652 " Event blass {}" + 653 " }" + 654 " Sequence sequence5 {" + 655 " Event blo {}" + 656 " Event blau {}" + 657 " Event blass {}" + 658 " }" + 659 " Sequence sequence5 {" + 660 " Event blo {}" + 661 " Event blau {}" + 662 " Event blass {}" + 663 " }" + 664 " Sequence sequence5 {" + 665 " Event blo {}" + 666 " Event blau {}" + 667 " Event blass {}" + 668 " }" + 669 " }" + 670 " Iteration iteration6 {" + 671 " Sequence sequence6 {" + 672 " Event ble {}" + 673 " Event blum {}" + 674 " Event blop {}" + 675 " }" + 676 " Sequence sequence6 {" + 677 " Event ble {}" + 678 " Event blum {}" + 679 " Event blop {}" + 680 " }" + 681 " Sequence sequence6 {" + 682 " Event ble {}" + 683 " Event blum {}" + 684 " Event blop {}" + 685 " }" + 686 " Sequence sequence6 {" + 687 " Event ble {}" + 688 " Event blum {}" + 689 " Event blop {}" + 690 " }" + 691 " Sequence sequence6 {" + 692 " Event ble {}" + 693 " Event blum {}" + 694 " Event blop {}" + 695 " }" + 696 " }" + 697 " }" + 698 " Sequence sequence1 {" + 699 " Iteration iteration4 {" + 700 " Sequence sequence4 {" + 701 " Event bla {}" + 702 " Event bli {}" + 703 " Event blup {}" + 704 " }" + 705 " Sequence sequence4 {" + 706 " Event bla {}" + 707 " Event bli {}" + 708 " Event blup {}" + 709 " }" + 710 " Sequence sequence4 {" + 711 " Event bla {}" + 712 " Event bli {}" + 713 " Event blup {}" + 714 " }" + 715 " Sequence sequence4 {" + 716 " Event bla {}" + 717 " Event bli {}" + 718 " Event blup {}" + 719 " }" + 720 " Sequence sequence4 {" + 721 " Event bla {}" + 722 " Event bli {}" + 723 " Event blup {}" + 724 " }" + 725 " }" + 726 " Iteration iteration5 {" + 727 " Sequence sequence5 {" + 728 " Event blo {}" + 729 " Event blau {}" + 730 " Event blass {}" + 731 " }" + 732 " Sequence sequence5 {" + 733 " Event blo {}" + 734 " Event blau {}" + 735 " Event blass {}" + 736 " }" + 737 " Sequence sequence5 {" + 738 " Event blo {}" + 739 " Event blau {}" + 740 " Event blass {}" + 741 " }" + 742 " Sequence sequence5 {" + 743 " Event blo {}" + 744 " Event blau {}" + 745 " Event blass {}" + 746 " }" + 747 " Sequence sequence5 {" + 748 " Event blo {}" + 749 " Event blau {}" + 750 " Event blass {}" + 751 " }" + 752 " }" + 753 " Iteration iteration6 {" + 754 " Sequence sequence6 {" + 755 " Event ble {}" + 756 " Event blum {}" + 757 " Event blop {}" + 758 " }" + 759 " Sequence sequence6 {" + 760 " Event ble {}" + 761 " Event blum {}" + 762 " Event blop {}" + 763 " }" + 764 " Sequence sequence6 {" + 765 " Event ble {}" + 766 " Event blum {}" + 767 " Event blop {}" + 768 " }" + 769 " Sequence sequence6 {" + 770 " Event ble {}" + 771 " Event blum {}" + 772 " Event blop {}" + 773 " }" + 774 " Sequence sequence6 {" + 775 " Event ble {}" + 776 " Event blum {}" + 777 " Event blop {}" + 778 " }" + 779 " }" + 780 " }" + 781 " Sequence sequence1 {" + 782 " Iteration iteration4 {" + 783 " Sequence sequence4 {" + 784 " Event bla {}" + 785 " Event bli {}" + 786 " Event blup {}" + 787 " }" + 788 " Sequence sequence4 {" + 789 " Event bla {}" + 790 " Event bli {}" + 791 " Event blup {}" + 792 " }" + 793 " Sequence sequence4 {" + 794 " Event bla {}" + 795 " Event bli {}" + 796 " Event blup {}" + 797 " }" + 798 " Sequence sequence4 {" + 799 " Event bla {}" + 800 " Event bli {}" + 801 " Event blup {}" + 802 " }" + 803 " Sequence sequence4 {" + 804 " Event bla {}" + 805 " Event bli {}" + 806 " Event blup {}" + 807 " }" + 808 " }" + 809 " Iteration iteration5 {" + 810 " Sequence sequence5 {" + 811 " Event blo {}" + 812 " Event blau {}" + 813 " Event blass {}" + 814 " }" + 815 " Sequence sequence5 {" + 816 " Event blo {}" + 817 " Event blau {}" + 818 " Event blass {}" + 819 " }" + 820 " Sequence sequence5 {" + 821 " Event blo {}" + 822 " Event blau {}" + 823 " Event blass {}" + 824 " }" + 825 " Sequence sequence5 {" + 826 " Event blo {}" + 827 " Event blau {}" + 828 " Event blass {}" + 829 " }" + 830 " Sequence sequence5 {" + 831 " Event blo {}" + 832 " Event blau {}" + 833 " Event blass {}" + 834 " }" + 835 " }" + 836 " Iteration iteration6 {" + 837 " Sequence sequence6 {" + 838 " Event ble {}" + 839 " Event blum {}" + 840 " Event blop {}" + 841 " }" + 842 " Sequence sequence6 {" + 843 " Event ble {}" + 844 " Event blum {}" + 845 " Event blop {}" + 846 " }" + 847 " Sequence sequence6 {" + 848 " Event ble {}" + 849 " Event blum {}" + 850 " Event blop {}" + 851 " }" + 852 " Sequence sequence6 {" + 853 " Event ble {}" + 854 " Event blum {}" + 855 " Event blop {}" + 856 " }" + 857 " Sequence sequence6 {" + 858 " Event ble {}" + 859 " Event blum {}" + 860 " Event blop {}" + 861 " }" + 862 " }" + 863 " }" + 864 " Sequence sequence1 {" + 865 " Iteration iteration4 {" + 866 " Sequence sequence4 {" + 867 " Event bla {}" + 868 " Event bli {}" + 869 " Event blup {}" + 870 " }" + 871 " Sequence sequence4 {" + 872 " Event bla {}" + 873 " Event bli {}" + 874 " Event blup {}" + 875 " }" + 876 " Sequence sequence4 {" + 877 " Event bla {}" + 878 " Event bli {}" + 879 " Event blup {}" + 880 " }" + 881 " Sequence sequence4 {" + 882 " Event bla {}" + 883 " Event bli {}" + 884 " Event blup {}" + 885 " }" + 886 " Sequence sequence4 {" + 887 " Event bla {}" + 888 " Event bli {}" + 889 " Event blup {}" + 890 " }" + 891 " }" + 892 " Iteration iteration5 {" + 893 " Sequence sequence5 {" + 894 " Event blo {}" + 895 " Event blau {}" + 896 " Event blass {}" + 897 " }" + 898 " Sequence sequence5 {" + 899 " Event blo {}" + 900 " Event blau {}" + 901 " Event blass {}" + 902 " }" + 903 " Sequence sequence5 {" + 904 " Event blo {}" + 905 " Event blau {}" + 906 " Event blass {}" + 907 " }" + 908 " Sequence sequence5 {" + 909 " Event blo {}" + 910 " Event blau {}" + 911 " Event blass {}" + 912 " }" + 913 " Sequence sequence5 {" + 914 " Event blo {}" + 915 " Event blau {}" + 916 " Event blass {}" + 917 " }" + 918 " }" + 919 " Iteration iteration6 {" + 920 " Sequence sequence6 {" + 921 " Event ble {}" + 922 " Event blum {}" + 923 " Event blop {}" + 924 " }" + 925 " Sequence sequence6 {" + 926 " Event ble {}" + 927 " Event blum {}" + 928 " Event blop {}" + 929 " }" + 930 " Sequence sequence6 {" + 931 " Event ble {}" + 932 " Event blum {}" + 933 " Event blop {}" + 934 " }" + 935 " Sequence sequence6 {" + 936 " Event ble {}" + 937 " Event blum {}" + 938 " Event blop {}" + 939 " }" + 940 " Sequence sequence6 {" + 941 " Event ble {}" + 942 " Event blum {}" + 943 " Event blop {}" + 944 " }" + 945 " }" + 946 " }" + 947 " Sequence sequence1 {" + 948 " Iteration iteration4 {" + 949 " Sequence sequence4 {" + 950 " Event bla {}" + 951 " Event bli {}" + 952 " Event blup {}" + 953 " }" + 954 " Sequence sequence4 {" + 955 " Event bla {}" + 956 " Event bli {}" + 957 " Event blup {}" + 958 " }" + 959 " Sequence sequence4 {" + 960 " Event bla {}" + 961 " Event bli {}" + 962 " Event blup {}" + 963 " }" + 964 " Sequence sequence4 {" + 965 " Event bla {}" + 966 " Event bli {}" + 967 " Event blup {}" + 968 " }" + 969 " Sequence sequence4 {" + 970 " Event bla {}" + 971 " Event bli {}" + 972 " Event blup {}" + 973 " }" + 974 " }" + 975 " Iteration iteration5 {" + 976 " Sequence sequence5 {" + 977 " Event blo {}" + 978 " Event blau {}" + 979 " Event blass {}" + 980 " }" + 981 " Sequence sequence5 {" + 982 " Event blo {}" + 983 " Event blau {}" + 984 " Event blass {}" + 985 " }" + 986 " Sequence sequence5 {" + 987 " Event blo {}" + 988 " Event blau {}" + 989 " Event blass {}" + 990 " }" + 991 " Sequence sequence5 {" + 992 " Event blo {}" + 993 " Event blau {}" + 994 " Event blass {}" + 995 " }" + 996 " Sequence sequence5 {" + 997 " Event blo {}" + 998 " Event blau {}" + 999 " Event blass {}" + 1000 " }" + 1001 " }" + 1002 " Iteration iteration6 {" + 1003 " Sequence sequence6 {" + 1004 " Event ble {}" + 1005 " Event blum {}" + 1006 " Event blop {}" + 1007 " }" + 1008 " Sequence sequence6 {" + 1009 " Event ble {}" + 1010 " Event blum {}" + 1011 " Event blop {}" + 1012 " }" + 1013 " Sequence sequence6 {" + 1014 " Event ble {}" + 1015 " Event blum {}" + 1016 " Event blop {}" + 1017 " }" + 1018 " Sequence sequence6 {" + 1019 " Event ble {}" + 1020 " Event blum {}" + 1021 " Event blop {}" + 1022 " }" + 1023 " Sequence sequence6 {" + 1024 " Event ble {}" + 1025 " Event blum {}" + 1026 " Event blop {}" + 465 1027 " }" + 466 1028 " }" + 467 1029 " }" + 468 1030 " }" + 469 "}", manager.getTask Tree());1031 "}", manager.getTaskModel().getUserSessions().get(0)); 470 1032 } 471 1033 -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/EventTaskComparisonRuleTest.java
r1125 r1146 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.tasktrees. nodeequality;15 package de.ugoe.cs.autoquest.tasktrees.taskequality; 16 16 17 17 import static org.junit.Assert.*; … … 22 22 import de.ugoe.cs.autoquest.eventcore.IEventType; 23 23 import de.ugoe.cs.autoquest.eventcore.StringEventType; 24 import de.ugoe.cs.autoquest.tasktrees. nodeequality.EventTaskComparisonRule;25 import de.ugoe.cs.autoquest.tasktrees. nodeequality.NodeEquality;26 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask TreeNode;27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask TreeNodeFactory;28 import de.ugoe.cs.autoquest.tasktrees.treeimpl.Task TreeNodeFactory;24 import de.ugoe.cs.autoquest.tasktrees.taskequality.EventTaskComparisonRule; 25 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 26 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 28 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 29 29 import de.ugoe.cs.autoquest.test.DummyGUIElement; 30 30 … … 39 39 @Test 40 40 public void test_isApplicable_01() { 41 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();42 43 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 44 45 IEventType eventType1 = new StringEventType("eventType1"); 46 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 47 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);41 ITaskFactory taskFactory = new TaskFactory(); 42 43 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 44 45 IEventType eventType1 = new StringEventType("eventType1"); 46 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 47 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 48 48 49 49 assertTrue(rule.isApplicable(task1, task1)); … … 55 55 @Test 56 56 public void test_isApplicable_02() { 57 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();58 59 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 60 61 IEventType eventType1 = new StringEventType("eventType1"); 62 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 63 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);57 ITaskFactory taskFactory = new TaskFactory(); 58 59 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 60 61 IEventType eventType1 = new StringEventType("eventType1"); 62 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 63 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 64 64 65 65 IEventType eventType2 = new StringEventType("eventType2"); 66 66 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 67 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);67 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 68 68 69 69 assertTrue(rule.isApplicable(task1, task2)); … … 76 76 @Test 77 77 public void test_isApplicable_03() { 78 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();79 80 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 81 82 IEventType eventType1 = new StringEventType("eventType1"); 83 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 84 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);78 ITaskFactory taskFactory = new TaskFactory(); 79 80 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 81 82 IEventType eventType1 = new StringEventType("eventType1"); 83 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 84 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 85 85 86 ITask TreeNode selection = treeNodeFactory.createNewSelection();86 ITask selection = taskFactory.createNewSelection(); 87 87 88 88 assertFalse(rule.isApplicable(task1, selection)); … … 95 95 @Test 96 96 public void test_isApplicable_04() { 97 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();98 99 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 100 101 IEventType eventType1 = new StringEventType("eventType1"); 102 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 103 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);104 105 ITask TreeNode sequence = treeNodeFactory.createNewSequence();97 ITaskFactory taskFactory = new TaskFactory(); 98 99 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 100 101 IEventType eventType1 = new StringEventType("eventType1"); 102 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 103 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 104 105 ITask sequence = taskFactory.createNewSequence(); 106 106 107 107 assertFalse(rule.isApplicable(task1, sequence)); … … 114 114 @Test 115 115 public void test_isApplicable_05() { 116 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();117 118 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 119 120 IEventType eventType1 = new StringEventType("eventType1"); 121 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 122 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);123 124 ITask TreeNode iteration = treeNodeFactory.createNewIteration();116 ITaskFactory taskFactory = new TaskFactory(); 117 118 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 119 120 IEventType eventType1 = new StringEventType("eventType1"); 121 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 122 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 123 124 ITask iteration = taskFactory.createNewIteration(); 125 125 126 126 assertFalse(rule.isApplicable(task1, iteration)); … … 133 133 @Test 134 134 public void test_isApplicable_06() { 135 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();136 137 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 138 139 IEventType eventType1 = new StringEventType("eventType1"); 140 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 141 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);142 143 ITask TreeNode optional = treeNodeFactory.createNewOptional();135 ITaskFactory taskFactory = new TaskFactory(); 136 137 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 138 139 IEventType eventType1 = new StringEventType("eventType1"); 140 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 141 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 142 143 ITask optional = taskFactory.createNewOptional(); 144 144 145 145 assertFalse(rule.isApplicable(task1, optional)); … … 152 152 @Test 153 153 public void test_compare_01() { 154 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();155 156 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 157 158 IEventType eventType1 = new StringEventType("eventType1"); 159 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 160 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);161 162 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(task1, task1));154 ITaskFactory taskFactory = new TaskFactory(); 155 156 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 157 158 IEventType eventType1 = new StringEventType("eventType1"); 159 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 160 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 161 162 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, task1)); 163 163 assertTrue(rule.areLexicallyEqual(task1, task1)); 164 164 assertTrue(rule.areSyntacticallyEqual(task1, task1)); … … 171 171 @Test 172 172 public void test_compare_02() { 173 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();174 175 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 176 177 IEventType eventType1 = new StringEventType("eventType1"); 178 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 179 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);180 181 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);182 183 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(task1, task2));173 ITaskFactory taskFactory = new TaskFactory(); 174 175 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 176 177 IEventType eventType1 = new StringEventType("eventType1"); 178 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 179 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 180 181 ITask task2 = taskFactory.createNewEventTask(eventType1, eventTarget1); 182 183 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, task2)); 184 184 assertTrue(rule.areLexicallyEqual(task1, task2)); 185 185 assertTrue(rule.areSyntacticallyEqual(task1, task2)); 186 186 assertTrue(rule.areSemanticallyEqual(task1, task2)); 187 187 188 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(task2, task1));188 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task2, task1)); 189 189 assertTrue(rule.areLexicallyEqual(task2, task1)); 190 190 assertTrue(rule.areSyntacticallyEqual(task2, task1)); … … 197 197 @Test 198 198 public void test_compare_03() { 199 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();200 201 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 202 203 IEventType eventType1 = new StringEventType("eventType1"); 204 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 205 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);199 ITaskFactory taskFactory = new TaskFactory(); 200 201 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 202 203 IEventType eventType1 = new StringEventType("eventType1"); 204 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 205 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 206 206 207 207 IEventType eventType2 = new StringEventType("eventType2"); 208 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);209 210 assertEquals( NodeEquality.UNEQUAL, rule.compare(task1, task2));208 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 209 210 assertEquals(TaskEquality.UNEQUAL, rule.compare(task1, task2)); 211 211 assertFalse(rule.areLexicallyEqual(task1, task2)); 212 212 assertFalse(rule.areSyntacticallyEqual(task1, task2)); 213 213 assertFalse(rule.areSemanticallyEqual(task1, task2)); 214 214 215 assertEquals( NodeEquality.UNEQUAL, rule.compare(task2, task1));215 assertEquals(TaskEquality.UNEQUAL, rule.compare(task2, task1)); 216 216 assertFalse(rule.areLexicallyEqual(task2, task1)); 217 217 assertFalse(rule.areSyntacticallyEqual(task2, task1)); … … 224 224 @Test 225 225 public void test_compare_04() { 226 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();227 228 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 229 230 IEventType eventType1 = new StringEventType("eventType1"); 231 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 232 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);226 ITaskFactory taskFactory = new TaskFactory(); 227 228 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 229 230 IEventType eventType1 = new StringEventType("eventType1"); 231 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 232 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 233 233 234 234 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 235 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType1, eventTarget2);236 237 assertEquals( NodeEquality.UNEQUAL, rule.compare(task1, task2));235 ITask task2 = taskFactory.createNewEventTask(eventType1, eventTarget2); 236 237 assertEquals(TaskEquality.UNEQUAL, rule.compare(task1, task2)); 238 238 assertFalse(rule.areLexicallyEqual(task1, task2)); 239 239 assertFalse(rule.areSyntacticallyEqual(task1, task2)); 240 240 assertFalse(rule.areSemanticallyEqual(task1, task2)); 241 241 242 assertEquals( NodeEquality.UNEQUAL, rule.compare(task2, task1));242 assertEquals(TaskEquality.UNEQUAL, rule.compare(task2, task1)); 243 243 assertFalse(rule.areLexicallyEqual(task2, task1)); 244 244 assertFalse(rule.areSyntacticallyEqual(task2, task1)); … … 252 252 @Test 253 253 public void test_compare_05() { 254 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();255 256 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 257 258 IEventType eventType1 = new StringEventType("eventType1"); 259 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 260 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);254 ITaskFactory taskFactory = new TaskFactory(); 255 256 EventTaskComparisonRule rule = new EventTaskComparisonRule(); 257 258 IEventType eventType1 = new StringEventType("eventType1"); 259 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 260 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 261 261 262 262 IEventType eventType2 = new StringEventType("eventType2"); 263 263 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 264 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);265 266 assertEquals( NodeEquality.UNEQUAL, rule.compare(task1, task2));264 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 265 266 assertEquals(TaskEquality.UNEQUAL, rule.compare(task1, task2)); 267 267 assertFalse(rule.areLexicallyEqual(task1, task2)); 268 268 assertFalse(rule.areSyntacticallyEqual(task1, task2)); 269 269 assertFalse(rule.areSemanticallyEqual(task1, task2)); 270 270 271 assertEquals( NodeEquality.UNEQUAL, rule.compare(task2, task1));271 assertEquals(TaskEquality.UNEQUAL, rule.compare(task2, task1)); 272 272 assertFalse(rule.areLexicallyEqual(task2, task1)); 273 273 assertFalse(rule.areSyntacticallyEqual(task2, task1)); -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/GUIEventTaskComparisonRuleTest.java
r1125 r1146 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.tasktrees. nodeequality;15 package de.ugoe.cs.autoquest.tasktrees.taskequality; 16 16 17 17 import static org.junit.Assert.*; … … 41 41 import de.ugoe.cs.autoquest.eventcore.gui.ValueSelection; 42 42 import de.ugoe.cs.autoquest.keyboardmaps.VirtualKey; 43 import de.ugoe.cs.autoquest.tasktrees.nodeequality.GUIEventTaskComparisonRule; 44 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEquality; 45 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; 46 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNodeFactory; 47 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNodeFactory; 43 import de.ugoe.cs.autoquest.tasktrees.taskequality.EventTaskComparisonRule; 44 import de.ugoe.cs.autoquest.tasktrees.taskequality.GUIEventTaskComparisonRule; 45 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 46 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 47 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 48 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 48 49 import de.ugoe.cs.autoquest.test.DummyGUIElement; 49 50 … … 58 59 @Test 59 60 public void test_isApplicable_01() { 60 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();61 ITaskFactory taskFactory = new TaskFactory(); 61 62 62 63 EventTaskComparisonRule rule = new EventTaskComparisonRule(); … … 64 65 IEventType eventType1 = new StringEventType("eventType1"); 65 66 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 66 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);67 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 67 68 68 69 assertTrue(rule.isApplicable(task1, task1)); … … 74 75 @Test 75 76 public void test_isApplicable_02() { 76 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();77 ITaskFactory taskFactory = new TaskFactory(); 77 78 78 79 EventTaskComparisonRule rule = new EventTaskComparisonRule(); … … 80 81 IEventType eventType1 = new StringEventType("eventType1"); 81 82 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 82 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);83 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 83 84 84 85 IEventType eventType2 = new StringEventType("eventType2"); 85 86 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 86 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);87 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 87 88 88 89 assertTrue(rule.isApplicable(task1, task2)); … … 95 96 @Test 96 97 public void test_isApplicable_03() { 97 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();98 ITaskFactory taskFactory = new TaskFactory(); 98 99 99 100 EventTaskComparisonRule rule = new EventTaskComparisonRule(); … … 101 102 IEventType eventType1 = new KeyboardFocusChange(); 102 103 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 103 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);104 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 104 105 105 106 IEventType eventType2 = new KeyboardFocusChange(); 106 107 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 107 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);108 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 108 109 109 110 assertTrue(rule.isApplicable(task1, task2)); … … 116 117 @Test 117 118 public void test_isApplicable_04() { 118 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();119 ITaskFactory taskFactory = new TaskFactory(); 119 120 120 121 EventTaskComparisonRule rule = new EventTaskComparisonRule(); … … 122 123 IEventType eventType1 = new KeyPressed(VirtualKey.LETTER_A); 123 124 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 124 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);125 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 125 126 126 127 IEventType eventType2 = new KeyReleased(VirtualKey.LETTER_B); 127 128 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 128 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);129 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 129 130 130 131 assertTrue(rule.isApplicable(task1, task2)); … … 137 138 @Test 138 139 public void test_isApplicable_05() { 139 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();140 ITaskFactory taskFactory = new TaskFactory(); 140 141 141 142 EventTaskComparisonRule rule = new EventTaskComparisonRule(); … … 143 144 IEventType eventType1 = new KeyTyped(VirtualKey.LETTER_C); 144 145 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 145 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);146 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 146 147 147 148 IEventType eventType2 = new KeyTyped(VirtualKey.LETTER_D); 148 149 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 149 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);150 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 150 151 151 152 assertTrue(rule.isApplicable(task1, task2)); … … 158 159 @Test 159 160 public void test_isApplicable_06() { 160 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();161 ITaskFactory taskFactory = new TaskFactory(); 161 162 162 163 EventTaskComparisonRule rule = new EventTaskComparisonRule(); … … 164 165 IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 5, 6); 165 166 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 166 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);167 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 167 168 168 169 IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.MIDDLE, 3, 1); 169 170 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 170 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);171 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 171 172 172 173 assertTrue(rule.isApplicable(task1, task2)); … … 179 180 @Test 180 181 public void test_isApplicable_07() { 181 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();182 ITaskFactory taskFactory = new TaskFactory(); 182 183 183 184 EventTaskComparisonRule rule = new EventTaskComparisonRule(); … … 185 186 IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.RIGHT, 4, 7); 186 187 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 187 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);188 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 188 189 189 190 IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.X, 9, 12); 190 191 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 191 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);192 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 192 193 193 194 assertTrue(rule.isApplicable(task1, task2)); … … 200 201 @Test 201 202 public void test_isApplicable_08() { 202 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();203 ITaskFactory taskFactory = new TaskFactory(); 203 204 204 205 EventTaskComparisonRule rule = new EventTaskComparisonRule(); … … 206 207 IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 207 208 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 208 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);209 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 209 210 210 211 IEventType eventType2 = new MouseDragAndDrop(5, 6, 7, 8); 211 212 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 212 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);213 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 213 214 214 215 assertTrue(rule.isApplicable(task1, task2)); … … 221 222 @Test 222 223 public void test_isApplicable_09() { 223 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();224 ITaskFactory taskFactory = new TaskFactory(); 224 225 225 226 EventTaskComparisonRule rule = new EventTaskComparisonRule(); … … 227 228 IEventType eventType1 = new Scroll(1, 2); 228 229 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 229 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);230 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 230 231 231 232 IEventType eventType2 = new Scroll(3, 4); 232 233 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 233 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);234 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 234 235 235 236 assertTrue(rule.isApplicable(task1, task2)); … … 242 243 @Test 243 244 public void test_isApplicable_10() { 244 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();245 ITaskFactory taskFactory = new TaskFactory(); 245 246 246 247 EventTaskComparisonRule rule = new EventTaskComparisonRule(); … … 249 250 IEventType eventType1 = new TextInput("text1", inputEvents); 250 251 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 251 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);252 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 252 253 253 254 IEventType eventType2 = new TextInput("text2", inputEvents); 254 255 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 255 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);256 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 256 257 257 258 assertTrue(rule.isApplicable(task1, task2)); … … 264 265 @Test 265 266 public void test_isApplicable_11() { 266 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();267 ITaskFactory taskFactory = new TaskFactory(); 267 268 268 269 EventTaskComparisonRule rule = new EventTaskComparisonRule(); … … 270 271 IEventType eventType1 = new TextSelection(); 271 272 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 272 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);273 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 273 274 274 275 IEventType eventType2 = new ValueSelection<String>("value"); 275 276 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 276 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);277 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 277 278 278 279 assertTrue(rule.isApplicable(task1, task2)); … … 285 286 @Test 286 287 public void test_isApplicable_12() { 287 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();288 ITaskFactory taskFactory = new TaskFactory(); 288 289 289 290 EventTaskComparisonRule rule = new EventTaskComparisonRule(); … … 291 292 IEventType eventType1 = new StringEventType("eventType1"); 292 293 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 293 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);294 295 ITask TreeNode selection = treeNodeFactory.createNewSelection();294 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 295 296 ITask selection = taskFactory.createNewSelection(); 296 297 297 298 assertFalse(rule.isApplicable(task1, selection)); … … 304 305 @Test 305 306 public void test_isApplicable_13() { 306 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();307 ITaskFactory taskFactory = new TaskFactory(); 307 308 308 309 EventTaskComparisonRule rule = new EventTaskComparisonRule(); … … 310 311 IEventType eventType1 = new StringEventType("eventType1"); 311 312 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 312 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);313 314 ITask TreeNode sequence = treeNodeFactory.createNewSequence();313 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 314 315 ITask sequence = taskFactory.createNewSequence(); 315 316 316 317 assertFalse(rule.isApplicable(task1, sequence)); … … 323 324 @Test 324 325 public void test_isApplicable_14() { 325 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();326 ITaskFactory taskFactory = new TaskFactory(); 326 327 327 328 EventTaskComparisonRule rule = new EventTaskComparisonRule(); … … 329 330 IEventType eventType1 = new StringEventType("eventType1"); 330 331 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 331 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);332 333 ITask TreeNode iteration = treeNodeFactory.createNewIteration();332 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 333 334 ITask iteration = taskFactory.createNewIteration(); 334 335 335 336 assertFalse(rule.isApplicable(task1, iteration)); … … 342 343 @Test 343 344 public void test_isApplicable_15() { 344 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();345 ITaskFactory taskFactory = new TaskFactory(); 345 346 346 347 EventTaskComparisonRule rule = new EventTaskComparisonRule(); … … 348 349 IEventType eventType1 = new StringEventType("eventType1"); 349 350 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 350 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);351 352 ITask TreeNode optional = treeNodeFactory.createNewOptional();351 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 352 353 ITask optional = taskFactory.createNewOptional(); 353 354 354 355 assertFalse(rule.isApplicable(task1, optional)); … … 361 362 @Test 362 363 public void test_compare_KeyboardFocusChange_01() { 363 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();364 ITaskFactory taskFactory = new TaskFactory(); 364 365 365 366 IEventType eventType1 = new KeyboardFocusChange(); 366 367 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 367 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);368 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 368 369 369 370 assertLexicallyEqual(task1, task1); … … 375 376 @Test 376 377 public void test_compare_KeyboardFocusChange_02() { 377 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();378 ITaskFactory taskFactory = new TaskFactory(); 378 379 379 380 IEventType eventType1 = new KeyboardFocusChange(); 380 381 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 381 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);382 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 382 383 383 384 IEventType eventType2 = new KeyboardFocusChange(); 384 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);385 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 385 386 386 387 assertLexicallyEqual(task1, task2); … … 392 393 @Test 393 394 public void test_compare_KeyboardFocusChange_03() { 394 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();395 ITaskFactory taskFactory = new TaskFactory(); 395 396 396 397 IEventType eventType1 = new KeyboardFocusChange(); 397 398 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 398 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);399 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 399 400 400 401 IEventType eventType2 = new KeyboardFocusChange(); 401 402 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 402 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);403 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 403 404 404 405 assertUnequal(task1, task2); … … 410 411 @Test 411 412 public void test_compare_KeyPressed_01() { 412 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();413 ITaskFactory taskFactory = new TaskFactory(); 413 414 414 415 IEventType eventType1 = new KeyPressed(VirtualKey.LETTER_A); 415 416 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 416 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);417 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 417 418 418 419 assertLexicallyEqual(task1, task1); … … 424 425 @Test 425 426 public void test_compare_KeyPressed_02() { 426 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();427 ITaskFactory taskFactory = new TaskFactory(); 427 428 428 429 IEventType eventType1 = new KeyPressed(VirtualKey.LETTER_A); 429 430 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 430 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);431 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 431 432 432 433 IEventType eventType2 = new KeyPressed(VirtualKey.LETTER_A); 433 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);434 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 434 435 435 436 assertLexicallyEqual(task1, task2); … … 441 442 @Test 442 443 public void test_compare_KeyPressed_03() { 443 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();444 ITaskFactory taskFactory = new TaskFactory(); 444 445 445 446 IEventType eventType1 = new KeyPressed(VirtualKey.LETTER_A); 446 447 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 447 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);448 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 448 449 449 450 IEventType eventType2 = new KeyPressed(VirtualKey.LETTER_B); 450 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);451 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 451 452 452 453 assertSemanticallyEqual(task1, task2); … … 458 459 @Test 459 460 public void test_compare_KeyPressed_04() { 460 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();461 ITaskFactory taskFactory = new TaskFactory(); 461 462 462 463 IEventType eventType1 = new KeyPressed(VirtualKey.LETTER_A); 463 464 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 464 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);465 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 465 466 466 467 IEventType eventType2 = new KeyPressed(VirtualKey.LETTER_A); 467 468 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 468 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);469 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 469 470 470 471 assertUnequal(task1, task2); … … 476 477 @Test 477 478 public void test_compare_KeyReleased_01() { 478 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();479 ITaskFactory taskFactory = new TaskFactory(); 479 480 480 481 IEventType eventType1 = new KeyReleased(VirtualKey.LETTER_A); 481 482 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 482 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);483 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 483 484 484 485 assertLexicallyEqual(task1, task1); … … 490 491 @Test 491 492 public void test_compare_KeyReleased_02() { 492 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();493 ITaskFactory taskFactory = new TaskFactory(); 493 494 494 495 IEventType eventType1 = new KeyReleased(VirtualKey.LETTER_A); 495 496 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 496 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);497 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 497 498 498 499 IEventType eventType2 = new KeyReleased(VirtualKey.LETTER_A); 499 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);500 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 500 501 501 502 assertLexicallyEqual(task1, task2); … … 507 508 @Test 508 509 public void test_compare_KeyReleased_03() { 509 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();510 ITaskFactory taskFactory = new TaskFactory(); 510 511 511 512 IEventType eventType1 = new KeyReleased(VirtualKey.LETTER_A); 512 513 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 513 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);514 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 514 515 515 516 IEventType eventType2 = new KeyReleased(VirtualKey.LETTER_B); 516 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);517 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 517 518 518 519 assertSemanticallyEqual(task1, task2); … … 524 525 @Test 525 526 public void test_compare_KeyReleased_04() { 526 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();527 ITaskFactory taskFactory = new TaskFactory(); 527 528 528 529 IEventType eventType1 = new KeyReleased(VirtualKey.LETTER_A); 529 530 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 530 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);531 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 531 532 532 533 IEventType eventType2 = new KeyReleased(VirtualKey.LETTER_A); 533 534 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 534 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);535 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 535 536 536 537 assertUnequal(task1, task2); … … 542 543 @Test 543 544 public void test_compare_KeyTyped_01() { 544 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();545 ITaskFactory taskFactory = new TaskFactory(); 545 546 546 547 IEventType eventType1 = new KeyTyped(VirtualKey.LETTER_A); 547 548 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 548 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);549 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 549 550 550 551 assertLexicallyEqual(task1, task1); … … 556 557 @Test 557 558 public void test_compare_KeyTyped_02() { 558 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();559 ITaskFactory taskFactory = new TaskFactory(); 559 560 560 561 IEventType eventType1 = new KeyTyped(VirtualKey.LETTER_A); 561 562 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 562 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);563 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 563 564 564 565 IEventType eventType2 = new KeyTyped(VirtualKey.LETTER_A); 565 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);566 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 566 567 567 568 assertLexicallyEqual(task1, task2); … … 573 574 @Test 574 575 public void test_compare_KeyTyped_03() { 575 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();576 ITaskFactory taskFactory = new TaskFactory(); 576 577 577 578 IEventType eventType1 = new KeyTyped(VirtualKey.LETTER_A); 578 579 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 579 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);580 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 580 581 581 582 IEventType eventType2 = new KeyTyped(VirtualKey.LETTER_B); 582 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);583 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 583 584 584 585 assertSemanticallyEqual(task1, task2); … … 590 591 @Test 591 592 public void test_compare_KeyTyped_04() { 592 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();593 ITaskFactory taskFactory = new TaskFactory(); 593 594 594 595 IEventType eventType1 = new KeyTyped(VirtualKey.LETTER_A); 595 596 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 596 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);597 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 597 598 598 599 IEventType eventType2 = new KeyTyped(VirtualKey.LETTER_A); 599 600 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 600 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);601 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 601 602 602 603 assertUnequal(task1, task2); … … 608 609 @Test 609 610 public void test_compare_MouseButtonDown_01() { 610 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();611 ITaskFactory taskFactory = new TaskFactory(); 611 612 612 613 IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 613 614 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 614 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);615 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 615 616 616 617 assertLexicallyEqual(task1, task1); … … 622 623 @Test 623 624 public void test_compare_MouseButtonDown_02() { 624 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();625 ITaskFactory taskFactory = new TaskFactory(); 625 626 626 627 IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 627 628 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 628 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);629 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 629 630 630 631 IEventType eventType2 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 631 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);632 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 632 633 633 634 assertLexicallyEqual(task1, task2); … … 639 640 @Test 640 641 public void test_compare_MouseButtonDown_03() { 641 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();642 ITaskFactory taskFactory = new TaskFactory(); 642 643 643 644 IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 644 645 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 645 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);646 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 646 647 647 648 IEventType eventType2 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 3); 648 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);649 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 649 650 650 651 assertSemanticallyEqual(task1, task2); … … 656 657 @Test 657 658 public void test_compare_MouseButtonDown_04() { 658 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();659 ITaskFactory taskFactory = new TaskFactory(); 659 660 660 661 IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 661 662 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 662 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);663 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 663 664 664 665 IEventType eventType2 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 3, 2); 665 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);666 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 666 667 667 668 assertSemanticallyEqual(task1, task2); … … 673 674 @Test 674 675 public void test_compare_MouseButtonDown_05() { 675 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();676 ITaskFactory taskFactory = new TaskFactory(); 676 677 677 678 IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 678 679 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 679 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);680 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 680 681 681 682 IEventType eventType2 = new MouseButtonDown(MouseButtonInteraction.Button.RIGHT, 1, 2); 682 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);683 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 683 684 684 685 assertUnequal(task1, task2); … … 690 691 @Test 691 692 public void test_compare_MouseButtonDown_06() { 692 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();693 ITaskFactory taskFactory = new TaskFactory(); 693 694 694 695 IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 695 696 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 696 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);697 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 697 698 698 699 IEventType eventType2 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 699 700 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 700 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);701 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 701 702 702 703 assertUnequal(task1, task2); … … 708 709 @Test 709 710 public void test_compare_MouseButtonUp_01() { 710 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();711 ITaskFactory taskFactory = new TaskFactory(); 711 712 712 713 IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 713 714 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 714 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);715 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 715 716 716 717 assertLexicallyEqual(task1, task1); … … 722 723 @Test 723 724 public void test_compare_MouseButtonUp_02() { 724 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();725 ITaskFactory taskFactory = new TaskFactory(); 725 726 726 727 IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 727 728 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 728 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);729 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 729 730 730 731 IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 731 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);732 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 732 733 733 734 assertLexicallyEqual(task1, task2); … … 739 740 @Test 740 741 public void test_compare_MouseButtonUp_03() { 741 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();742 ITaskFactory taskFactory = new TaskFactory(); 742 743 743 744 IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 744 745 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 745 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);746 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 746 747 747 748 IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 3); 748 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);749 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 749 750 750 751 assertSemanticallyEqual(task1, task2); … … 756 757 @Test 757 758 public void test_compare_MouseButtonUp_04() { 758 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();759 ITaskFactory taskFactory = new TaskFactory(); 759 760 760 761 IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 761 762 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 762 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);763 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 763 764 764 765 IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 3, 2); 765 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);766 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 766 767 767 768 assertSemanticallyEqual(task1, task2); … … 773 774 @Test 774 775 public void test_compare_MouseButtonUp_05() { 775 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();776 ITaskFactory taskFactory = new TaskFactory(); 776 777 777 778 IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 778 779 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 779 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);780 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 780 781 781 782 IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.RIGHT, 1, 2); 782 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);783 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 783 784 784 785 assertUnequal(task1, task2); … … 790 791 @Test 791 792 public void test_compare_MouseButtonUp_06() { 792 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();793 ITaskFactory taskFactory = new TaskFactory(); 793 794 794 795 IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 795 796 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 796 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);797 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 797 798 798 799 IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 799 800 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 800 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);801 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 801 802 802 803 assertUnequal(task1, task2); … … 808 809 @Test 809 810 public void test_compare_MouseClick_01() { 810 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();811 ITaskFactory taskFactory = new TaskFactory(); 811 812 812 813 IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 813 814 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 814 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);815 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 815 816 816 817 assertLexicallyEqual(task1, task1); … … 822 823 @Test 823 824 public void test_compare_MouseClick_02() { 824 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();825 ITaskFactory taskFactory = new TaskFactory(); 825 826 826 827 IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 827 828 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 828 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);829 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 829 830 830 831 IEventType eventType2 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 831 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);832 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 832 833 833 834 assertLexicallyEqual(task1, task2); … … 839 840 @Test 840 841 public void test_compare_MouseClick_03() { 841 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();842 ITaskFactory taskFactory = new TaskFactory(); 842 843 843 844 IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 844 845 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 845 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);846 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 846 847 847 848 IEventType eventType2 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 3); 848 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);849 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 849 850 850 851 assertSemanticallyEqual(task1, task2); … … 856 857 @Test 857 858 public void test_compare_MouseClick_04() { 858 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();859 ITaskFactory taskFactory = new TaskFactory(); 859 860 860 861 IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 861 862 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 862 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);863 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 863 864 864 865 IEventType eventType2 = new MouseClick(MouseButtonInteraction.Button.LEFT, 3, 2); 865 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);866 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 866 867 867 868 assertSemanticallyEqual(task1, task2); … … 873 874 @Test 874 875 public void test_compare_MouseClick_05() { 875 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();876 ITaskFactory taskFactory = new TaskFactory(); 876 877 877 878 IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 878 879 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 879 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);880 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 880 881 881 882 IEventType eventType2 = new MouseClick(MouseButtonInteraction.Button.RIGHT, 1, 2); 882 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);883 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 883 884 884 885 assertUnequal(task1, task2); … … 890 891 @Test 891 892 public void test_compare_MouseClick_06() { 892 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();893 ITaskFactory taskFactory = new TaskFactory(); 893 894 894 895 IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 895 896 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 896 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);897 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 897 898 898 899 IEventType eventType2 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 899 900 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 900 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);901 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 901 902 902 903 assertUnequal(task1, task2); … … 908 909 @Test 909 910 public void test_compare_MouseDoubleClick_01() { 910 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();911 ITaskFactory taskFactory = new TaskFactory(); 911 912 912 913 IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 913 914 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 914 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);915 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 915 916 916 917 assertLexicallyEqual(task1, task1); … … 922 923 @Test 923 924 public void test_compare_MouseDoubleClick_02() { 924 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();925 ITaskFactory taskFactory = new TaskFactory(); 925 926 926 927 IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 927 928 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 928 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);929 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 929 930 930 931 IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 931 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);932 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 932 933 933 934 assertLexicallyEqual(task1, task2); … … 939 940 @Test 940 941 public void test_compare_MouseDoubleClick_03() { 941 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();942 ITaskFactory taskFactory = new TaskFactory(); 942 943 943 944 IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 944 945 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 945 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);946 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 946 947 947 948 IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 3); 948 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);949 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 949 950 950 951 assertSemanticallyEqual(task1, task2); … … 956 957 @Test 957 958 public void test_compare_MouseDoubleClick_04() { 958 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();959 ITaskFactory taskFactory = new TaskFactory(); 959 960 960 961 IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 961 962 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 962 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);963 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 963 964 964 965 IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 3, 2); 965 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);966 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 966 967 967 968 assertSemanticallyEqual(task1, task2); … … 973 974 @Test 974 975 public void test_compare_MouseDoubleClick_05() { 975 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();976 ITaskFactory taskFactory = new TaskFactory(); 976 977 977 978 IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 978 979 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 979 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);980 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 980 981 981 982 IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.RIGHT, 1, 2); 982 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);983 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 983 984 984 985 assertUnequal(task1, task2); … … 990 991 @Test 991 992 public void test_compare_MouseDoubleClick_06() { 992 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();993 ITaskFactory taskFactory = new TaskFactory(); 993 994 994 995 IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 995 996 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 996 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);997 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 997 998 998 999 IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 999 1000 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 1000 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);1001 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 1001 1002 1002 1003 assertUnequal(task1, task2); … … 1008 1009 @Test 1009 1010 public void test_compare_MouseDragAndDrop_01() { 1010 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1011 ITaskFactory taskFactory = new TaskFactory(); 1011 1012 1012 1013 IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 1013 1014 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1014 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1015 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1015 1016 1016 1017 assertLexicallyEqual(task1, task1); … … 1022 1023 @Test 1023 1024 public void test_compare_MouseDragAndDrop_02() { 1024 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1025 ITaskFactory taskFactory = new TaskFactory(); 1025 1026 1026 1027 IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 1027 1028 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1028 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1029 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1029 1030 1030 1031 IEventType eventType2 = new MouseDragAndDrop(1, 2, 3, 4); 1031 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);1032 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 1032 1033 1033 1034 assertLexicallyEqual(task1, task2); … … 1039 1040 @Test 1040 1041 public void test_compare_MouseDragAndDrop_03() { 1041 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1042 ITaskFactory taskFactory = new TaskFactory(); 1042 1043 1043 1044 IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 1044 1045 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1045 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1046 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1046 1047 1047 1048 IEventType eventType2 = new MouseDragAndDrop(5, 2, 3, 4); 1048 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);1049 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 1049 1050 1050 1051 assertSemanticallyEqual(task1, task2); … … 1056 1057 @Test 1057 1058 public void test_compare_MouseDragAndDrop_04() { 1058 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1059 ITaskFactory taskFactory = new TaskFactory(); 1059 1060 1060 1061 IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 1061 1062 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1062 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1063 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1063 1064 1064 1065 IEventType eventType2 = new MouseDragAndDrop(1, 5, 3, 4); 1065 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);1066 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 1066 1067 1067 1068 assertSemanticallyEqual(task1, task2); … … 1073 1074 @Test 1074 1075 public void test_compare_MouseDragAndDrop_05() { 1075 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1076 ITaskFactory taskFactory = new TaskFactory(); 1076 1077 1077 1078 IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 1078 1079 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1079 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1080 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1080 1081 1081 1082 IEventType eventType2 = new MouseDragAndDrop(1, 2, 5, 4); 1082 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);1083 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 1083 1084 1084 1085 assertSemanticallyEqual(task1, task2); … … 1090 1091 @Test 1091 1092 public void test_compare_MouseDragAndDrop_06() { 1092 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1093 ITaskFactory taskFactory = new TaskFactory(); 1093 1094 1094 1095 IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 1095 1096 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1096 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1097 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1097 1098 1098 1099 IEventType eventType2 = new MouseDragAndDrop(1, 2, 3, 5); 1099 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);1100 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 1100 1101 1101 1102 assertSemanticallyEqual(task1, task2); … … 1107 1108 @Test 1108 1109 public void test_compare_MouseDragAndDrop_07() { 1109 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1110 ITaskFactory taskFactory = new TaskFactory(); 1110 1111 1111 1112 IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 1112 1113 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1113 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1114 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1114 1115 1115 1116 IEventType eventType2 = new MouseDragAndDrop(1, 2, 3, 4); 1116 1117 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 1117 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);1118 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 1118 1119 1119 1120 assertUnequal(task1, task2); … … 1125 1126 @Test 1126 1127 public void test_compare_Scroll_01() { 1127 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1128 ITaskFactory taskFactory = new TaskFactory(); 1128 1129 1129 1130 IEventType eventType1 = new Scroll(1, 2); 1130 1131 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1131 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1132 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1132 1133 1133 1134 assertLexicallyEqual(task1, task1); … … 1139 1140 @Test 1140 1141 public void test_compare_Scroll_02() { 1141 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1142 ITaskFactory taskFactory = new TaskFactory(); 1142 1143 1143 1144 IEventType eventType1 = new Scroll(1, 2); 1144 1145 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1145 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1146 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1146 1147 1147 1148 IEventType eventType2 = new Scroll(1, 2); 1148 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);1149 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 1149 1150 1150 1151 assertLexicallyEqual(task1, task2); … … 1156 1157 @Test 1157 1158 public void test_compare_Scroll_03() { 1158 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1159 ITaskFactory taskFactory = new TaskFactory(); 1159 1160 1160 1161 IEventType eventType1 = new Scroll(1, 2); 1161 1162 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1162 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1163 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1163 1164 1164 1165 IEventType eventType2 = new Scroll(3, 2); 1165 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);1166 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 1166 1167 1167 1168 assertSemanticallyEqual(task1, task2); … … 1173 1174 @Test 1174 1175 public void test_compare_Scroll_04() { 1175 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1176 ITaskFactory taskFactory = new TaskFactory(); 1176 1177 1177 1178 IEventType eventType1 = new Scroll(1, 2); 1178 1179 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1179 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1180 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1180 1181 1181 1182 IEventType eventType2 = new Scroll(1, 3); 1182 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);1183 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 1183 1184 1184 1185 assertSemanticallyEqual(task1, task2); … … 1190 1191 @Test 1191 1192 public void test_compare_Scroll_05() { 1192 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1193 ITaskFactory taskFactory = new TaskFactory(); 1193 1194 1194 1195 IEventType eventType1 = new Scroll(1, 2); 1195 1196 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1196 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1197 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1197 1198 1198 1199 IEventType eventType2 = new Scroll(1, 2); 1199 1200 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 1200 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);1201 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 1201 1202 1202 1203 assertUnequal(task1, task2); … … 1208 1209 @Test 1209 1210 public void test_compare_TextInput_01() { 1210 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1211 ITaskFactory taskFactory = new TaskFactory(); 1211 1212 1212 1213 IEventType eventType1 = new StringEventType("eventType1"); … … 1215 1216 textInputEvents1.add(new Event(eventType1, eventTarget1)); 1216 1217 eventType1 = new TextInput("enteredText1", textInputEvents1); 1217 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1218 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1218 1219 1219 1220 assertLexicallyEqual(task1, task1); … … 1225 1226 @Test 1226 1227 public void test_compare_TextInput_02() { 1227 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1228 ITaskFactory taskFactory = new TaskFactory(); 1228 1229 1229 1230 IEventType eventType1 = new StringEventType("eventType1"); … … 1232 1233 textInputEvents1.add(new Event(eventType1, eventTarget1)); 1233 1234 eventType1 = new TextInput("enteredText1", textInputEvents1); 1234 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1235 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1235 1236 1236 1237 IEventType eventType2 = new TextInput("enteredText1", textInputEvents1); 1237 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);1238 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 1238 1239 1239 1240 assertLexicallyEqual(task1, task2); … … 1245 1246 @Test 1246 1247 public void test_compare_TextInput_03() { 1247 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1248 ITaskFactory taskFactory = new TaskFactory(); 1248 1249 1249 1250 IEventType eventType1 = new StringEventType("eventType1"); … … 1252 1253 textInputEvents1.add(new Event(eventType1, eventTarget1)); 1253 1254 eventType1 = new TextInput("enteredText1", textInputEvents1); 1254 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1255 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1255 1256 1256 1257 IEventType eventType2 = new StringEventType("eventType2"); … … 1258 1259 textInputEvents2.add(new Event(eventType2, eventTarget1)); 1259 1260 eventType2 = new TextInput("enteredText1", textInputEvents2); 1260 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);1261 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 1261 1262 1262 1263 assertSyntacticallyEqual(task1, task2); … … 1268 1269 @Test 1269 1270 public void test_compare_TextInput_04() { 1270 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1271 ITaskFactory taskFactory = new TaskFactory(); 1271 1272 1272 1273 IEventType eventType1 = new StringEventType("eventType1"); … … 1275 1276 textInputEvents1.add(new Event(eventType1, eventTarget1)); 1276 1277 eventType1 = new TextInput("enteredText1", textInputEvents1); 1277 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1278 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1278 1279 1279 1280 IEventType eventType2 = new StringEventType("eventType2"); … … 1281 1282 textInputEvents2.add(new Event(eventType2, eventTarget1)); 1282 1283 eventType2 = new TextInput("enteredText2", textInputEvents2); 1283 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);1284 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 1284 1285 1285 1286 assertSemanticallyEqual(task1, task2); … … 1291 1292 @Test 1292 1293 public void test_compare_TextInput_05() { 1293 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1294 ITaskFactory taskFactory = new TaskFactory(); 1294 1295 1295 1296 IEventType eventType1 = new StringEventType("eventType1"); … … 1298 1299 textInputEvents1.add(new Event(eventType1, eventTarget1)); 1299 1300 eventType1 = new TextInput("enteredText1", textInputEvents1); 1300 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1301 1302 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 1303 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType1, eventTarget2);1301 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1302 1303 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 1304 ITask task2 = taskFactory.createNewEventTask(eventType1, eventTarget2); 1304 1305 1305 1306 assertUnequal(task1, task2); … … 1311 1312 @Test 1312 1313 public void test_compare_TextSelection_01() { 1313 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1314 ITaskFactory taskFactory = new TaskFactory(); 1314 1315 1315 1316 IEventType eventType1 = new TextSelection(); 1316 1317 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1317 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1318 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1318 1319 1319 1320 assertLexicallyEqual(task1, task1); … … 1325 1326 @Test 1326 1327 public void test_compare_TextSelection_02() { 1327 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1328 ITaskFactory taskFactory = new TaskFactory(); 1328 1329 1329 1330 IEventType eventType1 = new TextSelection(); 1330 1331 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1331 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1332 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1332 1333 1333 1334 IEventType eventType2 = new TextSelection(); 1334 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);1335 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 1335 1336 1336 1337 assertLexicallyEqual(task1, task2); … … 1342 1343 @Test 1343 1344 public void test_compare_TextSelection_03() { 1344 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1345 ITaskFactory taskFactory = new TaskFactory(); 1345 1346 1346 1347 IEventType eventType1 = new TextSelection(); 1347 1348 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1348 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1349 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1349 1350 1350 1351 IEventType eventType2 = new TextSelection(); 1351 1352 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 1352 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);1353 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 1353 1354 1354 1355 assertUnequal(task1, task2); … … 1360 1361 @Test 1361 1362 public void test_compare_ValueSelection_01() { 1362 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1363 ITaskFactory taskFactory = new TaskFactory(); 1363 1364 1364 1365 IEventType eventType1 = new ValueSelection<String>("value1"); 1365 1366 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1366 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1367 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1367 1368 1368 1369 assertLexicallyEqual(task1, task1); … … 1374 1375 @Test 1375 1376 public void test_compare_ValueSelection_02() { 1376 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1377 ITaskFactory taskFactory = new TaskFactory(); 1377 1378 1378 1379 IEventType eventType1 = new ValueSelection<String>("value1"); 1379 1380 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1380 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1381 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1381 1382 1382 1383 IEventType eventType2 = new ValueSelection<String>("value1"); 1383 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);1384 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 1384 1385 1385 1386 assertLexicallyEqual(task1, task2); … … 1391 1392 @Test 1392 1393 public void test_compare_ValueSelection_03() { 1393 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1394 ITaskFactory taskFactory = new TaskFactory(); 1394 1395 1395 1396 IEventType eventType1 = new ValueSelection<String>("value1"); 1396 1397 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1397 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1398 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1398 1399 1399 1400 IEventType eventType2 = new ValueSelection<String>("value2"); 1400 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1);1401 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 1401 1402 1402 1403 assertSemanticallyEqual(task1, task2); … … 1408 1409 @Test 1409 1410 public void test_compare_ValueSelection_04() { 1410 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();1411 ITaskFactory taskFactory = new TaskFactory(); 1411 1412 1412 1413 IEventType eventType1 = new ValueSelection<String>("value1"); 1413 1414 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 1414 ITask TreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1);1415 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 1415 1416 1416 1417 IEventType eventType2 = new ValueSelection<String>("value1"); 1417 1418 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 1418 ITask TreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2);1419 1420 assertUnequal(task1, task2); 1421 } 1422 1423 /** 1424 * 1425 */ 1426 private void assertLexicallyEqual(ITask TreeNode task1, ITaskTreeNodetask2) {1419 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 1420 1421 assertUnequal(task1, task2); 1422 } 1423 1424 /** 1425 * 1426 */ 1427 private void assertLexicallyEqual(ITask task1, ITask task2) { 1427 1428 GUIEventTaskComparisonRule rule = new GUIEventTaskComparisonRule(); 1428 1429 1429 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(task1, task2));1430 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, task2)); 1430 1431 assertTrue(rule.areLexicallyEqual(task1, task2)); 1431 1432 assertTrue(rule.areSyntacticallyEqual(task1, task2)); 1432 1433 assertTrue(rule.areSemanticallyEqual(task1, task2)); 1433 1434 1434 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(task2, task1));1435 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task2, task1)); 1435 1436 assertTrue(rule.areLexicallyEqual(task2, task1)); 1436 1437 assertTrue(rule.areSyntacticallyEqual(task2, task1)); … … 1441 1442 * 1442 1443 */ 1443 private void assertSyntacticallyEqual(ITask TreeNode task1, ITaskTreeNodetask2) {1444 private void assertSyntacticallyEqual(ITask task1, ITask task2) { 1444 1445 GUIEventTaskComparisonRule rule = new GUIEventTaskComparisonRule(); 1445 1446 1446 assertEquals( NodeEquality.SYNTACTICALLY_EQUAL, rule.compare(task1, task2));1447 assertEquals(TaskEquality.SYNTACTICALLY_EQUAL, rule.compare(task1, task2)); 1447 1448 assertFalse(rule.areLexicallyEqual(task1, task2)); 1448 1449 assertTrue(rule.areSyntacticallyEqual(task1, task2)); 1449 1450 assertTrue(rule.areSemanticallyEqual(task1, task2)); 1450 1451 1451 assertEquals( NodeEquality.SYNTACTICALLY_EQUAL, rule.compare(task2, task1));1452 assertEquals(TaskEquality.SYNTACTICALLY_EQUAL, rule.compare(task2, task1)); 1452 1453 assertFalse(rule.areLexicallyEqual(task2, task1)); 1453 1454 assertTrue(rule.areSyntacticallyEqual(task2, task1)); … … 1458 1459 * 1459 1460 */ 1460 private void assertSemanticallyEqual(ITask TreeNode task1, ITaskTreeNodetask2) {1461 private void assertSemanticallyEqual(ITask task1, ITask task2) { 1461 1462 GUIEventTaskComparisonRule rule = new GUIEventTaskComparisonRule(); 1462 1463 1463 assertEquals( NodeEquality.SEMANTICALLY_EQUAL, rule.compare(task1, task2));1464 assertEquals(TaskEquality.SEMANTICALLY_EQUAL, rule.compare(task1, task2)); 1464 1465 assertFalse(rule.areLexicallyEqual(task1, task2)); 1465 1466 assertFalse(rule.areSyntacticallyEqual(task1, task2)); 1466 1467 assertTrue(rule.areSemanticallyEqual(task1, task2)); 1467 1468 1468 assertEquals( NodeEquality.SEMANTICALLY_EQUAL, rule.compare(task2, task1));1469 assertEquals(TaskEquality.SEMANTICALLY_EQUAL, rule.compare(task2, task1)); 1469 1470 assertFalse(rule.areLexicallyEqual(task2, task1)); 1470 1471 assertFalse(rule.areSyntacticallyEqual(task2, task1)); … … 1475 1476 * 1476 1477 */ 1477 private void assertUnequal(ITask TreeNode task1, ITaskTreeNodetask2) {1478 private void assertUnequal(ITask task1, ITask task2) { 1478 1479 GUIEventTaskComparisonRule rule = new GUIEventTaskComparisonRule(); 1479 1480 1480 assertEquals( NodeEquality.UNEQUAL, rule.compare(task1, task2));1481 assertEquals(TaskEquality.UNEQUAL, rule.compare(task1, task2)); 1481 1482 assertFalse(rule.areLexicallyEqual(task1, task2)); 1482 1483 assertFalse(rule.areSyntacticallyEqual(task1, task2)); 1483 1484 assertFalse(rule.areSemanticallyEqual(task1, task2)); 1484 1485 1485 assertEquals( NodeEquality.UNEQUAL, rule.compare(task2, task1));1486 assertEquals(TaskEquality.UNEQUAL, rule.compare(task2, task1)); 1486 1487 assertFalse(rule.areLexicallyEqual(task2, task1)); 1487 1488 assertFalse(rule.areSyntacticallyEqual(task2, task1)); -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/IterationComparisonRuleTest.java
r1125 r1146 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.tasktrees. nodeequality;15 package de.ugoe.cs.autoquest.tasktrees.taskequality; 16 16 17 17 import static org.junit.Assert.*; … … 19 19 import org.junit.Test; 20 20 21 import de.ugoe.cs.autoquest.tasktrees.nodeequality.IterationComparisonRule; 22 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEquality; 23 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEqualityRuleManager; 21 import de.ugoe.cs.autoquest.eventcore.IEventTarget; 22 import de.ugoe.cs.autoquest.eventcore.IEventType; 23 import de.ugoe.cs.autoquest.eventcore.StringEventType; 24 import de.ugoe.cs.autoquest.tasktrees.taskequality.IterationComparisonRule; 25 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 26 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEqualityRuleManager; 24 27 import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 25 28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 26 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask TreeBuilder;27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask TreeNode;28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask TreeNodeFactory;29 import de.ugoe.cs.autoquest.tasktrees.treeimpl.Task TreeBuilder;30 import de.ugoe.cs.autoquest.tasktrees.treeimpl.Task TreeNode;31 import de.ugoe.cs.autoquest.t asktrees.treeimpl.TaskTreeNodeFactory;29 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 30 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 31 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 32 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; 33 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 34 import de.ugoe.cs.autoquest.test.DummyGUIElement; 32 35 33 36 /** … … 41 44 @Test 42 45 public void test() { 43 NodeEqualityRuleManager manager = new NodeEqualityRuleManager();46 TaskEqualityRuleManager manager = new TaskEqualityRuleManager(); 44 47 manager.init(); 45 48 46 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();47 ITask TreeBuilder treeBuilder = new TaskTreeBuilder();49 ITaskFactory taskFactory = new TaskFactory(); 50 ITaskBuilder treeBuilder = new TaskBuilder(); 48 51 49 52 IterationComparisonRule rule = new IterationComparisonRule(manager); 50 53 51 ITaskTreeNode task1 = new TaskTreeNode("task1"); 52 ITaskTreeNode task2 = new TaskTreeNode("task2"); 54 IEventType eventType1 = new StringEventType("eventType1"); 55 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 56 57 IEventType eventType2 = new StringEventType("eventType2"); 58 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 59 60 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 61 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 53 62 54 63 assertFalse(rule.isApplicable(task1, task2)); 55 64 56 IIteration iteration1 = t reeNodeFactory.createNewIteration();57 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(iteration1, iteration1));65 IIteration iteration1 = taskFactory.createNewIteration(); 66 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration1, iteration1)); 58 67 59 IIteration iteration2 = t reeNodeFactory.createNewIteration();68 IIteration iteration2 = taskFactory.createNewIteration(); 60 69 61 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(iteration1, iteration2));62 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(iteration2, iteration1));70 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration1, iteration2)); 71 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration2, iteration1)); 63 72 64 treeBuilder.set Child(iteration1, task1);73 treeBuilder.setMarkedTask(iteration1, task1); 65 74 66 assertEquals( NodeEquality.UNEQUAL, rule.compare(iteration1, iteration2));67 assertEquals( NodeEquality.UNEQUAL, rule.compare(iteration2, iteration1));75 assertEquals(TaskEquality.UNEQUAL, rule.compare(iteration1, iteration2)); 76 assertEquals(TaskEquality.UNEQUAL, rule.compare(iteration2, iteration1)); 68 77 69 treeBuilder.set Child(iteration2, task1);78 treeBuilder.setMarkedTask(iteration2, task1); 70 79 71 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(iteration1, iteration2));72 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(iteration2, iteration1));80 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration1, iteration2)); 81 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration2, iteration1)); 73 82 74 treeBuilder.set Child(iteration1, task2);83 treeBuilder.setMarkedTask(iteration1, task2); 75 84 76 assertEquals( NodeEquality.UNEQUAL, rule.compare(iteration1, iteration2));77 assertEquals( NodeEquality.UNEQUAL, rule.compare(iteration2, iteration1));85 assertEquals(TaskEquality.UNEQUAL, rule.compare(iteration1, iteration2)); 86 assertEquals(TaskEquality.UNEQUAL, rule.compare(iteration2, iteration1)); 78 87 79 treeBuilder.set Child(iteration2, task2);88 treeBuilder.setMarkedTask(iteration2, task2); 80 89 81 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(iteration1, iteration2));82 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(iteration2, iteration1));90 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration1, iteration2)); 91 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration2, iteration1)); 83 92 84 ISelection selection1 = t reeNodeFactory.createNewSelection();93 ISelection selection1 = taskFactory.createNewSelection(); 85 94 treeBuilder.addChild(selection1, task2); 86 treeBuilder.set Child(iteration1, selection1);95 treeBuilder.setMarkedTask(iteration1, selection1); 87 96 88 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(iteration1, iteration2));89 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(iteration2, iteration1));97 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration1, iteration2)); 98 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration2, iteration1)); 90 99 91 ISelection selection2 = t reeNodeFactory.createNewSelection();100 ISelection selection2 = taskFactory.createNewSelection(); 92 101 treeBuilder.addChild(selection2, task2); 93 treeBuilder.set Child(iteration2, selection2);102 treeBuilder.setMarkedTask(iteration2, selection2); 94 103 95 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(iteration1, iteration2));96 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(iteration2, iteration1));104 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration1, iteration2)); 105 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration2, iteration1)); 97 106 98 107 assertFalse(rule.isApplicable(iteration1, selection1)); -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/SelectionComparisonRuleTest.java
r1125 r1146 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.tasktrees. nodeequality;15 package de.ugoe.cs.autoquest.tasktrees.taskequality; 16 16 17 17 import static org.junit.Assert.*; … … 19 19 import org.junit.Test; 20 20 21 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEquality; 22 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEqualityRuleManager; 23 import de.ugoe.cs.autoquest.tasktrees.nodeequality.SelectionComparisonRule; 21 import de.ugoe.cs.autoquest.eventcore.IEventTarget; 22 import de.ugoe.cs.autoquest.eventcore.IEventType; 23 import de.ugoe.cs.autoquest.eventcore.StringEventType; 24 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 25 import de.ugoe.cs.autoquest.tasktrees.taskequality.SelectionComparisonRule; 26 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEqualityRuleManager; 24 27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 25 28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 26 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask TreeBuilder;27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask TreeNode;28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask TreeNodeFactory;29 import de.ugoe.cs.autoquest.tasktrees.treeimpl.Task TreeBuilder;30 import de.ugoe.cs.autoquest.tasktrees.treeimpl.Task TreeNode;31 import de.ugoe.cs.autoquest.t asktrees.treeimpl.TaskTreeNodeFactory;29 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 30 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 31 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 32 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; 33 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 34 import de.ugoe.cs.autoquest.test.DummyGUIElement; 32 35 33 36 /** … … 41 44 @Test 42 45 public void test() { 43 NodeEqualityRuleManager manager = new NodeEqualityRuleManager();46 TaskEqualityRuleManager manager = new TaskEqualityRuleManager(); 44 47 manager.init(); 45 48 46 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();47 ITask TreeBuilder treeBuilder = new TaskTreeBuilder();49 ITaskFactory taskFactory = new TaskFactory(); 50 ITaskBuilder treeBuilder = new TaskBuilder(); 48 51 49 52 SelectionComparisonRule rule = new SelectionComparisonRule(manager); 50 53 51 ITaskTreeNode task1 = new TaskTreeNode("task1"); 52 ITaskTreeNode task2 = new TaskTreeNode("task2"); 54 IEventType eventType1 = new StringEventType("eventType1"); 55 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 56 57 IEventType eventType2 = new StringEventType("eventType2"); 58 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 59 60 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 61 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 53 62 54 63 assertFalse(rule.isApplicable(task1, task2)); 55 64 56 ISelection selection1 = t reeNodeFactory.createNewSelection();57 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(selection1, selection1));65 ISelection selection1 = taskFactory.createNewSelection(); 66 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection1, selection1)); 58 67 59 ISelection selection2 = t reeNodeFactory.createNewSelection();68 ISelection selection2 = taskFactory.createNewSelection(); 60 69 61 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(selection1, selection2));62 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(selection2, selection1));70 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection1, selection2)); 71 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection2, selection1)); 63 72 64 73 treeBuilder.addChild(selection1, task1); 65 74 66 assertEquals( NodeEquality.UNEQUAL, rule.compare(selection1, selection2));67 assertEquals( NodeEquality.UNEQUAL, rule.compare(selection2, selection1));75 assertEquals(TaskEquality.UNEQUAL, rule.compare(selection1, selection2)); 76 assertEquals(TaskEquality.UNEQUAL, rule.compare(selection2, selection1)); 68 77 69 78 treeBuilder.addChild(selection2, task1); 70 79 71 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(selection1, selection2));72 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(selection2, selection1));80 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection1, selection2)); 81 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection2, selection1)); 73 82 74 83 treeBuilder.addChild(selection1, task2); 75 84 76 assertEquals( NodeEquality.UNEQUAL, rule.compare(selection1, selection2));77 assertEquals( NodeEquality.UNEQUAL, rule.compare(selection2, selection1));85 assertEquals(TaskEquality.UNEQUAL, rule.compare(selection1, selection2)); 86 assertEquals(TaskEquality.UNEQUAL, rule.compare(selection2, selection1)); 78 87 79 88 treeBuilder.addChild(selection2, task2); 80 89 81 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(selection1, selection2));82 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(selection2, selection1));90 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection1, selection2)); 91 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection2, selection1)); 83 92 84 ISelection selection3 = t reeNodeFactory.createNewSelection();93 ISelection selection3 = taskFactory.createNewSelection(); 85 94 treeBuilder.addChild(selection3, task2); 86 95 treeBuilder.addChild(selection3, task1); 87 96 88 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(selection1, selection3));89 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(selection3, selection1));97 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection1, selection3)); 98 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection3, selection1)); 90 99 91 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(selection2, selection3));92 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(selection3, selection2));100 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection2, selection3)); 101 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection3, selection2)); 93 102 94 ISequence sequence = t reeNodeFactory.createNewSequence();103 ISequence sequence = taskFactory.createNewSequence(); 95 104 assertFalse(rule.isApplicable(selection1, sequence)); 96 105 assertFalse(rule.isApplicable(sequence, selection1)); -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/SequenceComparisonRuleTest.java
r1125 r1146 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.tasktrees. nodeequality;15 package de.ugoe.cs.autoquest.tasktrees.taskequality; 16 16 17 17 import static org.junit.Assert.*; … … 19 19 import org.junit.Test; 20 20 21 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEquality; 22 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEqualityRuleManager; 23 import de.ugoe.cs.autoquest.tasktrees.nodeequality.SequenceComparisonRule; 21 import de.ugoe.cs.autoquest.eventcore.IEventTarget; 22 import de.ugoe.cs.autoquest.eventcore.IEventType; 23 import de.ugoe.cs.autoquest.eventcore.StringEventType; 24 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 25 import de.ugoe.cs.autoquest.tasktrees.taskequality.SequenceComparisonRule; 26 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEqualityRuleManager; 24 27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 25 28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 26 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask TreeBuilder;27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask TreeNode;28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask TreeNodeFactory;29 import de.ugoe.cs.autoquest.tasktrees.treeimpl.Task TreeBuilder;30 import de.ugoe.cs.autoquest.tasktrees.treeimpl.Task TreeNode;31 import de.ugoe.cs.autoquest.t asktrees.treeimpl.TaskTreeNodeFactory;29 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 30 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 31 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 32 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; 33 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 34 import de.ugoe.cs.autoquest.test.DummyGUIElement; 32 35 33 36 /** … … 41 44 @Test 42 45 public void test() { 43 NodeEqualityRuleManager manager = new NodeEqualityRuleManager();46 TaskEqualityRuleManager manager = new TaskEqualityRuleManager(); 44 47 manager.init(); 45 48 46 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();47 ITask TreeBuilder treeBuilder = new TaskTreeBuilder();49 ITaskFactory taskFactory = new TaskFactory(); 50 ITaskBuilder treeBuilder = new TaskBuilder(); 48 51 49 52 SequenceComparisonRule rule = new SequenceComparisonRule(manager); 50 53 51 ITaskTreeNode task1 = new TaskTreeNode("task1"); 52 ITaskTreeNode task2 = new TaskTreeNode("task2"); 54 IEventType eventType1 = new StringEventType("eventType1"); 55 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 56 57 IEventType eventType2 = new StringEventType("eventType2"); 58 IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 59 60 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 61 ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 53 62 54 63 assertFalse(rule.isApplicable(task1, task2)); 55 64 56 ISequence sequence1 = t reeNodeFactory.createNewSequence();57 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(sequence1, sequence1));65 ISequence sequence1 = taskFactory.createNewSequence(); 66 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(sequence1, sequence1)); 58 67 59 ISequence sequence2 = t reeNodeFactory.createNewSequence();68 ISequence sequence2 = taskFactory.createNewSequence(); 60 69 61 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(sequence1, sequence2));62 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(sequence2, sequence1));70 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(sequence1, sequence2)); 71 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(sequence2, sequence1)); 63 72 64 73 treeBuilder.addChild(sequence1, task1); 65 74 66 assertEquals( NodeEquality.UNEQUAL, rule.compare(sequence1, sequence2));67 assertEquals( NodeEquality.UNEQUAL, rule.compare(sequence2, sequence1));75 assertEquals(TaskEquality.UNEQUAL, rule.compare(sequence1, sequence2)); 76 assertEquals(TaskEquality.UNEQUAL, rule.compare(sequence2, sequence1)); 68 77 69 78 treeBuilder.addChild(sequence2, task1); 70 79 71 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(sequence1, sequence2));72 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(sequence2, sequence1));80 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(sequence1, sequence2)); 81 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(sequence2, sequence1)); 73 82 74 83 treeBuilder.addChild(sequence1, task2); 75 84 76 assertEquals( NodeEquality.UNEQUAL, rule.compare(sequence1, sequence2));77 assertEquals( NodeEquality.UNEQUAL, rule.compare(sequence2, sequence1));85 assertEquals(TaskEquality.UNEQUAL, rule.compare(sequence1, sequence2)); 86 assertEquals(TaskEquality.UNEQUAL, rule.compare(sequence2, sequence1)); 78 87 79 88 treeBuilder.addChild(sequence2, task2); 80 89 81 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(sequence1, sequence2));82 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(sequence2, sequence1));90 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(sequence1, sequence2)); 91 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(sequence2, sequence1)); 83 92 84 ISequence sequence3 = t reeNodeFactory.createNewSequence();93 ISequence sequence3 = taskFactory.createNewSequence(); 85 94 treeBuilder.addChild(sequence3, task2); 86 95 treeBuilder.addChild(sequence3, task1); 87 96 88 assertEquals( NodeEquality.UNEQUAL, rule.compare(sequence1, sequence3));89 assertEquals( NodeEquality.UNEQUAL, rule.compare(sequence3, sequence1));90 assertEquals( NodeEquality.UNEQUAL, rule.compare(sequence2, sequence3));91 assertEquals( NodeEquality.UNEQUAL, rule.compare(sequence3, sequence2));97 assertEquals(TaskEquality.UNEQUAL, rule.compare(sequence1, sequence3)); 98 assertEquals(TaskEquality.UNEQUAL, rule.compare(sequence3, sequence1)); 99 assertEquals(TaskEquality.UNEQUAL, rule.compare(sequence2, sequence3)); 100 assertEquals(TaskEquality.UNEQUAL, rule.compare(sequence3, sequence2)); 92 101 93 ISelection selection = t reeNodeFactory.createNewSelection();102 ISelection selection = taskFactory.createNewSelection(); 94 103 assertFalse(rule.isApplicable(sequence1, selection)); 95 104 assertFalse(rule.isApplicable(selection, sequence1)); -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskAndIterationComparisonRuleTest.java
r927 r1146 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.tasktrees. nodeequality;15 package de.ugoe.cs.autoquest.tasktrees.taskequality; 16 16 17 17 import static org.junit.Assert.*; … … 19 19 import org.junit.Test; 20 20 21 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeAndIterationComparisonRule; 22 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEquality; 23 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEqualityRuleManager; 21 import de.ugoe.cs.autoquest.eventcore.IEventTarget; 22 import de.ugoe.cs.autoquest.eventcore.IEventType; 23 import de.ugoe.cs.autoquest.eventcore.StringEventType; 24 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskAndIterationComparisonRule; 25 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 26 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEqualityRuleManager; 24 27 import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 25 28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 26 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask TreeBuilder;27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask TreeNode;28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask TreeNodeFactory;29 import de.ugoe.cs.autoquest.tasktrees.treeimpl.Task TreeBuilder;30 import de.ugoe.cs.autoquest.tasktrees.treeimpl.Task TreeNode;31 import de.ugoe.cs.autoquest.t asktrees.treeimpl.TaskTreeNodeFactory;29 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 30 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 31 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 32 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; 33 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 34 import de.ugoe.cs.autoquest.test.DummyGUIElement; 32 35 33 36 /** 34 37 * @author Patrick Harms 35 38 */ 36 public class NodeAndIterationComparisonRuleTest {39 public class TaskAndIterationComparisonRuleTest { 37 40 38 41 /** … … 41 44 @Test 42 45 public void test() { 43 NodeEqualityRuleManager manager = new NodeEqualityRuleManager();46 TaskEqualityRuleManager manager = new TaskEqualityRuleManager(); 44 47 manager.init(); 45 48 46 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();47 ITask TreeBuilder treeBuilder = new TaskTreeBuilder();49 ITaskFactory taskFactory = new TaskFactory(); 50 ITaskBuilder treeBuilder = new TaskBuilder(); 48 51 49 NodeAndIterationComparisonRule rule = new NodeAndIterationComparisonRule(manager);52 TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule(manager); 50 53 51 ITaskTreeNode task1 = new TaskTreeNode("task1"); 54 IEventType eventType1 = new StringEventType("eventType1"); 55 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 56 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 52 57 53 58 assertNull(rule.compare(task1, task1)); 54 59 55 IIteration iteration1 = t reeNodeFactory.createNewIteration();60 IIteration iteration1 = taskFactory.createNewIteration(); 56 61 assertNull(rule.compare(iteration1, iteration1)); 57 62 assertNull(rule.compare(task1, iteration1)); 58 63 assertNull(rule.compare(iteration1, task1)); 59 64 60 treeBuilder.set Child(iteration1, task1);65 treeBuilder.setMarkedTask(iteration1, task1); 61 66 62 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(iteration1, task1));63 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(task1, iteration1));67 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration1, task1)); 68 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, iteration1)); 64 69 65 ISelection selection1 = t reeNodeFactory.createNewSelection();70 ISelection selection1 = taskFactory.createNewSelection(); 66 71 treeBuilder.addChild(selection1, task1); 67 treeBuilder.set Child(iteration1, selection1);72 treeBuilder.setMarkedTask(iteration1, selection1); 68 73 69 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(iteration1, task1));70 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(task1, iteration1));74 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration1, task1)); 75 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, iteration1)); 71 76 } 72 77 -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskAndSelectionComparisonRuleTest.java
r927 r1146 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.tasktrees. nodeequality;15 package de.ugoe.cs.autoquest.tasktrees.taskequality; 16 16 17 17 import static org.junit.Assert.*; … … 19 19 import org.junit.Test; 20 20 21 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeAndSelectionComparisonRule; 22 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEquality; 23 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEqualityRuleManager; 21 import de.ugoe.cs.autoquest.eventcore.IEventTarget; 22 import de.ugoe.cs.autoquest.eventcore.IEventType; 23 import de.ugoe.cs.autoquest.eventcore.StringEventType; 24 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskAndSelectionComparisonRule; 25 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 26 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEqualityRuleManager; 24 27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 25 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask TreeBuilder;26 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask TreeNode;27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask TreeNodeFactory;28 import de.ugoe.cs.autoquest.tasktrees.treeimpl.Task TreeBuilder;29 import de.ugoe.cs.autoquest.tasktrees.treeimpl.Task TreeNode;30 import de.ugoe.cs.autoquest.t asktrees.treeimpl.TaskTreeNodeFactory;28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 29 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 30 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 31 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; 32 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 33 import de.ugoe.cs.autoquest.test.DummyGUIElement; 31 34 32 35 /** 33 36 * @author Patrick Harms 34 37 */ 35 public class NodeAndSelectionComparisonRuleTest {38 public class TaskAndSelectionComparisonRuleTest { 36 39 37 40 /** … … 40 43 @Test 41 44 public void test() { 42 NodeEqualityRuleManager manager = new NodeEqualityRuleManager();45 TaskEqualityRuleManager manager = new TaskEqualityRuleManager(); 43 46 manager.init(); 44 47 45 ITask TreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory();46 ITask TreeBuilder treeBuilder = new TaskTreeBuilder();48 ITaskFactory taskFactory = new TaskFactory(); 49 ITaskBuilder treeBuilder = new TaskBuilder(); 47 50 48 NodeAndSelectionComparisonRule rule = new NodeAndSelectionComparisonRule(manager);51 TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule(manager); 49 52 50 ITaskTreeNode task1 = new TaskTreeNode("task1"); 53 IEventType eventType1 = new StringEventType("eventType1"); 54 IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 55 ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 51 56 52 57 assertNull(rule.compare(task1, task1)); 53 58 54 ISelection selection1 = t reeNodeFactory.createNewSelection();59 ISelection selection1 = taskFactory.createNewSelection(); 55 60 assertNull(rule.compare(selection1, selection1)); 56 61 assertNull(rule.compare(task1, selection1)); … … 59 64 treeBuilder.addChild(selection1, task1); 60 65 61 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(selection1, task1));62 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(task1, selection1));66 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection1, task1)); 67 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, selection1)); 63 68 64 selection1 = t reeNodeFactory.createNewSelection();65 ISelection selection2 = t reeNodeFactory.createNewSelection();69 selection1 = taskFactory.createNewSelection(); 70 ISelection selection2 = taskFactory.createNewSelection(); 66 71 treeBuilder.addChild(selection2, task1); 67 72 treeBuilder.addChild(selection1, selection2); 68 73 69 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(selection1, task1));70 assertEquals( NodeEquality.LEXICALLY_EQUAL, rule.compare(task1, selection1));74 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection1, task1)); 75 assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, selection1)); 71 76 } 72 77 -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskEqualityTest.java
r927 r1146 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.tasktrees. nodeequality;15 package de.ugoe.cs.autoquest.tasktrees.taskequality; 16 16 17 17 import static org.junit.Assert.*; … … 19 19 import org.junit.Test; 20 20 21 import de.ugoe.cs.autoquest.tasktrees. nodeequality.NodeEquality;21 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 22 22 23 23 /** 24 24 * @author Patrick Harms 25 25 */ 26 public class NodeEqualityTest {26 public class TaskEqualityTest { 27 27 28 28 /** … … 31 31 @Test 32 32 public void test() { 33 assertTrue( NodeEquality.IDENTICAL.isAtLeast(NodeEquality.IDENTICAL));34 assertTrue( NodeEquality.IDENTICAL.isAtLeast(NodeEquality.LEXICALLY_EQUAL));35 assertTrue( NodeEquality.IDENTICAL.isAtLeast(NodeEquality.SYNTACTICALLY_EQUAL));36 assertTrue( NodeEquality.IDENTICAL.isAtLeast(NodeEquality.SEMANTICALLY_EQUAL));37 assertFalse( NodeEquality.IDENTICAL.isAtLeast(NodeEquality.UNEQUAL));33 assertTrue(TaskEquality.IDENTICAL.isAtLeast(TaskEquality.IDENTICAL)); 34 assertTrue(TaskEquality.IDENTICAL.isAtLeast(TaskEquality.LEXICALLY_EQUAL)); 35 assertTrue(TaskEquality.IDENTICAL.isAtLeast(TaskEquality.SYNTACTICALLY_EQUAL)); 36 assertTrue(TaskEquality.IDENTICAL.isAtLeast(TaskEquality.SEMANTICALLY_EQUAL)); 37 assertFalse(TaskEquality.IDENTICAL.isAtLeast(TaskEquality.UNEQUAL)); 38 38 39 assertFalse( NodeEquality.LEXICALLY_EQUAL.isAtLeast(NodeEquality.IDENTICAL));40 assertTrue( NodeEquality.LEXICALLY_EQUAL.isAtLeast(NodeEquality.LEXICALLY_EQUAL));41 assertTrue( NodeEquality.LEXICALLY_EQUAL.isAtLeast(NodeEquality.SYNTACTICALLY_EQUAL));42 assertTrue( NodeEquality.LEXICALLY_EQUAL.isAtLeast(NodeEquality.SEMANTICALLY_EQUAL));43 assertFalse( NodeEquality.LEXICALLY_EQUAL.isAtLeast(NodeEquality.UNEQUAL));39 assertFalse(TaskEquality.LEXICALLY_EQUAL.isAtLeast(TaskEquality.IDENTICAL)); 40 assertTrue(TaskEquality.LEXICALLY_EQUAL.isAtLeast(TaskEquality.LEXICALLY_EQUAL)); 41 assertTrue(TaskEquality.LEXICALLY_EQUAL.isAtLeast(TaskEquality.SYNTACTICALLY_EQUAL)); 42 assertTrue(TaskEquality.LEXICALLY_EQUAL.isAtLeast(TaskEquality.SEMANTICALLY_EQUAL)); 43 assertFalse(TaskEquality.LEXICALLY_EQUAL.isAtLeast(TaskEquality.UNEQUAL)); 44 44 45 assertFalse( NodeEquality.SYNTACTICALLY_EQUAL.isAtLeast(NodeEquality.IDENTICAL));46 assertFalse( NodeEquality.SYNTACTICALLY_EQUAL.isAtLeast(NodeEquality.LEXICALLY_EQUAL));47 assertTrue( NodeEquality.SYNTACTICALLY_EQUAL.isAtLeast(NodeEquality.SYNTACTICALLY_EQUAL));48 assertTrue( NodeEquality.SYNTACTICALLY_EQUAL.isAtLeast(NodeEquality.SEMANTICALLY_EQUAL));49 assertFalse( NodeEquality.SYNTACTICALLY_EQUAL.isAtLeast(NodeEquality.UNEQUAL));45 assertFalse(TaskEquality.SYNTACTICALLY_EQUAL.isAtLeast(TaskEquality.IDENTICAL)); 46 assertFalse(TaskEquality.SYNTACTICALLY_EQUAL.isAtLeast(TaskEquality.LEXICALLY_EQUAL)); 47 assertTrue(TaskEquality.SYNTACTICALLY_EQUAL.isAtLeast(TaskEquality.SYNTACTICALLY_EQUAL)); 48 assertTrue(TaskEquality.SYNTACTICALLY_EQUAL.isAtLeast(TaskEquality.SEMANTICALLY_EQUAL)); 49 assertFalse(TaskEquality.SYNTACTICALLY_EQUAL.isAtLeast(TaskEquality.UNEQUAL)); 50 50 51 assertFalse( NodeEquality.SEMANTICALLY_EQUAL.isAtLeast(NodeEquality.IDENTICAL));52 assertFalse( NodeEquality.SEMANTICALLY_EQUAL.isAtLeast(NodeEquality.LEXICALLY_EQUAL));53 assertFalse( NodeEquality.SEMANTICALLY_EQUAL.isAtLeast(NodeEquality.SYNTACTICALLY_EQUAL));54 assertTrue( NodeEquality.SEMANTICALLY_EQUAL.isAtLeast(NodeEquality.SEMANTICALLY_EQUAL));55 assertFalse( NodeEquality.SEMANTICALLY_EQUAL.isAtLeast(NodeEquality.UNEQUAL));51 assertFalse(TaskEquality.SEMANTICALLY_EQUAL.isAtLeast(TaskEquality.IDENTICAL)); 52 assertFalse(TaskEquality.SEMANTICALLY_EQUAL.isAtLeast(TaskEquality.LEXICALLY_EQUAL)); 53 assertFalse(TaskEquality.SEMANTICALLY_EQUAL.isAtLeast(TaskEquality.SYNTACTICALLY_EQUAL)); 54 assertTrue(TaskEquality.SEMANTICALLY_EQUAL.isAtLeast(TaskEquality.SEMANTICALLY_EQUAL)); 55 assertFalse(TaskEquality.SEMANTICALLY_EQUAL.isAtLeast(TaskEquality.UNEQUAL)); 56 56 57 assertFalse( NodeEquality.UNEQUAL.isAtLeast(NodeEquality.IDENTICAL));58 assertFalse( NodeEquality.UNEQUAL.isAtLeast(NodeEquality.LEXICALLY_EQUAL));59 assertFalse( NodeEquality.UNEQUAL.isAtLeast(NodeEquality.SYNTACTICALLY_EQUAL));60 assertFalse( NodeEquality.UNEQUAL.isAtLeast(NodeEquality.SEMANTICALLY_EQUAL));61 assertTrue( NodeEquality.UNEQUAL.isAtLeast(NodeEquality.UNEQUAL));57 assertFalse(TaskEquality.UNEQUAL.isAtLeast(TaskEquality.IDENTICAL)); 58 assertFalse(TaskEquality.UNEQUAL.isAtLeast(TaskEquality.LEXICALLY_EQUAL)); 59 assertFalse(TaskEquality.UNEQUAL.isAtLeast(TaskEquality.SYNTACTICALLY_EQUAL)); 60 assertFalse(TaskEquality.UNEQUAL.isAtLeast(TaskEquality.SEMANTICALLY_EQUAL)); 61 assertTrue(TaskEquality.UNEQUAL.isAtLeast(TaskEquality.UNEQUAL)); 62 62 } 63 63 -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/AbstractTemporalRelationshipTC.java
r1132 r1146 21 21 import java.lang.reflect.Constructor; 22 22 import java.lang.reflect.InvocationTargetException; 23 import java.util.ArrayList;24 23 import java.util.LinkedList; 25 24 import java.util.List; … … 29 28 import org.junit.Before; 30 29 31 import de.ugoe.cs.autoquest.eventcore.IEventTarget; 32 import de.ugoe.cs.autoquest.eventcore.IEventType; 33 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEquality; 34 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEqualityRuleManager; 30 import de.ugoe.cs.autoquest.tasktrees.TaskTreeChecker; 31 import de.ugoe.cs.autoquest.tasktrees.TaskTreeDecoder; 32 import de.ugoe.cs.autoquest.tasktrees.TaskTreeEncoder; 33 import de.ugoe.cs.autoquest.tasktrees.TaskTreeValidator; 34 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 35 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEqualityRuleManager; 35 36 import de.ugoe.cs.autoquest.tasktrees.testutils.Utilities; 36 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 37 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 38 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTree; 39 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeBuilder; 40 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; 41 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNodeFactory; 42 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeBuilder; 43 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNodeFactory; 37 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstanceList; 38 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 39 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 40 import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession; 41 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; 42 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 44 43 import de.ugoe.cs.util.console.Console; 45 44 import de.ugoe.cs.util.console.TextConsole; … … 52 51 53 52 /** */ 54 private List<IEventTask> events; 55 56 /** */ 57 private ITaskTreeBuilder taskTreeBuilder = new TaskTreeBuilder(); 58 59 /** */ 60 private ITaskTreeNodeFactory taskTreeNodeFactory = new TaskTreeNodeFactory(); 61 62 /** */ 63 private NodeEqualityRuleManager nodeEqualityRuleManager = 64 Utilities.getNodeEqualityRuleManagerForTests(); 53 private ITaskBuilder taskBuilder = new TaskBuilder(); 54 55 /** */ 56 private ITaskFactory taskFactory = new TaskFactory(); 57 58 /** */ 59 private TaskTreeDecoder decoder = null; 60 61 /** */ 62 private TaskTreeEncoder encoder = new TaskTreeEncoder(); 63 64 /** */ 65 private TaskEqualityRuleManager taskEqualityRuleManager = 66 Utilities.getTaskEqualityRuleManagerForTests(); 65 67 66 68 /** … … 69 71 @Before 70 72 public void setUp() { 73 Console.reset(); 71 74 new TextConsole(Level.FINEST); 72 events = new ArrayList<IEventTask>(); 75 76 decoder = new TaskTreeDecoder(taskFactory, taskBuilder); 73 77 } 74 78 … … 76 80 * 77 81 */ 78 protected void simulateEvent(IEventType eventType, IEventTarget eventTarget) { 79 events.add(taskTreeNodeFactory.createNewEventTask(eventType, eventTarget)); 80 Console.reset(); 82 protected void applyRule(Class<? extends ITaskInstanceListScopeRule> ruleClass, 83 String inputSpec, 84 String expectedOutputSpec) 85 { 86 ITaskInstanceListScopeRule rule = null; 87 88 CONSTRUCTOR_ITERATION: 89 for (Constructor<?> constructor : ruleClass.getDeclaredConstructors()) { 90 List<Object> parameters = new LinkedList<Object>(); 91 92 for (Class<?> type : constructor.getParameterTypes()) { 93 if (ITaskFactory.class.equals(type)) { 94 parameters.add(taskFactory); 95 } 96 else if (ITaskBuilder.class.equals(type)) { 97 parameters.add(taskBuilder); 98 } 99 else if (TaskEqualityRuleManager.class.equals(type)) { 100 parameters.add(taskEqualityRuleManager); 101 } 102 else if (TaskEquality.class.equals(type)) { 103 parameters.add(TaskEquality.LEXICALLY_EQUAL); 104 } 105 else { 106 continue CONSTRUCTOR_ITERATION; 107 } 108 } 109 110 try { 111 rule = (ITaskInstanceListScopeRule) constructor.newInstance(parameters.toArray()); 112 } 113 catch (IllegalArgumentException e) { 114 e.printStackTrace(); 115 fail("could not invoke the constructor " + constructor); 116 } 117 catch (InstantiationException e) { 118 e.printStackTrace(); 119 fail("could not invoke the constructor " + constructor); 120 } 121 catch (IllegalAccessException e) { 122 e.printStackTrace(); 123 fail("could not invoke the constructor " + constructor); 124 } 125 catch (InvocationTargetException e) { 126 e.printStackTrace(); 127 fail("could not invoke the constructor " + constructor); 128 } 129 } 130 131 if (rule == null) { 132 fail("no matching constructor found to instantiate rule " + ruleClass); 133 } 134 135 RuleApplicationResult result; 136 RuleApplicationStatus status; 137 138 ITaskInstanceList inputList = decoder.decode(inputSpec); 139 140 Stack<ITaskInstanceList> toBeAppliedOn = new Stack<ITaskInstanceList>(); 141 toBeAppliedOn.push(inputList); 142 143 do { 144 result = rule.apply(toBeAppliedOn.peek()); 145 146 if (result != null) { 147 status = result.getRuleApplicationStatus(); 148 assertNotNull(status); 149 } 150 else { 151 status = RuleApplicationStatus.NOT_APPLIED; 152 } 153 154 assertTrue(status != RuleApplicationStatus.FEASIBLE); 155 156 if ((result != null) && (result.getNewlyCreatedTaskInstances() != null)) { 157 for (int i = result.getNewlyCreatedTaskInstances().size() - 1; i >= 0; i--) { 158 toBeAppliedOn.push(result.getNewlyCreatedTaskInstances().get(i)); 159 } 160 } 161 162 if (status == RuleApplicationStatus.NOT_APPLIED) { 163 toBeAppliedOn.pop(); 164 } 165 166 } 167 while ((!toBeAppliedOn.isEmpty()) || (status == RuleApplicationStatus.FINISHED)); 168 169 ITaskInstanceList expectedList = decoder.decode(expectedOutputSpec); 170 171 new TaskTreeChecker().assertTaskInstanceListsEqual(expectedList, inputList); 81 172 } 82 173 … … 84 175 * 85 176 */ 86 protected ITaskTree getTaskTree() { 87 ISequence sequence = taskTreeNodeFactory.createNewSequence(); 88 89 for (IEventTask task : events) { 90 taskTreeBuilder.addChild(sequence, task); 91 } 92 93 TemporalRelationshipRuleManager ruleManager = new TemporalRelationshipRuleManager 94 (nodeEqualityRuleManager, taskTreeNodeFactory, taskTreeBuilder); 95 96 ruleManager.init(); 97 ruleManager.applyRules(sequence); 98 99 return taskTreeNodeFactory.createTaskTree(sequence); 100 } 101 102 /** 103 * 104 */ 105 protected ITaskTree getTaskTree(Class<? extends TemporalRelationshipRule> ruleClass, 106 NodeEquality nodeEquality) 177 protected void applySessionScopeRule(Class<? extends ISessionScopeRule> ruleClass, 178 String inputSpec, 179 String expectedOutputSpec) 107 180 { 108 return getTaskTree(ruleClass, nodeEquality, false); 109 } 110 111 /** 112 * 113 */ 114 protected ITaskTree getTaskTree(Class<? extends TemporalRelationshipRule> ruleClass, 115 NodeEquality nodeEquality, 116 boolean explicitSessionSeq) 117 { 118 ISequence sequence = taskTreeNodeFactory.createNewSequence(); 119 120 for (IEventTask task : events) { 121 taskTreeBuilder.addChild(sequence, task); 122 } 123 124 if (explicitSessionSeq) { 125 ISequence root = taskTreeNodeFactory.createNewSequence(); 126 taskTreeBuilder.addChild(root, sequence); 127 sequence = root; 128 } 129 130 TemporalRelationshipRule rule = null; 181 ISessionScopeRule rule = null; 131 182 132 183 CONSTRUCTOR_ITERATION: … … 135 186 136 187 for (Class<?> type : constructor.getParameterTypes()) { 137 if (ITaskTreeNodeFactory.class.equals(type)) { 138 parameters.add(taskTreeNodeFactory); 139 } 140 else if (ITaskTreeBuilder.class.equals(type)) { 141 parameters.add(taskTreeBuilder); 142 } 143 else if (NodeEqualityRuleManager.class.equals(type)) { 144 parameters.add(nodeEqualityRuleManager); 145 } 146 else if (NodeEquality.class.equals(type)) { 147 if (nodeEquality != null) { 148 parameters.add(nodeEquality); 149 } 150 else { 151 parameters.add(NodeEquality.LEXICALLY_EQUAL); 152 } 188 if (ITaskFactory.class.equals(type)) { 189 parameters.add(taskFactory); 190 } 191 else if (ITaskBuilder.class.equals(type)) { 192 parameters.add(taskBuilder); 193 } 194 else if (TaskEqualityRuleManager.class.equals(type)) { 195 parameters.add(taskEqualityRuleManager); 196 } 197 else if (TaskEquality.class.equals(type)) { 198 parameters.add(TaskEquality.LEXICALLY_EQUAL); 153 199 } 154 200 else { … … 158 204 159 205 try { 160 rule = ( TemporalRelationshipRule) constructor.newInstance(parameters.toArray());206 rule = (ISessionScopeRule) constructor.newInstance(parameters.toArray()); 161 207 } 162 208 catch (IllegalArgumentException e) { … … 182 228 } 183 229 184 RuleApplicationResult result; 185 RuleApplicationStatus status; 186 187 Stack<ITaskTreeNode> toBeAppliedOn = new Stack<ITaskTreeNode>(); 188 toBeAppliedOn.push(sequence); 189 190 do { 191 result = rule.apply(toBeAppliedOn.peek(), true); 192 193 if (result != null) { 194 status = result.getRuleApplicationStatus(); 195 assertNotNull(status); 196 } 197 else { 198 status = RuleApplicationStatus.NOT_APPLIED; 199 } 200 201 assertTrue(status != RuleApplicationStatus.FEASIBLE); 202 203 if ((result != null) && (result.getNewlyCreatedParentNodes() != null)) { 204 for (int i = result.getNewlyCreatedParentNodes().size() - 1; i >= 0; i--) { 205 toBeAppliedOn.push(result.getNewlyCreatedParentNodes().get(i)); 206 } 207 } 208 209 if (status == RuleApplicationStatus.NOT_APPLIED) { 210 toBeAppliedOn.pop(); 211 } 212 213 } 214 while ((!toBeAppliedOn.isEmpty()) || (status == RuleApplicationStatus.FINISHED)); 215 216 return taskTreeNodeFactory.createTaskTree(sequence); 230 ITaskInstanceList inputList = decoder.decode(inputSpec); 231 232 assertTrue(inputList instanceof IUserSession); 233 234 List<IUserSession> sessionList = new LinkedList<IUserSession>(); 235 sessionList.add((IUserSession) inputList); 236 237 System.out.println("Input:"); 238 encoder.encode(inputList, System.out); 239 240 RuleApplicationResult result = rule.apply(sessionList); 241 242 assertNotNull(result); 243 assertNotNull(result.getRuleApplicationStatus()); 244 assertTrue(result.getRuleApplicationStatus() != RuleApplicationStatus.FEASIBLE); 245 246 ITaskInstanceList expectedList = decoder.decode(expectedOutputSpec); 247 248 System.out.println("\nExpected Result:"); 249 encoder.encode(expectedList, System.out); 250 System.out.println("\nResult:"); 251 encoder.encode(inputList, System.out); 252 253 new TaskTreeChecker().assertTaskInstanceListsEqual(expectedList, inputList); 254 new TaskTreeValidator().validate(inputList); 217 255 } 218 256 -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleTest.java
r1132 r1146 17 17 import org.junit.Test; 18 18 19 import de.ugoe.cs.autoquest.eventcore.IEventTarget;20 import de.ugoe.cs.autoquest.eventcore.gui.IInteraction;21 import de.ugoe.cs.autoquest.tasktrees.TaskTreeChecker;22 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEquality;23 import de.ugoe.cs.autoquest.test.DummyGUIElement;24 import de.ugoe.cs.autoquest.test.DummyInteraction;25 26 19 /** 27 20 * TODO comment … … 36 29 */ 37 30 @Test 38 public void testTaskDetection() throws Exception { 39 IEventTarget element1 = new DummyGUIElement("elem1"); 40 41 IInteraction action1 = new DummyInteraction("action1", 1); 42 IInteraction action2 = new DummyInteraction("action2", 1); 43 IInteraction action3 = new DummyInteraction("action3", 1); 44 IInteraction action4 = new DummyInteraction("action4", 1); 45 46 simulateEvent(new DummyInteraction("noise0", 1), element1); 47 simulateEvent(action1, element1); 48 simulateEvent(action2, element1); 49 simulateEvent(action3, element1); 50 simulateEvent(action4, element1); 51 simulateEvent(new DummyInteraction("noise1", 1), element1); 52 simulateEvent(new DummyInteraction("noise2", 1), element1); 53 simulateEvent(action1, element1); 54 simulateEvent(action2, element1); 55 simulateEvent(action3, element1); 56 simulateEvent(action4, element1); 57 simulateEvent(new DummyInteraction("noise3", 1), element1); 58 simulateEvent(new DummyInteraction("noise4", 1), element1); 59 simulateEvent(new DummyInteraction("noise5", 1), element1); 60 simulateEvent(new DummyInteraction("noise6", 1), element1); 61 simulateEvent(action1, element1); 62 simulateEvent(action2, element1); 63 simulateEvent(action3, element1); 64 simulateEvent(action4, element1); 65 simulateEvent(new DummyInteraction("noise7", 1), element1); 66 simulateEvent(new DummyInteraction("noise8", 1), element1); 67 68 new TaskTreeChecker().assertTaskTree 69 ("Sequence root {" + 70 " Sequence session1 {" + 71 " Event noise0 {}" + 72 " Sequence sequence2 {" + 73 " Event action1 {}" + 74 " Event action2 {}" + 75 " Event action3 {}" + 76 " Event action4 {}" + 77 " }" + 78 " Event noise1 {}" + 79 " Event noise2 {}" + 80 " Sequence sequence2 {" + 81 " Event action1 {}" + 82 " Event action2 {}" + 83 " Event action3 {}" + 84 " Event action4 {}" + 85 " }" + 86 " Event noise3 {}" + 87 " Event noise4 {}" + 88 " Event noise5 {}" + 89 " Event noise6 {}" + 90 " Sequence sequence2 {" + 91 " Event action1 {}" + 92 " Event action2 {}" + 93 " Event action3 {}" + 94 " Event action4 {}" + 95 " }" + 96 " Event noise7 {}" + 97 " Event noise8 {}" + 98 " }" + 99 "}", getTaskTree(SequenceForTaskDetectionRule.class, NodeEquality.LEXICALLY_EQUAL, true)); 31 public void test_TaskDetection_01() throws Exception { 32 String input = 33 "UserSession {" + 34 " Event noise0 {}" + 35 " Event action1 {}" + 36 " Event action2 {}" + 37 " Event action3 {}" + 38 " Event action4 {}" + 39 " Event noise1 {}" + 40 " Event noise2 {}" + 41 " Event action1 {}" + 42 " Event action2 {}" + 43 " Event action3 {}" + 44 " Event action4 {}" + 45 " Event noise3 {}" + 46 " Event noise4 {}" + 47 " Event noise5 {}" + 48 " Event noise6 {}" + 49 " Event action1 {}" + 50 " Event action2 {}" + 51 " Event action3 {}" + 52 " Event action4 {}" + 53 " Event action1 {}" + 54 " Event action2 {}" + 55 " Event action3 {}" + 56 " Event action4 {}" + 57 " Event noise7 {}" + 58 "}"; 100 59 60 String output = 61 "UserSession {" + 62 " Event noise0 {}" + 63 " Iteration iteration1 {" + 64 " Sequence sequence1 {" + 65 " Event action1 {}" + 66 " Event action2 {}" + 67 " Event action3 {}" + 68 " Event action4 {}" + 69 " }" + 70 " }" + 71 " Event noise1 {}" + 72 " Event noise2 {}" + 73 " Iteration iteration1 {" + 74 " Sequence sequence1 {" + 75 " Event action1 {}" + 76 " Event action2 {}" + 77 " Event action3 {}" + 78 " Event action4 {}" + 79 " }" + 80 " }" + 81 " Event noise3 {}" + 82 " Event noise4 {}" + 83 " Event noise5 {}" + 84 " Event noise6 {}" + 85 " Iteration iteration1 {" + 86 " Sequence sequence1 {" + 87 " Event action1 {}" + 88 " Event action2 {}" + 89 " Event action3 {}" + 90 " Event action4 {}" + 91 " }" + 92 " Sequence sequence1 {" + 93 " Event action1 {}" + 94 " Event action2 {}" + 95 " Event action3 {}" + 96 " Event action4 {}" + 97 " }" + 98 " }" + 99 " Event noise7 {}" + 100 "}"; 101 102 applySessionScopeRule(SequenceForTaskDetectionRule.class, input, output); 103 } 104 105 /** 106 * 107 */ 108 @Test 109 public void test_TaskDetection_02() throws Exception { 110 String input = 111 "UserSession {" + 112 " Event noise0 {}" + 113 " Event action1 {}" + 114 " Event action2 {}" + 115 " Event noise1 {}" + 116 " Event noise2 {}" + 117 " Event action3 {}" + 118 " Event action1 {}" + 119 " Event action2 {}" + 120 " Event action4 {}" + 121 " Event noise3 {}" + 122 " Event noise4 {}" + 123 " Event noise5 {}" + 124 " Event noise6 {}" + 125 " Event action1 {}" + 126 " Event action2 {}" + 127 " Event action3 {}" + 128 " Event action4 {}" + 129 " Event action1 {}" + 130 " Event action2 {}" + 131 " Event action3 {}" + 132 " Event action4 {}" + 133 " Event noise7 {}" + 134 "}"; 135 136 String output = 137 "UserSession {" + 138 " Event noise0 {}" + 139 " Sequence sequence1 {" + 140 " Event action1 {}" + 141 " Event action2 {}" + 142 " }" + 143 " Event noise1 {}" + 144 " Event noise2 {}" + 145 " Event action3 {}" + 146 " Sequence sequence1 {" + 147 " Event action1 {}" + 148 " Event action2 {}" + 149 " }" + 150 " Event action4 {}" + 151 " Event noise3 {}" + 152 " Event noise4 {}" + 153 " Event noise5 {}" + 154 " Event noise6 {}" + 155 " Iteration iteration1 {" + 156 " Sequence sequence3 {" + 157 " Sequence sequence1 {" + 158 " Event action1 {}" + 159 " Event action2 {}" + 160 " }" + 161 " Event action3 {}" + 162 " Event action4 {}" + 163 " }" + 164 " Sequence sequence3 {" + 165 " Sequence sequence1 {" + 166 " Event action1 {}" + 167 " Event action2 {}" + 168 " }" + 169 " Event action3 {}" + 170 " Event action4 {}" + 171 " }" + 172 " }" + 173 " Event noise7 {}" + 174 "}"; 175 176 applySessionScopeRule(SequenceForTaskDetectionRule.class, input, output); 101 177 } 102 178 -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/testutils/Utilities.java
r927 r1146 15 15 package de.ugoe.cs.autoquest.tasktrees.testutils; 16 16 17 import de.ugoe.cs.autoquest.tasktrees. nodeequality.NodeEqualityRuleManager;17 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEqualityRuleManager; 18 18 19 19 /** … … 26 26 27 27 /** */ 28 private static final NodeEqualityRuleManager NODE_EQUALITY_RULE_MANAGER =29 new NodeEqualityRuleManager();28 private static final TaskEqualityRuleManager NODE_EQUALITY_RULE_MANAGER = 29 new TaskEqualityRuleManager(); 30 30 31 /** */ 31 32 static { 32 33 NODE_EQUALITY_RULE_MANAGER.init(); … … 38 39 * @return 39 40 */ 40 public static NodeEqualityRuleManager getNodeEqualityRuleManagerForTests() {41 public static TaskEqualityRuleManager getTaskEqualityRuleManagerForTests() { 41 42 return NODE_EQUALITY_RULE_MANAGER; 42 43 } -
trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/TaskModelTest.java
r1132 r1146 15 15 package de.ugoe.cs.autoquest.tasktrees.treeimpl; 16 16 17 import static org.junit.Assert.assertEquals; 18 import static org.junit.Assert.assertNotNull; 19 import static org.junit.Assert.assertNull; 17 import static org.junit.Assert.*; 20 18 21 19 import java.util.HashMap; 20 import java.util.LinkedList; 21 import java.util.List; 22 22 import java.util.Map; 23 23 24 24 import org.junit.Test; 25 25 26 import de.ugoe.cs.autoquest.eventcore.IEventTarget; 27 import de.ugoe.cs.autoquest.eventcore.IEventType; 26 28 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 27 29 import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 30 import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; 28 31 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 29 32 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 30 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTree; 31 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeBuilder; 32 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; 33 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNodeFactory; 34 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNodeInfo; 35 import de.ugoe.cs.autoquest.tasktrees.treeimpl.NodeInfo; 36 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeBuilder; 37 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNodeFactory; 33 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 34 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 35 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 36 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 37 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 38 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInfo; 39 import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession; 40 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskInfo; 41 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; 42 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 38 43 import de.ugoe.cs.autoquest.test.DummyGUIElement; 39 44 import de.ugoe.cs.autoquest.test.DummyInteraction; … … 45 50 * @author 2012, last modified by $Author: patrick$ 46 51 */ 47 public class Task TreeImplTest {52 public class TaskModelTest { 48 53 49 54 /** */ … … 51 56 52 57 /** */ 53 private ITask TreeBuilder taskTreeBuilder = new TaskTreeBuilder();58 private ITaskBuilder taskBuilder = new TaskBuilder(); 54 59 55 60 /** */ 56 private ITaskTreeNodeFactory taskTreeNodeFactory = new TaskTreeNodeFactory(); 57 58 /** 59 * @throws Exception 60 * 61 private ITaskFactory taskFactory = new TaskFactory(); 62 63 /** 64 * 65 */ 66 @Test 67 public void test_EventTask_01() throws Exception { 68 IEventType eventType = new DummyInteraction("interaction", 1); 69 IEventTarget eventTarget = new DummyGUIElement("elem"); 70 71 IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 72 73 assertNotNull(task); 74 assertNotNull(task.getDescription()); 75 assertNotNull(task.getId()); 76 assertTrue(task.equals(task)); 77 78 assertEquals(eventType, task.getEventType()); 79 assertEquals(eventTarget, task.getEventTarget()); 80 } 81 82 /** 83 * 84 */ 85 @Test 86 public void test_EventTask_02() throws Exception { 87 IEventType eventType = new DummyInteraction("interaction", 1); 88 IEventTarget eventTarget = new DummyGUIElement("elem"); 89 90 IEventTask task1 = taskFactory.createNewEventTask(eventType, eventTarget); 91 IEventTask task2 = taskFactory.createNewEventTask(eventType, eventTarget); 92 93 // the tasks will not be equal as they should have a different id 94 assertFalse(task1.equals(task2)); 95 } 96 97 /** 98 * 99 */ 100 @Test 101 public void test_EventTask_03() throws Exception { 102 IEventType eventType = new DummyInteraction("interaction", 1); 103 IEventTarget eventTarget = new DummyGUIElement("elem"); 104 105 IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 106 ITaskInstance taskInstance1 = taskFactory.createNewTaskInstance(task); 107 ITaskInstance taskInstance2 = taskFactory.createNewTaskInstance(task); 108 109 assertFalse(taskInstance1.equals(taskInstance2)); 110 } 111 112 /** 113 * 114 */ 115 @Test 116 public void test_Sequence_01() throws Exception { 117 ISequence task = taskFactory.createNewSequence(); 118 119 assertNotNull(task); 120 assertNotNull(task.getDescription()); 121 assertNotNull(task.getId()); 122 assertNotNull(task.getChildren()); 123 assertEquals(0, task.getChildren().size()); 124 assertTrue(task.equals(task)); 125 } 126 127 /** 128 * 129 */ 130 @Test 131 public void test_Sequence_02() throws Exception { 132 IEventType eventType = new DummyInteraction("interaction", 1); 133 IEventTarget eventTarget = new DummyGUIElement("elem"); 134 135 IEventTask child = taskFactory.createNewEventTask(eventType, eventTarget); 136 137 ISequence task = taskFactory.createNewSequence(); 138 139 taskBuilder.addChild(task, child); 140 141 assertNotNull(task.getChildren()); 142 assertEquals(1, task.getChildren().size()); 143 assertEquals(child, task.getChildren().get(0)); 144 } 145 146 /** 147 * 148 */ 149 @Test 150 public void test_Sequence_03() throws Exception { 151 IEventType eventType = new DummyInteraction("interaction", 1); 152 IEventTarget eventTarget = new DummyGUIElement("elem"); 153 154 IEventTask child1 = taskFactory.createNewEventTask(eventType, eventTarget); 155 IEventTask child2 = taskFactory.createNewEventTask(eventType, eventTarget); 156 IEventTask child3 = taskFactory.createNewEventTask(eventType, eventTarget); 157 IEventTask child4 = taskFactory.createNewEventTask(eventType, eventTarget); 158 IEventTask child5 = taskFactory.createNewEventTask(eventType, eventTarget); 159 160 ISequence task = taskFactory.createNewSequence(); 161 162 taskBuilder.addChild(task, child1); 163 taskBuilder.addChild(task, child2); 164 taskBuilder.addChild(task, child3); 165 taskBuilder.addChild(task, child4); 166 taskBuilder.addChild(task, child5); 167 168 assertNotNull(task.getChildren()); 169 assertEquals(5, task.getChildren().size()); 170 assertEquals(child1, task.getChildren().get(0)); 171 assertEquals(child2, task.getChildren().get(1)); 172 assertEquals(child3, task.getChildren().get(2)); 173 assertEquals(child4, task.getChildren().get(3)); 174 assertEquals(child5, task.getChildren().get(4)); 175 } 176 177 /** 178 * 179 */ 180 @Test 181 public void test_Selection_01() throws Exception { 182 ISelection task = taskFactory.createNewSelection(); 183 184 assertNotNull(task); 185 assertNotNull(task.getDescription()); 186 assertNotNull(task.getId()); 187 assertNotNull(task.getChildren()); 188 assertEquals(0, task.getChildren().size()); 189 assertTrue(task.equals(task)); 190 } 191 192 /** 193 * 194 */ 195 @Test 196 public void test_Selection_02() throws Exception { 197 IEventType eventType = new DummyInteraction("interaction", 1); 198 IEventTarget eventTarget = new DummyGUIElement("elem"); 199 200 IEventTask child = taskFactory.createNewEventTask(eventType, eventTarget); 201 202 ISelection task = taskFactory.createNewSelection(); 203 204 taskBuilder.addChild(task, child); 205 206 assertNotNull(task.getChildren()); 207 assertEquals(1, task.getChildren().size()); 208 assertEquals(child, task.getChildren().get(0)); 209 } 210 211 /** 212 * 213 */ 214 @Test 215 public void test_Selection_03() throws Exception { 216 IEventType eventType = new DummyInteraction("interaction", 1); 217 IEventTarget eventTarget = new DummyGUIElement("elem"); 218 219 IEventTask child1 = taskFactory.createNewEventTask(eventType, eventTarget); 220 IEventTask child2 = taskFactory.createNewEventTask(eventType, eventTarget); 221 IEventTask child3 = taskFactory.createNewEventTask(eventType, eventTarget); 222 IEventTask child4 = taskFactory.createNewEventTask(eventType, eventTarget); 223 IEventTask child5 = taskFactory.createNewEventTask(eventType, eventTarget); 224 225 ISelection task = taskFactory.createNewSelection(); 226 227 taskBuilder.addChild(task, child1); 228 taskBuilder.addChild(task, child2); 229 taskBuilder.addChild(task, child3); 230 taskBuilder.addChild(task, child4); 231 taskBuilder.addChild(task, child5); 232 233 assertNotNull(task.getChildren()); 234 assertEquals(5, task.getChildren().size()); 235 assertEquals(child1, task.getChildren().get(0)); 236 assertEquals(child2, task.getChildren().get(1)); 237 assertEquals(child3, task.getChildren().get(2)); 238 assertEquals(child4, task.getChildren().get(3)); 239 assertEquals(child5, task.getChildren().get(4)); 240 } 241 242 /** 243 * 244 */ 245 @Test 246 public void test_Iteration_01() throws Exception { 247 IIteration task = taskFactory.createNewIteration(); 248 249 assertNotNull(task); 250 assertNotNull(task.getDescription()); 251 assertNotNull(task.getId()); 252 assertNull(task.getMarkedTask()); 253 assertTrue(task.equals(task)); 254 } 255 256 /** 257 * 258 */ 259 @Test 260 public void test_Iteration_02() throws Exception { 261 IEventType eventType = new DummyInteraction("interaction", 1); 262 IEventTarget eventTarget = new DummyGUIElement("elem"); 263 264 IEventTask child = taskFactory.createNewEventTask(eventType, eventTarget); 265 266 IIteration task = taskFactory.createNewIteration(); 267 268 taskBuilder.setMarkedTask(task, child); 269 270 assertEquals(child, task.getMarkedTask()); 271 } 272 273 /** 274 * 275 */ 276 @Test 277 public void test_Iteration_03() throws Exception { 278 IEventType eventType = new DummyInteraction("interaction", 1); 279 IEventTarget eventTarget = new DummyGUIElement("elem"); 280 281 IEventTask child1 = taskFactory.createNewEventTask(eventType, eventTarget); 282 IEventTask child2 = taskFactory.createNewEventTask(eventType, eventTarget); 283 284 IIteration task = taskFactory.createNewIteration(); 285 286 taskBuilder.setMarkedTask(task, child1); 287 taskBuilder.setMarkedTask(task, child2); 288 289 assertEquals(child2, task.getMarkedTask()); 290 } 291 292 /** 293 * 294 */ 295 @Test 296 public void test_Optional_01() throws Exception { 297 IOptional task = taskFactory.createNewOptional(); 298 299 assertNotNull(task); 300 assertNotNull(task.getDescription()); 301 assertNotNull(task.getId()); 302 assertNull(task.getMarkedTask()); 303 assertTrue(task.equals(task)); 304 } 305 306 /** 307 * 308 */ 309 @Test 310 public void test_Optional_02() throws Exception { 311 IEventType eventType = new DummyInteraction("interaction", 1); 312 IEventTarget eventTarget = new DummyGUIElement("elem"); 313 314 IEventTask child = taskFactory.createNewEventTask(eventType, eventTarget); 315 316 IOptional task = taskFactory.createNewOptional(); 317 318 taskBuilder.setMarkedTask(task, child); 319 320 assertEquals(child, task.getMarkedTask()); 321 } 322 323 /** 324 * 325 */ 326 @Test 327 public void test_Optional_03() throws Exception { 328 IEventType eventType = new DummyInteraction("interaction", 1); 329 IEventTarget eventTarget = new DummyGUIElement("elem"); 330 331 IEventTask child1 = taskFactory.createNewEventTask(eventType, eventTarget); 332 IEventTask child2 = taskFactory.createNewEventTask(eventType, eventTarget); 333 334 IOptional task = taskFactory.createNewOptional(); 335 336 taskBuilder.setMarkedTask(task, child1); 337 taskBuilder.setMarkedTask(task, child2); 338 339 assertEquals(child2, task.getMarkedTask()); 340 } 341 342 /** 343 * 344 */ 345 @Test 346 public void test_EventTaskInstance_01() throws Exception { 347 IEventType eventType = new DummyInteraction("interaction", 1); 348 IEventTarget eventTarget = new DummyGUIElement("elem"); 349 350 IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 351 352 ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 353 354 assertNotNull(taskInstance); 355 assertEquals(task, taskInstance.getTask()); 356 assertTrue(taskInstance.equals(taskInstance)); 357 assertFalse(taskInstance.equals(task)); 358 assertNotNull(taskInstance.getChildren()); 359 assertEquals(0, taskInstance.getChildren().size()); 360 } 361 362 /** 363 * 364 */ 365 @Test 366 public void test_EventTaskInstance_02() throws Exception { 367 IEventType eventType = new DummyInteraction("interaction", 1); 368 IEventTarget eventTarget = new DummyGUIElement("elem"); 369 370 IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 371 372 ITaskInstance taskInstance1 = taskFactory.createNewTaskInstance(task); 373 ITaskInstance taskInstance2 = taskFactory.createNewTaskInstance(task); 374 375 assertFalse(taskInstance1.equals(taskInstance2)); 376 } 377 378 /** 379 * 380 */ 381 @Test(expected=IllegalArgumentException.class) 382 public void test_EventTaskInstance_03() throws Exception { 383 IEventType eventType = new DummyInteraction("interaction", 1); 384 IEventTarget eventTarget = new DummyGUIElement("elem"); 385 386 IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 387 388 ITaskInstance taskInstance1 = taskFactory.createNewTaskInstance(task); 389 ITaskInstance taskInstance2 = taskFactory.createNewTaskInstance(task); 390 391 taskBuilder.addChild(taskInstance1, taskInstance2); 392 } 393 394 /** 395 * 396 */ 397 @Test(expected=IllegalArgumentException.class) 398 public void test_SequenceInstance_01() throws Exception { 399 IEventType eventType = new DummyInteraction("interaction", 1); 400 IEventTarget eventTarget = new DummyGUIElement("elem"); 401 402 IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 403 404 ISequence sequence = taskFactory.createNewSequence(); 405 406 ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 407 ITaskInstance sequenceInstance = taskFactory.createNewTaskInstance(sequence); 408 409 taskBuilder.addChild(sequenceInstance, taskInstance); 410 } 411 412 /** 413 * 414 */ 415 @Test 416 public void test_SequenceInstance_02() throws Exception { 417 IEventType eventType = new DummyInteraction("interaction", 1); 418 IEventTarget eventTarget = new DummyGUIElement("elem"); 419 420 IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 421 422 ISequence sequence = taskFactory.createNewSequence(); 423 taskBuilder.addChild(sequence, task); 424 425 ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 426 ITaskInstance sequenceInstance = taskFactory.createNewTaskInstance(sequence); 427 428 taskBuilder.addChild(sequenceInstance, taskInstance); 429 430 assertNotNull(sequenceInstance.getChildren()); 431 assertEquals(1, sequenceInstance.getChildren().size()); 432 assertEquals(taskInstance, sequenceInstance.getChildren().get(0)); 433 } 434 435 /** 436 * 437 */ 438 @Test 439 public void test_SequenceInstance_03() throws Exception { 440 IEventType eventType = new DummyInteraction("interaction", 1); 441 IEventTarget eventTarget = new DummyGUIElement("elem"); 442 443 IEventTask task1 = taskFactory.createNewEventTask(eventType, eventTarget); 444 IEventTask task2 = taskFactory.createNewEventTask(eventType, eventTarget); 445 IEventTask task3 = taskFactory.createNewEventTask(eventType, eventTarget); 446 IEventTask task4 = taskFactory.createNewEventTask(eventType, eventTarget); 447 IEventTask task5 = taskFactory.createNewEventTask(eventType, eventTarget); 448 449 ISequence sequence = taskFactory.createNewSequence(); 450 taskBuilder.addChild(sequence, task1); 451 taskBuilder.addChild(sequence, task2); 452 taskBuilder.addChild(sequence, task3); 453 taskBuilder.addChild(sequence, task4); 454 taskBuilder.addChild(sequence, task5); 455 456 ITaskInstance taskInstance1 = taskFactory.createNewTaskInstance(task1); 457 ITaskInstance taskInstance2 = taskFactory.createNewTaskInstance(task2); 458 ITaskInstance taskInstance3 = taskFactory.createNewTaskInstance(task3); 459 ITaskInstance taskInstance4 = taskFactory.createNewTaskInstance(task4); 460 ITaskInstance taskInstance5 = taskFactory.createNewTaskInstance(task5); 461 ITaskInstance sequenceInstance = taskFactory.createNewTaskInstance(sequence); 462 463 taskBuilder.addChild(sequenceInstance, taskInstance1); 464 taskBuilder.addChild(sequenceInstance, taskInstance2); 465 taskBuilder.addChild(sequenceInstance, taskInstance3); 466 taskBuilder.addChild(sequenceInstance, taskInstance4); 467 taskBuilder.addChild(sequenceInstance, taskInstance5); 468 469 assertNotNull(sequenceInstance.getChildren()); 470 assertEquals(5, sequenceInstance.getChildren().size()); 471 assertEquals(taskInstance1, sequenceInstance.getChildren().get(0)); 472 assertEquals(taskInstance2, sequenceInstance.getChildren().get(1)); 473 assertEquals(taskInstance3, sequenceInstance.getChildren().get(2)); 474 assertEquals(taskInstance4, sequenceInstance.getChildren().get(3)); 475 assertEquals(taskInstance5, sequenceInstance.getChildren().get(4)); 476 } 477 478 /** 479 * 480 */ 481 @Test(expected=IllegalArgumentException.class) 482 public void test_SelectionInstance_01() throws Exception { 483 IEventType eventType = new DummyInteraction("interaction", 1); 484 IEventTarget eventTarget = new DummyGUIElement("elem"); 485 486 IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 487 488 ISelection selection = taskFactory.createNewSelection(); 489 490 ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 491 ITaskInstance selectionInstance = taskFactory.createNewTaskInstance(selection); 492 493 taskBuilder.addChild(selectionInstance, taskInstance); 494 } 495 496 /** 497 * 498 */ 499 @Test 500 public void test_SelectionInstance_02() throws Exception { 501 IEventType eventType = new DummyInteraction("interaction", 1); 502 IEventTarget eventTarget = new DummyGUIElement("elem"); 503 504 IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 505 506 ISelection selection = taskFactory.createNewSelection(); 507 taskBuilder.addChild(selection, task); 508 509 ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 510 ITaskInstance selectionInstance = taskFactory.createNewTaskInstance(selection); 511 512 taskBuilder.addChild(selectionInstance, taskInstance); 513 514 assertNotNull(selectionInstance.getChildren()); 515 assertEquals(1, selectionInstance.getChildren().size()); 516 assertEquals(taskInstance, selectionInstance.getChildren().get(0)); 517 } 518 519 /** 520 * 521 */ 522 @Test(expected=IllegalArgumentException.class) 523 public void test_SelectionInstance_03() throws Exception { 524 IEventType eventType = new DummyInteraction("interaction", 1); 525 IEventTarget eventTarget = new DummyGUIElement("elem"); 526 527 IEventTask task1 = taskFactory.createNewEventTask(eventType, eventTarget); 528 IEventTask task2 = taskFactory.createNewEventTask(eventType, eventTarget); 529 IEventTask task3 = taskFactory.createNewEventTask(eventType, eventTarget); 530 IEventTask task4 = taskFactory.createNewEventTask(eventType, eventTarget); 531 IEventTask task5 = taskFactory.createNewEventTask(eventType, eventTarget); 532 533 ISelection selection = taskFactory.createNewSelection(); 534 taskBuilder.addChild(selection, task1); 535 taskBuilder.addChild(selection, task2); 536 taskBuilder.addChild(selection, task3); 537 taskBuilder.addChild(selection, task4); 538 taskBuilder.addChild(selection, task5); 539 540 ITaskInstance taskInstance1 = taskFactory.createNewTaskInstance(task1); 541 ITaskInstance taskInstance2 = taskFactory.createNewTaskInstance(task2); 542 ITaskInstance selectionInstance = taskFactory.createNewTaskInstance(selection); 543 544 taskBuilder.addChild(selectionInstance, taskInstance1); 545 taskBuilder.addChild(selectionInstance, taskInstance2); 546 } 547 548 /** 549 * 550 */ 551 @Test(expected=IllegalArgumentException.class) 552 public void test_IterationInstance_01() throws Exception { 553 IEventType eventType = new DummyInteraction("interaction", 1); 554 IEventTarget eventTarget = new DummyGUIElement("elem"); 555 556 IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 557 558 IIteration iteration = taskFactory.createNewIteration(); 559 560 ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 561 ITaskInstance iterationInstance = taskFactory.createNewTaskInstance(iteration); 562 563 taskBuilder.addChild(iterationInstance, taskInstance); 564 } 565 566 /** 567 * 568 */ 569 @Test 570 public void test_IterationInstance_02() throws Exception { 571 IEventType eventType = new DummyInteraction("interaction", 1); 572 IEventTarget eventTarget = new DummyGUIElement("elem"); 573 574 IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 575 576 IIteration iteration = taskFactory.createNewIteration(); 577 taskBuilder.setMarkedTask(iteration, task); 578 579 ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 580 ITaskInstance iterationInstance = taskFactory.createNewTaskInstance(iteration); 581 582 taskBuilder.addChild(iterationInstance, taskInstance); 583 584 assertNotNull(iterationInstance.getChildren()); 585 assertEquals(1, iterationInstance.getChildren().size()); 586 assertEquals(taskInstance, iterationInstance.getChildren().get(0)); 587 } 588 589 /** 590 * 591 */ 592 @Test(expected=IllegalArgumentException.class) 593 public void test_IterationInstance_03() throws Exception { 594 IEventType eventType = new DummyInteraction("interaction", 1); 595 IEventTarget eventTarget = new DummyGUIElement("elem"); 596 597 IEventTask task1 = taskFactory.createNewEventTask(eventType, eventTarget); 598 IEventTask task2 = taskFactory.createNewEventTask(eventType, eventTarget); 599 600 IIteration iteration = taskFactory.createNewIteration(); 601 taskBuilder.setMarkedTask(iteration, task1); 602 taskBuilder.setMarkedTask(iteration, task2); 603 604 ITaskInstance taskInstance1 = taskFactory.createNewTaskInstance(task1); 605 ITaskInstance iterationInstance = taskFactory.createNewTaskInstance(iteration); 606 607 taskBuilder.addChild(iterationInstance, taskInstance1); 608 } 609 610 /** 611 * 612 */ 613 @Test 614 public void test_IterationInstance_04() throws Exception { 615 IEventType eventType = new DummyInteraction("interaction", 1); 616 IEventTarget eventTarget = new DummyGUIElement("elem"); 617 618 IEventTask task1 = taskFactory.createNewEventTask(eventType, eventTarget); 619 IEventTask task2 = taskFactory.createNewEventTask(eventType, eventTarget); 620 621 IIteration iteration = taskFactory.createNewIteration(); 622 taskBuilder.setMarkedTask(iteration, task1); 623 taskBuilder.setMarkedTask(iteration, task2); 624 625 ITaskInstance taskInstance2 = taskFactory.createNewTaskInstance(task2); 626 ITaskInstance iterationInstance = taskFactory.createNewTaskInstance(iteration); 627 628 taskBuilder.addChild(iterationInstance, taskInstance2); 629 630 assertNotNull(iterationInstance.getChildren()); 631 assertEquals(1, iterationInstance.getChildren().size()); 632 assertEquals(taskInstance2, iterationInstance.getChildren().get(0)); 633 } 634 635 /** 636 * 637 */ 638 @Test(expected=IllegalArgumentException.class) 639 public void test_OptionalInstance_01() throws Exception { 640 IEventType eventType = new DummyInteraction("interaction", 1); 641 IEventTarget eventTarget = new DummyGUIElement("elem"); 642 643 IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 644 645 IOptional optional = taskFactory.createNewOptional(); 646 647 ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 648 ITaskInstance optionalInstance = taskFactory.createNewTaskInstance(optional); 649 650 taskBuilder.addChild(optionalInstance, taskInstance); 651 } 652 653 /** 654 * 655 */ 656 @Test 657 public void test_OptionalInstance_02() throws Exception { 658 IEventType eventType = new DummyInteraction("interaction", 1); 659 IEventTarget eventTarget = new DummyGUIElement("elem"); 660 661 IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 662 663 IOptional optional = taskFactory.createNewOptional(); 664 taskBuilder.setMarkedTask(optional, task); 665 666 ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 667 ITaskInstance optionalInstance = taskFactory.createNewTaskInstance(optional); 668 669 taskBuilder.addChild(optionalInstance, taskInstance); 670 671 assertNotNull(optionalInstance.getChildren()); 672 assertEquals(1, optionalInstance.getChildren().size()); 673 assertEquals(taskInstance, optionalInstance.getChildren().get(0)); 674 } 675 676 /** 677 * 678 */ 679 @Test(expected=IllegalArgumentException.class) 680 public void test_OptionalInstance_03() throws Exception { 681 IEventType eventType = new DummyInteraction("interaction", 1); 682 IEventTarget eventTarget = new DummyGUIElement("elem"); 683 684 IEventTask task1 = taskFactory.createNewEventTask(eventType, eventTarget); 685 IEventTask task2 = taskFactory.createNewEventTask(eventType, eventTarget); 686 687 IOptional optional = taskFactory.createNewOptional(); 688 taskBuilder.setMarkedTask(optional, task1); 689 taskBuilder.setMarkedTask(optional, task2); 690 691 ITaskInstance taskInstance1 = taskFactory.createNewTaskInstance(task1); 692 ITaskInstance optionalInstance = taskFactory.createNewTaskInstance(optional); 693 694 taskBuilder.addChild(optionalInstance, taskInstance1); 695 } 696 697 /** 698 * 699 */ 700 @Test 701 public void test_OptionalInstance_04() throws Exception { 702 IEventType eventType = new DummyInteraction("interaction", 1); 703 IEventTarget eventTarget = new DummyGUIElement("elem"); 704 705 IEventTask task1 = taskFactory.createNewEventTask(eventType, eventTarget); 706 IEventTask task2 = taskFactory.createNewEventTask(eventType, eventTarget); 707 708 IOptional optional = taskFactory.createNewOptional(); 709 taskBuilder.setMarkedTask(optional, task1); 710 taskBuilder.setMarkedTask(optional, task2); 711 712 ITaskInstance taskInstance2 = taskFactory.createNewTaskInstance(task2); 713 ITaskInstance optionalInstance = taskFactory.createNewTaskInstance(optional); 714 715 taskBuilder.addChild(optionalInstance, taskInstance2); 716 717 assertNotNull(optionalInstance.getChildren()); 718 assertEquals(1, optionalInstance.getChildren().size()); 719 assertEquals(taskInstance2, optionalInstance.getChildren().get(0)); 720 } 721 722 /** 723 * 724 */ 725 @Test 726 public void test_UserSession_01() throws Exception { 727 IUserSession userSession = taskFactory.createUserSession(); 728 729 assertNotNull(userSession); 730 assertNotNull(userSession.getExecutedTasks()); 731 assertEquals(0, userSession.getExecutedTasks().size()); 732 } 733 734 /** 735 * 736 */ 737 @Test 738 public void test_UserSession_02() throws Exception { 739 IEventType eventType = new DummyInteraction("interaction", 1); 740 IEventTarget eventTarget = new DummyGUIElement("elem"); 741 742 IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 743 744 IUserSession userSession = taskFactory.createUserSession(); 745 746 ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 747 748 taskBuilder.addExecutedTask(userSession, taskInstance); 749 750 assertNotNull(userSession.getExecutedTasks()); 751 assertEquals(1, userSession.getExecutedTasks().size()); 752 assertEquals(taskInstance, userSession.getExecutedTasks().get(0)); 753 } 754 755 /** 756 * 757 */ 758 @Test 759 public void test_UserSession_03() throws Exception { 760 IEventType eventType = new DummyInteraction("interaction", 1); 761 IEventTarget eventTarget = new DummyGUIElement("elem"); 762 763 IEventTask task = taskFactory.createNewEventTask(eventType, eventTarget); 764 ISequence sequence = taskFactory.createNewSequence(); 765 ISelection selection = taskFactory.createNewSelection(); 766 IIteration iteration = taskFactory.createNewIteration(); 767 IOptional optional = taskFactory.createNewOptional(); 768 769 taskBuilder.addChild(sequence, task); 770 taskBuilder.addChild(selection, task); 771 taskBuilder.setMarkedTask(iteration, task); 772 taskBuilder.setMarkedTask(optional, task); 773 774 ITaskInstance taskInstance = taskFactory.createNewTaskInstance(task); 775 ITaskInstance sequenceInstance = taskFactory.createNewTaskInstance(sequence); 776 ITaskInstance selectionInstance = taskFactory.createNewTaskInstance(selection); 777 ITaskInstance iterationInstance = taskFactory.createNewTaskInstance(iteration); 778 ITaskInstance optionalInstance = taskFactory.createNewTaskInstance(optional); 779 780 taskBuilder.addChild(sequenceInstance, taskFactory.createNewTaskInstance(task)); 781 taskBuilder.addChild(selectionInstance, taskFactory.createNewTaskInstance(task)); 782 taskBuilder.addChild(iterationInstance, taskFactory.createNewTaskInstance(task)); 783 taskBuilder.addChild(optionalInstance, taskFactory.createNewTaskInstance(task)); 784 785 IUserSession userSession = taskFactory.createUserSession(); 786 787 taskBuilder.addExecutedTask(userSession, taskInstance); 788 taskBuilder.addExecutedTask(userSession, sequenceInstance); 789 taskBuilder.addExecutedTask(userSession, selectionInstance); 790 taskBuilder.addExecutedTask(userSession, iterationInstance); 791 taskBuilder.addExecutedTask(userSession, optionalInstance); 792 793 assertNotNull(userSession.getExecutedTasks()); 794 assertEquals(5, userSession.getExecutedTasks().size()); 795 assertEquals(taskInstance, userSession.getExecutedTasks().get(0)); 796 assertEquals(sequenceInstance, userSession.getExecutedTasks().get(1)); 797 assertEquals(selectionInstance, userSession.getExecutedTasks().get(2)); 798 assertEquals(iterationInstance, userSession.getExecutedTasks().get(3)); 799 assertEquals(optionalInstance, userSession.getExecutedTasks().get(4)); 800 } 801 802 /** 803 * 61 804 */ 62 805 @Test … … 67 810 68 811 for (int i = 0; i < noOfTrees; i++) { 69 System.err.println("iteration " + (i + 1) + ":"); 70 System.err.println(" creating tree"); 71 Map<ITaskTreeNode, ITaskTreeNodeInfo> treeInfos = 72 new HashMap<ITaskTreeNode, ITaskTreeNodeInfo>(); 73 ITaskTreeNode rootNode = createTree(noOfMaxChildren, maxDepth, treeInfos); 74 System.err.println(" creating task tree"); 75 ITaskTree taskTree = taskTreeNodeFactory.createTaskTree(rootNode); 812 System.err.println("\niteration " + (i + 1) + ":"); 813 System.err.println(" creating tasks"); 814 Map<ITask, ITaskInfo> expectedTaskInfos = new HashMap<ITask, ITaskInfo>(); 815 ITask task = createTaskTree(noOfMaxChildren, maxDepth, expectedTaskInfos); 816 if (!(task instanceof ISequence)) { 817 ISequence sequence = taskFactory.createNewSequence(); 818 taskBuilder.addChild(sequence, task); 819 task = sequence; 820 } 821 else { 822 expectedTaskInfos.remove(task); 823 } 824 825 ITaskInstance taskInstance = instantiateTask(task, noOfMaxChildren); 826 827 System.err.println(" creating user session"); 828 829 IUserSession session = taskFactory.createUserSession(); 830 831 for (ITaskInstance child : taskInstance.getChildren()) { 832 taskBuilder.addExecutedTask(session, child); 833 } 834 835 List<IUserSession> sessions = new LinkedList<IUserSession>(); 836 sessions.add(session); 837 838 ITaskModel taskTree = taskFactory.createTaskModel(sessions); 76 839 77 840 System.err.println(" validating task tree"); 78 assertEquals(rootNode, taskTree.getRoot()); 79 assertMapsEqual(treeInfos, taskTree.getTaskMap()); 80 } 81 } 82 83 /** 84 * TODO: comment 85 * 86 * @param treeInfos 87 * @param taskMap 88 */ 89 private void assertMapsEqual(Map<ITaskTreeNode, ITaskTreeNodeInfo> map1, 90 Map<ITaskTreeNode, ITaskTreeNodeInfo> map2) 841 Map<ITask, ITaskInfo> actualTaskInfos = new HashMap<ITask, ITaskInfo>(); 842 843 for (ITask currentTask : taskTree.getTasks()) { 844 actualTaskInfos.put(currentTask, taskTree.getTaskInfo(currentTask)); 845 } 846 847 assertMapsEqual(expectedTaskInfos, actualTaskInfos); 848 } 849 } 850 851 /** 852 * 853 */ 854 private void assertMapsEqual(Map<ITask, ITaskInfo> map1, 855 Map<ITask, ITaskInfo> map2) 91 856 { 92 857 try { … … 98 863 assertEquals(map1.size(), map2.size()); 99 864 100 for (Map.Entry<ITask TreeNode, ITaskTreeNodeInfo> entry : map1.entrySet()) {101 ITask TreeNodeInfo value2 = map2.get(entry.getKey());865 for (Map.Entry<ITask, ITaskInfo> entry : map1.entrySet()) { 866 ITaskInfo value2 = map2.get(entry.getKey()); 102 867 assertNotNull(value2); 103 868 assertEquals(entry.getValue().getTask(), value2.getTask()); … … 114 879 115 880 /** 116 * TODO: comment 117 * 118 * @param map2 119 */ 120 private void dumpMap(Map<ITaskTreeNode, ITaskTreeNodeInfo> map) { 881 * 882 */ 883 private void dumpMap(Map<ITask, ITaskInfo> map) { 121 884 System.err.println(); 122 885 … … 126 889 else { 127 890 System.err.println("map:"); 128 for (Map.Entry<ITask TreeNode, ITaskTreeNodeInfo> entry : map.entrySet()) {891 for (Map.Entry<ITask, ITaskInfo> entry : map.entrySet()) { 129 892 System.err.print(" "); 130 893 System.err.print(entry.getKey()); 131 for (int i = entry.getKey().toString().length(); i < 49; i++) {894 for (int i = entry.getKey().toString().length(); i < 60; i++) { 132 895 System.err.print(" "); 133 896 } … … 141 904 142 905 /** 143 * TODO: comment 144 * 145 * @param noOfMaxChildren 146 * @param maxDepth 147 * @param treeInfos 148 * @return 149 */ 150 private ITaskTreeNode createTree(int maxNoOfChildren, 151 int maxDepth, 152 Map<ITaskTreeNode, ITaskTreeNodeInfo> treeInfos) 906 * 907 */ 908 private ITask createTaskTree(int maxNoOfChildren, 909 int maxDepth, 910 Map<ITask, ITaskInfo> taskInfos) 153 911 throws Exception 154 912 { 155 /* 156 * for (int i = 0; i < (MAX_TREE_DEPTH + 1 - maxDepth); i++) { System.err.print(" "); } 157 */ 158 159 ITaskTreeNode tree; 913 914 ITask task; 160 915 161 916 // integrating the maximum depth here assures, that either something between 0 and 8 will 162 917 // be the type, or if the max depth decreases near 0 only event tasks will be created 163 918 // to finish the tree creation 164 int type = (int) (Math.random() * (Math.min(8, maxDepth)));919 int type = randomize(Math.min(10, maxDepth)); 165 920 166 921 switch (type) … … 168 923 case 0: { 169 924 // System.err.print("creating new event task "); 170 t ree = createNewEventTask(treeInfos);925 task = createNewEventTask(taskInfos); 171 926 break; 172 927 } 173 928 case 1: { 174 929 // System.err.print("reusing event task "); 175 t ree = reuseEventTask(treeInfos);930 task = reuseEventTask(taskInfos); 176 931 break; 177 932 } 178 933 case 2: { 179 934 // System.err.println("creating new sequence {"); 180 t ree = createNewSequence(maxNoOfChildren, maxDepth, treeInfos);935 task = createNewSequence(maxNoOfChildren, maxDepth, taskInfos); 181 936 break; 182 937 } 183 938 case 3: { 184 939 // System.err.println("reusing sequence {"); 185 t ree = reuseSequence(maxNoOfChildren, maxDepth, treeInfos);940 task = reuseSequence(maxNoOfChildren, maxDepth, taskInfos); 186 941 break; 187 942 } 188 943 case 4: { 189 944 // System.err.println("creating new selection {"); 190 t ree = createNewSelection(maxNoOfChildren, maxDepth, treeInfos);945 task = createNewSelection(maxNoOfChildren, maxDepth, taskInfos); 191 946 break; 192 947 } 193 948 case 5: { 194 949 // System.err.println("reusing selection {"); 195 t ree = reuseSelection(maxNoOfChildren, maxDepth, treeInfos);950 task = reuseSelection(maxNoOfChildren, maxDepth, taskInfos); 196 951 break; 197 952 } 198 953 case 6: { 199 954 // System.err.println("creating new iteration {"); 200 t ree = createNewIteration(maxNoOfChildren, maxDepth, treeInfos);955 task = createNewIteration(maxNoOfChildren, maxDepth, taskInfos); 201 956 break; 202 957 } 203 958 case 7: { 204 959 // System.err.println("reusing iteration {"); 205 tree = reuseIteration(maxNoOfChildren, maxDepth, treeInfos); 960 task = reuseIteration(maxNoOfChildren, maxDepth, taskInfos); 961 break; 962 } 963 case 8: { 964 // System.err.println("creating new optional {"); 965 task = createNewOptional(maxNoOfChildren, maxDepth, taskInfos); 966 break; 967 } 968 case 9: { 969 // System.err.println("reusing optional {"); 970 task = reuseOptional(maxNoOfChildren, maxDepth, taskInfos); 206 971 break; 207 972 } 208 973 default: { 209 974 // System.err.print("creating new event task per default "); 210 tree = createNewEventTask(treeInfos); 211 } 212 } 213 214 /* 215 * if (!(tree instanceof InteractionTask)) { for (int i = 0; i < (MAX_TREE_DEPTH + 1 - 216 * maxDepth); i++) { System.err.print(" "); } 217 * 218 * System.err.print("} "); } 219 * 220 * System.err.println(tree); 221 */ 222 223 return tree; 224 } 225 226 /** 227 * TODO: comment 228 * 229 * @param treeInfos 230 * @return 231 */ 232 private IEventTask createNewEventTask(Map<ITaskTreeNode, ITaskTreeNodeInfo> treeInfos) 975 task = createNewEventTask(taskInfos); 976 } 977 } 978 979 return task; 980 } 981 982 /** 983 * 984 */ 985 private ITask createNewEventTask(Map<ITask, ITaskInfo> taskInfos) 233 986 throws Exception 234 987 { 235 988 Thread.sleep(2); 236 989 long id = System.currentTimeMillis(); 237 IEventTask task = 238 taskTreeNodeFactory.createNewEventTask(new DummyInteraction("interaction" + id, 1), 239 new DummyGUIElement("elem" + id)); 240 241 treeInfos.put(task, new NodeInfo(task)); 990 IEventTask task = taskFactory.createNewEventTask 991 (new DummyInteraction("interaction" + id, 1), new DummyGUIElement("elem" + id)); 992 993 taskInfos.put(task, new TaskInfo(task)); 242 994 243 995 return task; … … 245 997 246 998 /** 247 * TODO: comment 248 * 249 * @param treeInfos 250 * @return 251 */ 252 private IEventTask reuseEventTask(Map<ITaskTreeNode, ITaskTreeNodeInfo> treeInfos) 999 * 1000 */ 1001 private ITask reuseEventTask(Map<ITask, ITaskInfo> taskInfos) 253 1002 throws Exception 254 1003 { 255 int noOfEventTasks = 0; 256 257 for (Map.Entry<ITaskTreeNode, ITaskTreeNodeInfo> entry : treeInfos.entrySet()) { 258 if (entry.getKey() instanceof IEventTask) { 259 noOfEventTasks++; 260 } 261 } 262 263 if (noOfEventTasks > 0) { 264 noOfEventTasks = (int) (Math.random() * noOfEventTasks); 265 266 for (Map.Entry<ITaskTreeNode, ITaskTreeNodeInfo> entry : treeInfos.entrySet()) { 267 if (entry.getKey() instanceof IEventTask) { 268 if (--noOfEventTasks <= 0) { 269 return (IEventTask) entry.getKey(); 1004 ITask eventTask = reuseTask(taskInfos, IEventTask.class); 1005 1006 if (eventTask == null) { 1007 eventTask = createNewEventTask(taskInfos); 1008 } 1009 1010 return eventTask; 1011 } 1012 1013 /** 1014 * 1015 */ 1016 private ITask createNewSequence(int maxNoOfChildren, 1017 int maxDepth, 1018 Map<ITask, ITaskInfo> taskInfos) 1019 throws Exception 1020 { 1021 ISequence sequence = taskFactory.createNewSequence(); 1022 1023 // ensure at the minimum 2 children 1024 int noOfChildren = randomize(2, maxNoOfChildren); 1025 1026 for (int i = 0; i < noOfChildren; i++) { 1027 ITask child = createTaskTree(maxNoOfChildren, maxDepth - 1, taskInfos); 1028 taskBuilder.addChild(sequence, child); 1029 } 1030 1031 taskInfos.put(sequence, new TaskInfo(sequence)); 1032 return sequence; 1033 } 1034 1035 /** 1036 * 1037 */ 1038 private ITask reuseSequence(int maxNoOfChildren, 1039 int maxDepth, 1040 Map<ITask, ITaskInfo> taskInfos) 1041 throws Exception 1042 { 1043 ITask sequence = reuseTask(taskInfos, ISequence.class); 1044 1045 if (sequence == null) { 1046 sequence = createNewSequence(maxNoOfChildren, maxDepth, taskInfos); 1047 } 1048 1049 return sequence; 1050 } 1051 1052 /** 1053 * 1054 */ 1055 private ITask createNewSelection(int maxNoOfChildren, 1056 int maxDepth, 1057 Map<ITask, ITaskInfo> taskInfos) 1058 throws Exception 1059 { 1060 ISelection selection = taskFactory.createNewSelection(); 1061 1062 // ensure at the minimum 1 child 1063 int noOfChildren = randomize(1, maxNoOfChildren); 1064 1065 for (int i = 0; i < noOfChildren; i++) { 1066 ITask child = createTaskTree(maxNoOfChildren, maxDepth - 1, taskInfos); 1067 taskBuilder.addChild(selection, child); 1068 } 1069 1070 taskInfos.put(selection, new TaskInfo(selection)); 1071 return selection; 1072 } 1073 1074 /** 1075 * 1076 */ 1077 private ITask reuseSelection(int maxNoOfChildren, 1078 int maxDepth, 1079 Map<ITask, ITaskInfo> taskInfos) 1080 throws Exception 1081 { 1082 ITask selection = reuseTask(taskInfos, ISelection.class); 1083 1084 if (selection == null) { 1085 selection = createNewSelection(maxNoOfChildren, maxDepth, taskInfos); 1086 } 1087 1088 return selection; 1089 } 1090 1091 /** 1092 * 1093 */ 1094 private ITask createNewIteration(int maxNoOfChildren, 1095 int maxDepth, 1096 Map<ITask, ITaskInfo> taskInfos) 1097 throws Exception 1098 { 1099 IIteration iteration = taskFactory.createNewIteration(); 1100 1101 ITask child = createTaskTree(maxNoOfChildren, maxDepth - 1, taskInfos); 1102 taskBuilder.setMarkedTask(iteration, child); 1103 1104 taskInfos.put(iteration, new TaskInfo(iteration)); 1105 return iteration; 1106 } 1107 1108 /** 1109 * 1110 */ 1111 private ITask reuseIteration(int maxNoOfChildren, 1112 int maxDepth, 1113 Map<ITask, ITaskInfo> taskInfos) 1114 throws Exception 1115 { 1116 ITask iteration = reuseTask(taskInfos, IIteration.class); 1117 1118 if (iteration == null) { 1119 iteration = createNewIteration(maxNoOfChildren, maxDepth, taskInfos); 1120 } 1121 1122 return iteration; 1123 } 1124 1125 /** 1126 * 1127 */ 1128 private ITask createNewOptional(int maxNoOfChildren, 1129 int maxDepth, 1130 Map<ITask, ITaskInfo> taskInfos) 1131 throws Exception 1132 { 1133 IOptional optional = taskFactory.createNewOptional(); 1134 1135 ITask child = createTaskTree(maxNoOfChildren, maxDepth - 1, taskInfos); 1136 taskBuilder.setMarkedTask(optional, child); 1137 1138 taskInfos.put(optional, new TaskInfo(optional)); 1139 return optional; 1140 } 1141 1142 /** 1143 * 1144 */ 1145 private ITask reuseOptional(int maxNoOfChildren, 1146 int maxDepth, 1147 Map<ITask, ITaskInfo> taskInfos) 1148 throws Exception 1149 { 1150 ITask optional = reuseTask(taskInfos, IOptional.class); 1151 1152 if (optional == null) { 1153 optional = createNewOptional(maxNoOfChildren, maxDepth, taskInfos); 1154 } 1155 1156 return optional; 1157 } 1158 1159 /** 1160 * 1161 */ 1162 private ITask reuseTask(Map<ITask, ITaskInfo> taskInfos, Class<? extends ITask> type) 1163 throws Exception 1164 { 1165 int noOfTasks = 0; 1166 1167 for (Map.Entry<ITask, ITaskInfo> entry : taskInfos.entrySet()) { 1168 if (type.isInstance(entry.getKey())) { 1169 noOfTasks++; 1170 } 1171 } 1172 1173 if (noOfTasks > 0) { 1174 noOfTasks = randomize(noOfTasks); 1175 1176 for (Map.Entry<ITask, ITaskInfo> entry : taskInfos.entrySet()) { 1177 if (type.isInstance(entry.getKey())) { 1178 if (--noOfTasks <= 0) { 1179 return entry.getKey(); 270 1180 } 271 1181 } … … 273 1183 } 274 1184 else { 275 return createNewEventTask(treeInfos);1185 return null; 276 1186 } 277 1187 … … 280 1190 281 1191 /** 282 * TODO: comment 283 * 284 * @param treeInfos 285 * @return 286 */ 287 private ISequence createNewSequence(int maxNoOfChildren, 288 int maxDepth, 289 Map<ITaskTreeNode, ITaskTreeNodeInfo> treeInfos) 290 throws Exception 291 { 292 ISequence sequence = taskTreeNodeFactory.createNewSequence(); 293 294 int noOfChildren = (int) (Math.random() * maxNoOfChildren); 295 296 for (int i = 0; i < noOfChildren; i++) { 297 ITaskTreeNode child = createTree(maxNoOfChildren, maxDepth - 1, treeInfos); 298 299 // through first removing an existing parent it is assured, that a parent is recorded 300 // only once. This is needed, because parent may be reused in a tree as well, but we 301 // always 302 // iterate the whole tree 303 ((NodeInfo) treeInfos.get(child)).removeParent(sequence); 304 ((NodeInfo) treeInfos.get(child)).addParent(sequence); 305 taskTreeBuilder.addChild(sequence, child); 306 } 307 308 treeInfos.put(sequence, new NodeInfo(sequence)); 309 return sequence; 310 } 311 312 /** 313 * TODO: comment 314 * 315 * @param treeInfos 316 * @return 317 */ 318 private ISequence reuseSequence(int maxNoOfChildren, 319 int maxDepth, 320 Map<ITaskTreeNode, ITaskTreeNodeInfo> treeInfos) 321 throws Exception 322 { 323 int noOfSequences = 0; 324 325 for (Map.Entry<ITaskTreeNode, ITaskTreeNodeInfo> entry : treeInfos.entrySet()) { 326 if (entry.getKey() instanceof ISequence) { 327 noOfSequences++; 328 } 329 } 330 331 if (noOfSequences > 0) { 332 noOfSequences = (int) (Math.random() * noOfSequences); 333 334 for (Map.Entry<ITaskTreeNode, ITaskTreeNodeInfo> entry : treeInfos.entrySet()) { 335 if (entry.getKey() instanceof ISequence) { 336 if (--noOfSequences <= 0) { 337 return (ISequence) entry.getKey(); 338 } 339 } 340 } 341 } 342 else { 343 return createNewSequence(maxNoOfChildren, maxDepth, treeInfos); 344 } 345 346 throw new RuntimeException("this is an implementation error"); 347 } 348 349 /** 350 * TODO: comment 351 * 352 * @param treeInfos 353 * @return 354 */ 355 private ISelection createNewSelection(int maxNoOfChildren, 356 int maxDepth, 357 Map<ITaskTreeNode, ITaskTreeNodeInfo> treeInfos) 358 throws Exception 359 { 360 ISelection selection = taskTreeNodeFactory.createNewSelection(); 361 362 int noOfChildren = (int) (Math.random() * maxNoOfChildren); 363 364 for (int i = 0; i < noOfChildren; i++) { 365 ITaskTreeNode child = createTree(maxNoOfChildren, maxDepth - 1, treeInfos); 366 367 // through first removing an existing parent it is assured, that a parent is recorded 368 // only once. This is needed, because parent may be reused in a tree as well, but we 369 // always 370 // iterate the whole tree 371 ((NodeInfo) treeInfos.get(child)).removeParent(selection); 372 ((NodeInfo) treeInfos.get(child)).addParent(selection); 373 taskTreeBuilder.addChild(selection, child); 374 } 375 376 treeInfos.put(selection, new NodeInfo(selection)); 377 return selection; 378 } 379 380 /** 381 * TODO: comment 382 * 383 * @param treeInfos 384 * @return 385 */ 386 private ISelection reuseSelection(int maxNoOfChildren, 387 int maxDepth, 388 Map<ITaskTreeNode, ITaskTreeNodeInfo> treeInfos) 389 throws Exception 390 { 391 int noOfSelections = 0; 392 393 for (Map.Entry<ITaskTreeNode, ITaskTreeNodeInfo> entry : treeInfos.entrySet()) { 394 if (entry.getKey() instanceof ISelection) { 395 noOfSelections++; 396 } 397 } 398 399 if (noOfSelections > 0) { 400 noOfSelections = (int) (Math.random() * noOfSelections); 401 402 for (Map.Entry<ITaskTreeNode, ITaskTreeNodeInfo> entry : treeInfos.entrySet()) { 403 if (entry.getKey() instanceof ISelection) { 404 if (--noOfSelections <= 0) { 405 return (ISelection) entry.getKey(); 406 } 407 } 408 } 409 } 410 else { 411 return createNewSelection(maxNoOfChildren, maxDepth, treeInfos); 412 } 413 414 throw new RuntimeException("this is an implementation error"); 415 } 416 417 /** 418 * TODO: comment 419 * 420 * @param treeInfos 421 * @return 422 */ 423 private IIteration createNewIteration(int maxNoOfChildren, 424 int maxDepth, 425 Map<ITaskTreeNode, ITaskTreeNodeInfo> treeInfos) 426 throws Exception 427 { 428 IIteration iteration = taskTreeNodeFactory.createNewIteration(); 429 430 ITaskTreeNode child = createTree(maxNoOfChildren, maxDepth - 1, treeInfos); 431 432 // through first removing an existing parent it is assured, that a parent is recorded 433 // only once. This is needed, because parent may be reused in a tree as well, but we always 434 // iterate the whole tree 435 ((NodeInfo) treeInfos.get(child)).removeParent(iteration); 436 ((NodeInfo) treeInfos.get(child)).addParent(iteration); 437 taskTreeBuilder.setChild(iteration, child); 438 439 treeInfos.put(iteration, new NodeInfo(iteration)); 440 return iteration; 441 } 442 443 /** 444 * TODO: comment 445 * 446 * @param treeInfos 447 * @return 448 */ 449 private IIteration reuseIteration(int maxNoOfChildren, 450 int maxDepth, 451 Map<ITaskTreeNode, ITaskTreeNodeInfo> treeInfos) 452 throws Exception 453 { 454 int noOfIterations = 0; 455 456 for (Map.Entry<ITaskTreeNode, ITaskTreeNodeInfo> entry : treeInfos.entrySet()) { 457 if (entry.getKey() instanceof IIteration) { 458 noOfIterations++; 459 } 460 } 461 462 if (noOfIterations > 0) { 463 noOfIterations = (int) (Math.random() * noOfIterations); 464 465 for (Map.Entry<ITaskTreeNode, ITaskTreeNodeInfo> entry : treeInfos.entrySet()) { 466 if (entry.getKey() instanceof IIteration) { 467 if (--noOfIterations <= 0) { 468 return (IIteration) entry.getKey(); 469 } 470 } 471 } 472 } 473 else { 474 return createNewIteration(maxNoOfChildren, maxDepth, treeInfos); 475 } 476 477 throw new RuntimeException("this is an implementation error"); 478 } 479 1192 * 1193 */ 1194 private ITaskInstance instantiateTask(ITask task, int maxIterationCount) throws Exception { 1195 ITaskInstance instance = taskFactory.createNewTaskInstance(task); 1196 1197 if (task instanceof ISequence) { 1198 for (ITask child : ((ISequence) task).getChildren()) { 1199 taskBuilder.addChild(instance, instantiateTask(child, maxIterationCount)); 1200 } 1201 } 1202 else if (task instanceof ISelection) { 1203 List<ITask> children = ((ISelection) task).getChildren(); 1204 int index = randomize(children.size()); 1205 taskBuilder.addChild(instance, instantiateTask(children.get(index), maxIterationCount)); 1206 } 1207 else if (task instanceof IIteration) { 1208 int count = randomize(maxIterationCount); 1209 ITask child = ((IIteration) task).getMarkedTask(); 1210 1211 for (int i = 0; i < count; i++) { 1212 taskBuilder.addChild(instance, instantiateTask(child, maxIterationCount)); 1213 } 1214 } 1215 else if (task instanceof IOptional) { 1216 ITask child = ((IOptional) task).getMarkedTask(); 1217 1218 if (randomize(1) == 0) { 1219 taskBuilder.addChild(instance, instantiateTask(child, maxIterationCount)); 1220 } 1221 } 1222 1223 return instance; 1224 } 1225 1226 /** 1227 * 1228 */ 1229 private int randomize(int max) throws Exception { 1230 return randomize(0, max); 1231 } 1232 1233 /** 1234 * 1235 */ 1236 private int randomize(int min, int max) throws Exception { 1237 if (min > max) { 1238 throw new IllegalArgumentException("min must always be smaller or equal than max"); 1239 } 1240 1241 int deviation = max - min; 1242 int value = (int) (Math.random() * deviation); 1243 1244 return value + min; 1245 } 480 1246 }
Note: See TracChangeset
for help on using the changeset viewer.