Search in sources :

Example 1 with TaskSequence

use of org.contextmapper.dsl.generator.sketchminer.model.TaskSequence in project context-mapper-dsl by ContextMapper.

the class TaskSequenceTest method canAddTask.

@Test
public void canAddTask() {
    // given
    Task initTask = new Task("Start", TaskType.COMMAND);
    Task secondTask = new Task("SecondTask", TaskType.COMMAND);
    // when
    TaskSequence seq = new TaskSequence(initTask);
    seq.addTask(secondTask);
    // then
    assertEquals(secondTask, seq.getLastTaskInSequence());
    assertEquals(2, seq.getTasks().size());
}
Also used : Task(org.contextmapper.dsl.generator.sketchminer.model.Task) TaskSequence(org.contextmapper.dsl.generator.sketchminer.model.TaskSequence) Test(org.junit.jupiter.api.Test)

Example 2 with TaskSequence

use of org.contextmapper.dsl.generator.sketchminer.model.TaskSequence in project context-mapper-dsl by ContextMapper.

the class TaskSequenceTest method canCreateTaskSequence.

@Test
public void canCreateTaskSequence() {
    // given
    Task initTask = new Task("Start", TaskType.COMMAND);
    // when
    TaskSequence seq = new TaskSequence(initTask);
    // then
    assertEquals(initTask, seq.getLastTaskInSequence());
    assertEquals(1, seq.getTasks().size());
}
Also used : Task(org.contextmapper.dsl.generator.sketchminer.model.Task) TaskSequence(org.contextmapper.dsl.generator.sketchminer.model.TaskSequence) Test(org.junit.jupiter.api.Test)

Example 3 with TaskSequence

use of org.contextmapper.dsl.generator.sketchminer.model.TaskSequence in project context-mapper-dsl by ContextMapper.

the class Flow2SketchMinerConverter method createNewSequenceWithTask.

private void createNewSequenceWithTask(TaskSequence seq, Task nextTask) {
    TaskSequence newSeq = seq.copy();
    if (newSeq.addTask(nextTask))
        finishSequence(newSeq);
    model.addSequence(newSeq);
}
Also used : TaskSequence(org.contextmapper.dsl.generator.sketchminer.model.TaskSequence)

Example 4 with TaskSequence

use of org.contextmapper.dsl.generator.sketchminer.model.TaskSequence in project context-mapper-dsl by ContextMapper.

the class TaskSequenceTest method canCopySequence.

@Test
public void canCopySequence() {
    // given
    Task initTask = new Task("Start", TaskType.COMMAND);
    TaskSequence seq1 = new TaskSequence(initTask);
    // when
    TaskSequence seq2 = seq1.copy();
    // then
    assertEquals(1, seq1.getTasks().size());
    assertEquals(1, seq2.getTasks().size());
    assertEquals(initTask, seq1.getLastTaskInSequence());
    assertEquals(initTask, seq2.getLastTaskInSequence());
    assertFalse(seq1.equals(seq2));
    assertFalse(seq1 == seq2);
}
Also used : Task(org.contextmapper.dsl.generator.sketchminer.model.Task) TaskSequence(org.contextmapper.dsl.generator.sketchminer.model.TaskSequence) Test(org.junit.jupiter.api.Test)

Example 5 with TaskSequence

use of org.contextmapper.dsl.generator.sketchminer.model.TaskSequence in project context-mapper-dsl by ContextMapper.

the class Flow2SketchMinerConverter method convert.

public SketchMinerModel convert() {
    for (Task initialTask : getInitialTasks()) {
        TaskSequence seq = new TaskSequence(initialTask);
        model.addSequence(seq);
        finishSequence(seq);
    }
    model.cleanupDuplicateSequences();
    return model;
}
Also used : Task(org.contextmapper.dsl.generator.sketchminer.model.Task) TaskSequence(org.contextmapper.dsl.generator.sketchminer.model.TaskSequence)

Aggregations

TaskSequence (org.contextmapper.dsl.generator.sketchminer.model.TaskSequence)7 Task (org.contextmapper.dsl.generator.sketchminer.model.Task)6 Test (org.junit.jupiter.api.Test)3