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

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