[927] | 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 |
|
---|
[922] | 15 | package de.ugoe.cs.autoquest.tasktrees.temporalrelation;
|
---|
[445] | 16 |
|
---|
| 17 | import org.junit.Test;
|
---|
| 18 |
|
---|
[1106] | 19 | import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement;
|
---|
[922] | 20 | import de.ugoe.cs.autoquest.tasktrees.TaskTreeChecker;
|
---|
| 21 | import de.ugoe.cs.autoquest.test.DummyGUIElement;
|
---|
| 22 | import de.ugoe.cs.autoquest.test.DummyInteraction;
|
---|
[445] | 23 |
|
---|
| 24 | /**
|
---|
| 25 | * TODO comment
|
---|
[557] | 26 | *
|
---|
[445] | 27 | * @version $Revision: $ $Date: $
|
---|
[557] | 28 | * @author 2011, last modified by $Author: $
|
---|
[445] | 29 | */
|
---|
[557] | 30 | public class DefaultGuiEventSequenceDetectionRuleTest extends AbstractTemporalRelationshipTC {
|
---|
[445] | 31 |
|
---|
[557] | 32 | /**
|
---|
| 33 | *
|
---|
| 34 | */
|
---|
| 35 | @Test
|
---|
[1106] | 36 | public void test_01() {
|
---|
| 37 | IGUIElement elem1 = new DummyGUIElement("elem1");
|
---|
| 38 | simulateEvent(new StartSequenceInteraction("start", 1), elem1);
|
---|
| 39 | simulateEvent(new FinishSequenceInteraction("end", 1), elem1);
|
---|
[445] | 40 |
|
---|
[557] | 41 | new TaskTreeChecker().assertTaskTree
|
---|
| 42 | ("Sequence sequence {" +
|
---|
[1106] | 43 | " Event start {}" +
|
---|
| 44 | " Event end {}" +
|
---|
| 45 | "}", getTaskTree(DefaultGuiEventSequenceDetectionRule.class, null));
|
---|
[557] | 46 | }
|
---|
[1106] | 47 |
|
---|
| 48 |
|
---|
[557] | 49 | /**
|
---|
| 50 | *
|
---|
| 51 | */
|
---|
| 52 | @Test
|
---|
[1106] | 53 | public void test_02() {
|
---|
| 54 | IGUIElement elem1 = new DummyGUIElement("elem1");
|
---|
| 55 | simulateEvent(new StartSequenceInteraction("start", 1), elem1);
|
---|
| 56 | simulateEvent(new DummyInteraction("bla", 1), elem1);
|
---|
| 57 | simulateEvent(new FinishSequenceInteraction("end", 1), elem1);
|
---|
[445] | 58 |
|
---|
[557] | 59 | new TaskTreeChecker().assertTaskTree
|
---|
| 60 | ("Sequence sequence {" +
|
---|
[1106] | 61 | " Event start {}" +
|
---|
[557] | 62 | " Event bla {}" +
|
---|
[1106] | 63 | " Event end {}" +
|
---|
| 64 | "}", getTaskTree(DefaultGuiEventSequenceDetectionRule.class, null));
|
---|
[557] | 65 | }
|
---|
[1106] | 66 |
|
---|
[557] | 67 | /**
|
---|
| 68 | *
|
---|
| 69 | */
|
---|
| 70 | @Test
|
---|
[1106] | 71 | public void test_03() {
|
---|
| 72 | IGUIElement elem1 = new DummyGUIElement("elem1");
|
---|
| 73 | simulateEvent(new StartSequenceInteraction("start", 1), elem1);
|
---|
| 74 | simulateEvent(new DummyInteraction("bla", 1), elem1);
|
---|
| 75 | simulateEvent(new DummyInteraction("bli", 1), elem1);
|
---|
| 76 | simulateEvent(new DummyInteraction("blup", 1), elem1);
|
---|
| 77 | simulateEvent(new FinishSequenceInteraction("end", 1), elem1);
|
---|
| 78 | simulateEvent(new StartSequenceInteraction("start", 1), elem1);
|
---|
| 79 | simulateEvent(new DummyInteraction("bla", 1), elem1);
|
---|
| 80 | simulateEvent(new DummyInteraction("bli", 1), elem1);
|
---|
| 81 | simulateEvent(new FinishSequenceInteraction("end", 1), elem1);
|
---|
[557] | 82 |
|
---|
| 83 | new TaskTreeChecker().assertTaskTree
|
---|
| 84 | ("Sequence sequence0 {" +
|
---|
| 85 | " Sequence sequence1 {" +
|
---|
[1106] | 86 | " Event start {}" +
|
---|
[557] | 87 | " Event bla {}" +
|
---|
[1106] | 88 | " Event bli {}" +
|
---|
| 89 | " Event blup {}" +
|
---|
| 90 | " Event end {}" +
|
---|
[557] | 91 | " }" +
|
---|
| 92 | " Sequence sequence2 {" +
|
---|
[1106] | 93 | " Event start {}" +
|
---|
[557] | 94 | " Event bla {}" +
|
---|
| 95 | " Event bli {}" +
|
---|
[1106] | 96 | " Event end {}" +
|
---|
[557] | 97 | " }" +
|
---|
[1106] | 98 | "}", getTaskTree(DefaultGuiEventSequenceDetectionRule.class, null));
|
---|
[557] | 99 | }
|
---|
[1106] | 100 |
|
---|
[557] | 101 | /**
|
---|
| 102 | *
|
---|
| 103 | */
|
---|
| 104 | @Test
|
---|
[1106] | 105 | public void test_04() {
|
---|
| 106 | IGUIElement elem1 = new DummyGUIElement("elem1");
|
---|
| 107 | simulateEvent(new StartAndFinishSequenceInteraction("startFinish", 1), elem1);
|
---|
| 108 | simulateEvent(new DummyInteraction("bla", 1), elem1);
|
---|
| 109 | simulateEvent(new DummyInteraction("bli", 1), elem1);
|
---|
| 110 | simulateEvent(new DummyInteraction("blup", 1), elem1);
|
---|
| 111 | simulateEvent(new StartAndFinishSequenceInteraction("startFinish", 1), elem1);
|
---|
| 112 | simulateEvent(new DummyInteraction("bla", 1), elem1);
|
---|
| 113 | simulateEvent(new DummyInteraction("bli", 1), elem1);
|
---|
| 114 | simulateEvent(new StartAndFinishSequenceInteraction("startFinish", 1), elem1);
|
---|
[557] | 115 |
|
---|
| 116 | new TaskTreeChecker().assertTaskTree
|
---|
| 117 | ("Sequence sequence0 {" +
|
---|
| 118 | " Sequence sequence1 {" +
|
---|
[1106] | 119 | " Event startFinish {}" +
|
---|
[557] | 120 | " Event bla {}" +
|
---|
| 121 | " Event bli {}" +
|
---|
[1106] | 122 | " Event blup {}" +
|
---|
[557] | 123 | " }" +
|
---|
| 124 | " Sequence sequence2 {" +
|
---|
[1106] | 125 | " Event startFinish {}" +
|
---|
[557] | 126 | " Event bla {}" +
|
---|
| 127 | " Event bli {}" +
|
---|
| 128 | " }" +
|
---|
[1106] | 129 | " Event startFinish {}" +
|
---|
| 130 | "}", getTaskTree(DefaultGuiEventSequenceDetectionRule.class, null));
|
---|
| 131 | }
|
---|
| 132 |
|
---|
| 133 | /**
|
---|
| 134 | *
|
---|
| 135 | */
|
---|
| 136 | @Test
|
---|
| 137 | public void test_05() {
|
---|
| 138 | IGUIElement elem1 = new DummyGUIElement("elem1");
|
---|
| 139 | simulateEvent(new StartSequenceInteraction("start", 1), elem1);
|
---|
| 140 | simulateEvent(new DummyInteraction("bla", 1), elem1);
|
---|
| 141 | simulateEvent(new StartSequenceInteraction("start", 1), elem1);
|
---|
| 142 | simulateEvent(new StartSequenceInteraction("start", 1), elem1);
|
---|
| 143 | simulateEvent(new DummyInteraction("bli", 1), elem1);
|
---|
| 144 | simulateEvent(new DummyInteraction("blup", 1), elem1);
|
---|
| 145 | simulateEvent(new FinishSequenceInteraction("finish", 1), elem1);
|
---|
| 146 | simulateEvent(new DummyInteraction("bla", 1), elem1);
|
---|
| 147 | simulateEvent(new DummyInteraction("bli", 1), elem1);
|
---|
| 148 | simulateEvent(new FinishSequenceInteraction("finish", 1), elem1);
|
---|
| 149 | simulateEvent(new StartSequenceInteraction("start", 1), elem1);
|
---|
| 150 | simulateEvent(new StartSequenceInteraction("start", 1), elem1);
|
---|
| 151 | simulateEvent(new StartSequenceInteraction("start", 1), elem1);
|
---|
| 152 | simulateEvent(new DummyInteraction("blup", 1), elem1);
|
---|
| 153 | simulateEvent(new FinishSequenceInteraction("finish", 1), elem1);
|
---|
| 154 | simulateEvent(new FinishSequenceInteraction("finish", 1), elem1);
|
---|
| 155 | simulateEvent(new FinishSequenceInteraction("finish", 1), elem1);
|
---|
| 156 | simulateEvent(new FinishSequenceInteraction("finish", 1), elem1);
|
---|
| 157 | simulateEvent(new FinishSequenceInteraction("finish", 1), elem1);
|
---|
| 158 |
|
---|
| 159 | new TaskTreeChecker().assertTaskTree
|
---|
| 160 | ("Sequence sequence0 {" +
|
---|
| 161 | " Sequence sequence1 {" +
|
---|
| 162 | " Event start {}" +
|
---|
[557] | 163 | " Event bla {}" +
|
---|
[1106] | 164 | " Sequence sequence2 {" +
|
---|
| 165 | " Event start {}" +
|
---|
| 166 | " Sequence sequence3 {" +
|
---|
| 167 | " Event start {}" +
|
---|
| 168 | " Event bli {}" +
|
---|
| 169 | " Event blup {}" +
|
---|
| 170 | " Event finish {}" +
|
---|
| 171 | " }" +
|
---|
| 172 | " Event bla {}" +
|
---|
| 173 | " Event bli {}" +
|
---|
| 174 | " Event finish {}" +
|
---|
| 175 | " }" +
|
---|
| 176 | " Sequence sequence4 {" +
|
---|
| 177 | " Event start {}" +
|
---|
| 178 | " Sequence sequence5 {" +
|
---|
| 179 | " Event start {}" +
|
---|
| 180 | " Sequence sequence6 {" +
|
---|
| 181 | " Event start {}" +
|
---|
| 182 | " Event blup {}" +
|
---|
| 183 | " Event finish {}" +
|
---|
| 184 | " }" +
|
---|
| 185 | " Event finish {}" +
|
---|
| 186 | " }" +
|
---|
| 187 | " Event finish {}" +
|
---|
| 188 | " }" +
|
---|
| 189 | " Event finish {}" +
|
---|
[557] | 190 | " }" +
|
---|
[1106] | 191 | " Event finish {}" +
|
---|
| 192 | "}", getTaskTree(DefaultGuiEventSequenceDetectionRule.class, null));
|
---|
| 193 | }
|
---|
| 194 |
|
---|
| 195 | /**
|
---|
| 196 | *
|
---|
| 197 | */
|
---|
| 198 | @Test
|
---|
| 199 | public void test_06() {
|
---|
| 200 | IGUIElement elem1 = new DummyGUIElement("elem1");
|
---|
| 201 | simulateEvent(new StartSequenceInteraction("start", 1), elem1);
|
---|
| 202 | simulateEvent(new DummyInteraction("bla", 1), elem1);
|
---|
| 203 | simulateEvent(new StartSequenceInteraction("start", 1), elem1);
|
---|
| 204 | simulateEvent(new StartSequenceInteraction("start", 1), elem1);
|
---|
| 205 | simulateEvent(new DummyInteraction("bli", 1), elem1);
|
---|
| 206 | simulateEvent(new DummyInteraction("blup", 1), elem1);
|
---|
| 207 | simulateEvent(new StartAndFinishSequenceInteraction("startFinish", 1), elem1);
|
---|
| 208 | simulateEvent(new DummyInteraction("bla", 1), elem1);
|
---|
| 209 | simulateEvent(new DummyInteraction("bli", 1), elem1);
|
---|
| 210 | simulateEvent(new FinishSequenceInteraction("finish", 1), elem1);
|
---|
| 211 | simulateEvent(new StartSequenceInteraction("start", 1), elem1);
|
---|
| 212 | simulateEvent(new StartSequenceInteraction("start", 1), elem1);
|
---|
| 213 | simulateEvent(new StartSequenceInteraction("start", 1), elem1);
|
---|
| 214 | simulateEvent(new DummyInteraction("blup", 1), elem1);
|
---|
| 215 | simulateEvent(new StartAndFinishSequenceInteraction("startFinish", 1), elem1);
|
---|
| 216 | simulateEvent(new FinishSequenceInteraction("finish", 1), elem1);
|
---|
| 217 | simulateEvent(new FinishSequenceInteraction("finish", 1), elem1);
|
---|
| 218 | simulateEvent(new FinishSequenceInteraction("finish", 1), elem1);
|
---|
| 219 | simulateEvent(new FinishSequenceInteraction("finish", 1), elem1);
|
---|
| 220 | simulateEvent(new FinishSequenceInteraction("finish", 1), elem1);
|
---|
| 221 | simulateEvent(new FinishSequenceInteraction("finish", 1), elem1);
|
---|
| 222 |
|
---|
| 223 | new TaskTreeChecker().assertTaskTree
|
---|
| 224 | ("Sequence sequence0 {" +
|
---|
| 225 | " Sequence sequence1 {" +
|
---|
| 226 | " Event start {}" +
|
---|
[557] | 227 | " Event bla {}" +
|
---|
[1106] | 228 | " Sequence sequence2 {" +
|
---|
| 229 | " Event start {}" +
|
---|
| 230 | " Sequence sequence3 {" +
|
---|
| 231 | " Event start {}" +
|
---|
| 232 | " Event bli {}" +
|
---|
| 233 | " Event blup {}" +
|
---|
| 234 | " }" +
|
---|
| 235 | " Sequence sequence4 {" +
|
---|
| 236 | " Event startFinish {}" +
|
---|
| 237 | " Event bla {}" +
|
---|
| 238 | " Event bli {}" +
|
---|
| 239 | " Event finish {}" +
|
---|
| 240 | " }" +
|
---|
| 241 | " Sequence sequence5 {" +
|
---|
| 242 | " Event start {}" +
|
---|
| 243 | " Sequence sequence6 {" +
|
---|
| 244 | " Event start {}" +
|
---|
| 245 | " Sequence sequence7 {" +
|
---|
| 246 | " Event start {}" +
|
---|
| 247 | " Event blup {}" +
|
---|
| 248 | " }" +
|
---|
| 249 | " Sequence sequence8 {" +
|
---|
| 250 | " Event startFinish {}" +
|
---|
| 251 | " Event finish {}" +
|
---|
| 252 | " }" +
|
---|
| 253 | " Event finish {}" +
|
---|
| 254 | " }" +
|
---|
| 255 | " Event finish {}" +
|
---|
| 256 | " }" +
|
---|
| 257 | " Event finish {}" +
|
---|
| 258 | " }" +
|
---|
| 259 | " Event finish {}" +
|
---|
[557] | 260 | " }" +
|
---|
[1106] | 261 | " Event finish {}" +
|
---|
| 262 | "}", getTaskTree(DefaultGuiEventSequenceDetectionRule.class, null));
|
---|
[557] | 263 | }
|
---|
[1106] | 264 |
|
---|
| 265 | /**
|
---|
| 266 | *
|
---|
| 267 | */
|
---|
| 268 | private class StartSequenceInteraction extends DummyInteraction {
|
---|
[557] | 269 |
|
---|
[1106] | 270 | /** */
|
---|
| 271 | private static final long serialVersionUID = 1L;
|
---|
| 272 |
|
---|
| 273 | /**
|
---|
| 274 | *
|
---|
| 275 | */
|
---|
| 276 | public StartSequenceInteraction(String interactionType, int interactionNumber) {
|
---|
| 277 | super(interactionType, interactionNumber);
|
---|
| 278 | }
|
---|
| 279 |
|
---|
| 280 | /* (non-Javadoc)
|
---|
| 281 | * @see de.ugoe.cs.autoquest.test.DummyInteraction#startsLogicalSequence()
|
---|
| 282 | */
|
---|
| 283 | @Override
|
---|
| 284 | public boolean startsLogicalSequence() {
|
---|
| 285 | return true;
|
---|
| 286 | }
|
---|
| 287 |
|
---|
| 288 | }
|
---|
| 289 |
|
---|
| 290 | /**
|
---|
| 291 | *
|
---|
| 292 | */
|
---|
| 293 | private class FinishSequenceInteraction extends DummyInteraction {
|
---|
| 294 |
|
---|
| 295 | /** */
|
---|
| 296 | private static final long serialVersionUID = 1L;
|
---|
| 297 |
|
---|
| 298 | /**
|
---|
| 299 | *
|
---|
| 300 | */
|
---|
| 301 | public FinishSequenceInteraction(String interactionType, int interactionNumber) {
|
---|
| 302 | super(interactionType, interactionNumber);
|
---|
| 303 | }
|
---|
| 304 |
|
---|
| 305 | /* (non-Javadoc)
|
---|
| 306 | * @see de.ugoe.cs.autoquest.test.DummyInteraction#finishesLogicalSequence()
|
---|
| 307 | */
|
---|
| 308 | @Override
|
---|
| 309 | public boolean finishesLogicalSequence() {
|
---|
| 310 | return true;
|
---|
| 311 | }
|
---|
| 312 |
|
---|
| 313 | }
|
---|
| 314 |
|
---|
| 315 | /**
|
---|
| 316 | *
|
---|
| 317 | */
|
---|
| 318 | private class StartAndFinishSequenceInteraction extends DummyInteraction {
|
---|
| 319 |
|
---|
| 320 | /** */
|
---|
| 321 | private static final long serialVersionUID = 1L;
|
---|
| 322 |
|
---|
| 323 | /**
|
---|
| 324 | *
|
---|
| 325 | */
|
---|
| 326 | public StartAndFinishSequenceInteraction(String interactionType, int interactionNumber) {
|
---|
| 327 | super(interactionType, interactionNumber);
|
---|
| 328 | }
|
---|
| 329 |
|
---|
| 330 | /* (non-Javadoc)
|
---|
| 331 | * @see de.ugoe.cs.autoquest.test.DummyInteraction#startsLogicalSequence()
|
---|
| 332 | */
|
---|
| 333 | @Override
|
---|
| 334 | public boolean startsLogicalSequence() {
|
---|
| 335 | return true;
|
---|
| 336 | }
|
---|
| 337 |
|
---|
| 338 | /* (non-Javadoc)
|
---|
| 339 | * @see de.ugoe.cs.autoquest.test.DummyInteraction#finishesLogicalSequence()
|
---|
| 340 | */
|
---|
| 341 | @Override
|
---|
| 342 | public boolean finishesLogicalSequence() {
|
---|
| 343 | return true;
|
---|
| 344 | }
|
---|
| 345 |
|
---|
| 346 | }
|
---|
[445] | 347 | }
|
---|