Search in sources :

Example 21 with ProcessApi

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

the class HttpTaskIT method testGetWithIgnoreErrors.

@Test
public void testGetWithIgnoreErrors() throws Exception {
    URI dir = HttpTaskIT.class.getResource("httpGetWithIgnoreErrors").toURI();
    byte[] payload = archive(dir);
    Map<String, Object> input = new HashMap<>();
    input.put("archive", payload);
    input.put("arguments.user", "wrongUsername");
    input.put("arguments.password", "wrongPassword");
    input.put("arguments.url", mockHttpBaseUrl + rule.getPort() + mockHttpPathUnauthorized);
    StartProcessResponse spr = start(input);
    ProcessApi processApi = new ProcessApi(getApiClient());
    ProcessEntry pir = waitForCompletion(processApi, spr.getInstanceId());
    assertEquals(ProcessEntry.StatusEnum.FINISHED, pir.getStatus());
    byte[] ab = getLog(pir.getLogFileName());
    assertLog(".*statusCode: 401*", ab);
    assertLog(".*Success response: false*", ab);
}
Also used : ProcessApi(com.walmartlabs.concord.client.ProcessApi) HashMap(java.util.HashMap) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry) URI(java.net.URI) StartProcessResponse(com.walmartlabs.concord.client.StartProcessResponse) Test(org.junit.jupiter.api.Test)

Example 22 with ProcessApi

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

the class HttpTaskIT method testPatch.

@Test
public void testPatch() throws Exception {
    URI dir = HttpTaskIT.class.getResource("httpPatch").toURI();
    byte[] payload = archive(dir);
    Map<String, Object> input = new HashMap<>();
    input.put("archive", payload);
    input.put("arguments.user", mockHttpAuthUser);
    input.put("arguments.password", mockHttpAuthPassword);
    input.put("arguments.url", mockHttpBaseUrl + rule.getPort() + mockHttpPathPassword);
    StartProcessResponse spr = start(input);
    ProcessApi processApi = new ProcessApi(getApiClient());
    ProcessEntry pir = waitForCompletion(processApi, spr.getInstanceId());
    assertEquals(ProcessEntry.StatusEnum.FINISHED, pir.getStatus());
    byte[] ab = getLog(pir.getLogFileName());
    assertLog(".*Success response.*", ab);
    assertLog(".*Out Response: true*", ab);
}
Also used : ProcessApi(com.walmartlabs.concord.client.ProcessApi) HashMap(java.util.HashMap) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry) URI(java.net.URI) StartProcessResponse(com.walmartlabs.concord.client.StartProcessResponse) Test(org.junit.jupiter.api.Test)

Example 23 with ProcessApi

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

the class HttpTaskIT method testPostWithFormUrlEncoded.

@Test
public void testPostWithFormUrlEncoded() throws Exception {
    URI dir = HttpTaskIT.class.getResource("httpPostWithFormUrlEncoded").toURI();
    byte[] payload = archive(dir);
    Map<String, Object> input = new HashMap<>();
    input.put("archive", payload);
    input.put("arguments.url", mockHttpBaseUrl + rule.getPort() + mockHttpPathFormUrlEncoded);
    StartProcessResponse spr = start(input);
    ProcessApi processApi = new ProcessApi(getApiClient());
    ProcessEntry pir = waitForCompletion(processApi, spr.getInstanceId());
    assertEquals(ProcessEntry.StatusEnum.FINISHED, pir.getStatus());
    byte[] ab = getLog(pir.getLogFileName());
    assertLog(".*Success response.*", ab);
    assertLog(".*Out Response: true*", ab);
}
Also used : ProcessApi(com.walmartlabs.concord.client.ProcessApi) HashMap(java.util.HashMap) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry) URI(java.net.URI) StartProcessResponse(com.walmartlabs.concord.client.StartProcessResponse) Test(org.junit.jupiter.api.Test)

Example 24 with ProcessApi

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

the class HttpTaskIT method testGetAsDefaultMethod.

@Test
public void testGetAsDefaultMethod() throws Exception {
    URI dir = HttpTaskIT.class.getResource("httpGetAsDefaultMethod").toURI();
    byte[] payload = archive(dir);
    ProcessApi processApi = new ProcessApi(getApiClient());
    Map<String, Object> input = new HashMap<>();
    input.put("archive", payload);
    input.put("arguments.url", SERVER_URL + mockHttpPathPing);
    StartProcessResponse spr = start(input);
    ProcessEntry pir = waitForCompletion(processApi, spr.getInstanceId());
    assertEquals(ProcessEntry.StatusEnum.FINISHED, pir.getStatus());
    byte[] ab = getLog(pir.getLogFileName());
    assertLog(".*Request method: GET*", ab);
    assertLog(".*Success response.*", ab);
    assertLog(".*Out Response: true*", ab);
}
Also used : ProcessApi(com.walmartlabs.concord.client.ProcessApi) HashMap(java.util.HashMap) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry) URI(java.net.URI) StartProcessResponse(com.walmartlabs.concord.client.StartProcessResponse) Test(org.junit.jupiter.api.Test)

Example 25 with ProcessApi

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

the class PublicFlowsIT method testProfiles.

/**
 * Verifies that {@code publicFlow} values are merged across profiles
 * and a {@code publicFlow} from a profile can be used an the {@code entryPoint}
 */
@Test
public void testProfiles() throws Exception {
    byte[] payload = archive(ProcessIT.class.getResource("publicFlowsInProfiles").toURI());
    Map<String, Object> input = new HashMap<>();
    input.put("archive", payload);
    StartProcessResponse spr = start(input);
    ProcessApi processApi = new ProcessApi(getApiClient());
    ProcessEntry pe = waitForCompletion(processApi, spr.getInstanceId());
    byte[] ab = getLog(pe.getLogFileName());
    assertLog(".*Hello A.*", ab);
    assertLog(".*Hello B.*", ab);
    assertLog(".*Hello C.*", ab);
    // ---
    input = new HashMap<>();
    input.put("archive", payload);
    input.put("activeProfiles", "profileA");
    input.put("entryPoint", "flowA");
    spr = start(input);
    pe = waitForCompletion(processApi, spr.getInstanceId());
    ab = getLog(pe.getLogFileName());
    assertLog(".*Hello A.*", ab);
    assertNoLog(".*Hello B.*", ab);
    assertNoLog(".*Hello C.*", ab);
    // ---
    input = new HashMap<>();
    input.put("archive", payload);
    input.put("entryPoint", "flowC");
    spr = start(input);
    pe = waitForCompletion(processApi, spr.getInstanceId());
    assertEquals(ProcessEntry.StatusEnum.FAILED, pe.getStatus());
    ab = getLog(pe.getLogFileName());
    assertLogAtLeast(".*not a public flow.*", 1, ab);
}
Also used : ProcessApi(com.walmartlabs.concord.client.ProcessApi) HashMap(java.util.HashMap) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry) StartProcessResponse(com.walmartlabs.concord.client.StartProcessResponse) Test(org.junit.jupiter.api.Test)

Aggregations

ProcessApi (com.walmartlabs.concord.client.ProcessApi)58 ProcessEntry (com.walmartlabs.concord.client.ProcessEntry)55 StartProcessResponse (com.walmartlabs.concord.client.StartProcessResponse)54 Test (org.junit.jupiter.api.Test)54 HashMap (java.util.HashMap)34 URI (java.net.URI)23 File (java.io.File)4 Path (java.nio.file.Path)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 UUID (java.util.UUID)2 ZipArchiveOutputStream (org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream)2 ConcordProcess (ca.ibodrov.concord.testcontainers.ConcordProcess)1 Payload (ca.ibodrov.concord.testcontainers.Payload)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ApiClient (com.walmartlabs.concord.ApiClient)1 ApiException (com.walmartlabs.concord.ApiException)1 FormListEntry (com.walmartlabs.concord.client.FormListEntry)1 FormSubmitResponse (com.walmartlabs.concord.client.FormSubmitResponse)1 ITUtils.randomString (com.walmartlabs.concord.it.common.ITUtils.randomString)1 PosixFilePermission (java.nio.file.attribute.PosixFilePermission)1