Search in sources :

Example 1 with ProcessEventEntry

use of com.walmartlabs.concord.client.ProcessEventEntry in project concord by walmartlabs.

the class FlowEventsIT method test.

@Test
public void test() throws Exception {
    Payload payload = new Payload().archive(resource("flowEvents"));
    ConcordProcess proc = concord.processes().start(payload);
    expectStatus(proc, ProcessEntry.StatusEnum.FINISHED);
    // ---
    ProcessEventsApi processEventsApi = new ProcessEventsApi(concord.apiClient());
    List<ProcessEventEntry> events = processEventsApi.list(proc.instanceId(), "ELEMENT", null, null, null, null, null, null);
    assertNotNull(events);
    // ---
    // expression:
    // - ${log.info('BOO')}
    assertEvent(events, 0, new EventData().pre().correlationId().location(9, 7, "concord.yml").flow("default").name("log").description("Task: log"));
    assertEvent(events, 1, new EventData().post().duration().correlationId().location(9, 7, "concord.yml").flow("default").name("log").description("Task: log"));
    // task full form:
    // - task: log
    // in:
    // msg: "test"
    // pre
    assertEvent(events, 2, new EventData().pre().correlationId().location(12, 7, "concord.yml").flow("default").name("log").description("Task: log"));
    // post
    assertEvent(events, 3, new EventData().post().duration().correlationId().location(12, 7, "concord.yml").flow("default").name("log").description("Task: log"));
    // script:
    // - script: js
    assertEvent(events, 4, new EventData().correlationId().location(17, 7, "concord.yml").flow("default").description("Script: js"));
    // if
    // - if: ${1 == 1}
    assertEvent(events, 5, new EventData().correlationId().location(22, 7, "concord.yml").flow("default").description("Check: ${1 == 1}"));
    // - log: "It's true!"
    // pre
    assertEvent(events, 6, new EventData().pre().correlationId().location(24, 11, "concord.yml").flow("default").name("log").description("Task: log"));
    // post
    assertEvent(events, 7, new EventData().post().correlationId().duration().location(24, 11, "concord.yml").flow("default").name("log").description("Task: log"));
    // - switch: ${myVar}
    assertEvent(events, 8, new EventData().correlationId().location(26, 7, "concord.yml").flow("default").description("Switch: ${myVar}"));
    // - log: "It's red!"
    // pre
    assertEvent(events, 9, new EventData().pre().correlationId().location(28, 11, "concord.yml").flow("default").name("log").description("Task: log"));
    // post
    assertEvent(events, 10, new EventData().post().correlationId().duration().location(28, 11, "concord.yml").flow("default").name("log").description("Task: log"));
    // set variables
    assertEvent(events, 11, new EventData().correlationId().location(30, 7, "concord.yml").flow("default").description("Set variables"));
    // flow call
    assertEvent(events, 12, new EventData().correlationId().location(33, 7, "concord.yml").flow("default").description("Flow call: returnFlow"));
    // return
    assertEvent(events, 13, new EventData().correlationId().location(38, 7, "concord.yml").flow("returnFlow").description("Return"));
    // flow call
    assertEvent(events, 14, new EventData().correlationId().location(35, 7, "concord.yml").flow("default").description("Flow call: exitFlow"));
    // exit
    assertEvent(events, 15, new EventData().correlationId().location(41, 7, "concord.yml").flow("exitFlow").description("Exit"));
}
Also used : ConcordProcess(ca.ibodrov.concord.testcontainers.ConcordProcess) Payload(ca.ibodrov.concord.testcontainers.Payload) ProcessEventsApi(com.walmartlabs.concord.client.ProcessEventsApi) ProcessEventEntry(com.walmartlabs.concord.client.ProcessEventEntry) Test(org.junit.jupiter.api.Test)

Aggregations

ConcordProcess (ca.ibodrov.concord.testcontainers.ConcordProcess)1 Payload (ca.ibodrov.concord.testcontainers.Payload)1 ProcessEventEntry (com.walmartlabs.concord.client.ProcessEventEntry)1 ProcessEventsApi (com.walmartlabs.concord.client.ProcessEventsApi)1 Test (org.junit.jupiter.api.Test)1