Ignore:
Timestamp:
04/04/13 16:06:07 (12 years ago)
Author:
pharms
Message:
  • complete refactoring of task tree model with a separation of task models and task instances
  • appropriate adaptation of task tree generation process
  • appropriate adaptation of commands and task tree visualization
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  
    2929import de.ugoe.cs.autoquest.test.DummyGUIElement; 
    3030import de.ugoe.cs.autoquest.test.DummyInteraction; 
     31import de.ugoe.cs.util.console.Console; 
    3132import de.ugoe.cs.util.console.TextConsole; 
    3233 
     
    4748    @Before 
    4849    public void setUp() { 
     50        Console.reset(); 
    4951        new TextConsole(Level.FINEST); 
    5052        manager = new TaskTreeManager(); 
     
    6668    public void testOneEventOnOneElement() { 
    6769        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)); 
    7474    } 
    7575 
     
    8484        simulateEvent(new DummyInteraction("blo", 1), eventTarget); 
    8585        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)); 
    9896    } 
    9997 
     
    111109        simulateEvent(new DummyInteraction("bla", 1), eventTarget1); 
    112110        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)); 
    129125    } 
    130126 
     
    142138        simulateEvent(new DummyInteraction("bla", 1), eventTarget1); 
    143139        simulateEvent(new DummyInteraction("bli", 1), eventTarget1); 
    144         simulateEvent(new DummyInteraction("bla", 1), eventTarget1); 
    145         simulateEvent(new DummyInteraction("bli", 1), eventTarget2); 
     140        simulateEvent(new DummyInteraction("blup", 1), eventTarget1); 
     141        simulateEvent(new DummyInteraction("ble", 1), eventTarget2); 
    146142        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)); 
    178172    } 
    179173 
     
    187181        simulateEvent(event1, eventTarget1); 
    188182        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 {}" + 
    195188             "  }" + 
    196              "}", manager.getTaskTree()); 
     189             "}", manager.getTaskModel().getUserSessions().get(0)); 
    197190    } 
    198191 
     
    208201        } 
    209202 
    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 {}" + 
    216216             "  }" + 
    217              "}", manager.getTaskTree()); 
     217             "}", manager.getTaskModel().getUserSessions().get(0)); 
    218218    } 
    219219 
     
    229229        IEventType event2 = new DummyInteraction("bli", 1); 
    230230        IEventType event3 = new DummyInteraction("blup", 1); 
     231        IEventType event4 = new DummyInteraction("ble", 1); 
     232        IEventType event5 = new DummyInteraction("blo", 1); 
    231233 
    232234        simulateEvent(event2, eventTarget1); 
     
    235237            simulateEvent(event1, eventTarget1); 
    236238        } 
    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 {}" + 
    250257             "  }" + 
    251              "}", manager.getTaskTree()); 
     258             "  Event ble {}" + 
     259             "  Event blo {}" + 
     260             "}", manager.getTaskModel().getUserSessions().get(0)); 
    252261 
    253262    } 
     
    264273 
    265274        // now test with iterations of iterations 
    266         for (int i = 0; i < 10; i++) { 
     275        for (int i = 0; i < 5; i++) { 
    267276            for (int j = 0; j < 5; j++) { 
    268277                simulateEvent(event1, eventTarget1); 
     
    276285        } 
    277286 
    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 {}" + 
    292403             "      }" + 
    293404             "    }" + 
    294405             "  }" + 
    295              "}", manager.getTaskTree()); 
     406             "}", manager.getTaskModel().getUserSessions().get(0)); 
    296407 
    297408    } 
     
    315426        simulateEvent(event3, eventTarget1); 
    316427         
    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 {}" + 
    326440             "    }" + 
    327441             "  }" + 
    328              "}", manager.getTaskTree()); 
     442             "}", manager.getTaskModel().getUserSessions().get(0)); 
    329443    } 
    330444 
     
    345459        } 
    346460 
    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 {}" + 
    356513             "    }" + 
    357514             "  }" + 
    358              "}", manager.getTaskTree()); 
     515             "}", manager.getTaskModel().getUserSessions().get(0)); 
    359516    } 
    360517 
     
    375532         
    376533        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++) { 
    380535            simulateEvent(event1, eventTarget1); 
    381536            simulateEvent(event2, eventTarget1); 
    382537            simulateEvent(event3, eventTarget1); 
    383538        } 
     539        simulateEvent(event5, eventTarget1); 
    384540        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             "    }" + 
    404571             "  }" + 
    405              "}", manager.getTaskTree()); 
     572             "  Event blo {}" + 
     573             "  Event blu {}" + 
     574             "}", manager.getTaskModel().getUserSessions().get(0)); 
    406575    } 
    407576 
     
    418587        IEventType event5 = new DummyInteraction("blau", 1); 
    419588        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); 
    420592 
    421593        // now test with iterations of iterations 
    422         for (int i = 0; i < 10; i++) { 
     594        for (int i = 0; i < 5; i++) { 
    423595            for (int j = 0; j < 5; j++) { 
    424596                simulateEvent(event1, eventTarget1); 
     
    432604            } 
    433605            for (int j = 0; j < 5; j++) { 
    434                 simulateEvent(event1, eventTarget1); 
    435                 simulateEvent(event3, eventTarget1); 
    436                 simulateEvent(event5, eventTarget1); 
     606                simulateEvent(event7, eventTarget1); 
     607                simulateEvent(event8, eventTarget1); 
     608                simulateEvent(event9, eventTarget1); 
    437609            } 
    438610        } 
    439611 
    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 {}" + 
    4651027             "        }" + 
    4661028             "      }" + 
    4671029             "    }" + 
    4681030             "  }" + 
    469              "}", manager.getTaskTree()); 
     1031             "}", manager.getTaskModel().getUserSessions().get(0)); 
    4701032    } 
    4711033 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/EventTaskComparisonRuleTest.java

    r1125 r1146  
    1313//   limitations under the License. 
    1414 
    15 package de.ugoe.cs.autoquest.tasktrees.nodeequality; 
     15package de.ugoe.cs.autoquest.tasktrees.taskequality; 
    1616 
    1717import static org.junit.Assert.*; 
     
    2222import de.ugoe.cs.autoquest.eventcore.IEventType; 
    2323import 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.ITaskTreeNode; 
    27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNodeFactory; 
    28 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNodeFactory; 
     24import de.ugoe.cs.autoquest.tasktrees.taskequality.EventTaskComparisonRule; 
     25import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
     26import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     27import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
     28import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 
    2929import de.ugoe.cs.autoquest.test.DummyGUIElement; 
    3030 
     
    3939    @Test 
    4040    public void test_isApplicable_01() { 
    41         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
    42  
    43         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    44  
    45         IEventType eventType1 = new StringEventType("eventType1"); 
    46         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    47         ITaskTreeNode 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); 
    4848 
    4949        assertTrue(rule.isApplicable(task1, task1)); 
     
    5555    @Test 
    5656    public void test_isApplicable_02() { 
    57         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
    58  
    59         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    60  
    61         IEventType eventType1 = new StringEventType("eventType1"); 
    62         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    63         ITaskTreeNode 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); 
    6464 
    6565        IEventType eventType2 = new StringEventType("eventType2"); 
    6666        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    67         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     67        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    6868 
    6969        assertTrue(rule.isApplicable(task1, task2)); 
     
    7676    @Test 
    7777    public void test_isApplicable_03() { 
    78         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
    79  
    80         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    81  
    82         IEventType eventType1 = new StringEventType("eventType1"); 
    83         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    84         ITaskTreeNode 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); 
    8585        
    86         ITaskTreeNode selection = treeNodeFactory.createNewSelection(); 
     86        ITask selection = taskFactory.createNewSelection(); 
    8787 
    8888        assertFalse(rule.isApplicable(task1, selection)); 
     
    9595    @Test 
    9696    public void test_isApplicable_04() { 
    97         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
    98  
    99         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    100  
    101         IEventType eventType1 = new StringEventType("eventType1"); 
    102         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    103         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
    104  
    105         ITaskTreeNode 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(); 
    106106 
    107107        assertFalse(rule.isApplicable(task1, sequence)); 
     
    114114    @Test 
    115115    public void test_isApplicable_05() { 
    116         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
    117  
    118         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    119  
    120         IEventType eventType1 = new StringEventType("eventType1"); 
    121         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    122         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
    123  
    124         ITaskTreeNode 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(); 
    125125 
    126126        assertFalse(rule.isApplicable(task1, iteration)); 
     
    133133    @Test 
    134134    public void test_isApplicable_06() { 
    135         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
    136  
    137         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    138  
    139         IEventType eventType1 = new StringEventType("eventType1"); 
    140         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    141         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
    142  
    143         ITaskTreeNode 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(); 
    144144 
    145145        assertFalse(rule.isApplicable(task1, optional)); 
     
    152152    @Test 
    153153    public void test_compare_01() { 
    154         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
    155          
    156         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    157          
    158         IEventType eventType1 = new StringEventType("eventType1"); 
    159         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    160         ITaskTreeNode 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)); 
    163163        assertTrue(rule.areLexicallyEqual(task1, task1)); 
    164164        assertTrue(rule.areSyntacticallyEqual(task1, task1)); 
     
    171171    @Test 
    172172    public void test_compare_02() { 
    173         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
    174          
    175         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    176          
    177         IEventType eventType1 = new StringEventType("eventType1"); 
    178         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    179         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
    180          
    181         ITaskTreeNode 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)); 
    184184        assertTrue(rule.areLexicallyEqual(task1, task2)); 
    185185        assertTrue(rule.areSyntacticallyEqual(task1, task2)); 
    186186        assertTrue(rule.areSemanticallyEqual(task1, task2)); 
    187187 
    188         assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(task2, task1)); 
     188        assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task2, task1)); 
    189189        assertTrue(rule.areLexicallyEqual(task2, task1)); 
    190190        assertTrue(rule.areSyntacticallyEqual(task2, task1)); 
     
    197197    @Test 
    198198    public void test_compare_03() { 
    199         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
    200          
    201         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    202          
    203         IEventType eventType1 = new StringEventType("eventType1"); 
    204         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    205         ITaskTreeNode 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); 
    206206         
    207207        IEventType eventType2 = new StringEventType("eventType2"); 
    208         ITaskTreeNode 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)); 
    211211        assertFalse(rule.areLexicallyEqual(task1, task2)); 
    212212        assertFalse(rule.areSyntacticallyEqual(task1, task2)); 
    213213        assertFalse(rule.areSemanticallyEqual(task1, task2)); 
    214214 
    215         assertEquals(NodeEquality.UNEQUAL, rule.compare(task2, task1)); 
     215        assertEquals(TaskEquality.UNEQUAL, rule.compare(task2, task1)); 
    216216        assertFalse(rule.areLexicallyEqual(task2, task1)); 
    217217        assertFalse(rule.areSyntacticallyEqual(task2, task1)); 
     
    224224    @Test 
    225225    public void test_compare_04() { 
    226         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
    227          
    228         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    229          
    230         IEventType eventType1 = new StringEventType("eventType1"); 
    231         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    232         ITaskTreeNode 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); 
    233233         
    234234        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    235         ITaskTreeNode 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)); 
    238238        assertFalse(rule.areLexicallyEqual(task1, task2)); 
    239239        assertFalse(rule.areSyntacticallyEqual(task1, task2)); 
    240240        assertFalse(rule.areSemanticallyEqual(task1, task2)); 
    241241 
    242         assertEquals(NodeEquality.UNEQUAL, rule.compare(task2, task1)); 
     242        assertEquals(TaskEquality.UNEQUAL, rule.compare(task2, task1)); 
    243243        assertFalse(rule.areLexicallyEqual(task2, task1)); 
    244244        assertFalse(rule.areSyntacticallyEqual(task2, task1)); 
     
    252252    @Test 
    253253    public void test_compare_05() { 
    254         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
    255          
    256         EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
    257          
    258         IEventType eventType1 = new StringEventType("eventType1"); 
    259         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    260         ITaskTreeNode 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); 
    261261         
    262262        IEventType eventType2 = new StringEventType("eventType2"); 
    263263        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    264         ITaskTreeNode 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)); 
    267267        assertFalse(rule.areLexicallyEqual(task1, task2)); 
    268268        assertFalse(rule.areSyntacticallyEqual(task1, task2)); 
    269269        assertFalse(rule.areSemanticallyEqual(task1, task2)); 
    270270 
    271         assertEquals(NodeEquality.UNEQUAL, rule.compare(task2, task1)); 
     271        assertEquals(TaskEquality.UNEQUAL, rule.compare(task2, task1)); 
    272272        assertFalse(rule.areLexicallyEqual(task2, task1)); 
    273273        assertFalse(rule.areSyntacticallyEqual(task2, task1)); 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/GUIEventTaskComparisonRuleTest.java

    r1125 r1146  
    1313//   limitations under the License. 
    1414 
    15 package de.ugoe.cs.autoquest.tasktrees.nodeequality; 
     15package de.ugoe.cs.autoquest.tasktrees.taskequality; 
    1616 
    1717import static org.junit.Assert.*; 
     
    4141import de.ugoe.cs.autoquest.eventcore.gui.ValueSelection; 
    4242import 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; 
     43import de.ugoe.cs.autoquest.tasktrees.taskequality.EventTaskComparisonRule; 
     44import de.ugoe.cs.autoquest.tasktrees.taskequality.GUIEventTaskComparisonRule; 
     45import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
     46import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     47import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
     48import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 
    4849import de.ugoe.cs.autoquest.test.DummyGUIElement; 
    4950 
     
    5859    @Test 
    5960    public void test_isApplicable_01() { 
    60         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     61        ITaskFactory taskFactory = new TaskFactory(); 
    6162 
    6263        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     
    6465        IEventType eventType1 = new StringEventType("eventType1"); 
    6566        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    66         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     67        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    6768 
    6869        assertTrue(rule.isApplicable(task1, task1)); 
     
    7475    @Test 
    7576    public void test_isApplicable_02() { 
    76         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     77        ITaskFactory taskFactory = new TaskFactory(); 
    7778 
    7879        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     
    8081        IEventType eventType1 = new StringEventType("eventType1"); 
    8182        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    82         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     83        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    8384 
    8485        IEventType eventType2 = new StringEventType("eventType2"); 
    8586        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    86         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     87        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    8788 
    8889        assertTrue(rule.isApplicable(task1, task2)); 
     
    9596    @Test 
    9697    public void test_isApplicable_03() { 
    97         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     98        ITaskFactory taskFactory = new TaskFactory(); 
    9899 
    99100        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     
    101102        IEventType eventType1 = new KeyboardFocusChange(); 
    102103        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    103         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     104        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    104105 
    105106        IEventType eventType2 = new KeyboardFocusChange(); 
    106107        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    107         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     108        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    108109 
    109110        assertTrue(rule.isApplicable(task1, task2)); 
     
    116117    @Test 
    117118    public void test_isApplicable_04() { 
    118         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     119        ITaskFactory taskFactory = new TaskFactory(); 
    119120 
    120121        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     
    122123        IEventType eventType1 = new KeyPressed(VirtualKey.LETTER_A); 
    123124        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    124         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     125        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    125126 
    126127        IEventType eventType2 = new KeyReleased(VirtualKey.LETTER_B); 
    127128        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    128         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     129        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    129130 
    130131        assertTrue(rule.isApplicable(task1, task2)); 
     
    137138    @Test 
    138139    public void test_isApplicable_05() { 
    139         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     140        ITaskFactory taskFactory = new TaskFactory(); 
    140141 
    141142        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     
    143144        IEventType eventType1 = new KeyTyped(VirtualKey.LETTER_C); 
    144145        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    145         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     146        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    146147 
    147148        IEventType eventType2 = new KeyTyped(VirtualKey.LETTER_D); 
    148149        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    149         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     150        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    150151 
    151152        assertTrue(rule.isApplicable(task1, task2)); 
     
    158159    @Test 
    159160    public void test_isApplicable_06() { 
    160         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     161        ITaskFactory taskFactory = new TaskFactory(); 
    161162 
    162163        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     
    164165        IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 5, 6); 
    165166        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    166         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     167        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    167168 
    168169        IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.MIDDLE, 3, 1); 
    169170        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    170         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     171        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    171172 
    172173        assertTrue(rule.isApplicable(task1, task2)); 
     
    179180    @Test 
    180181    public void test_isApplicable_07() { 
    181         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     182        ITaskFactory taskFactory = new TaskFactory(); 
    182183 
    183184        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     
    185186        IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.RIGHT, 4, 7); 
    186187        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    187         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     188        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    188189 
    189190        IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.X, 9, 12); 
    190191        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    191         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     192        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    192193 
    193194        assertTrue(rule.isApplicable(task1, task2)); 
     
    200201    @Test 
    201202    public void test_isApplicable_08() { 
    202         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     203        ITaskFactory taskFactory = new TaskFactory(); 
    203204 
    204205        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     
    206207        IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 
    207208        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    208         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     209        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    209210 
    210211        IEventType eventType2 = new MouseDragAndDrop(5, 6, 7, 8); 
    211212        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    212         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     213        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    213214 
    214215        assertTrue(rule.isApplicable(task1, task2)); 
     
    221222    @Test 
    222223    public void test_isApplicable_09() { 
    223         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     224        ITaskFactory taskFactory = new TaskFactory(); 
    224225 
    225226        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     
    227228        IEventType eventType1 = new Scroll(1, 2); 
    228229        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    229         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     230        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    230231 
    231232        IEventType eventType2 = new Scroll(3, 4); 
    232233        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    233         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     234        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    234235 
    235236        assertTrue(rule.isApplicable(task1, task2)); 
     
    242243    @Test 
    243244    public void test_isApplicable_10() { 
    244         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     245        ITaskFactory taskFactory = new TaskFactory(); 
    245246 
    246247        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     
    249250        IEventType eventType1 = new TextInput("text1", inputEvents); 
    250251        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    251         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     252        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    252253 
    253254        IEventType eventType2 = new TextInput("text2", inputEvents); 
    254255        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    255         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     256        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    256257 
    257258        assertTrue(rule.isApplicable(task1, task2)); 
     
    264265    @Test 
    265266    public void test_isApplicable_11() { 
    266         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     267        ITaskFactory taskFactory = new TaskFactory(); 
    267268 
    268269        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     
    270271        IEventType eventType1 = new TextSelection(); 
    271272        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    272         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     273        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    273274 
    274275        IEventType eventType2 = new ValueSelection<String>("value"); 
    275276        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    276         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     277        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    277278 
    278279        assertTrue(rule.isApplicable(task1, task2)); 
     
    285286    @Test 
    286287    public void test_isApplicable_12() { 
    287         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     288        ITaskFactory taskFactory = new TaskFactory(); 
    288289 
    289290        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     
    291292        IEventType eventType1 = new StringEventType("eventType1"); 
    292293        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    293         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
    294  
    295         ITaskTreeNode selection = treeNodeFactory.createNewSelection(); 
     294        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     295 
     296        ITask selection = taskFactory.createNewSelection(); 
    296297 
    297298        assertFalse(rule.isApplicable(task1, selection)); 
     
    304305    @Test 
    305306    public void test_isApplicable_13() { 
    306         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     307        ITaskFactory taskFactory = new TaskFactory(); 
    307308 
    308309        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     
    310311        IEventType eventType1 = new StringEventType("eventType1"); 
    311312        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    312         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
    313  
    314         ITaskTreeNode sequence = treeNodeFactory.createNewSequence(); 
     313        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     314 
     315        ITask sequence = taskFactory.createNewSequence(); 
    315316 
    316317        assertFalse(rule.isApplicable(task1, sequence)); 
     
    323324    @Test 
    324325    public void test_isApplicable_14() { 
    325         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     326        ITaskFactory taskFactory = new TaskFactory(); 
    326327 
    327328        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     
    329330        IEventType eventType1 = new StringEventType("eventType1"); 
    330331        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    331         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
    332  
    333         ITaskTreeNode iteration = treeNodeFactory.createNewIteration(); 
     332        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     333 
     334        ITask iteration = taskFactory.createNewIteration(); 
    334335 
    335336        assertFalse(rule.isApplicable(task1, iteration)); 
     
    342343    @Test 
    343344    public void test_isApplicable_15() { 
    344         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     345        ITaskFactory taskFactory = new TaskFactory(); 
    345346 
    346347        EventTaskComparisonRule rule = new EventTaskComparisonRule(); 
     
    348349        IEventType eventType1 = new StringEventType("eventType1"); 
    349350        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    350         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
    351  
    352         ITaskTreeNode optional = treeNodeFactory.createNewOptional(); 
     351        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
     352 
     353        ITask optional = taskFactory.createNewOptional(); 
    353354 
    354355        assertFalse(rule.isApplicable(task1, optional)); 
     
    361362    @Test 
    362363    public void test_compare_KeyboardFocusChange_01() { 
    363         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     364        ITaskFactory taskFactory = new TaskFactory(); 
    364365         
    365366        IEventType eventType1 = new KeyboardFocusChange(); 
    366367        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    367         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     368        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    368369         
    369370        assertLexicallyEqual(task1, task1); 
     
    375376    @Test 
    376377    public void test_compare_KeyboardFocusChange_02() { 
    377         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     378        ITaskFactory taskFactory = new TaskFactory(); 
    378379         
    379380        IEventType eventType1 = new KeyboardFocusChange(); 
    380381        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    381         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     382        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    382383 
    383384        IEventType eventType2 = new KeyboardFocusChange(); 
    384         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     385        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    385386         
    386387        assertLexicallyEqual(task1, task2); 
     
    392393    @Test 
    393394    public void test_compare_KeyboardFocusChange_03() { 
    394         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     395        ITaskFactory taskFactory = new TaskFactory(); 
    395396         
    396397        IEventType eventType1 = new KeyboardFocusChange(); 
    397398        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    398         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     399        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    399400 
    400401        IEventType eventType2 = new KeyboardFocusChange(); 
    401402        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    402         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     403        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    403404         
    404405        assertUnequal(task1, task2); 
     
    410411    @Test 
    411412    public void test_compare_KeyPressed_01() { 
    412         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     413        ITaskFactory taskFactory = new TaskFactory(); 
    413414         
    414415        IEventType eventType1 = new KeyPressed(VirtualKey.LETTER_A); 
    415416        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    416         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     417        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    417418         
    418419        assertLexicallyEqual(task1, task1); 
     
    424425    @Test 
    425426    public void test_compare_KeyPressed_02() { 
    426         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     427        ITaskFactory taskFactory = new TaskFactory(); 
    427428         
    428429        IEventType eventType1 = new KeyPressed(VirtualKey.LETTER_A); 
    429430        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    430         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     431        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    431432         
    432433        IEventType eventType2 = new KeyPressed(VirtualKey.LETTER_A); 
    433         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     434        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    434435         
    435436        assertLexicallyEqual(task1, task2); 
     
    441442    @Test 
    442443    public void test_compare_KeyPressed_03() { 
    443         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     444        ITaskFactory taskFactory = new TaskFactory(); 
    444445         
    445446        IEventType eventType1 = new KeyPressed(VirtualKey.LETTER_A); 
    446447        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    447         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     448        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    448449         
    449450        IEventType eventType2 = new KeyPressed(VirtualKey.LETTER_B); 
    450         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     451        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    451452         
    452453        assertSemanticallyEqual(task1, task2); 
     
    458459    @Test 
    459460    public void test_compare_KeyPressed_04() { 
    460         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     461        ITaskFactory taskFactory = new TaskFactory(); 
    461462         
    462463        IEventType eventType1 = new KeyPressed(VirtualKey.LETTER_A); 
    463464        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    464         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     465        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    465466         
    466467        IEventType eventType2 = new KeyPressed(VirtualKey.LETTER_A); 
    467468        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    468         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     469        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    469470         
    470471        assertUnequal(task1, task2); 
     
    476477    @Test 
    477478    public void test_compare_KeyReleased_01() { 
    478         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     479        ITaskFactory taskFactory = new TaskFactory(); 
    479480         
    480481        IEventType eventType1 = new KeyReleased(VirtualKey.LETTER_A); 
    481482        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    482         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     483        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    483484         
    484485        assertLexicallyEqual(task1, task1); 
     
    490491    @Test 
    491492    public void test_compare_KeyReleased_02() { 
    492         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     493        ITaskFactory taskFactory = new TaskFactory(); 
    493494         
    494495        IEventType eventType1 = new KeyReleased(VirtualKey.LETTER_A); 
    495496        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    496         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     497        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    497498         
    498499        IEventType eventType2 = new KeyReleased(VirtualKey.LETTER_A); 
    499         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     500        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    500501         
    501502        assertLexicallyEqual(task1, task2); 
     
    507508    @Test 
    508509    public void test_compare_KeyReleased_03() { 
    509         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     510        ITaskFactory taskFactory = new TaskFactory(); 
    510511         
    511512        IEventType eventType1 = new KeyReleased(VirtualKey.LETTER_A); 
    512513        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    513         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     514        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    514515         
    515516        IEventType eventType2 = new KeyReleased(VirtualKey.LETTER_B); 
    516         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     517        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    517518         
    518519        assertSemanticallyEqual(task1, task2); 
     
    524525    @Test 
    525526    public void test_compare_KeyReleased_04() { 
    526         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     527        ITaskFactory taskFactory = new TaskFactory(); 
    527528         
    528529        IEventType eventType1 = new KeyReleased(VirtualKey.LETTER_A); 
    529530        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    530         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     531        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    531532         
    532533        IEventType eventType2 = new KeyReleased(VirtualKey.LETTER_A); 
    533534        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    534         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     535        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    535536         
    536537        assertUnequal(task1, task2); 
     
    542543    @Test 
    543544    public void test_compare_KeyTyped_01() { 
    544         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     545        ITaskFactory taskFactory = new TaskFactory(); 
    545546         
    546547        IEventType eventType1 = new KeyTyped(VirtualKey.LETTER_A); 
    547548        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    548         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     549        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    549550         
    550551        assertLexicallyEqual(task1, task1); 
     
    556557    @Test 
    557558    public void test_compare_KeyTyped_02() { 
    558         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     559        ITaskFactory taskFactory = new TaskFactory(); 
    559560         
    560561        IEventType eventType1 = new KeyTyped(VirtualKey.LETTER_A); 
    561562        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    562         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     563        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    563564         
    564565        IEventType eventType2 = new KeyTyped(VirtualKey.LETTER_A); 
    565         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     566        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    566567         
    567568        assertLexicallyEqual(task1, task2); 
     
    573574    @Test 
    574575    public void test_compare_KeyTyped_03() { 
    575         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     576        ITaskFactory taskFactory = new TaskFactory(); 
    576577         
    577578        IEventType eventType1 = new KeyTyped(VirtualKey.LETTER_A); 
    578579        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    579         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     580        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    580581         
    581582        IEventType eventType2 = new KeyTyped(VirtualKey.LETTER_B); 
    582         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     583        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    583584         
    584585        assertSemanticallyEqual(task1, task2); 
     
    590591    @Test 
    591592    public void test_compare_KeyTyped_04() { 
    592         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     593        ITaskFactory taskFactory = new TaskFactory(); 
    593594         
    594595        IEventType eventType1 = new KeyTyped(VirtualKey.LETTER_A); 
    595596        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    596         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     597        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    597598         
    598599        IEventType eventType2 = new KeyTyped(VirtualKey.LETTER_A); 
    599600        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    600         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     601        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    601602         
    602603        assertUnequal(task1, task2); 
     
    608609    @Test 
    609610    public void test_compare_MouseButtonDown_01() { 
    610         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     611        ITaskFactory taskFactory = new TaskFactory(); 
    611612         
    612613        IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 
    613614        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    614         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     615        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    615616         
    616617        assertLexicallyEqual(task1, task1); 
     
    622623    @Test 
    623624    public void test_compare_MouseButtonDown_02() { 
    624         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     625        ITaskFactory taskFactory = new TaskFactory(); 
    625626         
    626627        IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 
    627628        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    628         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     629        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    629630         
    630631        IEventType eventType2 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 
    631         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     632        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    632633         
    633634        assertLexicallyEqual(task1, task2); 
     
    639640    @Test 
    640641    public void test_compare_MouseButtonDown_03() { 
    641         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     642        ITaskFactory taskFactory = new TaskFactory(); 
    642643         
    643644        IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 
    644645        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    645         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     646        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    646647         
    647648        IEventType eventType2 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 3); 
    648         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     649        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    649650         
    650651        assertSemanticallyEqual(task1, task2); 
     
    656657    @Test 
    657658    public void test_compare_MouseButtonDown_04() { 
    658         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     659        ITaskFactory taskFactory = new TaskFactory(); 
    659660         
    660661        IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 
    661662        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    662         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     663        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    663664         
    664665        IEventType eventType2 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 3, 2); 
    665         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     666        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    666667         
    667668        assertSemanticallyEqual(task1, task2); 
     
    673674    @Test 
    674675    public void test_compare_MouseButtonDown_05() { 
    675         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     676        ITaskFactory taskFactory = new TaskFactory(); 
    676677         
    677678        IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 
    678679        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    679         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     680        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    680681         
    681682        IEventType eventType2 = new MouseButtonDown(MouseButtonInteraction.Button.RIGHT, 1, 2); 
    682         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     683        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    683684         
    684685        assertUnequal(task1, task2); 
     
    690691    @Test 
    691692    public void test_compare_MouseButtonDown_06() { 
    692         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     693        ITaskFactory taskFactory = new TaskFactory(); 
    693694         
    694695        IEventType eventType1 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 
    695696        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    696         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     697        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    697698         
    698699        IEventType eventType2 = new MouseButtonDown(MouseButtonInteraction.Button.LEFT, 1, 2); 
    699700        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    700         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     701        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    701702         
    702703        assertUnequal(task1, task2); 
     
    708709    @Test 
    709710    public void test_compare_MouseButtonUp_01() { 
    710         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     711        ITaskFactory taskFactory = new TaskFactory(); 
    711712         
    712713        IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 
    713714        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    714         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     715        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    715716         
    716717        assertLexicallyEqual(task1, task1); 
     
    722723    @Test 
    723724    public void test_compare_MouseButtonUp_02() { 
    724         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     725        ITaskFactory taskFactory = new TaskFactory(); 
    725726         
    726727        IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 
    727728        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    728         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     729        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    729730         
    730731        IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 
    731         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     732        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    732733         
    733734        assertLexicallyEqual(task1, task2); 
     
    739740    @Test 
    740741    public void test_compare_MouseButtonUp_03() { 
    741         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     742        ITaskFactory taskFactory = new TaskFactory(); 
    742743         
    743744        IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 
    744745        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    745         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     746        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    746747         
    747748        IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 3); 
    748         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     749        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    749750         
    750751        assertSemanticallyEqual(task1, task2); 
     
    756757    @Test 
    757758    public void test_compare_MouseButtonUp_04() { 
    758         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     759        ITaskFactory taskFactory = new TaskFactory(); 
    759760         
    760761        IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 
    761762        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    762         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     763        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    763764         
    764765        IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 3, 2); 
    765         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     766        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    766767         
    767768        assertSemanticallyEqual(task1, task2); 
     
    773774    @Test 
    774775    public void test_compare_MouseButtonUp_05() { 
    775         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     776        ITaskFactory taskFactory = new TaskFactory(); 
    776777         
    777778        IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 
    778779        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    779         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     780        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    780781         
    781782        IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.RIGHT, 1, 2); 
    782         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     783        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    783784         
    784785        assertUnequal(task1, task2); 
     
    790791    @Test 
    791792    public void test_compare_MouseButtonUp_06() { 
    792         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     793        ITaskFactory taskFactory = new TaskFactory(); 
    793794         
    794795        IEventType eventType1 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 
    795796        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    796         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     797        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    797798         
    798799        IEventType eventType2 = new MouseButtonUp(MouseButtonInteraction.Button.LEFT, 1, 2); 
    799800        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    800         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     801        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    801802         
    802803        assertUnequal(task1, task2); 
     
    808809    @Test 
    809810    public void test_compare_MouseClick_01() { 
    810         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     811        ITaskFactory taskFactory = new TaskFactory(); 
    811812         
    812813        IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    813814        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    814         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     815        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    815816         
    816817        assertLexicallyEqual(task1, task1); 
     
    822823    @Test 
    823824    public void test_compare_MouseClick_02() { 
    824         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     825        ITaskFactory taskFactory = new TaskFactory(); 
    825826         
    826827        IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    827828        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    828         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     829        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    829830         
    830831        IEventType eventType2 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    831         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     832        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    832833         
    833834        assertLexicallyEqual(task1, task2); 
     
    839840    @Test 
    840841    public void test_compare_MouseClick_03() { 
    841         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     842        ITaskFactory taskFactory = new TaskFactory(); 
    842843         
    843844        IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    844845        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    845         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     846        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    846847         
    847848        IEventType eventType2 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 3); 
    848         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     849        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    849850         
    850851        assertSemanticallyEqual(task1, task2); 
     
    856857    @Test 
    857858    public void test_compare_MouseClick_04() { 
    858         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     859        ITaskFactory taskFactory = new TaskFactory(); 
    859860         
    860861        IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    861862        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    862         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     863        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    863864         
    864865        IEventType eventType2 = new MouseClick(MouseButtonInteraction.Button.LEFT, 3, 2); 
    865         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     866        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    866867         
    867868        assertSemanticallyEqual(task1, task2); 
     
    873874    @Test 
    874875    public void test_compare_MouseClick_05() { 
    875         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     876        ITaskFactory taskFactory = new TaskFactory(); 
    876877         
    877878        IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    878879        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    879         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     880        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    880881         
    881882        IEventType eventType2 = new MouseClick(MouseButtonInteraction.Button.RIGHT, 1, 2); 
    882         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     883        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    883884         
    884885        assertUnequal(task1, task2); 
     
    890891    @Test 
    891892    public void test_compare_MouseClick_06() { 
    892         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     893        ITaskFactory taskFactory = new TaskFactory(); 
    893894         
    894895        IEventType eventType1 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    895896        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    896         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     897        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    897898         
    898899        IEventType eventType2 = new MouseClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    899900        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    900         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     901        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    901902         
    902903        assertUnequal(task1, task2); 
     
    908909    @Test 
    909910    public void test_compare_MouseDoubleClick_01() { 
    910         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     911        ITaskFactory taskFactory = new TaskFactory(); 
    911912         
    912913        IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    913914        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    914         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     915        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    915916         
    916917        assertLexicallyEqual(task1, task1); 
     
    922923    @Test 
    923924    public void test_compare_MouseDoubleClick_02() { 
    924         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     925        ITaskFactory taskFactory = new TaskFactory(); 
    925926         
    926927        IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    927928        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    928         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     929        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    929930         
    930931        IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    931         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     932        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    932933         
    933934        assertLexicallyEqual(task1, task2); 
     
    939940    @Test 
    940941    public void test_compare_MouseDoubleClick_03() { 
    941         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     942        ITaskFactory taskFactory = new TaskFactory(); 
    942943         
    943944        IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    944945        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    945         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     946        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    946947         
    947948        IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 3); 
    948         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     949        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    949950         
    950951        assertSemanticallyEqual(task1, task2); 
     
    956957    @Test 
    957958    public void test_compare_MouseDoubleClick_04() { 
    958         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     959        ITaskFactory taskFactory = new TaskFactory(); 
    959960         
    960961        IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    961962        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    962         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     963        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    963964         
    964965        IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 3, 2); 
    965         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     966        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    966967         
    967968        assertSemanticallyEqual(task1, task2); 
     
    973974    @Test 
    974975    public void test_compare_MouseDoubleClick_05() { 
    975         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     976        ITaskFactory taskFactory = new TaskFactory(); 
    976977         
    977978        IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    978979        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    979         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     980        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    980981         
    981982        IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.RIGHT, 1, 2); 
    982         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     983        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    983984         
    984985        assertUnequal(task1, task2); 
     
    990991    @Test 
    991992    public void test_compare_MouseDoubleClick_06() { 
    992         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     993        ITaskFactory taskFactory = new TaskFactory(); 
    993994         
    994995        IEventType eventType1 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    995996        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    996         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     997        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    997998         
    998999        IEventType eventType2 = new MouseDoubleClick(MouseButtonInteraction.Button.LEFT, 1, 2); 
    9991000        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    1000         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     1001        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    10011002         
    10021003        assertUnequal(task1, task2); 
     
    10081009    @Test 
    10091010    public void test_compare_MouseDragAndDrop_01() { 
    1010         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1011        ITaskFactory taskFactory = new TaskFactory(); 
    10111012         
    10121013        IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 
    10131014        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1014         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1015        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    10151016         
    10161017        assertLexicallyEqual(task1, task1); 
     
    10221023    @Test 
    10231024    public void test_compare_MouseDragAndDrop_02() { 
    1024         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1025        ITaskFactory taskFactory = new TaskFactory(); 
    10251026         
    10261027        IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 
    10271028        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1028         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1029        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    10291030         
    10301031        IEventType eventType2 = new MouseDragAndDrop(1, 2, 3, 4); 
    1031         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     1032        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    10321033         
    10331034        assertLexicallyEqual(task1, task2); 
     
    10391040    @Test 
    10401041    public void test_compare_MouseDragAndDrop_03() { 
    1041         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1042        ITaskFactory taskFactory = new TaskFactory(); 
    10421043         
    10431044        IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 
    10441045        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1045         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1046        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    10461047         
    10471048        IEventType eventType2 = new MouseDragAndDrop(5, 2, 3, 4); 
    1048         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     1049        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    10491050         
    10501051        assertSemanticallyEqual(task1, task2); 
     
    10561057    @Test 
    10571058    public void test_compare_MouseDragAndDrop_04() { 
    1058         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1059        ITaskFactory taskFactory = new TaskFactory(); 
    10591060         
    10601061        IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 
    10611062        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1062         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1063        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    10631064         
    10641065        IEventType eventType2 = new MouseDragAndDrop(1, 5, 3, 4); 
    1065         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     1066        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    10661067         
    10671068        assertSemanticallyEqual(task1, task2); 
     
    10731074    @Test 
    10741075    public void test_compare_MouseDragAndDrop_05() { 
    1075         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1076        ITaskFactory taskFactory = new TaskFactory(); 
    10761077         
    10771078        IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 
    10781079        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1079         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1080        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    10801081         
    10811082        IEventType eventType2 = new MouseDragAndDrop(1, 2, 5, 4); 
    1082         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     1083        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    10831084         
    10841085        assertSemanticallyEqual(task1, task2); 
     
    10901091    @Test 
    10911092    public void test_compare_MouseDragAndDrop_06() { 
    1092         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1093        ITaskFactory taskFactory = new TaskFactory(); 
    10931094         
    10941095        IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 
    10951096        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1096         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1097        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    10971098         
    10981099        IEventType eventType2 = new MouseDragAndDrop(1, 2, 3, 5); 
    1099         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     1100        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    11001101         
    11011102        assertSemanticallyEqual(task1, task2); 
     
    11071108    @Test 
    11081109    public void test_compare_MouseDragAndDrop_07() { 
    1109         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1110        ITaskFactory taskFactory = new TaskFactory(); 
    11101111         
    11111112        IEventType eventType1 = new MouseDragAndDrop(1, 2, 3, 4); 
    11121113        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1113         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1114        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    11141115         
    11151116        IEventType eventType2 = new MouseDragAndDrop(1, 2, 3, 4); 
    11161117        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    1117         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     1118        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    11181119         
    11191120        assertUnequal(task1, task2); 
     
    11251126    @Test 
    11261127    public void test_compare_Scroll_01() { 
    1127         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1128        ITaskFactory taskFactory = new TaskFactory(); 
    11281129         
    11291130        IEventType eventType1 = new Scroll(1, 2); 
    11301131        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1131         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1132        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    11321133         
    11331134        assertLexicallyEqual(task1, task1); 
     
    11391140    @Test 
    11401141    public void test_compare_Scroll_02() { 
    1141         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1142        ITaskFactory taskFactory = new TaskFactory(); 
    11421143         
    11431144        IEventType eventType1 = new Scroll(1, 2); 
    11441145        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1145         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1146        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    11461147         
    11471148        IEventType eventType2 = new Scroll(1, 2); 
    1148         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     1149        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    11491150         
    11501151        assertLexicallyEqual(task1, task2); 
     
    11561157    @Test 
    11571158    public void test_compare_Scroll_03() { 
    1158         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1159        ITaskFactory taskFactory = new TaskFactory(); 
    11591160         
    11601161        IEventType eventType1 = new Scroll(1, 2); 
    11611162        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1162         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1163        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    11631164         
    11641165        IEventType eventType2 = new Scroll(3, 2); 
    1165         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     1166        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    11661167         
    11671168        assertSemanticallyEqual(task1, task2); 
     
    11731174    @Test 
    11741175    public void test_compare_Scroll_04() { 
    1175         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1176        ITaskFactory taskFactory = new TaskFactory(); 
    11761177         
    11771178        IEventType eventType1 = new Scroll(1, 2); 
    11781179        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1179         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1180        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    11801181         
    11811182        IEventType eventType2 = new Scroll(1, 3); 
    1182         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     1183        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    11831184         
    11841185        assertSemanticallyEqual(task1, task2); 
     
    11901191    @Test 
    11911192    public void test_compare_Scroll_05() { 
    1192         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1193        ITaskFactory taskFactory = new TaskFactory(); 
    11931194         
    11941195        IEventType eventType1 = new Scroll(1, 2); 
    11951196        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1196         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1197        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    11971198         
    11981199        IEventType eventType2 = new Scroll(1, 2); 
    11991200        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    1200         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     1201        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    12011202         
    12021203        assertUnequal(task1, task2); 
     
    12081209    @Test 
    12091210    public void test_compare_TextInput_01() { 
    1210         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1211        ITaskFactory taskFactory = new TaskFactory(); 
    12111212         
    12121213        IEventType eventType1 = new StringEventType("eventType1"); 
     
    12151216        textInputEvents1.add(new Event(eventType1, eventTarget1)); 
    12161217        eventType1 = new TextInput("enteredText1", textInputEvents1); 
    1217         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1218        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    12181219         
    12191220        assertLexicallyEqual(task1, task1); 
     
    12251226    @Test 
    12261227    public void test_compare_TextInput_02() { 
    1227         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1228        ITaskFactory taskFactory = new TaskFactory(); 
    12281229         
    12291230        IEventType eventType1 = new StringEventType("eventType1"); 
     
    12321233        textInputEvents1.add(new Event(eventType1, eventTarget1)); 
    12331234        eventType1 = new TextInput("enteredText1", textInputEvents1); 
    1234         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1235        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    12351236         
    12361237        IEventType eventType2 = new TextInput("enteredText1", textInputEvents1); 
    1237         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     1238        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    12381239 
    12391240        assertLexicallyEqual(task1, task2); 
     
    12451246    @Test 
    12461247    public void test_compare_TextInput_03() { 
    1247         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1248        ITaskFactory taskFactory = new TaskFactory(); 
    12481249         
    12491250        IEventType eventType1 = new StringEventType("eventType1"); 
     
    12521253        textInputEvents1.add(new Event(eventType1, eventTarget1)); 
    12531254        eventType1 = new TextInput("enteredText1", textInputEvents1); 
    1254         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1255        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    12551256         
    12561257        IEventType eventType2 = new StringEventType("eventType2"); 
     
    12581259        textInputEvents2.add(new Event(eventType2, eventTarget1)); 
    12591260        eventType2 = new TextInput("enteredText1", textInputEvents2); 
    1260         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     1261        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    12611262 
    12621263        assertSyntacticallyEqual(task1, task2); 
     
    12681269    @Test 
    12691270    public void test_compare_TextInput_04() { 
    1270         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1271        ITaskFactory taskFactory = new TaskFactory(); 
    12711272         
    12721273        IEventType eventType1 = new StringEventType("eventType1"); 
     
    12751276        textInputEvents1.add(new Event(eventType1, eventTarget1)); 
    12761277        eventType1 = new TextInput("enteredText1", textInputEvents1); 
    1277         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1278        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    12781279         
    12791280        IEventType eventType2 = new StringEventType("eventType2"); 
     
    12811282        textInputEvents2.add(new Event(eventType2, eventTarget1)); 
    12821283        eventType2 = new TextInput("enteredText2", textInputEvents2); 
    1283         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     1284        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    12841285 
    12851286        assertSemanticallyEqual(task1, task2); 
     
    12911292    @Test 
    12921293    public void test_compare_TextInput_05() { 
    1293         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1294        ITaskFactory taskFactory = new TaskFactory(); 
    12941295         
    12951296        IEventType eventType1 = new StringEventType("eventType1"); 
     
    12981299        textInputEvents1.add(new Event(eventType1, eventTarget1)); 
    12991300        eventType1 = new TextInput("enteredText1", textInputEvents1); 
    1300         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
    1301          
    1302         IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    1303         ITaskTreeNode 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); 
    13041305 
    13051306        assertUnequal(task1, task2); 
     
    13111312    @Test 
    13121313    public void test_compare_TextSelection_01() { 
    1313         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1314        ITaskFactory taskFactory = new TaskFactory(); 
    13141315         
    13151316        IEventType eventType1 = new TextSelection(); 
    13161317        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1317         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1318        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    13181319         
    13191320        assertLexicallyEqual(task1, task1); 
     
    13251326    @Test 
    13261327    public void test_compare_TextSelection_02() { 
    1327         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1328        ITaskFactory taskFactory = new TaskFactory(); 
    13281329         
    13291330        IEventType eventType1 = new TextSelection(); 
    13301331        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1331         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1332        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    13321333 
    13331334        IEventType eventType2 = new TextSelection(); 
    1334         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     1335        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    13351336         
    13361337        assertLexicallyEqual(task1, task2); 
     
    13421343    @Test 
    13431344    public void test_compare_TextSelection_03() { 
    1344         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1345        ITaskFactory taskFactory = new TaskFactory(); 
    13451346         
    13461347        IEventType eventType1 = new TextSelection(); 
    13471348        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1348         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1349        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    13491350 
    13501351        IEventType eventType2 = new TextSelection(); 
    13511352        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    1352         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
     1353        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget2); 
    13531354         
    13541355        assertUnequal(task1, task2); 
     
    13601361    @Test 
    13611362    public void test_compare_ValueSelection_01() { 
    1362         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1363        ITaskFactory taskFactory = new TaskFactory(); 
    13631364         
    13641365        IEventType eventType1 = new ValueSelection<String>("value1"); 
    13651366        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1366         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1367        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    13671368         
    13681369        assertLexicallyEqual(task1, task1); 
     
    13741375    @Test 
    13751376    public void test_compare_ValueSelection_02() { 
    1376         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1377        ITaskFactory taskFactory = new TaskFactory(); 
    13771378         
    13781379        IEventType eventType1 = new ValueSelection<String>("value1"); 
    13791380        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1380         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1381        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    13811382         
    13821383        IEventType eventType2 = new ValueSelection<String>("value1"); 
    1383         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     1384        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    13841385         
    13851386        assertLexicallyEqual(task1, task2); 
     
    13911392    @Test 
    13921393    public void test_compare_ValueSelection_03() { 
    1393         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1394        ITaskFactory taskFactory = new TaskFactory(); 
    13941395         
    13951396        IEventType eventType1 = new ValueSelection<String>("value1"); 
    13961397        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1397         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1398        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    13981399         
    13991400        IEventType eventType2 = new ValueSelection<String>("value2"); 
    1400         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget1); 
     1401        ITask task2 = taskFactory.createNewEventTask(eventType2, eventTarget1); 
    14011402         
    14021403        assertSemanticallyEqual(task1, task2); 
     
    14081409    @Test 
    14091410    public void test_compare_ValueSelection_04() { 
    1410         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
     1411        ITaskFactory taskFactory = new TaskFactory(); 
    14111412         
    14121413        IEventType eventType1 = new ValueSelection<String>("value1"); 
    14131414        IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    1414         ITaskTreeNode task1 = treeNodeFactory.createNewEventTask(eventType1, eventTarget1); 
     1415        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    14151416         
    14161417        IEventType eventType2 = new ValueSelection<String>("value1"); 
    14171418        IEventTarget eventTarget2 = new DummyGUIElement("elem2"); 
    1418         ITaskTreeNode task2 = treeNodeFactory.createNewEventTask(eventType2, eventTarget2); 
    1419          
    1420         assertUnequal(task1, task2); 
    1421     } 
    1422      
    1423     /** 
    1424      * 
    1425      */ 
    1426     private void assertLexicallyEqual(ITaskTreeNode task1, ITaskTreeNode task2) { 
     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) { 
    14271428        GUIEventTaskComparisonRule rule = new GUIEventTaskComparisonRule(); 
    14281429         
    1429         assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(task1, task2)); 
     1430        assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, task2)); 
    14301431        assertTrue(rule.areLexicallyEqual(task1, task2)); 
    14311432        assertTrue(rule.areSyntacticallyEqual(task1, task2)); 
    14321433        assertTrue(rule.areSemanticallyEqual(task1, task2)); 
    14331434 
    1434         assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(task2, task1)); 
     1435        assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task2, task1)); 
    14351436        assertTrue(rule.areLexicallyEqual(task2, task1)); 
    14361437        assertTrue(rule.areSyntacticallyEqual(task2, task1)); 
     
    14411442     * 
    14421443     */ 
    1443     private void assertSyntacticallyEqual(ITaskTreeNode task1, ITaskTreeNode task2) { 
     1444    private void assertSyntacticallyEqual(ITask task1, ITask task2) { 
    14441445        GUIEventTaskComparisonRule rule = new GUIEventTaskComparisonRule(); 
    14451446         
    1446         assertEquals(NodeEquality.SYNTACTICALLY_EQUAL, rule.compare(task1, task2)); 
     1447        assertEquals(TaskEquality.SYNTACTICALLY_EQUAL, rule.compare(task1, task2)); 
    14471448        assertFalse(rule.areLexicallyEqual(task1, task2)); 
    14481449        assertTrue(rule.areSyntacticallyEqual(task1, task2)); 
    14491450        assertTrue(rule.areSemanticallyEqual(task1, task2)); 
    14501451 
    1451         assertEquals(NodeEquality.SYNTACTICALLY_EQUAL, rule.compare(task2, task1)); 
     1452        assertEquals(TaskEquality.SYNTACTICALLY_EQUAL, rule.compare(task2, task1)); 
    14521453        assertFalse(rule.areLexicallyEqual(task2, task1)); 
    14531454        assertTrue(rule.areSyntacticallyEqual(task2, task1)); 
     
    14581459     * 
    14591460     */ 
    1460     private void assertSemanticallyEqual(ITaskTreeNode task1, ITaskTreeNode task2) { 
     1461    private void assertSemanticallyEqual(ITask task1, ITask task2) { 
    14611462        GUIEventTaskComparisonRule rule = new GUIEventTaskComparisonRule(); 
    14621463         
    1463         assertEquals(NodeEquality.SEMANTICALLY_EQUAL, rule.compare(task1, task2)); 
     1464        assertEquals(TaskEquality.SEMANTICALLY_EQUAL, rule.compare(task1, task2)); 
    14641465        assertFalse(rule.areLexicallyEqual(task1, task2)); 
    14651466        assertFalse(rule.areSyntacticallyEqual(task1, task2)); 
    14661467        assertTrue(rule.areSemanticallyEqual(task1, task2)); 
    14671468 
    1468         assertEquals(NodeEquality.SEMANTICALLY_EQUAL, rule.compare(task2, task1)); 
     1469        assertEquals(TaskEquality.SEMANTICALLY_EQUAL, rule.compare(task2, task1)); 
    14691470        assertFalse(rule.areLexicallyEqual(task2, task1)); 
    14701471        assertFalse(rule.areSyntacticallyEqual(task2, task1)); 
     
    14751476     * 
    14761477     */ 
    1477     private void assertUnequal(ITaskTreeNode task1, ITaskTreeNode task2) { 
     1478    private void assertUnequal(ITask task1, ITask task2) { 
    14781479        GUIEventTaskComparisonRule rule = new GUIEventTaskComparisonRule(); 
    14791480         
    1480         assertEquals(NodeEquality.UNEQUAL, rule.compare(task1, task2)); 
     1481        assertEquals(TaskEquality.UNEQUAL, rule.compare(task1, task2)); 
    14811482        assertFalse(rule.areLexicallyEqual(task1, task2)); 
    14821483        assertFalse(rule.areSyntacticallyEqual(task1, task2)); 
    14831484        assertFalse(rule.areSemanticallyEqual(task1, task2)); 
    14841485 
    1485         assertEquals(NodeEquality.UNEQUAL, rule.compare(task2, task1)); 
     1486        assertEquals(TaskEquality.UNEQUAL, rule.compare(task2, task1)); 
    14861487        assertFalse(rule.areLexicallyEqual(task2, task1)); 
    14871488        assertFalse(rule.areSyntacticallyEqual(task2, task1)); 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/IterationComparisonRuleTest.java

    r1125 r1146  
    1313//   limitations under the License. 
    1414 
    15 package de.ugoe.cs.autoquest.tasktrees.nodeequality; 
     15package de.ugoe.cs.autoquest.tasktrees.taskequality; 
    1616 
    1717import static org.junit.Assert.*; 
     
    1919import org.junit.Test; 
    2020 
    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; 
     21import de.ugoe.cs.autoquest.eventcore.IEventTarget; 
     22import de.ugoe.cs.autoquest.eventcore.IEventType; 
     23import de.ugoe.cs.autoquest.eventcore.StringEventType; 
     24import de.ugoe.cs.autoquest.tasktrees.taskequality.IterationComparisonRule; 
     25import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
     26import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEqualityRuleManager; 
    2427import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
    2528import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
    26 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeBuilder; 
    27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; 
    28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNodeFactory; 
    29 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeBuilder; 
    30 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNode; 
    31 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNodeFactory; 
     29import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
     30import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     31import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
     32import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; 
     33import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 
     34import de.ugoe.cs.autoquest.test.DummyGUIElement; 
    3235 
    3336/** 
     
    4144    @Test 
    4245    public void test() { 
    43         NodeEqualityRuleManager manager = new NodeEqualityRuleManager(); 
     46        TaskEqualityRuleManager manager = new TaskEqualityRuleManager(); 
    4447        manager.init(); 
    4548         
    46         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
    47         ITaskTreeBuilder treeBuilder = new TaskTreeBuilder(); 
     49        ITaskFactory taskFactory = new TaskFactory(); 
     50        ITaskBuilder treeBuilder = new TaskBuilder(); 
    4851         
    4952        IterationComparisonRule rule = new IterationComparisonRule(manager); 
    5053         
    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); 
    5362         
    5463        assertFalse(rule.isApplicable(task1, task2)); 
    5564         
    56         IIteration iteration1 = treeNodeFactory.createNewIteration(); 
    57         assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(iteration1, iteration1)); 
     65        IIteration iteration1 = taskFactory.createNewIteration(); 
     66        assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration1, iteration1)); 
    5867 
    59         IIteration iteration2 = treeNodeFactory.createNewIteration(); 
     68        IIteration iteration2 = taskFactory.createNewIteration(); 
    6069         
    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)); 
    6372         
    64         treeBuilder.setChild(iteration1, task1); 
     73        treeBuilder.setMarkedTask(iteration1, task1); 
    6574         
    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)); 
    6877         
    69         treeBuilder.setChild(iteration2, task1); 
     78        treeBuilder.setMarkedTask(iteration2, task1); 
    7079         
    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)); 
    7382         
    74         treeBuilder.setChild(iteration1, task2); 
     83        treeBuilder.setMarkedTask(iteration1, task2); 
    7584         
    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)); 
    7887         
    79         treeBuilder.setChild(iteration2, task2); 
     88        treeBuilder.setMarkedTask(iteration2, task2); 
    8089         
    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)); 
    8392         
    84         ISelection selection1 = treeNodeFactory.createNewSelection(); 
     93        ISelection selection1 = taskFactory.createNewSelection(); 
    8594        treeBuilder.addChild(selection1, task2); 
    86         treeBuilder.setChild(iteration1, selection1); 
     95        treeBuilder.setMarkedTask(iteration1, selection1); 
    8796         
    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)); 
    9099         
    91         ISelection selection2 = treeNodeFactory.createNewSelection(); 
     100        ISelection selection2 = taskFactory.createNewSelection(); 
    92101        treeBuilder.addChild(selection2, task2); 
    93         treeBuilder.setChild(iteration2, selection2); 
     102        treeBuilder.setMarkedTask(iteration2, selection2); 
    94103         
    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)); 
    97106         
    98107        assertFalse(rule.isApplicable(iteration1, selection1)); 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/SelectionComparisonRuleTest.java

    r1125 r1146  
    1313//   limitations under the License. 
    1414 
    15 package de.ugoe.cs.autoquest.tasktrees.nodeequality; 
     15package de.ugoe.cs.autoquest.tasktrees.taskequality; 
    1616 
    1717import static org.junit.Assert.*; 
     
    1919import org.junit.Test; 
    2020 
    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; 
     21import de.ugoe.cs.autoquest.eventcore.IEventTarget; 
     22import de.ugoe.cs.autoquest.eventcore.IEventType; 
     23import de.ugoe.cs.autoquest.eventcore.StringEventType; 
     24import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
     25import de.ugoe.cs.autoquest.tasktrees.taskequality.SelectionComparisonRule; 
     26import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEqualityRuleManager; 
    2427import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
    2528import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
    26 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeBuilder; 
    27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; 
    28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNodeFactory; 
    29 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeBuilder; 
    30 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNode; 
    31 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNodeFactory; 
     29import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
     30import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     31import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
     32import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; 
     33import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 
     34import de.ugoe.cs.autoquest.test.DummyGUIElement; 
    3235 
    3336/** 
     
    4144    @Test 
    4245    public void test() { 
    43         NodeEqualityRuleManager manager = new NodeEqualityRuleManager(); 
     46        TaskEqualityRuleManager manager = new TaskEqualityRuleManager(); 
    4447        manager.init(); 
    4548         
    46         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
    47         ITaskTreeBuilder treeBuilder = new TaskTreeBuilder(); 
     49        ITaskFactory taskFactory = new TaskFactory(); 
     50        ITaskBuilder treeBuilder = new TaskBuilder(); 
    4851         
    4952        SelectionComparisonRule rule = new SelectionComparisonRule(manager); 
    5053         
    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); 
    5362         
    5463        assertFalse(rule.isApplicable(task1, task2)); 
    5564         
    56         ISelection selection1 = treeNodeFactory.createNewSelection(); 
    57         assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(selection1, selection1)); 
     65        ISelection selection1 = taskFactory.createNewSelection(); 
     66        assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection1, selection1)); 
    5867 
    59         ISelection selection2 = treeNodeFactory.createNewSelection(); 
     68        ISelection selection2 = taskFactory.createNewSelection(); 
    6069         
    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)); 
    6372         
    6473        treeBuilder.addChild(selection1, task1); 
    6574         
    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)); 
    6877         
    6978        treeBuilder.addChild(selection2, task1); 
    7079         
    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)); 
    7382         
    7483        treeBuilder.addChild(selection1, task2); 
    7584         
    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)); 
    7887         
    7988        treeBuilder.addChild(selection2, task2); 
    8089         
    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)); 
    8392         
    84         ISelection selection3 = treeNodeFactory.createNewSelection(); 
     93        ISelection selection3 = taskFactory.createNewSelection(); 
    8594        treeBuilder.addChild(selection3, task2); 
    8695        treeBuilder.addChild(selection3, task1); 
    8796         
    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)); 
    9099         
    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)); 
    93102 
    94         ISequence sequence = treeNodeFactory.createNewSequence(); 
     103        ISequence sequence = taskFactory.createNewSequence(); 
    95104        assertFalse(rule.isApplicable(selection1, sequence)); 
    96105        assertFalse(rule.isApplicable(sequence, selection1)); 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/SequenceComparisonRuleTest.java

    r1125 r1146  
    1313//   limitations under the License. 
    1414 
    15 package de.ugoe.cs.autoquest.tasktrees.nodeequality; 
     15package de.ugoe.cs.autoquest.tasktrees.taskequality; 
    1616 
    1717import static org.junit.Assert.*; 
     
    1919import org.junit.Test; 
    2020 
    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; 
     21import de.ugoe.cs.autoquest.eventcore.IEventTarget; 
     22import de.ugoe.cs.autoquest.eventcore.IEventType; 
     23import de.ugoe.cs.autoquest.eventcore.StringEventType; 
     24import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
     25import de.ugoe.cs.autoquest.tasktrees.taskequality.SequenceComparisonRule; 
     26import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEqualityRuleManager; 
    2427import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
    2528import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
    26 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeBuilder; 
    27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; 
    28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNodeFactory; 
    29 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeBuilder; 
    30 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNode; 
    31 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNodeFactory; 
     29import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
     30import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     31import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
     32import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; 
     33import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 
     34import de.ugoe.cs.autoquest.test.DummyGUIElement; 
    3235 
    3336/** 
     
    4144    @Test 
    4245    public void test() { 
    43         NodeEqualityRuleManager manager = new NodeEqualityRuleManager(); 
     46        TaskEqualityRuleManager manager = new TaskEqualityRuleManager(); 
    4447        manager.init(); 
    4548         
    46         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
    47         ITaskTreeBuilder treeBuilder = new TaskTreeBuilder(); 
     49        ITaskFactory taskFactory = new TaskFactory(); 
     50        ITaskBuilder treeBuilder = new TaskBuilder(); 
    4851         
    4952        SequenceComparisonRule rule = new SequenceComparisonRule(manager); 
    5053         
    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); 
    5362         
    5463        assertFalse(rule.isApplicable(task1, task2)); 
    5564         
    56         ISequence sequence1 = treeNodeFactory.createNewSequence(); 
    57         assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(sequence1, sequence1)); 
     65        ISequence sequence1 = taskFactory.createNewSequence(); 
     66        assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(sequence1, sequence1)); 
    5867 
    59         ISequence sequence2 = treeNodeFactory.createNewSequence(); 
     68        ISequence sequence2 = taskFactory.createNewSequence(); 
    6069         
    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)); 
    6372         
    6473        treeBuilder.addChild(sequence1, task1); 
    6574         
    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)); 
    6877         
    6978        treeBuilder.addChild(sequence2, task1); 
    7079         
    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)); 
    7382         
    7483        treeBuilder.addChild(sequence1, task2); 
    7584         
    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)); 
    7887         
    7988        treeBuilder.addChild(sequence2, task2); 
    8089         
    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)); 
    8392         
    84         ISequence sequence3 = treeNodeFactory.createNewSequence(); 
     93        ISequence sequence3 = taskFactory.createNewSequence(); 
    8594        treeBuilder.addChild(sequence3, task2); 
    8695        treeBuilder.addChild(sequence3, task1); 
    8796         
    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)); 
    92101 
    93         ISelection selection = treeNodeFactory.createNewSelection(); 
     102        ISelection selection = taskFactory.createNewSelection(); 
    94103        assertFalse(rule.isApplicable(sequence1, selection)); 
    95104        assertFalse(rule.isApplicable(selection, sequence1)); 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskAndIterationComparisonRuleTest.java

    r927 r1146  
    1313//   limitations under the License. 
    1414 
    15 package de.ugoe.cs.autoquest.tasktrees.nodeequality; 
     15package de.ugoe.cs.autoquest.tasktrees.taskequality; 
    1616 
    1717import static org.junit.Assert.*; 
     
    1919import org.junit.Test; 
    2020 
    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; 
     21import de.ugoe.cs.autoquest.eventcore.IEventTarget; 
     22import de.ugoe.cs.autoquest.eventcore.IEventType; 
     23import de.ugoe.cs.autoquest.eventcore.StringEventType; 
     24import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskAndIterationComparisonRule; 
     25import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
     26import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEqualityRuleManager; 
    2427import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
    2528import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
    26 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeBuilder; 
    27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; 
    28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNodeFactory; 
    29 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeBuilder; 
    30 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNode; 
    31 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNodeFactory; 
     29import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
     30import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     31import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
     32import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; 
     33import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 
     34import de.ugoe.cs.autoquest.test.DummyGUIElement; 
    3235 
    3336/** 
    3437 * @author Patrick Harms 
    3538 */ 
    36 public class NodeAndIterationComparisonRuleTest { 
     39public class TaskAndIterationComparisonRuleTest { 
    3740 
    3841    /** 
     
    4144    @Test 
    4245    public void test() { 
    43         NodeEqualityRuleManager manager = new NodeEqualityRuleManager(); 
     46        TaskEqualityRuleManager manager = new TaskEqualityRuleManager(); 
    4447        manager.init(); 
    4548         
    46         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
    47         ITaskTreeBuilder treeBuilder = new TaskTreeBuilder(); 
     49        ITaskFactory taskFactory = new TaskFactory(); 
     50        ITaskBuilder treeBuilder = new TaskBuilder(); 
    4851         
    49         NodeAndIterationComparisonRule rule = new NodeAndIterationComparisonRule(manager); 
     52        TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule(manager); 
    5053         
    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); 
    5257         
    5358        assertNull(rule.compare(task1, task1)); 
    5459         
    55         IIteration iteration1 = treeNodeFactory.createNewIteration(); 
     60        IIteration iteration1 = taskFactory.createNewIteration(); 
    5661        assertNull(rule.compare(iteration1, iteration1)); 
    5762        assertNull(rule.compare(task1, iteration1)); 
    5863        assertNull(rule.compare(iteration1, task1)); 
    5964 
    60         treeBuilder.setChild(iteration1, task1); 
     65        treeBuilder.setMarkedTask(iteration1, task1); 
    6166         
    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)); 
    6469         
    65         ISelection selection1 = treeNodeFactory.createNewSelection(); 
     70        ISelection selection1 = taskFactory.createNewSelection(); 
    6671        treeBuilder.addChild(selection1, task1); 
    67         treeBuilder.setChild(iteration1, selection1); 
     72        treeBuilder.setMarkedTask(iteration1, selection1); 
    6873         
    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)); 
    7176    } 
    7277 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskAndSelectionComparisonRuleTest.java

    r927 r1146  
    1313//   limitations under the License. 
    1414 
    15 package de.ugoe.cs.autoquest.tasktrees.nodeequality; 
     15package de.ugoe.cs.autoquest.tasktrees.taskequality; 
    1616 
    1717import static org.junit.Assert.*; 
     
    1919import org.junit.Test; 
    2020 
    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; 
     21import de.ugoe.cs.autoquest.eventcore.IEventTarget; 
     22import de.ugoe.cs.autoquest.eventcore.IEventType; 
     23import de.ugoe.cs.autoquest.eventcore.StringEventType; 
     24import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskAndSelectionComparisonRule; 
     25import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
     26import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEqualityRuleManager; 
    2427import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
    25 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeBuilder; 
    26 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; 
    27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNodeFactory; 
    28 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeBuilder; 
    29 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNode; 
    30 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNodeFactory; 
     28import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
     29import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     30import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
     31import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; 
     32import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 
     33import de.ugoe.cs.autoquest.test.DummyGUIElement; 
    3134 
    3235/** 
    3336 * @author Patrick Harms 
    3437 */ 
    35 public class NodeAndSelectionComparisonRuleTest { 
     38public class TaskAndSelectionComparisonRuleTest { 
    3639 
    3740    /** 
     
    4043    @Test 
    4144    public void test() { 
    42         NodeEqualityRuleManager manager = new NodeEqualityRuleManager(); 
     45        TaskEqualityRuleManager manager = new TaskEqualityRuleManager(); 
    4346        manager.init(); 
    4447         
    45         ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); 
    46         ITaskTreeBuilder treeBuilder = new TaskTreeBuilder(); 
     48        ITaskFactory taskFactory = new TaskFactory(); 
     49        ITaskBuilder treeBuilder = new TaskBuilder(); 
    4750         
    48         NodeAndSelectionComparisonRule rule = new NodeAndSelectionComparisonRule(manager); 
     51        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule(manager); 
    4952         
    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); 
    5156         
    5257        assertNull(rule.compare(task1, task1)); 
    5358         
    54         ISelection selection1 = treeNodeFactory.createNewSelection(); 
     59        ISelection selection1 = taskFactory.createNewSelection(); 
    5560        assertNull(rule.compare(selection1, selection1)); 
    5661        assertNull(rule.compare(task1, selection1)); 
     
    5964        treeBuilder.addChild(selection1, task1); 
    6065         
    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)); 
    6368         
    64         selection1 = treeNodeFactory.createNewSelection(); 
    65         ISelection selection2 = treeNodeFactory.createNewSelection(); 
     69        selection1 = taskFactory.createNewSelection(); 
     70        ISelection selection2 = taskFactory.createNewSelection(); 
    6671        treeBuilder.addChild(selection2, task1); 
    6772        treeBuilder.addChild(selection1, selection2); 
    6873         
    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)); 
    7176    } 
    7277 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskEqualityTest.java

    r927 r1146  
    1313//   limitations under the License. 
    1414 
    15 package de.ugoe.cs.autoquest.tasktrees.nodeequality; 
     15package de.ugoe.cs.autoquest.tasktrees.taskequality; 
    1616 
    1717import static org.junit.Assert.*; 
     
    1919import org.junit.Test; 
    2020 
    21 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEquality; 
     21import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
    2222 
    2323/** 
    2424 * @author Patrick Harms 
    2525 */ 
    26 public class NodeEqualityTest { 
     26public class TaskEqualityTest { 
    2727 
    2828    /** 
     
    3131    @Test 
    3232    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)); 
    3838 
    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)); 
    4444 
    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)); 
    5050 
    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)); 
    5656 
    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)); 
    6262    } 
    6363 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/AbstractTemporalRelationshipTC.java

    r1132 r1146  
    2121import java.lang.reflect.Constructor; 
    2222import java.lang.reflect.InvocationTargetException; 
    23 import java.util.ArrayList; 
    2423import java.util.LinkedList; 
    2524import java.util.List; 
     
    2928import org.junit.Before; 
    3029 
    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; 
     30import de.ugoe.cs.autoquest.tasktrees.TaskTreeChecker; 
     31import de.ugoe.cs.autoquest.tasktrees.TaskTreeDecoder; 
     32import de.ugoe.cs.autoquest.tasktrees.TaskTreeEncoder; 
     33import de.ugoe.cs.autoquest.tasktrees.TaskTreeValidator; 
     34import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
     35import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEqualityRuleManager; 
    3536import 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; 
     37import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstanceList; 
     38import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
     39import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
     40import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession; 
     41import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; 
     42import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 
    4443import de.ugoe.cs.util.console.Console; 
    4544import de.ugoe.cs.util.console.TextConsole; 
     
    5251 
    5352    /** */ 
    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(); 
    6567 
    6668    /** 
     
    6971    @Before 
    7072    public void setUp() { 
     73        Console.reset(); 
    7174        new TextConsole(Level.FINEST); 
    72         events = new ArrayList<IEventTask>(); 
     75         
     76        decoder = new TaskTreeDecoder(taskFactory, taskBuilder); 
    7377    } 
    7478 
     
    7680     * 
    7781     */ 
    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); 
    81172    } 
    82173 
     
    84175     * 
    85176     */ 
    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) 
    107180    { 
    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; 
    131182         
    132183        CONSTRUCTOR_ITERATION: 
     
    135186             
    136187            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); 
    153199                } 
    154200                else { 
     
    158204             
    159205            try { 
    160                 rule = (TemporalRelationshipRule) constructor.newInstance(parameters.toArray()); 
     206                rule = (ISessionScopeRule) constructor.newInstance(parameters.toArray()); 
    161207            } 
    162208            catch (IllegalArgumentException e) { 
     
    182228        } 
    183229         
    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); 
    217255    } 
    218256 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleTest.java

    r1132 r1146  
    1717import org.junit.Test; 
    1818 
    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  
    2619/** 
    2720 * TODO comment 
     
    3629     */ 
    3730    @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            "}"; 
    10059 
     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); 
    101177    } 
    102178 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/testutils/Utilities.java

    r927 r1146  
    1515package de.ugoe.cs.autoquest.tasktrees.testutils; 
    1616 
    17 import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEqualityRuleManager; 
     17import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEqualityRuleManager; 
    1818 
    1919/** 
     
    2626     
    2727    /** */ 
    28     private static final NodeEqualityRuleManager NODE_EQUALITY_RULE_MANAGER = 
    29         new NodeEqualityRuleManager(); 
     28    private static final TaskEqualityRuleManager NODE_EQUALITY_RULE_MANAGER = 
     29        new TaskEqualityRuleManager(); 
    3030 
     31    /** */ 
    3132    static { 
    3233        NODE_EQUALITY_RULE_MANAGER.init(); 
     
    3839     * @return 
    3940     */ 
    40     public static NodeEqualityRuleManager getNodeEqualityRuleManagerForTests() { 
     41    public static TaskEqualityRuleManager getTaskEqualityRuleManagerForTests() { 
    4142        return NODE_EQUALITY_RULE_MANAGER; 
    4243    } 
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/treeimpl/TaskModelTest.java

    r1132 r1146  
    1515package de.ugoe.cs.autoquest.tasktrees.treeimpl; 
    1616 
    17 import static org.junit.Assert.assertEquals; 
    18 import static org.junit.Assert.assertNotNull; 
    19 import static org.junit.Assert.assertNull; 
     17import static org.junit.Assert.*; 
    2018 
    2119import java.util.HashMap; 
     20import java.util.LinkedList; 
     21import java.util.List; 
    2222import java.util.Map; 
    2323 
    2424import org.junit.Test; 
    2525 
     26import de.ugoe.cs.autoquest.eventcore.IEventTarget; 
     27import de.ugoe.cs.autoquest.eventcore.IEventType; 
    2628import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
    2729import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
     30import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; 
    2831import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
    2932import 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; 
     33import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     34import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
     35import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskModel; 
     36import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
     37import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
     38import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInfo; 
     39import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession; 
     40import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskInfo; 
     41import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; 
     42import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 
    3843import de.ugoe.cs.autoquest.test.DummyGUIElement; 
    3944import de.ugoe.cs.autoquest.test.DummyInteraction; 
     
    4550 * @author 2012, last modified by $Author: patrick$ 
    4651 */ 
    47 public class TaskTreeImplTest { 
     52public class TaskModelTest { 
    4853     
    4954    /** */ 
     
    5156 
    5257    /** */ 
    53     private ITaskTreeBuilder taskTreeBuilder = new TaskTreeBuilder(); 
     58    private ITaskBuilder taskBuilder = new TaskBuilder(); 
    5459 
    5560    /** */ 
    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     * 
    61804     */ 
    62805    @Test 
     
    67810 
    68811        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); 
    76839 
    77840            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) 
    91856    { 
    92857        try { 
     
    98863            assertEquals(map1.size(), map2.size()); 
    99864 
    100             for (Map.Entry<ITaskTreeNode, ITaskTreeNodeInfo> entry : map1.entrySet()) { 
    101                 ITaskTreeNodeInfo value2 = map2.get(entry.getKey()); 
     865            for (Map.Entry<ITask, ITaskInfo> entry : map1.entrySet()) { 
     866                ITaskInfo value2 = map2.get(entry.getKey()); 
    102867                assertNotNull(value2); 
    103868                assertEquals(entry.getValue().getTask(), value2.getTask()); 
     
    114879 
    115880    /** 
    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) { 
    121884        System.err.println(); 
    122885 
     
    126889        else { 
    127890            System.err.println("map:"); 
    128             for (Map.Entry<ITaskTreeNode, ITaskTreeNodeInfo> entry : map.entrySet()) { 
     891            for (Map.Entry<ITask, ITaskInfo> entry : map.entrySet()) { 
    129892                System.err.print("  "); 
    130893                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++) { 
    132895                    System.err.print(" "); 
    133896                } 
     
    141904 
    142905    /** 
    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) 
    153911        throws Exception 
    154912    { 
    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; 
    160915 
    161916        // integrating the maximum depth here assures, that either something between 0 and 8 will 
    162917        // be the type, or if the max depth decreases near 0 only event tasks will be created 
    163918        // to finish the tree creation 
    164         int type = (int) (Math.random() * (Math.min(8, maxDepth))); 
     919        int type = randomize(Math.min(10, maxDepth)); 
    165920 
    166921        switch (type) 
     
    168923            case 0: { 
    169924                // System.err.print("creating new event task "); 
    170                 tree = createNewEventTask(treeInfos); 
     925                task = createNewEventTask(taskInfos); 
    171926                break; 
    172927            } 
    173928            case 1: { 
    174929                // System.err.print("reusing event task "); 
    175                 tree = reuseEventTask(treeInfos); 
     930                task = reuseEventTask(taskInfos); 
    176931                break; 
    177932            } 
    178933            case 2: { 
    179934                // System.err.println("creating new sequence {"); 
    180                 tree = createNewSequence(maxNoOfChildren, maxDepth, treeInfos); 
     935                task = createNewSequence(maxNoOfChildren, maxDepth, taskInfos); 
    181936                break; 
    182937            } 
    183938            case 3: { 
    184939                // System.err.println("reusing sequence {"); 
    185                 tree = reuseSequence(maxNoOfChildren, maxDepth, treeInfos); 
     940                task = reuseSequence(maxNoOfChildren, maxDepth, taskInfos); 
    186941                break; 
    187942            } 
    188943            case 4: { 
    189944                // System.err.println("creating new selection {"); 
    190                 tree = createNewSelection(maxNoOfChildren, maxDepth, treeInfos); 
     945                task = createNewSelection(maxNoOfChildren, maxDepth, taskInfos); 
    191946                break; 
    192947            } 
    193948            case 5: { 
    194949                // System.err.println("reusing selection {"); 
    195                 tree = reuseSelection(maxNoOfChildren, maxDepth, treeInfos); 
     950                task = reuseSelection(maxNoOfChildren, maxDepth, taskInfos); 
    196951                break; 
    197952            } 
    198953            case 6: { 
    199954                // System.err.println("creating new iteration {"); 
    200                 tree = createNewIteration(maxNoOfChildren, maxDepth, treeInfos); 
     955                task = createNewIteration(maxNoOfChildren, maxDepth, taskInfos); 
    201956                break; 
    202957            } 
    203958            case 7: { 
    204959                // 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); 
    206971                break; 
    207972            } 
    208973            default: { 
    209974                // 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) 
    233986        throws Exception 
    234987    { 
    235988        Thread.sleep(2); 
    236989        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)); 
    242994 
    243995        return task; 
     
    245997 
    246998    /** 
    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) 
    2531002        throws Exception 
    2541003    { 
    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(); 
    2701180                    } 
    2711181                } 
     
    2731183        } 
    2741184        else { 
    275             return createNewEventTask(treeInfos); 
     1185            return null; 
    2761186        } 
    2771187 
     
    2801190 
    2811191    /** 
    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    } 
    4801246} 
Note: See TracChangeset for help on using the changeset viewer.