source: trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/CondenseSimilarTasksRuleTest.java @ 1846

Last change on this file since 1846 was 1845, checked in by pharms, 10 years ago
  • adapted tests to bug fixes
File size: 98.8 KB
Line 
1//   Copyright 2012 Georg-August-Universität Göttingen, Germany
2//
3//   Licensed under the Apache License, Version 2.0 (the "License");
4//   you may not use this file except in compliance with the License.
5//   You may obtain a copy of the License at
6//
7//       http://www.apache.org/licenses/LICENSE-2.0
8//
9//   Unless required by applicable law or agreed to in writing, software
10//   distributed under the License is distributed on an "AS IS" BASIS,
11//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//   See the License for the specific language governing permissions and
13//   limitations under the License.
14
15package de.ugoe.cs.autoquest.tasktrees.temporalrelation;
16
17import org.junit.Test;
18
19/**
20 * @author Patrick Harms
21 */
22public class CondenseSimilarTasksRuleTest extends AbstractTemporalRelationshipTC {
23
24    /**
25     *
26     */
27    @Test
28    public void test_SelectionDetection_01() throws Exception {
29        String input =
30            "UserSession {" +
31            "  Sequence sequence1 {" +
32            "    Iteration it1 {" +
33            "      Event action1 {}" +
34            "    }" +
35            "    Event selAction1 {}" +
36            "    Event action3 {}" +
37            "  }" +
38            "  Sequence sequence2 {" +
39            "    Iteration it1 {" +
40            "      Event action1 {}" +
41            "      Event action1 {}" +
42            "    }" +
43            "    Event selAction2 {}" +
44            "    Event action3 {}" +
45            "  }" +
46            "}";
47
48        String output =
49            "UserSession {" +
50            "  Sequence sequence3 {" +
51            "    Iteration it1 {" +
52            "      Event action1 {}" +
53            "    }" +
54            "    Selection sel1 {" +
55            "      Event selAction1 {}" +
56            "    }" +
57            "    Event action3 {}" +
58            "  }" +
59            "  Sequence sequence3 {" +
60            "    Iteration it1 {" +
61            "      Event action1 {}" +
62            "      Event action1 {}" +
63            "    }" +
64            "    Selection sel1 {" +
65            "      Event selAction2 {}" +
66            "    }" +
67            "    Event action3 {}" +
68            "  }" +
69            "}";
70
71        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
72    }
73
74    /**
75     *
76     */
77    @Test
78    public void test_SelectionDetection_02() throws Exception {
79        String input =
80            "UserSession {" +
81            "  Sequence sequence1 {" +
82            "    Iteration iter1 {" +
83            "      Event action1 {}" +
84            "      Event action1 {}" +
85            "    }" +
86            "    Event selAction1 {}" +
87            "    Event action3 {}" +
88            "  }" +
89            "  Sequence sequence2 {" +
90            "    Iteration iter1 {" +
91            "      Event action1 {}" +
92            "    }" +
93            "    Event selAction2 {}" +
94            "    Event action3 {}" +
95            "  }" +
96            "}";
97
98        String output =
99            "UserSession {" +
100            "  Sequence sequence3 {" +
101            "    Iteration iter1 {" +
102            "      Event action1 {}" +
103            "      Event action1 {}" +
104            "    }" +
105            "    Selection sel1 {" +
106            "      Event selAction1 {}" +
107            "    }" +
108            "    Event action3 {}" +
109            "  }" +
110            "  Sequence sequence3 {" +
111            "    Iteration iter1 {" +
112            "      Event action1 {}" +
113            "    }" +
114            "    Selection sel1 {" +
115            "      Event selAction2 {}" +
116            "    }" +
117            "    Event action3 {}" +
118            "  }" +
119            "}";
120
121        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
122    }
123
124    /**
125     *
126     */
127    @Test
128    public void test_SelectionDetection_03() throws Exception {
129        String input =
130            "UserSession {" +
131            "  Sequence sequence1 {" +
132            "    Iteration iter1 {" +
133            "      Sequence sequence2 {" +
134            "        Iteration iter2 {" +
135            "          Event action1 {}" +
136            "        }" +
137            "        Event selAction1 {}" +
138            "        Event action2 {}" +
139            "      }" +
140            "      Sequence sequence2 {" +
141            "        Iteration iter2 {" +
142            "          Event action1 {}" +
143            "        }" +
144            "        Event selAction1 {}" +
145            "        Event action2 {}" +
146            "      }" +
147            "    }" +
148            "    Event action3 {}" +
149            "  }" +
150            "  Sequence sequence3 {" +
151            "    Iteration iter2 {" +
152            "      Event action1 {}" +
153            "      Event action1 {}" +
154            "    }" +
155            "    Event selAction2 {}" +
156            "    Event action2 {}" +
157            "    Event action3 {}" +
158            "  }" +
159            "}";
160
161        String output =
162            "UserSession {" +
163            "  Sequence sequence4 {" +
164            "    Iteration iter3 {" +
165            "      Sequence sequence5 {" +
166            "        Iteration iter2 {" +
167            "          Event action1 {}" +
168            "        }" +
169            "        Selection sel1 {" +
170            "          Event selAction1 {}" +
171            "        }" +
172            "        Event action2 {}" +
173            "      }" +
174            "      Sequence sequence5 {" +
175            "        Iteration iter2 {" +
176            "          Event action1 {}" +
177            "        }" +
178            "        Selection sel1 {" +
179            "          Event selAction1 {}" +
180            "        }" +
181            "        Event action2 {}" +
182            "      }" +
183            "    }" +
184            "    Event action3 {}" +
185            "  }" +
186            "  Sequence sequence4 {" +
187            "    Iteration iter3 {" +
188            "      Sequence sequence5 {" +
189            "        Iteration iter2 {" +
190            "          Event action1 {}" +
191            "          Event action1 {}" +
192            "        }" +
193            "        Selection sel1 {" +
194            "          Event selAction2 {}" +
195            "        }" +
196            "        Event action2 {}" +
197            "      }" +
198            "    }" +
199            "    Event action3 {}" +
200            "  }" +
201           "}";
202
203        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
204    }
205
206    /**
207     *
208     */
209    @Test
210    public void test_SelectionDetection_04() throws Exception {
211        String input =
212            "UserSession {" +
213            "  Sequence sequence1 {" +
214            "    Sequence sequence2 {" +
215            "      Iteration iter1 {" +
216            "        Event action1 {}" +
217            "        Event action1 {}" +
218            "      }" +
219            "      Event selAction1 {}" +
220            "      Event action2 {}" +
221            "    }" +
222            "    Sequence sequence3 {" +
223            "      Sequence sequence4 {" +
224            "        Iteration iter1 {" +
225            "          Event action1 {}" +
226            "        }" +
227            "      Event selAction2 {}" +
228            "      }" +
229            "      Event action2 {}" +
230            "    }" +
231            "  }" +
232            "}";
233
234        String output =
235            "UserSession {" +
236            "  Sequence sequence5 {" +
237            "    Sequence sequence6 {" +
238            "      Iteration iter1 {" +
239            "        Event action1 {}" +
240            "        Event action1 {}" +
241            "      }" +
242            "      Selection sel1 {" +
243            "        Event selAction1 {}" +
244            "      }" +
245            "      Event action2 {}" +
246            "    }" +
247            "    Sequence sequence6 {" +
248            "      Iteration iter1 {" +
249            "        Event action1 {}" +
250            "      }" +
251            "      Selection sel1 {" +
252            "        Event selAction2 {}" +
253            "      }" +
254            "      Event action2 {}" +
255            "    }" +
256            "  }" +
257           "}";
258
259        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
260    }
261
262    /**
263     *
264     */
265    @Test
266    public void test_OptionalDetection_01() throws Exception {
267        String input =
268            "UserSession {" +
269            "  Sequence sequence1 {" +
270            "    Event action1 {}" +
271            "    Event optAction1 {}" +
272            "    Event action2 {}" +
273            "  }" +
274            "  Sequence sequence2 {" +
275            "    Event action1 {}" +
276            "    Event action2 {}" +
277            "  }" +
278            "}";
279
280        String output =
281            "UserSession {" +
282            "  Sequence sequence3 {" +
283            "    Event action1 {}" +
284            "    Optional opt1 {" +
285            "      Event optAction1 {}" +
286            "    }" +
287            "    Event action2 {}" +
288            "  }" +
289            "  Sequence sequence3 {" +
290            "    Event action1 {}" +
291            "    Optional opt1 {}" +
292            "    Event action2 {}" +
293            "  }" +
294            "}";
295
296        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
297    }
298
299    /**
300     *
301     */
302    @Test
303    public void test_OptionalDetection_02() throws Exception {
304        String input =
305            "UserSession {" +
306            "  Sequence sequence1 {" +
307            "    Event action1 {}" +
308            "    Event action2 {}" +
309            "  }" +
310            "  Sequence sequence2 {" +
311            "    Event action1 {}" +
312            "    Event optAction1 {}" +
313            "    Event action2 {}" +
314            "  }" +
315            "}";
316
317        String output =
318            "UserSession {" +
319            "  Sequence sequence3 {" +
320            "    Event action1 {}" +
321            "    Optional opt1 {}" +
322            "    Event action2 {}" +
323            "  }" +
324            "  Sequence sequence3 {" +
325            "    Event action1 {}" +
326            "    Optional opt1 {" +
327            "      Event optAction1 {}" +
328            "    }" +
329            "    Event action2 {}" +
330            "  }" +
331           "}";
332
333        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
334    }
335
336    /**
337     *
338     */
339    @Test
340    public void test_OptionalDetection_03() throws Exception {
341        String input =
342            "UserSession {" +
343            "  Sequence sequence1 {" +
344            "    Iteration iter1 {" +
345            "      Event action1 {}" +
346            "      Event action1 {}" +
347            "      Event action1 {}" +
348            "    }" +
349            "    Event action2 {}" +
350            "  }" +
351            "  Sequence sequence3 {" +
352            "    Iteration iter1 {" +
353            "      Event action1 {}" +
354            "    }" +
355            "    Event optAction1 {}" +
356            "    Event action2 {}" +
357            "  }" +
358            "}";
359
360        String output =
361            "UserSession {" +
362            "  Sequence sequence4 {" +
363            "    Iteration iter1 {" +
364            "      Event action1 {}" +
365            "      Event action1 {}" +
366            "      Event action1 {}" +
367            "    }" +
368            "    Optional opt1 {}" +
369            "    Event action2 {}" +
370            "  }" +
371            "  Sequence sequence4 {" +
372            "    Iteration iter1 {" +
373            "      Event action1 {}" +
374            "    }" +
375            "    Optional opt1 {" +
376            "      Event optAction1 {}" +
377            "    }" +
378            "    Event action2 {}" +
379            "  }" +
380           "}";
381
382        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
383    }
384
385    /**
386     *
387     */
388    @Test
389    public void test_OptionalDetection_04() throws Exception {
390        String input =
391            "UserSession {" +
392            "  Sequence sequence1 {" +
393            "    Iteration iter1 {" +
394            "      Sequence sequence2 {" +
395            "        Iteration iter2 {" +
396            "          Event action1 {}" +
397            "        }" +
398            "        Event action2 {}" +
399            "      }" +
400            "      Sequence sequence2 {" +
401            "        Iteration iter2 {" +
402            "          Event action1 {}" +
403            "        }" +
404            "        Event action2 {}" +
405            "      }" +
406            "    }" +
407            "    Event action3 {}" +
408            "  }" +
409            "  Sequence sequence3 {" +
410            "    Iteration iter2 {" +
411            "      Event action1 {}" +
412            "      Event action1 {}" +
413            "    }" +
414            "    Event optAction1 {}" +
415            "    Event action2 {}" +
416            "    Event action3 {}" +
417            "  }" +
418            "}";
419
420        String output =
421            "UserSession {" +
422            "  Sequence sequence4 {" +
423            "    Iteration iter3 {" +
424            "      Sequence sequence5 {" +
425            "        Iteration iter2 {" +
426            "          Event action1 {}" +
427            "        }" +
428            "        Optional opt1 {}" +
429            "        Event action2 {}" +
430            "      }" +
431            "      Sequence sequence5 {" +
432            "        Iteration iter2 {" +
433            "          Event action1 {}" +
434            "        }" +
435            "        Optional opt1 {}" +
436            "        Event action2 {}" +
437            "      }" +
438            "    }" +
439            "    Event action3 {}" +
440            "  }" +
441            "  Sequence sequence4 {" +
442            "    Iteration iter3 {" +
443            "      Sequence sequence5 {" +
444            "        Iteration iter2 {" +
445            "          Event action1 {}" +
446            "          Event action1 {}" +
447            "        }" +
448            "        Optional opt1 {" +
449            "          Event optAction1 {}" +
450            "        }" +
451            "        Event action2 {}" +
452            "      }" +
453            "    }" +
454            "    Event action3 {}" +
455            "  }" +
456           "}";
457
458        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
459    }
460
461    /**
462     *
463     */
464    @Test
465    public void test_OptionalDetection_05() throws Exception {
466        String input =
467            "UserSession {" +
468            "  Sequence sequence1 {" +
469            "    Sequence sequence2 {" +
470            "      Iteration iter1 {" +
471            "        Event action1 {}" +
472            "        Event action1 {}" +
473            "      }" +
474            "      Event action2 {}" +
475            "    }" +
476            "    Sequence sequence3 {" +
477            "      Sequence sequence4 {" +
478            "        Iteration iter1 {" +
479            "          Event action1 {}" +
480            "        }" +
481            "        Event optAction1 {}" +
482            "      }" +
483            "      Event action2 {}" +
484            "    }" +
485            "  }" +
486            "}";
487
488        String output =
489            "UserSession {" +
490            "  Sequence sequence5 {" +
491            "    Sequence sequence6 {" +
492            "      Iteration iter1 {" +
493            "        Event action1 {}" +
494            "        Event action1 {}" +
495            "      }" +
496            "      Optional opt1 {}" +
497            "      Event action2 {}" +
498            "    }" +
499            "    Sequence sequence6 {" +
500            "      Iteration iter1 {" +
501            "        Event action1 {}" +
502            "      }" +
503            "      Optional opt1 {" +
504            "        Event optAction1 {}" +
505            "      }" +
506            "      Event action2 {}" +
507            "    }" +
508            "  }" +
509           "}";
510
511        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
512    }
513
514    /**
515     *
516     */
517    @Test
518    public void test_OptionalDetection_06() throws Exception {
519        String input =
520            "UserSession {" +
521            "  Sequence sequence1 {" +
522            "    Event action1 {}" +
523            "    Iteration it1 {" +
524            "      Event optAction1 {}" +
525            "    }" +
526            "    Event action2 {}" +
527            "  }" +
528            "  Sequence sequence2 {" +
529            "    Event action1 {}" +
530            "    Event action2 {}" +
531            "  }" +
532            "}";
533
534        String output =
535            "UserSession {" +
536            "  Sequence sequence3 {" +
537            "    Event action1 {}" +
538            "    Optional opt1 {" +
539            "      Iteration it1 {" +
540            "        Event optAction1 {}" +
541            "      }" +
542            "    }" +
543            "    Event action2 {}" +
544            "  }" +
545            "  Sequence sequence3 {" +
546            "    Event action1 {}" +
547            "    Optional opt1 {}" +
548            "    Event action2 {}" +
549            "  }" +
550            "}";
551
552        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
553    }
554
555    /**
556     *
557     */
558    @Test
559    public void test_OptionalDetection_07() throws Exception {
560        String input =
561            "UserSession {" +
562            "  Sequence sequence1 {" +
563            "    Event action1 {}" +
564            "    Optional op1 {" +
565            "      Event optAction1 {}" +
566            "    }" +
567            "    Event action2 {}" +
568            "  }" +
569            "  Sequence sequence2 {" +
570            "    Event action1 {}" +
571            "    Event action2 {}" +
572            "  }" +
573            "}";
574
575        String output =
576            "UserSession {" +
577            "  Sequence sequence3 {" +
578            "    Event action1 {}" +
579            "    Optional opt1 {" +
580            "      Event optAction1 {}" +
581            "    }" +
582            "    Event action2 {}" +
583            "  }" +
584            "  Sequence sequence3 {" +
585            "    Event action1 {}" +
586            "    Optional opt1 {}" +
587            "    Event action2 {}" +
588            "  }" +
589            "}";
590
591        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
592    }
593
594    /**
595     *
596     */
597    @Test
598    public void test_IterationPreservation_01() throws Exception {
599        String input =
600            "UserSession {" +
601            "  Iteration itSequence1 {" +
602            "    Sequence sequence1 {" +
603            "      Event action1 {}" +
604            "      Event optAction1 {}" +
605            "      Event action2 {}" +
606            "    }" +
607            "  }" +
608            "  Sequence sequence2 {" +
609            "    Event action1 {}" +
610            "    Event action2 {}" +
611            "  }" +
612            "}";
613
614        String output =
615            "UserSession {" +
616            "  Iteration itSequence3 {" +
617            "    Sequence sequence3 {" +
618            "      Event action1 {}" +
619            "      Optional opt1 {" +
620            "        Event optAction1 {}" +
621            "      }" +
622            "      Event action2 {}" +
623            "    }" +
624            "  }" +
625            "  Sequence sequence3 {" +
626            "    Event action1 {}" +
627            "    Optional opt1 {}" +
628            "    Event action2 {}" +
629            "  }" +
630            "}";
631
632        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
633    }
634
635    /**
636     *
637     */
638    @Test
639    public void test_IterationPreservation_02() throws Exception {
640        String input =
641            "UserSession {" +
642            "  Sequence sequence1 {" +
643            "    Iteration itSequence2 {" +
644            "      Sequence sequence2 {" +
645            "        Event action1 {}" +
646            "        Event action2 {}" +
647            "      }" +
648            "      Sequence sequence2 {" +
649            "        Event action1 {}" +
650            "        Event action2 {}" +
651            "      }" +
652            "    }" +
653            "    Event action3 {}" +
654            "  }" +
655            "  Sequence sequence3 {" +
656            "    Event action1 {}" +
657            "    Iteration itSequence4 {" +
658            "      Sequence sequence4 {" +
659            "        Event action4 {}" +
660            "        Event action3 {}" +
661            "      }" +
662            "    }" +
663            "  }" +
664            "}";
665
666        String output =
667            "UserSession {" +
668            "  Selection sel1 {" +
669            "    Sequence sequence1 {" +
670            "      Iteration itSequence2 {" +
671            "        Sequence sequence2 {" +
672            "          Event action1 {}" +
673            "          Event action2 {}" +
674            "        }" +
675            "        Sequence sequence2 {" +
676            "          Event action1 {}" +
677            "          Event action2 {}" +
678            "        }" +
679            "      }" +
680            "      Event action3 {}" +
681            "    }" +
682            "  }" +
683            "  Selection sel1 {" +
684            "    Sequence sequence3 {" +
685            "      Event action1 {}" +
686            "      Iteration itSequence4 {" +
687            "        Sequence sequence4 {" +
688            "          Event action4 {}" +
689            "          Event action3 {}" +
690            "        }" +
691            "      }" +
692            "    }" +
693            "  }" +
694            "}";
695
696        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
697    }
698
699    /**
700     *
701     */
702    @Test
703    public void test_IterationPreservation_03() throws Exception {
704        String input =
705            "UserSession {" +
706            "  Iteration itSequence1 {" +
707            "    Sequence sequence1 {" +
708            "      Iteration itSequence2 {" +
709            "        Sequence sequence2 {" +
710            "          Event action1 {}" +
711            "          Event action2 {}" +
712            "        }" +
713            "        Sequence sequence2 {" +
714            "          Event action1 {}" +
715            "          Event action2 {}" +
716            "        }" +
717            "      }" +
718            "      Event action3 {}" +
719            "    }" +
720            "  }" +
721            "  Iteration itSequence3 {" +
722            "    Sequence sequence3 {" +
723            "      Event action1 {}" +
724            "      Iteration itSequence4 {" +
725            "        Sequence sequence4 {" +
726            "          Event action4 {}" +
727            "          Event action3 {}" +
728            "        }" +
729            "      }" +
730            "    }" +
731            "  }" +
732            "}";
733
734        String output =
735            "UserSession {" +
736            "  Iteration itSelection1 {" +
737            "    Selection sel1 {" +
738            "      Sequence sequence1 {" +
739            "        Iteration itSequence2 {" +
740            "          Sequence sequence2 {" +
741            "            Event action1 {}" +
742            "            Event action2 {}" +
743            "          }" +
744            "          Sequence sequence2 {" +
745            "            Event action1 {}" +
746            "            Event action2 {}" +
747            "          }" +
748            "        }" +
749            "        Event action3 {}" +
750            "      }" +
751            "    }" +
752            "    Selection sel1 {" +
753            "      Sequence sequence3 {" +
754            "        Event action1 {}" +
755            "        Iteration itSequence4 {" +
756            "          Sequence sequence4 {" +
757            "            Event action4 {}" +
758            "            Event action3 {}" +
759            "          }" +
760            "        }" +
761            "      }" +
762            "    }" +
763            "  }" +
764            "}";
765
766        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
767    }
768
769    /**
770     *
771     */
772    @Test
773    public void test_IterationPreservation_04() throws Exception {
774        String input =
775            "UserSession {" +
776            "  Sequence sequence1 {" +
777            "    Iteration itSequence2 {" +
778            "      Sequence sequence2 {" +
779            "        Event action1 {}" +
780            "        Iteration itSequence3 {" +
781            "          Sequence sequence3 {" +
782            "            Event action2 {}" +
783            "            Event action3 {}" +
784            "          }" +
785            "          Sequence sequence3 {" +
786            "            Event action2 {}" +
787            "            Event action3 {}" +
788            "          }" +
789            "        }" +
790            "      }" +
791            "    }" +
792            "    Event action4 {}" +
793            "  }" +
794            "  Sequence sequence4 {" +
795            "    Event action1 {}" +
796            "    Iteration itSequence5 {" +
797            "      Sequence sequence5 {" +
798            "        Iteration itSequence6 {" +
799            "          Sequence sequence6 {" +
800            "            Event action2 {}" +
801            "            Event action5 {}" +
802            "          }" +
803            "        }" +
804            "        Event action4 {}" +
805            "      }" +
806            "    }" +
807            "  }" +
808            "}";
809
810        String output =
811            "UserSession {" +
812            "  Selection sel1 {" +
813            "    Sequence sequence1 {" +
814            "      Iteration itSequence2 {" +
815            "        Sequence sequence2 {" +
816            "          Event action1 {}" +
817            "          Iteration itSequence3 {" +
818            "            Sequence sequence3 {" +
819            "              Event action2 {}" +
820            "              Event action3 {}" +
821            "            }" +
822            "            Sequence sequence3 {" +
823            "              Event action2 {}" +
824            "              Event action3 {}" +
825            "            }" +
826            "          }" +
827            "        }" +
828            "      }" +
829            "      Event action4 {}" +
830            "    }" +
831            "  }" +
832            "  Selection sel1 {" +
833            "    Sequence sequence4 {" +
834            "      Event action1 {}" +
835            "      Iteration itSequence5 {" +
836            "        Sequence sequence5 {" +
837            "          Iteration itSequence6 {" +
838            "            Sequence sequence6 {" +
839            "              Event action2 {}" +
840            "              Event action5 {}" +
841            "            }" +
842            "          }" +
843            "          Event action4 {}" +
844            "        }" +
845            "      }" +
846            "    }" +
847            "  }" +
848            "}";
849
850        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
851    }
852
853    /**
854     *
855     */
856    @Test
857    public void test_IterationPreservation_05() throws Exception {
858        String input =
859            "UserSession {" +
860            "  Sequence sequence1 {" +
861            "    Event noiseAction1 {}" +
862            "    Iteration itSequence2 {" +
863            "      Sequence sequence2 {" +
864            "        Iteration itSequence3 {" +
865            "          Sequence sequence3 {" +
866            "            Event action1 {}" +
867            "            Iteration itSequence4 {" +
868            "              Sequence sequence4 {" +
869            "                Event action2 {}" +
870            "                Event action3 {}" +
871            "              }" +
872            "            }" +
873            "          }" +
874            "        }" +
875            "        Event action4 {}" +
876            "      }" +
877            "      Sequence sequence2 {" +
878            "        Iteration itSequence3 {" +
879            "          Sequence sequence3 {" +
880            "            Event action1 {}" +
881            "            Iteration itSequence4 {" +
882            "              Sequence sequence4 {" +
883            "                Event action2 {}" +
884            "                Event action3 {}" +
885            "              }" +
886            "            }" +
887            "          }" +
888            "        }" +
889            "        Event action4 {}" +
890            "      }" +
891            "    }" +
892            "    Event noiseAction2 {}" +
893            "  }" +
894            "  Sequence sequence5 {" +
895            "    Event noiseAction1 {}" +
896            "    Iteration itSequence6 {" +
897            "      Sequence sequence6 {" +
898            "        Event action1 {}" +
899            "        Iteration itSequence7 {" +
900            "          Sequence sequence7 {" +
901            "            Iteration itSequence8 {" +
902            "              Sequence sequence8 {" +
903            "                Event action5 {}" +
904            "                Event action3 {}" +
905            "              }" +
906            "            }" +
907            "            Event action4 {}" +
908            "          }" +
909            "        }" +
910            "      }" +
911            "    }" +
912            "    Event noiseAction2 {}" +
913            "  }" +
914            "}";
915
916        String output =
917            "UserSession {" +
918            "  Sequence sequence9 {" +
919            "    Event noiseAction1 {}" +
920            "    Iteration itSelection1 {" +
921            "      Selection sel1 {" +
922            "        Sequence sequence2 {" +
923            "          Iteration itSequence3 {" +
924            "            Sequence sequence3 {" +
925            "              Event action1 {}" +
926            "              Iteration itSequence4 {" +
927            "                Sequence sequence4 {" +
928            "                  Event action2 {}" +
929            "                  Event action3 {}" +
930            "                }" +
931            "              }" +
932            "            }" +
933            "          }" +
934            "          Event action4 {}" +
935            "        }" +
936            "      }" +
937            "      Selection sel1 {" +
938            "        Sequence sequence2 {" +
939            "          Iteration itSequence3 {" +
940            "            Sequence sequence3 {" +
941            "              Event action1 {}" +
942            "              Iteration itSequence4 {" +
943            "                Sequence sequence4 {" +
944            "                  Event action2 {}" +
945            "                  Event action3 {}" +
946            "                }" +
947            "              }" +
948            "            }" +
949            "          }" +
950            "          Event action4 {}" +
951            "        }" +
952            "      }" +
953            "    }" +
954            "    Event noiseAction2 {}" +
955            "  }" +
956            "  Sequence sequence9 {" +
957            "    Event noiseAction1 {}" +
958            "    Iteration itSelection1 {" +
959            "      Selection sel1 {" +
960            "        Sequence sequence6 {" +
961            "          Event action1 {}" +
962            "          Iteration itSequence7 {" +
963            "            Sequence sequence7 {" +
964            "              Iteration itSequence8 {" +
965            "                Sequence sequence8 {" +
966            "                  Event action5 {}" +
967            "                  Event action3 {}" +
968            "                }" +
969            "              }" +
970            "              Event action4 {}" +
971            "            }" +
972            "          }" +
973            "        }" +
974            "      }" +
975            "    }" +
976            "    Event noiseAction2 {}" +
977            "  }" +
978            "}";
979
980        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
981    }
982
983    /**
984     *
985     */
986    @Test
987    public void test_IterationPreservation_06() throws Exception {
988        String input =
989            "UserSession {" +
990            "  Sequence sequence1 {" +
991            "    Iteration itSequence2 {" +
992            "      Sequence sequence2 {" +
993            "        Event action1 {}" +
994            "        Event action2 {}" +
995            "        Event action3 {}" +
996            "      }" +
997            "    }" +
998            "    Iteration itSequence3 {" +
999            "      Sequence sequence3 {" +
1000            "        Event action4 {}" +
1001            "        Event action5 {}" +
1002            "        Event action6 {}" +
1003            "      }" +
1004            "      Sequence sequence3 {" +
1005            "        Event action4 {}" +
1006            "        Event action5 {}" +
1007            "        Event action6 {}" +
1008            "      }" +
1009            "    }" +
1010            "  }" +
1011            "  Sequence sequence4 {" +
1012            "    Event action1 {}" +
1013            "    Event action2 {}" +
1014            "    Event action5 {}" +
1015            "    Event action6 {}" +
1016            "  }" +
1017            "}";
1018
1019        String output =
1020            "UserSession {" +
1021            "  Selection sel1 {" +
1022            "    Sequence sequence1 {" +
1023            "      Iteration itSequence2 {" +
1024            "        Sequence sequence2 {" +
1025            "          Event action1 {}" +
1026            "          Event action2 {}" +
1027            "          Event action3 {}" +
1028            "        }" +
1029            "      }" +
1030            "      Iteration itSequence3 {" +
1031            "        Sequence sequence3 {" +
1032            "          Event action4 {}" +
1033            "          Event action5 {}" +
1034            "          Event action6 {}" +
1035            "        }" +
1036            "        Sequence sequence3 {" +
1037            "          Event action4 {}" +
1038            "          Event action5 {}" +
1039            "          Event action6 {}" +
1040            "        }" +
1041            "      }" +
1042            "    }" +
1043            "  }" +
1044            "  Selection sel1 {" +
1045            "    Sequence sequence4 {" +
1046            "      Event action1 {}" +
1047            "      Event action2 {}" +
1048            "      Event action5 {}" +
1049            "      Event action6 {}" +
1050            "    }" +
1051            "  }" +
1052            "}";
1053
1054        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
1055    }
1056
1057    /**
1058     * TODO: correct to let it run through
1059     */
1060    /*@Test
1061    public void test_IterationPreservation_07() throws Exception {
1062        String input =
1063            "UserSession {" +
1064            "  Sequence sequence1 {" +
1065            "    Sequence sequence2 {" +
1066            "      Event action1 {}" +
1067            "      Event action2 {}" +
1068            "    }" +
1069            "    Event action3 {}" +
1070            "  }" +
1071            "  Sequence sequence3 {" +
1072            "    Sequence sequence4 {" +
1073            "      Sequence sequence2 {" +
1074            "        Event action1 {}" +
1075            "        Event action2 {}" +
1076            "      }" +
1077            "      Iteration it1 {" +
1078            "        Event inserted1 {}" +
1079            "      }" +
1080            "    }" +
1081            "    Iteration it2 {" +
1082            "      Sequence sequence5 {" +
1083            "        Event inserted2 {}" +
1084            "        Event action3 {}" +
1085            "      }" +
1086            "      Sequence sequence5 {" +
1087            "        Event inserted2 {}" +
1088            "        Event action3 {}" +
1089            "      }" +
1090            "    }" +
1091            "  }" +
1092            "}";
1093
1094        String output =
1095            "UserSession {" +
1096            "  Selection sel1 {" +
1097            "    Sequence sequence1 {" +
1098            "      Sequence sequence2 {" +
1099            "        Event action1 {}" +
1100            "        Event action2 {}" +
1101            "      }" +
1102            "      Event action3 {}" +
1103            "    }" +
1104            "  }" +
1105            "  Selection sel1 {" +
1106            "    Sequence sequence3 {" +
1107            "      Sequence sequence4 {" +
1108            "        Sequence sequence2 {" +
1109            "          Event action1 {}" +
1110            "          Event action2 {}" +
1111            "        }" +
1112            "        Iteration it1 {" +
1113            "          Event inserted1 {}" +
1114            "        }" +
1115            "      }" +
1116            "      Iteration it2 {" +
1117            "        Sequence sequence5 {" +
1118            "          Event inserted2 {}" +
1119            "          Event action3 {}" +
1120            "        }" +
1121            "        Sequence sequence5 {" +
1122            "          Event inserted2 {}" +
1123            "          Event action3 {}" +
1124            "        }" +
1125            "      }" +
1126            "    }" +
1127            "  }" +
1128            "}";
1129
1130        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
1131    }
1132
1133    /**
1134     *
1135     */
1136    @Test
1137    public void test_NoSimilarityDetection_01() throws Exception {
1138        String input =
1139            "UserSession {" +
1140            "  Sequence sequence1 {" +
1141            "    Event selAction1 {}" +
1142            "    Event action2 {}" +
1143            "    Event action3 {}" +
1144            "  }" +
1145            "  Sequence sequence2 {" +
1146            "    Event selAction2 {}" +
1147            "    Event action2 {}" +
1148            "    Event action3 {}" +
1149            "  }" +
1150            "}";
1151
1152        String output =
1153            "UserSession {" +
1154            "  Sequence sequence1 {" +
1155            "    Event selAction1 {}" +
1156            "    Event action2 {}" +
1157            "    Event action3 {}" +
1158            "  }" +
1159            "  Sequence sequence2 {" +
1160            "    Event selAction2 {}" +
1161            "    Event action2 {}" +
1162            "    Event action3 {}" +
1163            "  }" +
1164            "}";
1165
1166        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
1167    }
1168
1169    /**
1170     *
1171     */
1172    @Test
1173    public void test_NoSimilarityDetection_02() throws Exception {
1174        String input =
1175            "UserSession {" +
1176            "  Sequence sequence1 {" +
1177            "    Event action1 {}" +
1178            "    Event action2 {}" +
1179            "    Event selAction1 {}" +
1180            "  }" +
1181            "  Sequence sequence2 {" +
1182            "    Event action1 {}" +
1183            "    Event action2 {}" +
1184            "    Event selAction2 {}" +
1185            "  }" +
1186            "}";
1187
1188        String output =
1189            "UserSession {" +
1190            "  Sequence sequence1 {" +
1191            "    Event action1 {}" +
1192            "    Event action2 {}" +
1193            "    Event selAction1 {}" +
1194            "  }" +
1195            "  Sequence sequence2 {" +
1196            "    Event action1 {}" +
1197            "    Event action2 {}" +
1198            "    Event selAction2 {}" +
1199            "  }" +
1200            "}";
1201
1202        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
1203    }
1204
1205    /**
1206     *
1207     */
1208    @Test
1209    public void test_UniquenessOfReplacements_01() throws Exception {
1210        // situation where the same optional task is identified for two different sets of similar
1211        // tasks. However, the replacements must have the same optional task as child although
1212        // the parents are different.
1213        String input =
1214            "UserSession {" +
1215            "  Sequence sequence1 {" +
1216            "    Event action1 {}" +
1217            "    Event optAction1 {}" +
1218            "    Event action2 {}" +
1219            "  }" +
1220            "  Sequence sequence2 {" +
1221            "    Event action1 {}" +
1222            "    Event action2 {}" +
1223            "  }" +
1224            "  Sequence sequence3 {" +
1225            "    Event action3 {}" +
1226            "    Event optAction1 {}" +
1227            "    Event action4 {}" +
1228            "  }" +
1229            "  Sequence sequence4 {" +
1230            "    Event action3 {}" +
1231            "    Event action4 {}" +
1232            "  }" +
1233            "}";
1234
1235        String output =
1236            "UserSession {" +
1237            "  Sequence sequence5 {" +
1238            "    Event action1 {}" +
1239            "    Optional opt1 {" +
1240            "      Event optAction1 {}" +
1241            "    }" +
1242            "    Event action2 {}" +
1243            "  }" +
1244            "  Sequence sequence5 {" +
1245            "    Event action1 {}" +
1246            "    Optional opt1 {}" +
1247            "    Event action2 {}" +
1248            "  }" +
1249            "  Sequence sequence6 {" +
1250            "    Event action3 {}" +
1251            "    Optional opt1 {" +
1252            "      Event optAction1 {}" +
1253            "    }" +
1254            "    Event action4 {}" +
1255            "  }" +
1256            "  Sequence sequence6 {" +
1257            "    Event action3 {}" +
1258            "    Optional opt1 {}" +
1259            "    Event action4 {}" +
1260            "  }" +
1261            "}";
1262
1263        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
1264    }
1265
1266    /**
1267     *
1268     */
1269    @Test
1270    public void test_UniquenessOfReplacements_02() throws Exception {
1271        // situation where the same selection task is identified for two different sets of similar
1272        // tasks. However, the replacements must have the same selection task as child although
1273        // the parents are different.
1274        String input =
1275            "UserSession {" +
1276            "  Sequence sequence1 {" +
1277            "    Iteration it1 {" +
1278            "      Event action1 {}" +
1279            "    }" +
1280            "    Event selAction1 {}" +
1281            "    Event action2 {}" +
1282            "  }" +
1283            "  Sequence sequence2 {" +
1284            "    Iteration it1 {" +
1285            "      Event action1 {}" +
1286            "      Event action1 {}" +
1287            "    }" +
1288            "    Event selAction2 {}" +
1289            "    Event action2 {}" +
1290            "  }" +
1291            "  Sequence sequence3 {" +
1292            "    Iteration it2 {" +
1293            "      Event action3 {}" +
1294            "      Event action3 {}" +
1295            "    }" +
1296            "    Event selAction1 {}" +
1297            "    Event action4 {}" +
1298            "  }" +
1299            "  Sequence sequence4 {" +
1300            "    Iteration it2 {" +
1301            "      Event action3 {}" +
1302            "    }" +
1303            "    Event selAction2 {}" +
1304            "    Event action4 {}" +
1305            "  }" +
1306            "}";
1307
1308        String output =
1309            "UserSession {" +
1310            "  Sequence sequence5 {" +
1311            "    Iteration it1 {" +
1312            "      Event action1 {}" +
1313            "    }" +
1314            "    Selection sel1 {" +
1315            "      Event selAction1 {}" +
1316            "    }" +
1317            "    Event action2 {}" +
1318            "  }" +
1319            "  Sequence sequence5 {" +
1320            "    Iteration it1 {" +
1321            "      Event action1 {}" +
1322            "      Event action1 {}" +
1323            "    }" +
1324            "    Selection sel1 {" +
1325            "      Event selAction2 {}" +
1326            "    }" +
1327            "    Event action2 {}" +
1328            "  }" +
1329            "  Sequence sequence6 {" +
1330            "    Iteration it2 {" +
1331            "      Event action3 {}" +
1332            "      Event action3 {}" +
1333            "    }" +
1334            "    Selection sel1 {" +
1335            "      Event selAction1 {}" +
1336            "    }" +
1337            "    Event action4 {}" +
1338            "  }" +
1339            "  Sequence sequence6 {" +
1340            "    Iteration it2 {" +
1341            "      Event action3 {}" +
1342            "    }" +
1343            "    Selection sel1 {" +
1344            "      Event selAction2 {}" +
1345            "    }" +
1346            "    Event action4 {}" +
1347            "  }" +
1348            "}";
1349
1350        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
1351    }
1352
1353    /**
1354     *
1355     */
1356    @Test
1357    public void test_SpecificIntermediateSituations_01() throws Exception {
1358        String input =
1359            "UserSession {" +
1360            "  Sequence sequence1 {" +
1361            "    Event action1 {}" +
1362            "    Optional op1 {" +
1363            "      Event optAction1 {}" +
1364            "    }" +
1365            "    Event action2 {}" +
1366            "  }" +
1367            "  Sequence sequence2 {" +
1368            "    Event action1 {}" +
1369            "    Event optAction1 {}" +
1370            "    Event action2 {}" +
1371            "  }" +
1372            "}";
1373
1374        String output =
1375            "UserSession {" +
1376            "  Sequence sequence3 {" +
1377            "    Event action1 {}" +
1378            "    Optional opt1 {" +
1379            "      Event optAction1 {}" +
1380            "    }" +
1381            "    Event action2 {}" +
1382            "  }" +
1383            "  Sequence sequence3 {" +
1384            "    Event action1 {}" +
1385            "    Optional opt1 {" +
1386            "      Event optAction1 {}" +
1387            "    }" +
1388            "    Event action2 {}" +
1389            "  }" +
1390            "}";
1391
1392        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
1393    }
1394
1395    /**
1396     *
1397     */
1398    @Test
1399    public void test_SpecificIntermediateSituations_02() throws Exception {
1400        String input =
1401            "UserSession {" +
1402            "  Sequence sequence1 {" +
1403            "    Event action1 {}" +
1404            "    Iteration itSeq2 {" +
1405            "      Sequence sequence2 {" +
1406            "        Event optAction1 {}" +
1407            "        Event optAction2 {}" +
1408            "      }" +
1409            "      Sequence sequence2 {" +
1410            "        Event optAction1 {}" +
1411            "        Event optAction2 {}" +
1412            "      }" +
1413            "    }" +
1414            "    Event action2 {}" +
1415            "    Event action3 {}" +
1416            "    Event action4 {}" +
1417            "  }" +
1418            "  Sequence sequence3 {" +
1419            "    Event action1 {}" +
1420            "    Event action2 {}" +
1421            "    Event action3 {}" +
1422            "    Event action4 {}" +
1423            "  }" +
1424            "}";
1425
1426        String output =
1427            "UserSession {" +
1428            "  Sequence sequence4 {" +
1429            "    Event action1 {}" +
1430            "    Optional opt1 {" +
1431            "      Iteration itSeq2 {" +
1432            "        Sequence sequence2 {" +
1433            "          Event optAction1 {}" +
1434            "          Event optAction2 {}" +
1435            "        }" +
1436            "        Sequence sequence2 {" +
1437            "          Event optAction1 {}" +
1438            "          Event optAction2 {}" +
1439            "        }" +
1440            "      }" +
1441            "    }" +
1442            "    Event action2 {}" +
1443            "    Event action3 {}" +
1444            "    Event action4 {}" +
1445            "  }" +
1446            "  Sequence sequence4 {" +
1447            "    Event action1 {}" +
1448            "    Optional opt1 {}" +
1449            "    Event action2 {}" +
1450            "    Event action3 {}" +
1451            "    Event action4 {}" +
1452            "  }" +
1453            "}";
1454
1455        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
1456    }
1457
1458    /**
1459     *
1460     */
1461    @Test
1462    public void test_SpecificIntermediateSituations_03() throws Exception {
1463        String input =
1464            "UserSession {" +
1465            "  Sequence 6635 {" +
1466            "    Sequence 6464 {" +
1467            "      Iteration 6108 {" +
1468            "        Event action1 {}" +
1469            "      }" +
1470            "      Sequence 6305 {" +
1471            "        Sequence 6284 {" +
1472            "          Sequence 6198 {" +
1473            "            Iteration 6111 {" +
1474            "              Event action2 {}" +
1475            "            }" +
1476            "            Event action3 {}" +
1477            "          }" +
1478            "          Iteration 6089 {" +
1479            "            Event action8 {}" +
1480            "          }" +
1481            "        }" +
1482            "        Event action4 {}" +
1483            "      }" +
1484            "      Sequence 6211 {" +
1485            "        Event action5 {}" +
1486            "        Event action6 {}" +
1487            "      }" +
1488            "    }" +
1489            "    Sequence 6350 {" +
1490            "      Iteration 6089 {" +
1491            "        Event action8 {}" +
1492            "      }" +
1493            "      Iteration 6189 {" +
1494            "        Event action7 {}" +
1495            "      }" +
1496            "    }" +
1497            "  }" +
1498            "  Sequence 6381 {" +
1499            "    Iteration 6108 {" +
1500            "      Event action1 {}" +
1501            "    }" +
1502            "    Sequence 6258 {" +
1503            "      Sequence 6218 {" +
1504            "        Sequence 6199 {" +
1505            "          Sequence 6198 {" +
1506            "            Iteration 6111 {" +
1507            "              Event action2 {}" +
1508            "            }" +
1509            "            Event action3 {}" +
1510            "          }" +
1511            "          Event action4 {}" +
1512            "        }" +
1513            "        Sequence 6211 {" +
1514            "          Event action5 {}" +
1515            "          Event action6 {}" +
1516            "        }" +
1517            "      }" +
1518            "      Iteration 6189 {" +
1519            "        Event action7 {}" +
1520            "      }" +
1521            "    }" +
1522            "  }" +
1523            "}";
1524
1525        String output =
1526            "UserSession {" +
1527            "  Sequence sequence4 {" +
1528            "    Iteration 6108 {" +
1529            "      Event action1 {}" +
1530            "    }" +
1531            "    Sequence 6198 {" +
1532            "      Iteration 6111 {" +
1533            "        Event action2 {}" +
1534            "      }" +
1535            "      Event action3 {}" +
1536            "    }" +
1537            "    Optional opt1 {" +
1538            "      Iteration 6089 {" +
1539            "        Event action8 {}" +
1540            "      }" +
1541            "    }" +
1542            "    Event action4 {}" +
1543            "    Sequence 6211 {" +
1544            "      Event action5 {}" +
1545            "      Event action6 {}" +
1546            "    }" +
1547            "    Optional opt1 {" +
1548            "      Iteration 6089 {" +
1549            "        Event action8 {}" +
1550            "      }" +
1551            "    }" +
1552            "    Iteration 6189 {" +
1553            "      Event action7 {}" +
1554            "    }" +
1555            "  }" +
1556            "  Sequence sequence4 {" +
1557            "    Iteration 6108 {" +
1558            "      Event action1 {}" +
1559            "    }" +
1560            "    Sequence 6198 {" +
1561            "      Iteration 6111 {" +
1562            "        Event action2 {}" +
1563            "      }" +
1564            "      Event action3 {}" +
1565            "    }" +
1566            "    Optional opt1 { }" +
1567            "    Event action4 {}" +
1568            "    Sequence 6211 {" +
1569            "      Event action5 {}" +
1570            "      Event action6 {}" +
1571            "    }" +
1572            "    Optional opt1 { }" +
1573            "    Iteration 6189 {" +
1574            "      Event action7 {}" +
1575            "    }" +
1576            "  }" +
1577            "}";
1578
1579        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
1580    }
1581
1582    /**
1583     *
1584     */
1585    @Test
1586    public void test_SpecificIntermediateSituations_04() throws Exception {
1587        String input =
1588            "UserSession {" +
1589            "  Sequence seq1 {" +
1590            "    Event action1 {}" +
1591            "    Sequence seq2 {" +
1592            "      Event action2 {}" +
1593            "      Optional 221221 {" +
1594            "        Event action9 {}" +
1595            "      }" +
1596            "      Event action4 {}" +
1597            "      Optional 221221 {" +
1598            "        Event action9 {}" +
1599            "      }" +
1600            "      Event action5 {}" +
1601            "    }" +
1602            "    Sequence seq3 {" +
1603            "      Sequence seq4 {" +
1604            "        Event action6 {}" +
1605            "        Event action7 {}" +
1606            "      }" +
1607            "      Event action9 {}" +
1608            "    }" +
1609            "  }" +
1610            "  Sequence seq5 {" +
1611            "    Iteration 211092 {" +
1612            "      Sequence seq6 {" +
1613            "        Event action1 {}" +
1614            "        Sequence seq7 {" +
1615            "          Sequence seq8 {" +
1616            "            Event action2 {}" +
1617            "            Optional 221296 {" +
1618            "              Event action3 {}" +
1619            "            }" +
1620            "            Event action4 {}" +
1621            "            Event action5 {}" +
1622            "          }" +
1623            "          Sequence seq4 {" +
1624            "            Event action6 {}" +
1625            "            Event action7 {}" +
1626            "          }" +
1627            "        }" +
1628            "      }" +
1629            "    }" +
1630            "    Iteration #210928 {" +
1631            "      Sequence seq9 {" +
1632            "        Event action8 {}" +
1633            "        Event action9 {}" +
1634            "      }" +
1635            "      Sequence seq9 {" +
1636            "        Event action8 {}" +
1637            "        Event action9 {}" +
1638            "      }" +
1639            "    }" +
1640            "  }" +
1641            "}";
1642
1643        String output =
1644            "UserSession {" +
1645            "  Sequence seq10 {" +
1646            "    Event action1 {}" +
1647            "    Event action2 {}" +
1648            "    Selection 24 {" +
1649            "      Optional 4 {" +
1650            "        Event action9{}" +
1651            "      }" +
1652            "    }" +
1653            "    Event action5{}" +
1654            "    Optional 4 {" +
1655            "      Event action9{}" +
1656            "    }" +
1657            "    Event action5{}" +
1658            "    Sequence seq4 {" +
1659            "      Event action6 {}" +
1660            "      Event action7 {}" +
1661            "    }" +
1662            "    Iteration 27 {" +
1663            "      Sequence seq12 {" +
1664            "        Optional 25 {" +
1665            "        }" +
1666            "        Event action9{}" +
1667            "      }" +
1668            "    }" +
1669            "  }" +
1670            "  Sequence seq10 {" +
1671            "    Event action1 {}" +
1672            "    Event action2 {}" +
1673            "    Selection 24 {" +
1674            "      Optional 14 {" +
1675            "        Event action3 {}" +
1676            "      }" +
1677            "    }" +
1678            "    Event action5{}" +
1679            "    Optional 4 {" +
1680            "    }" +
1681            "    Event action5{}" +
1682            "    Sequence seq4 {" +
1683            "      Event action6 {}" +
1684            "      Event action7 {}" +
1685            "    }" +
1686            "    Iteration 27 {" +
1687            "      Sequence seq12 {" +
1688            "        Optional 25 {" +
1689            "          Event action8 {}" +
1690            "        }" +
1691            "        Event action9{}" +
1692            "      }" +
1693            "      Sequence seq12 {" +
1694            "        Optional 25 {" +
1695            "          Event action8 {}" +
1696            "        }" +
1697            "        Event action9{}" +
1698            "      }" +
1699            "    }" +
1700            "  }" +
1701            "}";
1702
1703        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
1704    }
1705
1706    /**
1707     * TODO: correct to let it run through
1708     */
1709    /*@Test
1710    public void test_SpecificIntermediateSituations_05() throws Exception {
1711        String input =
1712            "UserSession {" +
1713            "  Sequence 1 {" +
1714            "    Iteration 211092 {" +
1715            "      Sequence 2 {" +
1716            "        Iteration 210420 {" +
1717            "          Event action1 {}" +
1718            "        }" +
1719            "        Sequence 3 {" +
1720            "          Sequence 4 {" +
1721            "            Iteration 210339 {" +
1722            "              Event action2 {}" +
1723            "            }" +
1724            "            Optional 221296 {" +
1725            "              Iteration 210776 {" +
1726            "                Event action3 {}" +
1727            "              }" +
1728            "            }" +
1729            "            Iteration 210452 {" +
1730            "              Event action4 {}" +
1731            "            }" +
1732            "            Iteration 210453 {" +
1733            "              Event action5 {}" +
1734            "            }" +
1735            "          }" +
1736            "          Sequence 5 {" +
1737            "            Iteration 210422 {" +
1738            "              Event action6 {}" +
1739            "            }" +
1740            "            Iteration 210456 {" +
1741            "              Event action7 {}" +
1742            "            }" +
1743            "          }" +
1744            "        }" +
1745            "      }" +
1746            "    }" +
1747            "    Iteration #210928 {" +
1748            "      Sequence 6 {" +
1749            "        Iteration 210369 {" +
1750            "          Event action8 {}" +
1751            "        }" +
1752            "        Iteration 210337 {" +
1753            "          Event action9 {}" +
1754            "        }" +
1755            "      }" +
1756            "      Sequence 6 {" +
1757            "        Iteration 210369 {" +
1758            "          Event action8 {}" +
1759            "        }" +
1760            "        Iteration 210337 {" +
1761            "          Event action9 {}" +
1762            "        }" +
1763            "      }" +
1764            "    }" +
1765            "  }" +
1766            "  Sequence 7 {" +
1767            "    Iteration 210420 {" +
1768            "      Event action1 {}" +
1769            "    }" +
1770            "    Sequence 8 {" +
1771            "      Sequence 9 {" +
1772            "        Iteration 210339 {" +
1773            "          Event action2 {}" +
1774            "        }" +
1775            "      }" +
1776            "      Optional 221221 {" +
1777            "        Iteration 210337 {" +
1778            "          Event action9 {}" +
1779            "        }" +
1780            "      }" +
1781            "      Iteration 210452 {" +
1782            "        Event action4 {}" +
1783            "      }" +
1784            "      Optional 221221 {" +
1785            "        Iteration 210337 {" +
1786            "          Event action9 {}" +
1787            "        }" +
1788            "      }" +
1789            "      Iteration 210453 {" +
1790            "        Event action5 {}" +
1791            "      }" +
1792            "    }" +
1793            "    Sequence 10 {" +
1794            "      Sequence 11 {" +
1795            "        Iteration 210422 {" +
1796            "          Event action6 {}" +
1797            "        }" +
1798            "        Iteration 210456 {" +
1799            "          Event action7 {}" +
1800            "        }" +
1801            "      }" +
1802            "      Iteration 210337 {" +
1803            "        Event action9 {}" +
1804            "      }" +
1805            "    }" +
1806            "  }" +
1807            "}";
1808
1809        String output =
1810            "UserSession {" +
1811            "  Sequence sequence12 {" +
1812            "    Iteration 211092 {" +
1813            "      Sequence 2 {" +
1814            "        Iteration 210420 {" +
1815            "          Event action1 {}" +
1816            "        }" +
1817            "        Sequence 3 {" +
1818            "          Sequence 4 {" +
1819            "            Iteration 210339 {" +
1820            "              Event action2 {}" +
1821            "            }" +
1822            "            Optional 221296 {" +
1823            "              Iteration 210776 {" +
1824            "                Event action3 {}" +
1825            "              }" +
1826            "            }" +
1827            "            Iteration 210452 {" +
1828            "              Event action4 {}" +
1829            "            }" +
1830            "            Iteration 210453 {" +
1831            "              Event action5 {}" +
1832            "            }" +
1833            "          }" +
1834            "          Sequence 5 {" +
1835            "            Iteration 210422 {" +
1836            "              Event action6 {}" +
1837            "            }" +
1838            "            Iteration 210456 {" +
1839            "              Event action7 {}" +
1840            "            }" +
1841            "          }" +
1842            "        }" +
1843            "      }" +
1844            "    }" +
1845            "    Iteration #210928 {" +
1846            "      Sequence 6 {" +
1847            "        Iteration 210369 {" +
1848            "          Event action8 {}" +
1849            "        }" +
1850            "        Iteration 210337 {" +
1851            "          Event action9 {}" +
1852            "        }" +
1853            "      }" +
1854            "      Sequence 6 {" +
1855            "        Iteration 210369 {" +
1856            "          Event action8 {}" +
1857            "        }" +
1858            "        Iteration 210337 {" +
1859            "          Event action9 {}" +
1860            "        }" +
1861            "      }" +
1862            "    }" +
1863            "  }" +
1864            "  Sequence 7 {" +
1865            "    Iteration 210420 {" +
1866            "      Event action1 {}" +
1867            "    }" +
1868            "    Sequence 8 {" +
1869            "      Sequence 9 {" +
1870            "        Iteration 210339 {" +
1871            "          Event action2 {}" +
1872            "        }" +
1873            "      }" +
1874            "      Optional 221221 {" +
1875            "        Iteration 210337 {" +
1876            "          Event action9 {}" +
1877            "        }" +
1878            "      }" +
1879            "      Iteration 210452 {" +
1880            "        Event action4 {}" +
1881            "      }" +
1882            "      Optional 221221 {" +
1883            "        Iteration 210337 {" +
1884            "          Event action9 {}" +
1885            "        }" +
1886            "      }" +
1887            "      Iteration 210453 {" +
1888            "        Event action5 {}" +
1889            "      }" +
1890            "    }" +
1891            "    Sequence 10 {" +
1892            "      Sequence 11 {" +
1893            "        Iteration 210422 {" +
1894            "          Event action6 {}" +
1895            "        }" +
1896            "        Iteration 210456 {" +
1897            "          Event action7 {}" +
1898            "        }" +
1899            "      }" +
1900            "      Iteration 210337 {" +
1901            "        Event action9 {}" +
1902            "      }" +
1903            "    }" +
1904            "  }" +
1905            "}";
1906
1907        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
1908    }
1909
1910    /**
1911     * TODO: correct to let it run through
1912     */
1913    /*@Test
1914    public void test_SpecificIntermediateSituations_06() throws Exception {
1915        String input =
1916            "UserSession {" +
1917            "  Sequence seq1 {" +
1918            "    Event action1 {}" +
1919            "    Event action2 {}" +
1920            "    Event action3 {}" +
1921            "  }" +
1922            "  Sequence seq2 {" +
1923            "    Event action1 {}" +
1924            "    Event action2 {}" +
1925            "    Selection sel3 {" +
1926            "      Event action3 {}" +
1927            "    }" +
1928            "  }" +
1929            "}";
1930
1931        String output =
1932            "UserSession {" +
1933            "  Sequence seq3 {" +
1934            "    Event action1 {}" +
1935            "    Event action2 {}" +
1936            "    Selection sel3 {" +
1937            "      Event action3 {}" +
1938            "    }" +
1939            "  }" +
1940            "  Sequence seq3 {" +
1941            "    Event action1 {}" +
1942            "    Event action2 {}" +
1943            "    Selection sel3 {" +
1944            "      Event action3 {}" +
1945            "    }" +
1946            "  }" +
1947            "}";
1948
1949        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
1950    }
1951
1952    /**
1953     *
1954     */
1955    @Test
1956    public void test_SpecificIntermediateSituations_07() throws Exception {
1957        String input =
1958            "UserSession {" +
1959            "  Sequence seq1 {" +
1960            "    Event action1 {}" +
1961            "    Iteration it1 {" +
1962            "      Event action2 {}" +
1963            "      Event action2 {}" +
1964            "    }" +
1965            "    Selection sel1 {" +
1966            "      Event action3 {}" +
1967            "    }" +
1968            "    Event action5 {}" +
1969            "  }" +
1970            "  Sequence seq2 {" +
1971            "    Event action1 {}" +
1972            "    Iteration it1 {" +
1973            "      Event action2 {}" +
1974            "    }" +
1975            "    Selection sel2 {" +
1976            "      Event action4 {}" +
1977            "    }" +
1978            "    Event action5 {}" +
1979            "  }" +
1980            "}";
1981
1982        String output =
1983            "UserSession {" +
1984            "  Sequence seq3 {" +
1985            "    Event action1 {}" +
1986            "    Iteration it1 {" +
1987            "      Event action2 {}" +
1988            "      Event action2 {}" +
1989            "    }" +
1990            "    Selection sel3 {" +
1991            "      Event action3 {}" +
1992            "    }" +
1993            "    Event action5 {}" +
1994            "  }" +
1995            "  Sequence seq3 {" +
1996            "    Event action1 {}" +
1997            "    Iteration it1 {" +
1998            "      Event action2 {}" +
1999            "    }" +
2000            "    Selection sel3 {" +
2001            "      Event action4 {}" +
2002            "    }" +
2003            "    Event action5 {}" +
2004            "  }" +
2005            "}";
2006
2007        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
2008    }
2009
2010    /**
2011     * TODO: correct to let it run through
2012     */
2013    /*@Test
2014    public void test_SpecificIntermediateSituations_08() throws Exception {
2015        String input =
2016            "UserSession {" +
2017            "  Sequence seq1 {" +
2018            "    Event action1 {}" +
2019            "    Event action2 {}" +
2020            "    Optional opt2 {" +
2021            "      Sequence seq2 {" +
2022            "        Event action5 {}" +
2023            "        Event action6 {}" +
2024            "      }" +
2025            "    }" +
2026            "  }" +
2027            "  Sequence seq1 {" +
2028            "    Event action1 {}" +
2029            "    Event action2 {}" +
2030            "    Optional opt2 {}" +
2031            "  }" +
2032            "  Sequence seq3 {" +
2033            "    Event action1 {}" +
2034            "    Event action2 {}" +
2035            "    Optional opt1 {" +
2036            "      Event action4 {}" +
2037            "    }" +
2038            "    Sequence seq2 {" +
2039            "      Event action5 {}" +
2040            "      Event action6 {}" +
2041            "    }" +
2042            "  }" +
2043            "}";
2044
2045        String output =
2046            "UserSession {" +
2047            "  Sequence seq4 {" +
2048            "    Event action1 {}" +
2049            "    Event action2 {}" +
2050            "    Optional opt1 {}" +
2051            "    Optional opt2 {" +
2052            "      Sequence seq2 {" +
2053            "        Event action5 {}" +
2054            "        Event action6 {}" +
2055            "      }" +
2056            "    }" +
2057            "  }" +
2058            "  Sequence seq4 {" +
2059            "    Event action1 {}" +
2060            "    Event action2 {}" +
2061            "    Optional opt1 {}" +
2062            "    Optional opt2 {}" +
2063            "  }" +
2064            "  Sequence seq4 {" +
2065            "    Event action1 {}" +
2066            "    Event action2 {}" +
2067            "    Optional opt1 {" +
2068            "      Event action4 {}" +
2069            "    }" +
2070            "    Optional opt2 {" +
2071            "      Sequence seq2 {" +
2072            "        Event action5 {}" +
2073            "        Event action6 {}" +
2074            "      }" +
2075            "    }" +
2076            "  }" +
2077            "}";
2078
2079        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
2080    }
2081
2082    /**
2083     *
2084     */
2085    @Test
2086    public void test_SpecificIntermediateSituations_09() throws Exception {
2087        String input =
2088            "UserSession {" +
2089            "  Sequence seq1 {" +
2090            "    Sequence seq2 {" +
2091            "      Event action0 {}" +
2092            "      Event action1 {}" +
2093            "      Event action2 {}" +
2094            "      Event action3 {}" +
2095            "    }" +
2096            "    Event action4 {}" +
2097            "    Event action5 {}" +
2098            "  }" +
2099            "  Sequence seq3 {" +
2100            "    Sequence seq4 {" +
2101            "      Event action0 {}" +
2102            "      Event action1 {}" +
2103            "      Event action3 {}" +
2104            "    }" +
2105            "    Event action4 {}" +
2106            "    Event action5 {}" +
2107            "  }" +
2108            "  Sequence seq5 {" +
2109            "    Sequence seq2 {" +
2110            "      Event action0 {}" +
2111            "      Event action1 {}" +
2112            "      Event action2 {}" +
2113            "      Event action3 {}" +
2114            "    }" +
2115            "    Event action5 {}" +
2116            "  }" +
2117            "}";
2118
2119        String output =
2120            "UserSession {" +
2121            "  Sequence seq6 {" +
2122            "    Sequence seq7 {" +
2123            "      Event action0 {}" +
2124            "      Event action1 {}" +
2125            "      Optional opt1 {" +
2126            "        Event action2 {}" +
2127            "      }" +
2128            "      Event action3 {}" +
2129            "    }" +
2130            "    Optional opt2 {" +
2131            "      Event action4 {}" +
2132            "    }" +
2133            "    Event action5 {}" +
2134            "  }" +
2135            "  Sequence seq6 {" +
2136            "    Sequence seq7 {" +
2137            "      Event action0 {}" +
2138            "      Event action1 {}" +
2139            "      Optional opt1 {}" +
2140            "      Event action3 {}" +
2141            "    }" +
2142            "    Optional opt2 {" +
2143            "      Event action4 {}" +
2144            "    }" +
2145            "    Event action5 {}" +
2146            "  }" +
2147            "  Sequence seq6 {" +
2148            "    Sequence seq7 {" +
2149            "      Event action0 {}" +
2150            "      Event action1 {}" +
2151            "      Optional opt1 {" +
2152            "        Event action2 {}" +
2153            "      }" +
2154            "      Event action3 {}" +
2155            "    }" +
2156            "    Optional opt2 {}" +
2157            "    Event action5 {}" +
2158            "  }" +
2159            "}";
2160
2161        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
2162    }
2163
2164    /**
2165     * TODO: correct to let it run through
2166     */
2167    /*@Test
2168    public void test_RealLifeScenario_01() throws Exception {
2169        // situation where the same selection task is identified for two different sets of similar
2170        // tasks. However, the replacements must have the same selection task as child although
2171        // the parents are different.
2172        String input =
2173            "UserSession {" +
2174            "  Sequence seq1 {" +
2175            "    Iteration itSeq2 {" +
2176            "      Sequence seq2 {" +
2177            "        Iteration itSeq3 {" +
2178            "          Sequence seq3 {" +
2179            "            Iteration itSeq4 {" +
2180            "              Sequence seq4 {" +
2181            "                Iteration itClickTf1 {" +
2182            "                  Event clickTf1 {}" +
2183            "                }" +
2184            "                Iteration itEnterTf1 {" +
2185            "                  Event enterTf1 {}" +
2186            "                }" +
2187            "              }" +
2188            "            }" +
2189            "            Event tabPress {}" +
2190            "          }" +
2191            "        }" +
2192            "        Iteration itEnterTf2 {" +
2193            "          Event enterTf2 {}" +
2194            "        }" +
2195            "      }" +
2196            "    }" +
2197            "    Iteration itSeqConfirm {" +
2198            "      Sequence seqConfirm {" +
2199            "        Iteration itClickBtn {" +
2200            "          Event clickBtn {}" +
2201            "        }" +
2202            "        Iteration itScroll {" +
2203            "          Event scroll {}" +
2204            "        }" +
2205            "      }" +
2206            "    }" +
2207            "  }" +
2208            "  Sequence seq5 {" +
2209            "    Iteration itSeq4 {" +
2210            "      Sequence seq4 {" +
2211            "        Iteration itClickTf1 {" +
2212            "          Event clickTf1 {}" +
2213            "        }" +
2214            "        Iteration itEnterTf1 {" +
2215            "          Event enterTf1 {}" +
2216            "        }" +
2217            "      }" +
2218            "    }" +
2219            "    Sequence seq6 {" +
2220            "      Iteration itSeq7 {" +
2221            "        Sequence seq7 {" +
2222            "          Iteration itClickTf2 {" +
2223            "            Event clickTf2 {}" +
2224            "          }" +
2225            "          Iteration itEnterTf2 {" +
2226            "            Event enterTf2 {}" +
2227            "          }" +
2228            "        }" +
2229            "      }" +
2230            "      Iteration itSeqConfirm {" +
2231            "        Sequence seqConfirm {" +
2232            "          Iteration itClickBtn {" +
2233            "            Event clickBtn {}" +
2234            "          }" +
2235            "          Iteration itScroll {" +
2236            "            Event scroll {}" +
2237            "          }" +
2238            "        }" +
2239            "      }" +
2240            "    }" +
2241            "  }" +
2242            "}";
2243
2244        String output =
2245            "UserSession {" +
2246            "  Selection sel1 {" +
2247            "    Sequence seq8 {" +
2248            "      Iteration itSeq2 {" +
2249            "        Sequence seq2 {" +
2250            "          Iteration itSeq3 {" +
2251            "            Sequence seq3 {" +
2252            "              Iteration itSeq4 {" +
2253            "                Sequence seq4 {" +
2254            "                  Iteration itClickTf1 {" +
2255            "                    Event clickTf1 {}" +
2256            "                  }" +
2257            "                  Iteration itEnterTf1 {" +
2258            "                    Event enterTf1 {}" +
2259            "                  }" +
2260            "                }" +
2261            "              }" +
2262            "              Event tabPress {}" +
2263            "            }" +
2264            "          }" +
2265            "          Iteration itEnterTf2 {" +
2266            "            Event enterTf2 {}" +
2267            "          }" +
2268            "        }" +
2269            "      }" +
2270            "      Iteration itSeqConfirm {" +
2271            "        Sequence seqConfirm {" +
2272            "          Iteration itClickBtn {" +
2273            "            Event clickBtn {}" +
2274            "          }" +
2275            "          Iteration itScroll {" +
2276            "            Event scroll {}" +
2277            "          }" +
2278            "        }" +
2279            "      }" +
2280            "    }" +
2281            "  }" +
2282            "  Selection sel1 {" +
2283            "    Sequence seq9 {" +
2284            "      Iteration itSeq4 {" +
2285            "        Sequence seq4 {" +
2286            "          Iteration itClickTf1 {" +
2287            "            Event clickTf1 {}" +
2288            "          }" +
2289            "          Iteration itEnterTf1 {" +
2290            "            Event enterTf1 {}" +
2291            "          }" +
2292            "        }" +
2293            "      }" +
2294            "      Sequence seq6 {" +
2295            "        Iteration itSeq7 {" +
2296            "          Sequence seq7 {" +
2297            "            Iteration itClickTf2 {" +
2298            "              Event clickTf2 {}" +
2299            "            }" +
2300            "            Iteration itEnterTf2 {" +
2301            "              Event enterTf2 {}" +
2302            "            }" +
2303            "          }" +
2304            "        }" +
2305            "        Iteration itSeqConfirm {" +
2306            "          Sequence seqConfirm {" +
2307            "            Iteration itClickBtn {" +
2308            "              Event clickBtn {}" +
2309            "            }" +
2310            "            Iteration itScroll {" +
2311            "              Event scroll {}" +
2312            "            }" +
2313            "          }" +
2314            "        }" +
2315            "      }" +
2316            "    }" +
2317            "  }" +
2318            "}";
2319
2320        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
2321    }
2322
2323    /**
2324     * TODO: correct to let it run through
2325     */
2326    /*@Test
2327    public void test_RealLifeScenario_02() throws Exception {
2328        // situation where the same selection task is identified for two different sets of similar
2329        // tasks. However, the replacements must have the same selection task as child although
2330        // the parents are different.
2331        String input =
2332            "UserSession {" +
2333            "  Sequence seq1 {" +
2334            "    Iteration itSeq2 {" +
2335            "      Sequence seq2 {" +
2336            "        Iteration itSeq3 {" +
2337            "          Sequence seq3 {" +
2338            "            Iteration itSeq4 {" +
2339            "              Sequence seq4 {" +
2340            "                Iteration itClickTf1 {" +
2341            "                  Event clickTf1 {}" +
2342            "                }" +
2343            "                Iteration itEnterTf1 {" +
2344            "                  Event enterTf1 {}" +
2345            "                }" +
2346            "              }" +
2347            "              Sequence seq4 {" +
2348            "                Iteration itClickTf1 {" +
2349            "                  Event clickTf1 {}" +
2350            "                }" +
2351            "                Iteration itEnterTf1 {" +
2352            "                  Event enterTf1 {}" +
2353            "                }" +
2354            "              }" +
2355            "            }" +
2356            "            Event tabPress {}" +
2357            "          }" +
2358            "          Sequence seq3 {" +
2359            "            Iteration itSeq4 {" +
2360            "              Sequence seq4 {" +
2361            "                Iteration itClickTf1 {" +
2362            "                  Event clickTf1 {}" +
2363            "                }" +
2364            "                Iteration itEnterTf1 {" +
2365            "                  Event enterTf1 {}" +
2366            "                }" +
2367            "              }" +
2368            "              Sequence seq4 {" +
2369            "                Iteration itClickTf1 {" +
2370            "                  Event clickTf1 {}" +
2371            "                }" +
2372            "                Iteration itEnterTf1 {" +
2373            "                  Event enterTf1 {}" +
2374            "                }" +
2375            "              }" +
2376            "            }" +
2377            "            Event tabPress {}" +
2378            "          }" +
2379            "        }" +
2380            "        Iteration itEnterTf2 {" +
2381            "          Event enterTf2 {}" +
2382            "        }" +
2383            "      }" +
2384            "      Sequence seq2 {" +
2385            "        Iteration itSeq3 {" +
2386            "          Sequence seq3 {" +
2387            "            Iteration itSeq4 {" +
2388            "              Sequence seq4 {" +
2389            "                Iteration itClickTf1 {" +
2390            "                  Event clickTf1 {}" +
2391            "                }" +
2392            "                Iteration itEnterTf1 {" +
2393            "                  Event enterTf1 {}" +
2394            "                }" +
2395            "              }" +
2396            "              Sequence seq4 {" +
2397            "                Iteration itClickTf1 {" +
2398            "                  Event clickTf1 {}" +
2399            "                }" +
2400            "                Iteration itEnterTf1 {" +
2401            "                  Event enterTf1 {}" +
2402            "                }" +
2403            "              }" +
2404            "            }" +
2405            "            Event tabPress {}" +
2406            "          }" +
2407            "          Sequence seq3 {" +
2408            "            Iteration itSeq4 {" +
2409            "              Sequence seq4 {" +
2410            "                Iteration itClickTf1 {" +
2411            "                  Event clickTf1 {}" +
2412            "                }" +
2413            "                Iteration itEnterTf1 {" +
2414            "                  Event enterTf1 {}" +
2415            "                }" +
2416            "              }" +
2417            "              Sequence seq4 {" +
2418            "                Iteration itClickTf1 {" +
2419            "                  Event clickTf1 {}" +
2420            "                }" +
2421            "                Iteration itEnterTf1 {" +
2422            "                  Event enterTf1 {}" +
2423            "                }" +
2424            "              }" +
2425            "            }" +
2426            "            Event tabPress {}" +
2427            "          }" +
2428            "        }" +
2429            "        Iteration itEnterTf2 {" +
2430            "          Event enterTf2 {}" +
2431            "        }" +
2432            "      }" +
2433            "    }" +
2434            "    Iteration itSeqConfirm {" +
2435            "      Sequence seqConfirm {" +
2436            "        Iteration itClickBtn {" +
2437            "          Event clickBtn {}" +
2438            "        }" +
2439            "        Iteration itScroll {" +
2440            "          Event scroll {}" +
2441            "        }" +
2442            "      }" +
2443            "      Sequence seqConfirm {" +
2444            "        Iteration itClickBtn {" +
2445            "          Event clickBtn {}" +
2446            "        }" +
2447            "        Iteration itScroll {" +
2448            "          Event scroll {}" +
2449            "        }" +
2450            "      }" +
2451            "    }" +
2452            "  }" +
2453            "  Sequence seq5 {" +
2454            "    Iteration itSeq4 {" +
2455            "      Sequence seq4 {" +
2456            "        Iteration itClickTf1 {" +
2457            "          Event clickTf1 {}" +
2458            "        }" +
2459            "        Iteration itEnterTf1 {" +
2460            "          Event enterTf1 {}" +
2461            "        }" +
2462            "      }" +
2463            "      Sequence seq4 {" +
2464            "        Iteration itClickTf1 {" +
2465            "          Event clickTf1 {}" +
2466            "        }" +
2467            "        Iteration itEnterTf1 {" +
2468            "          Event enterTf1 {}" +
2469            "        }" +
2470            "      }" +
2471            "    }" +
2472            "    Sequence seq6 {" +
2473            "      Iteration itSeq7 {" +
2474            "        Sequence seq7 {" +
2475            "          Iteration itClickTf2 {" +
2476            "            Event clickTf2 {}" +
2477            "          }" +
2478            "          Iteration itEnterTf2 {" +
2479            "            Event enterTf2 {}" +
2480            "          }" +
2481            "        }" +
2482            "        Sequence seq7 {" +
2483            "          Iteration itClickTf2 {" +
2484            "            Event clickTf2 {}" +
2485            "          }" +
2486            "          Iteration itEnterTf2 {" +
2487            "            Event enterTf2 {}" +
2488            "          }" +
2489            "        }" +
2490            "      }" +
2491            "      Iteration itSeqConfirm {" +
2492            "        Sequence seqConfirm {" +
2493            "          Iteration itClickBtn {" +
2494            "            Event clickBtn {}" +
2495            "          }" +
2496            "          Iteration itScroll {" +
2497            "            Event scroll {}" +
2498            "          }" +
2499            "        }" +
2500            "        Sequence seqConfirm {" +
2501            "          Iteration itClickBtn {" +
2502            "            Event clickBtn {}" +
2503            "          }" +
2504            "          Iteration itScroll {" +
2505            "            Event scroll {}" +
2506            "          }" +
2507            "        }" +
2508            "      }" +
2509            "    }" +
2510            "  }" +
2511            "}";
2512
2513        String output =
2514            "UserSession {" +
2515            "  Sequence seq8 {" +
2516            "    Iteration itSeq2 {" +
2517            "      Sequence seq2 {" +
2518            "        Iteration itSeq3 {" +
2519            "          Sequence seq3 {" +
2520            "            Iteration itSeq4 {" +
2521            "              Sequence seq4 {" +
2522            "                Iteration itClickTf1 {" +
2523            "                  Event clickTf1 {}" +
2524            "                }" +
2525            "                Iteration itEnterTf1 {" +
2526            "                  Event enterTf1 {}" +
2527            "                }" +
2528            "              }" +
2529            "              Sequence seq4 {" +
2530            "                Iteration itClickTf1 {" +
2531            "                  Event clickTf1 {}" +
2532            "                }" +
2533            "                Iteration itEnterTf1 {" +
2534            "                  Event enterTf1 {}" +
2535            "                }" +
2536            "              }" +
2537            "            }" +
2538            "            Event tabPress {}" +
2539            "          }" +
2540            "          Sequence seq3 {" +
2541            "            Iteration itSeq4 {" +
2542            "              Sequence seq4 {" +
2543            "                Iteration itClickTf1 {" +
2544            "                  Event clickTf1 {}" +
2545            "                }" +
2546            "                Iteration itEnterTf1 {" +
2547            "                  Event enterTf1 {}" +
2548            "                }" +
2549            "              }" +
2550            "              Sequence seq4 {" +
2551            "                Iteration itClickTf1 {" +
2552            "                  Event clickTf1 {}" +
2553            "                }" +
2554            "                Iteration itEnterTf1 {" +
2555            "                  Event enterTf1 {}" +
2556            "                }" +
2557            "              }" +
2558            "            }" +
2559            "            Event tabPress {}" +
2560            "          }" +
2561            "        }" +
2562            "        Iteration itEnterTf2 {" +
2563            "          Event enterTf2 {}" +
2564            "        }" +
2565            "      }" +
2566            "      Sequence seq2 {" +
2567            "        Iteration itSeq3 {" +
2568            "          Sequence seq3 {" +
2569            "            Iteration itSeq4 {" +
2570            "              Sequence seq4 {" +
2571            "                Iteration itClickTf1 {" +
2572            "                  Event clickTf1 {}" +
2573            "                }" +
2574            "                Iteration itEnterTf1 {" +
2575            "                  Event enterTf1 {}" +
2576            "                }" +
2577            "              }" +
2578            "              Sequence seq4 {" +
2579            "                Iteration itClickTf1 {" +
2580            "                  Event clickTf1 {}" +
2581            "                }" +
2582            "                Iteration itEnterTf1 {" +
2583            "                  Event enterTf1 {}" +
2584            "                }" +
2585            "              }" +
2586            "            }" +
2587            "            Event tabPress {}" +
2588            "          }" +
2589            "          Sequence seq3 {" +
2590            "            Iteration itSeq4 {" +
2591            "              Sequence seq4 {" +
2592            "                Iteration itClickTf1 {" +
2593            "                  Event clickTf1 {}" +
2594            "                }" +
2595            "                Iteration itEnterTf1 {" +
2596            "                  Event enterTf1 {}" +
2597            "                }" +
2598            "              }" +
2599            "              Sequence seq4 {" +
2600            "                Iteration itClickTf1 {" +
2601            "                  Event clickTf1 {}" +
2602            "                }" +
2603            "                Iteration itEnterTf1 {" +
2604            "                  Event enterTf1 {}" +
2605            "                }" +
2606            "              }" +
2607            "            }" +
2608            "            Event tabPress {}" +
2609            "          }" +
2610            "        }" +
2611            "        Iteration itEnterTf2 {" +
2612            "          Event enterTf2 {}" +
2613            "        }" +
2614            "      }" +
2615            "    }" +
2616            "    Iteration itSeqConfirm {" +
2617            "      Sequence seqConfirm {" +
2618            "        Iteration itClickBtn {" +
2619            "          Event clickBtn {}" +
2620            "        }" +
2621            "        Iteration itScroll {" +
2622            "          Event scroll {}" +
2623            "        }" +
2624            "      }" +
2625            "      Sequence seqConfirm {" +
2626            "        Iteration itClickBtn {" +
2627            "          Event clickBtn {}" +
2628            "        }" +
2629            "        Iteration itScroll {" +
2630            "          Event scroll {}" +
2631            "        }" +
2632            "      }" +
2633            "    }" +
2634            "  }" +
2635            "  Sequence seq5 {" +
2636            "    Iteration itSeq4 {" +
2637            "      Sequence seq4 {" +
2638            "        Iteration itClickTf1 {" +
2639            "          Event clickTf1 {}" +
2640            "        }" +
2641            "        Iteration itEnterTf1 {" +
2642            "          Event enterTf1 {}" +
2643            "        }" +
2644            "      }" +
2645            "      Sequence seq4 {" +
2646            "        Iteration itClickTf1 {" +
2647            "          Event clickTf1 {}" +
2648            "        }" +
2649            "        Iteration itEnterTf1 {" +
2650            "          Event enterTf1 {}" +
2651            "        }" +
2652            "      }" +
2653            "    }" +
2654            "    Sequence seq6 {" +
2655            "      Iteration itSeq7 {" +
2656            "        Sequence seq7 {" +
2657            "          Iteration itClickTf2 {" +
2658            "            Event clickTf2 {}" +
2659            "          }" +
2660            "          Iteration itEnterTf2 {" +
2661            "            Event enterTf2 {}" +
2662            "          }" +
2663            "        }" +
2664            "        Sequence seq7 {" +
2665            "          Iteration itClickTf2 {" +
2666            "            Event clickTf2 {}" +
2667            "          }" +
2668            "          Iteration itEnterTf2 {" +
2669            "            Event enterTf2 {}" +
2670            "          }" +
2671            "        }" +
2672            "      }" +
2673            "      Iteration itSeqConfirm {" +
2674            "        Sequence seqConfirm {" +
2675            "          Iteration itClickBtn {" +
2676            "            Event clickBtn {}" +
2677            "          }" +
2678            "          Iteration itScroll {" +
2679            "            Event scroll {}" +
2680            "          }" +
2681            "        }" +
2682            "        Sequence seqConfirm {" +
2683            "          Iteration itClickBtn {" +
2684            "            Event clickBtn {}" +
2685            "          }" +
2686            "          Iteration itScroll {" +
2687            "            Event scroll {}" +
2688            "          }" +
2689            "        }" +
2690            "      }" +
2691            "    }" +
2692            "  }" +
2693            "}";
2694
2695        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
2696    }
2697
2698    /**
2699     * TODO: correct to let it run through
2700     */
2701    /*@Test
2702    public void test_RealLifeScenario_03() throws Exception {
2703        // situation where the same selection task is identified for two different sets of similar
2704        // tasks. However, the replacements must have the same selection task as child although
2705        // the parents are different.
2706        String input =
2707            "UserSession {" +
2708            "  Sequence sequence1 {" +
2709            "    Iteration itSeqUtilizeTextField1 {" +
2710            "      Sequence seqUtilizeTextField1 {" +
2711            "        Iteration itClickTextField1 {" +
2712            "          Event clickTextField1 {}" +
2713            "          Event clickTextField1 {}" +
2714            "        }" +
2715            "        Iteration itEnterTextTextField1 {" +
2716            "          Event enterTextTextField1 {}" +
2717            "        }" +
2718            "      }" +
2719            "      Sequence seqUtilizeTextField1 {" +
2720            "        Iteration itClickTextField1 {" +
2721            "          Event clickTextField1 {}" +
2722            "        }" +
2723            "        Iteration itEnterTextTextField1 {" +
2724            "          Event enterTextTextField1 {}" +
2725            "        }" +
2726            "      }" +
2727            "    }" +
2728            "    Sequence sequence2 {" +
2729            "      Iteration itSeqUtilizeTextField2 {" +
2730            "        Sequence seqUtilizeTextField2 {" +
2731            "          Iteration itClickTextField2 {" +
2732            "            Event clickTextField2 {}" +
2733            "          }" +
2734            "          Iteration itEnterTextTextField2 {" +
2735            "            Event enterTextTextField2 {}" +
2736            "            Event enterTextTextField2 {}" +
2737            "          }" +
2738            "        }" +
2739            "        Sequence seqUtilizeTextField2 {" +
2740            "          Iteration itClickTextField2 {" +
2741            "            Event clickTextField2 {}" +
2742            "            Event clickTextField2 {}" +
2743            "          }" +
2744            "          Iteration itEnterTextTextField2 {" +
2745            "            Event enterTextTextField2 {}" +
2746            "          }" +
2747            "        }" +
2748            "      }" +
2749            "      Iteration itClickButton1 {" +
2750            "        Event clickButton1 {}" +
2751            "        Event clickButton1 {}" +
2752            "      }" +
2753            "    }" +
2754            "  }" +
2755            "  Sequence sequence3 {" +
2756            "    Iteration itSequence4 {" +
2757            "      Sequence sequence4 {" +
2758            "        Iteration itSequence5 {" +
2759            "          Sequence sequence5 {" +
2760            "            Iteration itSeqUtilizeTextField1 {" +
2761            "              Sequence seqUtilizeTextField1 {" +
2762            "                Iteration itClickTextField1 {" +
2763            "                  Event clickTextField1 {}" +
2764            "                }" +
2765            "                Iteration itEnterTextTextField1 {" +
2766            "                  Event enterTextTextField1 {}" +
2767            "                }" +
2768            "              }" +
2769            "            }" +
2770            "            Event pressTabTextField2 {}" +
2771            "          }" +
2772            "          Sequence sequence5 {" +
2773            "            Iteration itSeqUtilizeTextField1 {" +
2774            "              Sequence seqUtilizeTextField1 {" +
2775            "                Iteration itClickTextField1 {" +
2776            "                  Event clickTextField1 {}" +
2777            "                }" +
2778            "                Iteration itEnterTextTextField1 {" +
2779            "                  Event enterTextTextField1 {}" +
2780            "                }" +
2781            "              }" +
2782            "            }" +
2783            "            Event pressTabTextField2 {}" +
2784            "          }" +
2785            "        }" +
2786            "        Iteration itEnterTextTextField2 {" +
2787            "          Event enterTextTextField2 {}" +
2788            "          Event enterTextTextField2 {}" +
2789            "        }" +
2790            "      }" +
2791            "      Sequence sequence4 {" +
2792            "        Iteration itSequence5 {" +
2793            "          Sequence sequence5 {" +
2794            "            Iteration itSeqUtilizeTextField1 {" +
2795            "              Sequence seqUtilizeTextField1 {" +
2796            "                Iteration itClickTextField1 {" +
2797            "                  Event clickTextField1 {}" +
2798            "                }" +
2799            "                Iteration itEnterTextTextField1 {" +
2800            "                  Event enterTextTextField1 {}" +
2801            "                  Event enterTextTextField1 {}" +
2802            "                }" +
2803            "              }" +
2804            "              Sequence seqUtilizeTextField1 {" +
2805            "                Iteration itClickTextField1 {" +
2806            "                  Event clickTextField1 {}" +
2807            "                  Event clickTextField1 {}" +
2808            "                }" +
2809            "                Iteration itEnterTextTextField1 {" +
2810            "                  Event enterTextTextField1 {}" +
2811            "                }" +
2812            "              }" +
2813            "            }" +
2814            "            Event pressTabTextField2 {}" +
2815            "          }" +
2816            "        }" +
2817            "        Iteration itEnterTextTextField2 {" +
2818            "          Event enterTextTextField2 {}" +
2819            "        }" +
2820            "      }" +
2821            "    }" +
2822            "    Iteration itClickButton1 {" +
2823            "      Event clickButton1 {}" +
2824            "    }" +
2825            "  }" +
2826            "}";
2827
2828        String output =
2829            "UserSession {" +
2830            "  Sequence sequence6 {" +
2831            "    Selection selection1 {" +
2832            "      Sequence sequence7 {" +
2833            "        Iteration itSeqUtilizeTextField1 {" +
2834            "          Sequence seqUtilizeTextField1 {" +
2835            "            Iteration itClickTextField1 {" +
2836            "              Event clickTextField1 {}" +
2837            "              Event clickTextField1 {}" +
2838            "            }" +
2839            "            Iteration itEnterTextTextField1 {" +
2840            "              Event enterTextTextField1 {}" +
2841            "            }" +
2842            "          }" +
2843            "          Sequence seqUtilizeTextField1 {" +
2844            "            Iteration itClickTextField1 {" +
2845            "              Event clickTextField1 {}" +
2846            "            }" +
2847            "            Iteration itEnterTextTextField1 {" +
2848            "              Event enterTextTextField1 {}" +
2849            "            }" +
2850            "          }" +
2851            "        }" +
2852            "        Iteration itSeqUtilizeTextField2 {" +
2853            "          Sequence seqUtilizeTextField2 {" +
2854            "            Iteration itClickTextField2 {" +
2855            "              Event clickTextField2 {}" +
2856            "            }" +
2857            "            Iteration itEnterTextTextField2 {" +
2858            "              Event enterTextTextField2 {}" +
2859            "              Event enterTextTextField2 {}" +
2860            "            }" +
2861            "          }" +
2862            "          Sequence seqUtilizeTextField2 {" +
2863            "            Iteration itClickTextField2 {" +
2864            "              Event clickTextField2 {}" +
2865            "              Event clickTextField2 {}" +
2866            "            }" +
2867            "            Iteration itEnterTextTextField2 {" +
2868            "              Event enterTextTextField2 {}" +
2869            "            }" +
2870            "          }" +
2871            "        }" +
2872            "      }" +
2873            "    }" +
2874            "    Iteration itClickButton1 {" +
2875            "      Event clickButton1 {}" +
2876            "      Event clickButton1 {}" +
2877            "    }" +
2878            "  }" +
2879            "  Sequence sequence6 {" +
2880            "    Selection selection1 {" +
2881            "      Iteration itSeq4 {" +
2882            "        Sequence sequence4 {" +
2883            "          Iteration itSequence5 {" +
2884            "            Sequence sequence5 {" +
2885            "              Iteration itSeqUtilizeTextField1 {" +
2886            "                Sequence seqUtilizeTextField1 {" +
2887            "                  Iteration itClickTextField1 {" +
2888            "                    Event clickTextField1 {}" +
2889            "                  }" +
2890            "                  Iteration itEnterTextTextField1 {" +
2891            "                    Event enterTextTextField1 {}" +
2892            "                  }" +
2893            "                }" +
2894            "              }" +
2895            "              Event pressTabTextField2 {}" +
2896            "            }" +
2897            "            Sequence sequence5 {" +
2898            "              Iteration itSeqUtilizeTextField1 {" +
2899            "                Sequence seqUtilizeTextField1 {" +
2900            "                  Iteration itClickTextField1 {" +
2901            "                    Event clickTextField1 {}" +
2902            "                  }" +
2903            "                  Iteration itEnterTextTextField1 {" +
2904            "                    Event enterTextTextField1 {}" +
2905            "                  }" +
2906            "                }" +
2907            "              }" +
2908            "              Event pressTabTextField2 {}" +
2909            "            }" +
2910            "          }" +
2911            "          Iteration itEnterTextTextField2 {" +
2912            "            Event enterTextTextField2 {}" +
2913            "            Event enterTextTextField2 {}" +
2914            "          }" +
2915            "        }" +
2916            "        Sequence sequence4 {" +
2917            "          Iteration itSequence5 {" +
2918            "            Sequence sequence5 {" +
2919            "              Iteration itSeqUtilizeTextField1 {" +
2920            "                Sequence seqUtilizeTextField1 {" +
2921            "                  Iteration itClickTextField1 {" +
2922            "                    Event clickTextField1 {}" +
2923            "                  }" +
2924            "                  Iteration itEnterTextTextField1 {" +
2925            "                    Event enterTextTextField1 {}" +
2926            "                    Event enterTextTextField1 {}" +
2927            "                  }" +
2928            "                }" +
2929            "                Sequence seqUtilizeTextField1 {" +
2930            "                  Iteration itClickTextField1 {" +
2931            "                    Event clickTextField1 {}" +
2932            "                    Event clickTextField1 {}" +
2933            "                  }" +
2934            "                  Iteration itEnterTextTextField1 {" +
2935            "                    Event enterTextTextField1 {}" +
2936            "                  }" +
2937            "                }" +
2938            "              }" +
2939            "              Event pressTabTextField2 {}" +
2940            "            }" +
2941            "          }" +
2942            "          Iteration itEnterTextTextField2 {" +
2943            "            Event enterTextTextField2 {}" +
2944            "          }" +
2945            "        }" +
2946            "      }" +
2947            "    }" +
2948            "    Iteration itClickButton1 {" +
2949            "      Event clickButton1 {}" +
2950            "    }" +
2951            "  }" +
2952            "}";
2953
2954        applySessionScopeRule(CondenseSimilarTasksRule.class, input, output);
2955    }*/
2956}
Note: See TracBrowser for help on using the repository browser.