Search in sources :

Example 66 with ProcessEntry

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

the class ProcessIT method testMetaWithExit.

/**
 * Test the process metadata with exit step.
 */
@Test
public void testMetaWithExit() throws Exception {
    Payload payload = new Payload().archive(resource("exitWithMeta")).arg("name", "Concord");
    ConcordProcess proc = concord.processes().start(payload);
    ProcessEntry pe = expectStatus(proc, ProcessEntry.StatusEnum.FINISHED);
    // ---
    proc.assertLog(".*Hello, Concord!.*");
    assertNotNull(pe.getMeta());
    assertEquals("init-value", pe.getMeta().get("test"));
}
Also used : ConcordProcess(ca.ibodrov.concord.testcontainers.ConcordProcess) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry) Payload(ca.ibodrov.concord.testcontainers.Payload) Test(org.junit.jupiter.api.Test)

Example 67 with ProcessEntry

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

the class AbstractGeneralTriggerIT method waitProcesses.

protected Map<ProcessEntry.StatusEnum, ProcessEntry> waitProcesses(String orgName, String projectName, ProcessEntry.StatusEnum first, ProcessEntry.StatusEnum... more) throws Exception {
    ProcessApi processApi = new ProcessApi(getApiClient());
    List<ProcessEntry> processes;
    while (true) {
        processes = processApi.list(orgName, projectName, null, null, null, null, null, null, null, null, null);
        if (processes.size() == 1 + (more != null ? more.length : 0)) {
            break;
        }
        Thread.sleep(1000);
    }
    Map<ProcessEntry.StatusEnum, ProcessEntry> ps = new HashMap<>();
    for (ProcessEntry p : processes) {
        ProcessEntry pir = waitForStatus(processApi, p.getInstanceId(), first, more);
        ProcessEntry pe = ps.put(pir.getStatus(), pir);
        if (pe != null) {
            throw new RuntimeException("already got process with '" + pe.getStatus() + "' status, id: " + pe.getInstanceId());
        }
    }
    return ps;
}
Also used : ProcessApi(com.walmartlabs.concord.client.ProcessApi) HashMap(java.util.HashMap) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry)

Example 68 with ProcessEntry

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

the class ProcessIT method testOnFailureVariables2.

@Test
public void testOnFailureVariables2() throws Exception {
    ConcordProcess proc = concord.processes().start(new Payload().archive(resource("onFailureVars2")));
    proc.expectStatus(StatusEnum.FAILED);
    // wait for the onFailure process
    ConcordProcess onFailureProc;
    while (true) {
        List<ProcessEntry> l = proc.subprocesses();
        if (!l.isEmpty()) {
            onFailureProc = concord.processes().get(l.get(0).getInstanceId());
            break;
        }
        Thread.sleep(1000);
    }
    onFailureProc.expectStatus(StatusEnum.FINISHED);
    onFailureProc.assertLog(".*abc: Hello.*");
    onFailureProc.assertLog(".*Last error was:.*PropertyNotFoundException.*");
}
Also used : ConcordProcess(ca.ibodrov.concord.testcontainers.ConcordProcess) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry) Payload(ca.ibodrov.concord.testcontainers.Payload) Test(org.junit.jupiter.api.Test)

Example 69 with ProcessEntry

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

the class ProcessIT method testGetProcessErrorMessageFromBpmnError.

@Test
public void testGetProcessErrorMessageFromBpmnError() throws Exception {
    byte[] archive = archive(ProcessIT.class.getResource("throwBpmnError").toURI());
    // start the process
    ConcordProcess proc = concord.processes().start(new Payload().archive(archive));
    // wait for completion
    ProcessEntry pe = proc.expectStatus(StatusEnum.FAILED);
    assertProcessErrorMessage(pe, ".*myBnpmError.*");
}
Also used : ConcordProcess(ca.ibodrov.concord.testcontainers.ConcordProcess) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry) Payload(ca.ibodrov.concord.testcontainers.Payload) Test(org.junit.jupiter.api.Test)

Example 70 with ProcessEntry

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

the class ProcessIT method testDisableProcess.

@Test
public void testDisableProcess() throws Exception {
    byte[] archive = archive(ProcessIT.class.getResource("disableProcess").toURI());
    // ---
    ConcordProcess proc = concord.processes().start(new Payload().archive(archive));
    // ---
    proc.expectStatus(StatusEnum.FINISHED);
    // ---
    ProcessEntry pe = proc.disable();
    assertTrue(pe.isDisabled());
}
Also used : ConcordProcess(ca.ibodrov.concord.testcontainers.ConcordProcess) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry) Payload(ca.ibodrov.concord.testcontainers.Payload) Test(org.junit.jupiter.api.Test)

Aggregations

ProcessEntry (com.walmartlabs.concord.client.ProcessEntry)70 Test (org.junit.jupiter.api.Test)68 ProcessApi (com.walmartlabs.concord.client.ProcessApi)55 StartProcessResponse (com.walmartlabs.concord.client.StartProcessResponse)54 HashMap (java.util.HashMap)35 URI (java.net.URI)23 ConcordProcess (ca.ibodrov.concord.testcontainers.ConcordProcess)15 Payload (ca.ibodrov.concord.testcontainers.Payload)15 Path (java.nio.file.Path)4 ITUtils.randomString (com.walmartlabs.concord.it.common.ITUtils.randomString)3 Utils.resourceToString (com.walmartlabs.concord.it.runtime.v2.Utils.resourceToString)3 File (java.io.File)3 FormListEntry (com.walmartlabs.concord.client.FormListEntry)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 UUID (java.util.UUID)2 ZipArchiveOutputStream (org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream)2 ApiClient (com.walmartlabs.concord.ApiClient)1 FormSubmitResponse (com.walmartlabs.concord.client.FormSubmitResponse)1 HostEntry (com.walmartlabs.concord.client.HostEntry)1 NodeRosterHostsApi (com.walmartlabs.concord.client.NodeRosterHostsApi)1