Search in sources :

Example 16 with ProcessApi

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

the class HttpTaskIT method testPostWithDebug.

@Test
public void testPostWithDebug() throws Exception {
    URI dir = HttpTaskIT.class.getResource("httpPostWithDebug").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(".*requestInfo.*", ab);
    assertLog(".*responseInfo.*", 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 17 with ProcessApi

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

the class HttpTaskIT method testGetWithHeaders.

@Test
public void testGetWithHeaders() throws Exception {
    URI dir = HttpTaskIT.class.getResource("httpGetWithHeaders").toURI();
    byte[] payload = archive(dir);
    Map<String, Object> input = new HashMap<>();
    input.put("archive", payload);
    input.put("arguments.url", mockHttpBaseUrl + rule.getPort() + mockHttpPathHeaders);
    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);
    assertLog(".*Response content: request headers:.*h1=v1.*", ab);
    assertLog(".*Response content: request headers:.*h2=v2.*", 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 18 with ProcessApi

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

the class HttpTaskIT method testPostWithAuthUsingToken.

@Test
public void testPostWithAuthUsingToken() throws Exception {
    URI dir = HttpTaskIT.class.getResource("httpPostWithAuthUsingToken").toURI();
    byte[] payload = archive(dir);
    Map<String, Object> input = new HashMap<>();
    input.put("archive", payload);
    input.put("arguments.authToken", mockHttpAuthToken);
    input.put("arguments.url", mockHttpBaseUrl + rule.getPort() + mockHttpPathToken);
    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 19 with ProcessApi

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

the class HttpTaskIT method testGetWithAuthUsingToken.

@Test
public void testGetWithAuthUsingToken() throws Exception {
    URI dir = HttpTaskIT.class.getResource("httpGetWithAuthUsingToken").toURI();
    byte[] payload = archive(dir);
    Map<String, Object> input = new HashMap<>();
    input.put("archive", payload);
    input.put("arguments.authToken", mockHttpAuthToken);
    input.put("arguments.url", mockHttpBaseUrl + rule.getPort() + mockHttpPathToken);
    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 20 with ProcessApi

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

the class HttpTaskIT method testGetWithQueryParams.

@Test
public void testGetWithQueryParams() throws Exception {
    URI dir = HttpTaskIT.class.getResource("httpGetWithQueryParams").toURI();
    byte[] payload = archive(dir);
    ProcessApi processApi = new ProcessApi(getApiClient());
    Map<String, Object> input = new HashMap<>();
    input.put("archive", payload);
    input.put("arguments.url", mockHttpBaseUrl + rule.getPort() + mockHttpPathQueryParams);
    StartProcessResponse spr = start(input);
    ProcessEntry pir = waitForCompletion(processApi, spr.getInstanceId());
    assertEquals(ProcessEntry.StatusEnum.FINISHED, pir.getStatus());
    byte[] ab = getLog(pir.getLogFileName());
    assertLog(".*Success response.*", ab);
    assertLog(".*message: hello concord!*", ab);
    assertLog(".*multi-value-1: value1*", ab);
    assertLog(".*multi-value-2: value2*", 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)

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