Search in sources :

Example 31 with ProcessEntry

use of com.walmartlabs.concord.client.ProcessEntry 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 32 with ProcessEntry

use of com.walmartlabs.concord.client.ProcessEntry 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 33 with ProcessEntry

use of com.walmartlabs.concord.client.ProcessEntry 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)

Example 34 with ProcessEntry

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

the class SecretsTaskIT method test.

@Test
public void test() throws Exception {
    String secretName = "secret_" + randomString();
    byte[] payload = archive(SecretsTaskIT.class.getResource("secretsTask").toURI());
    Map<String, Object> input = new HashMap<>();
    input.put("archive", payload);
    input.put("arguments.secretName", secretName);
    StartProcessResponse spr = start(input);
    ProcessApi processApi = new ProcessApi(getApiClient());
    ProcessEntry pir = waitForCompletion(processApi, spr.getInstanceId());
    assertNotNull(pir.getLogFileName());
    byte[] bytes = getLog(pir.getLogFileName());
    // System.out.println(new String(bytes));
    assertLog(".* Delete secret2.*", bytes);
}
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)

Example 35 with ProcessEntry

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

the class VariablesInjectionIT method test.

@Test
public void test() throws Exception {
    byte[] payload = archive(VariablesInjectionIT.class.getResource("inject").toURI(), ITConstants.DEPENDENCIES_DIR);
    ProcessApi processApi = new ProcessApi(getApiClient());
    StartProcessResponse spr = start(payload);
    assertNotNull(spr.getInstanceId());
    ProcessEntry pir = waitForCompletion(processApi, spr.getInstanceId());
    byte[] ab = getLog(pir.getLogFileName());
    assertLog(".*Hello, Concord!.*", ab);
    assertLog(".*Hello, world!!!.*", ab);
    assertLog(".*Hello, world. \\(from method param\\).*", ab);
    assertLog(".*Hello, world. \\(from injected var\\).*", ab);
}
Also used : ProcessApi(com.walmartlabs.concord.client.ProcessApi) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry) StartProcessResponse(com.walmartlabs.concord.client.StartProcessResponse) 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