Search in sources :

Example 1 with ProcessInstanceEventBatch

use of io.automatiko.engine.services.event.impl.ProcessInstanceEventBatch in project automatiko-engine by automatiko-io.

the class ProcessInstanceEventBatchTest method testMilestones.

@Test
public void testMilestones() {
    ProcessInstanceEventBatch batch = new ProcessInstanceEventBatch(null, null);
    WorkflowProcessInstance pi = mock(WorkflowProcessInstance.class);
    when(pi.milestones()).thenReturn(null);
    assertThat(batch.createMilestones(pi)).isNull();
    when(pi.milestones()).thenReturn(emptyList());
    assertThat(batch.createMilestones(pi)).isEmpty();
    Milestone milestone = Milestone.builder().withId("id").withName("name").withStatus(Status.AVAILABLE).build();
    when(pi.milestones()).thenReturn(singleton(milestone));
    MilestoneEventBody milestoneEventBody = MilestoneEventBody.create().id("id").name("name").status(Status.AVAILABLE.name()).build();
    assertThat(batch.createMilestones(pi)).containsOnly(milestoneEventBody);
}
Also used : ProcessInstanceEventBatch(io.automatiko.engine.services.event.impl.ProcessInstanceEventBatch) Milestone(io.automatiko.engine.api.workflow.flexible.Milestone) MilestoneEventBody(io.automatiko.engine.services.event.impl.MilestoneEventBody) WorkflowProcessInstance(io.automatiko.engine.api.runtime.process.WorkflowProcessInstance) Test(org.junit.jupiter.api.Test)

Example 2 with ProcessInstanceEventBatch

use of io.automatiko.engine.services.event.impl.ProcessInstanceEventBatch in project automatiko-engine by automatiko-io.

the class ProcessInstanceEventBatchTest method testNoProcessIdDefined.

@Test
public void testNoProcessIdDefined() {
    ProcessInstanceEventBatch batch = new ProcessInstanceEventBatch("http://localhost:8080", null);
    assertThat(batch.extractRuntimeSource(emptyMap())).isNull();
}
Also used : ProcessInstanceEventBatch(io.automatiko.engine.services.event.impl.ProcessInstanceEventBatch) Test(org.junit.jupiter.api.Test)

Example 3 with ProcessInstanceEventBatch

use of io.automatiko.engine.services.event.impl.ProcessInstanceEventBatch in project automatiko-engine by automatiko-io.

the class ProcessInstanceEventBatchTest method testNoServiceDefined.

@Test
public void testNoServiceDefined() {
    ProcessInstanceEventBatch batch = new ProcessInstanceEventBatch("", null);
    assertThat(batch.extractRuntimeSource(singletonMap(PROCESS_ID_META_DATA, "travels"))).isEqualTo("/travels");
    assertThat(batch.extractRuntimeSource(singletonMap(PROCESS_ID_META_DATA, "demo.orders"))).isEqualTo("/orders");
}
Also used : ProcessInstanceEventBatch(io.automatiko.engine.services.event.impl.ProcessInstanceEventBatch) Test(org.junit.jupiter.api.Test)

Example 4 with ProcessInstanceEventBatch

use of io.automatiko.engine.services.event.impl.ProcessInstanceEventBatch in project automatiko-engine by automatiko-io.

the class ProcessInstanceEventBatchTest method testServiceDefined.

@Test
public void testServiceDefined() {
    ProcessInstanceEventBatch batch = new ProcessInstanceEventBatch("http://localhost:8080", null);
    assertThat(batch.extractRuntimeSource(singletonMap(PROCESS_ID_META_DATA, "travels"))).isEqualTo("http://localhost:8080/travels");
    assertThat(batch.extractRuntimeSource(singletonMap(PROCESS_ID_META_DATA, "demo.orders"))).isEqualTo("http://localhost:8080/orders");
}
Also used : ProcessInstanceEventBatch(io.automatiko.engine.services.event.impl.ProcessInstanceEventBatch) Test(org.junit.jupiter.api.Test)

Aggregations

ProcessInstanceEventBatch (io.automatiko.engine.services.event.impl.ProcessInstanceEventBatch)4 Test (org.junit.jupiter.api.Test)4 WorkflowProcessInstance (io.automatiko.engine.api.runtime.process.WorkflowProcessInstance)1 Milestone (io.automatiko.engine.api.workflow.flexible.Milestone)1 MilestoneEventBody (io.automatiko.engine.services.event.impl.MilestoneEventBody)1