Ignore:
Timestamp:
08/14/13 17:04:42 (11 years ago)
Author:
pharms
Message:
  • rework of task model to move event instance stuff to task instances
  • introduction of sequence, selection, iteration and optional instances
Location:
trunk/autoquest-test-utils/src/main/java/de/ugoe/cs/autoquest/tasktrees
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-test-utils/src/main/java/de/ugoe/cs/autoquest/tasktrees/TaskTreeChecker.java

    r1146 r1294  
    2020import java.util.HashMap; 
    2121import java.util.Iterator; 
     22import java.util.LinkedList; 
    2223import java.util.List; 
    2324import java.util.Map; 
     
    2728import de.ugoe.cs.autoquest.eventcore.gui.TextInput; 
    2829import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
     30import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    2931import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
     32import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptionalInstance; 
    3033import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
     34import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; 
    3135import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
    3236import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     
    7074     * 
    7175     */ 
    72     public void assertTaskInstanceList(String userSessionSpec, ITaskInstanceList taskInstances) { 
     76    public void assertUserSession(String userSessionSpec, IUserSession session) { 
    7377        if (doTrace) { 
    74             new TaskTreeEncoder().encode(taskInstances, System.err); 
     78            new TaskTreeEncoder().encode(session, System.err); 
    7579        } 
    7680 
     
    8690             
    8791            if (taskInstanceSpec != null) { 
    88                 assertTaskInstanceList(taskInstanceSpec, taskInstances, tasks); 
     92                assertUserSession(taskInstanceSpec, session, tasks); 
     93            } 
     94        } 
     95    } 
     96 
     97    /** 
     98     * 
     99     */ 
     100    public void assertTaskInstance(String userSessionSpec, ITaskInstance taskInstance) { 
     101        if (doTrace) { 
     102            new TaskTreeEncoder().encode(taskInstance, System.err); 
     103        } 
     104 
     105        TaskSpec taskInstanceSpec = null; 
     106 
     107        Matcher taskMatcher = taskPattern.matcher(userSessionSpec); 
     108         
     109        Map<String, ITask> tasks = new HashMap<String, ITask>(); 
     110 
     111        while (taskMatcher.find()) { 
     112 
     113            taskInstanceSpec = parseTaskInstance(taskMatcher); 
     114             
     115            if (taskInstanceSpec != null) { 
     116                assertTaskInstance(taskInstanceSpec, taskInstance, tasks); 
    89117            } 
    90118        } 
     
    154182            } 
    155183             
    156             List<ITaskInstance> expectedChildren = expected.getChildren(); 
    157             List<ITaskInstance> checkedChildren = checked.getChildren(); 
     184            List<ITaskInstance> expectedChildren = getChildren(expected); 
     185            List<ITaskInstance> checkedChildren = getChildren(checked); 
    158186             
    159187            if ((expectedChildren != null) && (expectedChildren.size() > 0)) { 
     
    241269     * @param taskMapCopy 
    242270     */ 
    243     private void assertTaskInstanceList(TaskSpec           taskSpec, 
    244                                         ITaskInstanceList  taskInstances, 
    245                                         Map<String, ITask> tasks) 
     271    private void assertUserSession(TaskSpec           taskSpec, 
     272                                   IUserSession       session, 
     273                                   Map<String, ITask> tasks) 
    246274    { 
    247275        if (doTrace) { 
    248             System.err.println("\ncomparing " + taskSpec.type + " with " + taskInstances + "\n"); 
    249         } 
    250  
    251         if ((taskInstances instanceof IUserSession) && (!"UserSession".equals(taskSpec.type))) { 
     276            System.err.println("\ncomparing " + taskSpec.type + " with " + session + "\n"); 
     277        } 
     278 
     279        if (!"UserSession".equals(taskSpec.type)) { 
    252280            fail("can not compare a task instance with a user session"); 
    253281        } 
    254         else if ((!(taskInstances instanceof IUserSession)) && 
    255                  (!"TaskInstances".equals(taskSpec.type))) 
    256         { 
     282         
     283        List<ITaskInstance> children = session.getExecutedTasks(); 
     284         
     285        if (taskSpec.children.length != children.size()) { 
     286            fail("number of task instances in task instance list does not match"); 
     287        } 
     288         
     289        for (int i = 0; i < children.size(); i++) { 
     290            TaskSpec childSpec = taskSpec.children[i]; 
     291            assertTrue(taskSpecEqualsTaskInstance(childSpec, children.get(i), tasks)); 
     292        } 
     293    } 
     294 
     295    /** 
     296     * @param task 
     297     * @param taskMapCopy 
     298     */ 
     299    private void assertTaskInstance(TaskSpec           taskSpec, 
     300                                    ITaskInstance      taskInstance, 
     301                                    Map<String, ITask> tasks) 
     302    { 
     303        if (doTrace) { 
     304            System.err.println("\ncomparing " + taskSpec.type + " with " + taskInstance + "\n"); 
     305        } 
     306 
     307        if (!"TaskInstances".equals(taskSpec.type)) { 
    257308            fail("can not compare a task instance with a task instance list"); 
    258309        } 
    259310         
    260         if (taskSpec.children.length != taskInstances.size()) { 
     311        List<ITaskInstance> children = getChildren(taskInstance); 
     312         
     313        if (taskSpec.children.length != children.size()) { 
    261314            fail("number of task instances in task instance list does not match"); 
    262315        } 
    263316         
    264         for (int i = 0; i < taskInstances.size(); i++) { 
     317        for (int i = 0; i < children.size(); i++) { 
    265318            TaskSpec childSpec = taskSpec.children[i]; 
    266             assertTrue(taskSpecEqualsTaskInstance(childSpec, taskInstances.get(i), tasks)); 
     319            assertTrue(taskSpecEqualsTaskInstance(childSpec, children.get(i), tasks)); 
    267320        } 
    268321    } 
     
    284337        if (("Event".equals(taskSpec.type) && (!(task instanceof IEventTask))) || 
    285338            ("TextInputEvent".equals(taskSpec.type) && 
    286              ((!(task instanceof IEventTask)) || 
    287               (!(((IEventTask) task).getEventType() instanceof TextInput)))) || 
     339             ((!(taskInstance instanceof IEventTaskInstance)) || 
     340              (!(((IEventTaskInstance) taskInstance).getEvent().getType() instanceof TextInput)))) || 
    288341            ("Sequence".equals(taskSpec.type) && (!(task instanceof ISequence))) || 
    289342            ("Selection".equals(taskSpec.type) && (!(task instanceof ISelection))) || 
     
    306359 
    307360        if ("TextInputEvent".equals(taskSpec.type)) { 
    308             TextInput eventType = (TextInput) ((IEventTask) task).getEventType(); 
     361            TextInput eventType = (TextInput) 
     362                ((IEventTaskInstance) taskInstance).getEvent().getType(); 
     363             
    309364            if ((taskSpec.additionalInfo != null) && 
    310365                !"".equals(taskSpec.additionalInfo) && 
     
    319374            } 
    320375        } 
    321         else if ((task instanceof IEventTask) && (((IEventTask) task).getEventType() != null) && 
    322                  (!taskSpec.name.equals(((IEventTask) task).getEventType().getName()))) 
     376        else if ((task instanceof IEventTask) && 
     377                 (((IEventTaskInstance) taskInstance).getEvent().getType() != null) && 
     378                 (!taskSpec.name.equals(((IEventTaskInstance) taskInstance).getEvent().getType().getName()))) 
    323379        { 
    324380            // simple event names do not match. But what about the event name in 
     
    328384                    (!"".equals(taskSpec.additionalInfo) ? " " + taskSpec.additionalInfo : ""); 
    329385 
    330             if (!complexName.equals(((IEventTask) task).getEventType().getName())) { 
     386            if (!complexName.equals(((IEventTaskInstance) taskInstance).getEvent().getType().getName())) { 
    331387                if (doTrace) { 
    332                     System.err.println("event names do not match: " + taskSpec.name + " != " + 
    333                                        ((IEventTask) task).getEventType().getName() + "\n"); 
     388                    System.err.println 
     389                        ("event names do not match: " + taskSpec.name + " != " + 
     390                         ((IEventTaskInstance) taskInstance).getEvent().getType().getName() + "\n"); 
    334391                } 
    335392                return false; 
     
    358415        } 
    359416 
    360         if (((taskSpec.children == null) && (taskInstance.getChildren().size() > 0)) || 
     417        List<ITaskInstance> children = getChildren(taskInstance); 
     418         
     419        if (((taskSpec.children == null) && (children.size() > 0)) || 
    361420            ((taskSpec.children != null) && 
    362              (taskSpec.children.length != taskInstance.getChildren().size()))) 
     421             (taskSpec.children.length != children.size()))) 
    363422        { 
    364423            if (doTrace) { 
     
    366425                    ("numbers of children do not match: " + 
    367426                     (taskSpec.children == null ? "0" : taskSpec.children.length) + " != " + 
    368                      (taskInstance.getChildren() == null ? "0" : 
    369                           taskInstance.getChildren().size()) + "\n"); 
     427                     (children == null ? "0" : children.size()) + "\n"); 
    370428            } 
    371429            return false; 
    372430        } 
    373431 
    374         Iterator<ITaskInstance> children = taskInstance.getChildren().iterator(); 
     432        Iterator<ITaskInstance> childrenIterator = children.iterator(); 
    375433        if (taskSpec.children != null) { 
    376434            for (TaskSpec child : taskSpec.children) { 
    377                 if (!taskSpecEqualsTaskInstance(child, children.next(), tasks)) { 
     435                if (!taskSpecEqualsTaskInstance(child, childrenIterator.next(), tasks)) { 
    378436                    if (doTrace) { 
    379437                        System.err.println("one of the children does not match\n"); 
     
    384442        } 
    385443 
    386         if (!children.hasNext()) { 
     444        if (!childrenIterator.hasNext()) { 
    387445            if (doTrace) { 
    388446                System.err.println("nodes match\n"); 
     
    398456    } 
    399457     
     458    /** 
     459     * <p> 
     460     * TODO: comment 
     461     * </p> 
     462     * 
     463     * @param taskInstance 
     464     * @return 
     465     */ 
     466    private List<ITaskInstance> getChildren(ITaskInstance taskInstance) { 
     467        List<ITaskInstance> result = new LinkedList<ITaskInstance>(); 
     468         
     469        if (taskInstance instanceof ITaskInstanceList) { 
     470            for (ITaskInstance child : (ITaskInstanceList) taskInstance) { 
     471                result.add(child); 
     472            } 
     473        } 
     474        else if (taskInstance instanceof ISelectionInstance) { 
     475            result.add(((ISelectionInstance) taskInstance).getChild()); 
     476        } 
     477        else if (taskInstance instanceof IOptionalInstance) { 
     478            result.add(((IOptionalInstance) taskInstance).getChild()); 
     479        } 
     480         
     481        return result; 
     482    } 
     483 
    400484    /** 
    401485     * 
  • trunk/autoquest-test-utils/src/main/java/de/ugoe/cs/autoquest/tasktrees/TaskTreeDecoder.java

    r1212 r1294  
    2626import de.ugoe.cs.autoquest.eventcore.StringEventType; 
    2727import de.ugoe.cs.autoquest.eventcore.gui.TextInput; 
     28import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
     29import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    2830import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
     31import de.ugoe.cs.autoquest.tasktrees.treeifc.IIterationInstance; 
    2932import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; 
     33import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptionalInstance; 
    3034import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
     35import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; 
    3136import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
     37import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequenceInstance; 
    3238import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    3339import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
     
    173179            } 
    174180            else { 
    175                 task = createUserInteractionTask(matcher); 
     181                task = createUserInteractionTaskInstance(matcher).getTask(); 
    176182            }   
    177183            tasks.put(id, task); 
    178184        } 
    179185         
    180         if ((matcher.group(5) != null) && (!"".equals(matcher.group(5).trim()))) { 
    181             taskBuilder.setDescription(task, matcher.group(5).trim()); 
    182         } 
    183  
    184         ITaskInstance instance = taskFactory.createNewTaskInstance(task); 
     186        ITaskInstance instance; 
     187         
     188        if (task instanceof ISequence) { 
     189            instance = taskFactory.createNewTaskInstance((ISequence) task); 
     190        } 
     191        else if (task instanceof ISelection) { 
     192            instance = taskFactory.createNewTaskInstance((ISelection) task); 
     193        } 
     194        else if (task instanceof IIteration) { 
     195            instance = taskFactory.createNewTaskInstance((IIteration) task); 
     196        } 
     197        else if (task instanceof IOptional) { 
     198            instance = taskFactory.createNewTaskInstance((IOptional) task); 
     199        } 
     200        else { 
     201            instance = taskFactory.createNewTaskInstance 
     202                 ((IEventTask) task, 
     203                  ((IEventTaskInstance) task.getInstances().iterator().next()).getEvent()); 
     204        }   
    185205         
    186206        while (taskMatcher.find() && !"}".equals(taskMatcher.group(0))) { 
     
    216236            } 
    217237             
    218             taskBuilder.addChild(instance, childInstance); 
     238            if (instance instanceof ISequenceInstance) { 
     239                taskBuilder.addChild((ISequenceInstance) instance, childInstance); 
     240            } 
     241            else if (instance instanceof ISelectionInstance) { 
     242                taskBuilder.setChild((ISelectionInstance) instance, childInstance); 
     243            } 
     244            else if (instance instanceof IIterationInstance) { 
     245                taskBuilder.addChild((IIterationInstance) instance, childInstance); 
     246            } 
     247            else if (instance instanceof IOptionalInstance) { 
     248                taskBuilder.setChild((IOptionalInstance) instance, childInstance); 
     249            } 
    219250        } 
    220251 
     
    229260     * @return 
    230261     */ 
    231     private ITask createUserInteractionTask(Matcher matcher) { 
     262    private ITaskInstance createUserInteractionTaskInstance(Matcher matcher) { 
    232263        String evenType = matcher.group(1); 
    233264        String id = matcher.group(2); 
    234         IEventTarget evenTarget = targets.get(id); 
    235         if (evenTarget == null) { 
    236             evenTarget = determineTarget(evenType, id, matcher.group(4)); 
    237             targets.put(id, evenTarget); 
     265        IEventTarget eventTarget = targets.get(id); 
     266        if (eventTarget == null) { 
     267            eventTarget = determineTarget(evenType, id, matcher.group(4)); 
     268            targets.put(id, eventTarget); 
    238269        } 
    239270        IEventType eventType = determineType(evenType, matcher.group(4)); 
    240         return taskFactory.createNewEventTask(eventType, evenTarget); 
     271        IEventTask task = taskFactory.createNewEventTask(eventType + " --> " + eventTarget); 
     272         
     273        return taskFactory.createNewTaskInstance(task, new Event(eventType, eventTarget)); 
    241274    } 
    242275 
  • trunk/autoquest-test-utils/src/main/java/de/ugoe/cs/autoquest/tasktrees/TaskTreeEncoder.java

    r1146 r1294  
    2424import java.util.Map; 
    2525 
     26import de.ugoe.cs.autoquest.eventcore.Event; 
    2627import de.ugoe.cs.autoquest.eventcore.gui.TextInput; 
    2728import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
     29import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    2830import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
    2931import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; 
     32import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptionalInstance; 
    3033import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
     34import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; 
    3135import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
    3236import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
     
    141145        else if (task instanceof IEventTask) { 
    142146            out.print(indent); 
    143             out.print(((IEventTask) task).getEventType()); 
    144             out.print(" "); 
    145             out.print(((IEventTask) task).getEventTarget().getStringIdentifier()); 
    146 //            if (((IEventTask) node).getEventTarget() instanceof IGUIElement) { 
    147 //              out.print(" "); 
    148 //              out.print(((IGUIElement) ((IEventTask) node).getEventTarget()).getSpecification()); 
    149 //            } 
     147            out.print(task); 
    150148        } 
    151149        else { 
     
    154152 
    155153        int i = 0; 
    156         for (ITaskInstance child : taskInstance.getChildren()) { 
    157             encode(child, out, indent + "  ", i++); 
     154         
     155        if (taskInstance instanceof ITaskInstanceList) { 
     156            for (ITaskInstance child : (ITaskInstanceList) taskInstance) { 
     157                encode(child, out, indent + "  ", i++); 
     158            } 
     159        } 
     160        else if (taskInstance instanceof ISelectionInstance) { 
     161            encode(((ISelectionInstance) taskInstance).getChild(), out, indent + "  ", i++); 
     162        } 
     163        else if (taskInstance instanceof IOptionalInstance) { 
     164            encode(((IOptionalInstance) taskInstance).getChild(), out, indent + "  ", i++); 
    158165        } 
    159166 
     
    221228        } 
    222229        else if (task instanceof IEventTask) { 
    223             if (((IEventTask) task).getEventType() instanceof TextInput) { 
     230            Event event = ((IEventTaskInstance) taskInstance).getEvent(); 
     231            if (event.getType() instanceof TextInput) { 
    224232                if (id == null) { 
    225233                    id = "textInput" + typeCounters[3]++; 
     
    229237                System.out.print(id); 
    230238                System.out.print(" \""); 
    231                 System.out.print(((TextInput) ((IEventTask) task).getEventType()).getEnteredText()); 
     239                System.out.print(((TextInput) event.getType()).getEnteredText()); 
    232240                System.out.print("\""); 
    233241            } 
     
    240248                System.out.print(id); 
    241249                System.out.print(' '); 
    242                 System.out.print(((IEventTask) task).getEventType().getName()); 
     250                System.out.print(event.getType().getName()); 
    243251            } 
    244252            System.out.print(" {}\" +"); 
     
    250258        taskIds.put(task, id); 
    251259         
    252         for (ITaskInstance child : taskInstance.getChildren()) { 
    253             dumpTaskInstanceAsCheckString(child, typeCounters, taskIds, indent + "  "); 
     260        if (taskInstance instanceof ITaskInstanceList) { 
     261            for (ITaskInstance child : (ITaskInstanceList) taskInstance) { 
     262                dumpTaskInstanceAsCheckString(child, typeCounters, taskIds, indent + "  "); 
     263            } 
     264        } 
     265        else if (taskInstance instanceof ISelectionInstance) { 
     266            dumpTaskInstanceAsCheckString 
     267                (((ISelectionInstance) taskInstance).getChild(), typeCounters, taskIds, indent + "  "); 
     268        } 
     269        else if (taskInstance instanceof IOptionalInstance) { 
     270            dumpTaskInstanceAsCheckString 
     271                (((IOptionalInstance) taskInstance).getChild(), typeCounters, taskIds, indent + "  "); 
    254272        } 
    255273 
  • trunk/autoquest-test-utils/src/main/java/de/ugoe/cs/autoquest/tasktrees/TaskTreeValidator.java

    r1146 r1294  
    2020 
    2121import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 
     22import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 
    2223import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
     24import de.ugoe.cs.autoquest.tasktrees.treeifc.IIterationInstance; 
    2325import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; 
     26import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptionalInstance; 
    2427import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
     28import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; 
    2529import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 
     30import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequenceInstance; 
    2631import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    2732import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; 
     
    6671             
    6772            assertEquals("number of children of sequence instance must match sequence model", 
    68                          taskInstance.size(), task.getChildren().size()); 
     73                         ((ISequenceInstance) taskInstance).size(), task.getChildren().size()); 
    6974             
    70             for (int i = 0; i < taskInstance.size(); i++) { 
    71                 assertNotNull("sequence instance child " + i + " was null", taskInstance.get(i)); 
    72                 ITask childTask = taskInstance.get(i).getTask(); 
     75            for (int i = 0; i < ((ISequenceInstance) taskInstance).size(); i++) { 
     76                assertNotNull("sequence instance child " + i + " was null", 
     77                              ((ISequenceInstance) taskInstance).get(i)); 
     78                ITask childTask = ((ISequenceInstance) taskInstance).get(i).getTask(); 
    7379                assertSame("task of sequence child " + i + " does not match sequence model", 
    7480                           childTask, task.getChildren().get(i)); 
     
    7884            ISelection task = (ISelection) taskInstance.getTask(); 
    7985             
    80             assertEquals 
    81                 ("number of children of selection instance must be 1", 1, taskInstance.size()); 
     86            assertNotNull("number of children of selection instance must be 1", 
     87                          ((ISelectionInstance) taskInstance).getChild()); 
    8288            assertTrue 
    8389                ("number of children of selection must be larger 0", task.getChildren().size() > 0); 
     
    9096                assertFalse("child of selection model must not be an optional", 
    9197                            childTask instanceof IOptional); 
    92                 if (childTask.equals(taskInstance.get(0).getTask())) { 
     98                if (childTask.equals(((ISelectionInstance) taskInstance).getChild().getTask())) { 
    9399                    found = true; 
    94100                    break; 
     
    107113                        childTask instanceof IOptional); 
    108114             
    109             for (int i = 0; i < taskInstance.size(); i++) { 
    110                 assertNotNull("iteration instance child " + i + " was null", taskInstance.get(i)); 
     115            for (int i = 0; i < ((IIterationInstance) taskInstance).size(); i++) { 
     116                assertNotNull("iteration instance child " + i + " was null", 
     117                              ((IIterationInstance) taskInstance).get(i)); 
    111118                assertSame("task of iteration child " + i + " does not match iteration model", 
    112                            childTask, taskInstance.get(i).getTask()); 
     119                           childTask, ((IIterationInstance) taskInstance).get(i).getTask()); 
    113120            } 
    114121        } 
     
    119126                        childTask instanceof IOptional); 
    120127             
    121             assertEquals 
    122                 ("number of children of optional instance must be 1", 1, taskInstance.size()); 
     128            assertNotNull("number of children of optional instance must be 1", 
     129                          ((IOptionalInstance) taskInstance).getChild()); 
    123130             
    124131            assertEquals("task of optional child does not match optional model", 
    125                          childTask, taskInstance.get(0).getTask()); 
     132                         childTask, ((IOptionalInstance) taskInstance).getChild().getTask()); 
    126133        } 
    127134        else if (taskInstance.getTask() instanceof IEventTask) { 
    128135            IEventTask task = (IEventTask) taskInstance.getTask(); 
    129136            assertNotNull("event task model must not be null", task); 
    130             assertNotNull("event type of event task model must not be null", task.getEventType()); 
    131             assertNotNull 
    132                 ("event target of event task model must not be null", task.getEventTarget()); 
    133  
    134             assertEquals("event task instance must not have children", 0, taskInstance.size()); 
     137            assertNotNull("event of event task instance must not be null", 
     138                          ((IEventTaskInstance) taskInstance).getEvent()); 
    135139        } 
    136140        else { 
     
    138142        } 
    139143         
    140         for (ITaskInstance child : taskInstance) { 
    141             validate(child); 
     144        if (taskInstance instanceof ITaskInstanceList) { 
     145            for (ITaskInstance child : (ITaskInstanceList) taskInstance) { 
     146                validate(child); 
     147            } 
     148        } 
     149        else if (taskInstance instanceof ISelectionInstance) { 
     150            validate(((ISelectionInstance) taskInstance).getChild()); 
     151        } 
     152        else if (taskInstance instanceof IOptionalInstance) { 
     153            validate(((IOptionalInstance) taskInstance).getChild()); 
    142154        } 
    143155    } 
Note: See TracChangeset for help on using the changeset viewer.