Search in sources :

Example 11 with ProcessApi

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

the class ClasspathIsolationIT method testBrokenDeps.

@Test
public void testBrokenDeps() throws Exception {
    byte[] payload = archive(ClasspathIsolationIT.class.getResource("brokenDeps").toURI());
    Map<String, Object> input = new HashMap<>();
    input.put("archive", payload);
    Map<String, Object> cfg = new HashMap<>();
    cfg.put("dependencies", new String[] { "mvn://com.walmartlabs.concord.it.tasks:broken-deps:" + ITConstants.PROJECT_VERSION });
    input.put("request", cfg);
    StartProcessResponse spr = start(input);
    ProcessApi processApi = new ProcessApi(getApiClient());
    ProcessEntry pir = waitForCompletion(processApi, spr.getInstanceId());
    byte[] ab = getLog(pir.getLogFileName());
    assertLog(".*hello!.*", 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 12 with ProcessApi

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

the class ConfigurableResourcesIT method testProfiles.

@Test
public void testProfiles() throws Exception {
    // prepare the payload
    byte[] payload = archive(ProcessIT.class.getResource("configurableProfilesDirectory").toURI());
    // start the process
    ProcessApi processApi = new ProcessApi(getApiClient());
    StartProcessResponse spr = start(payload);
    assertNotNull(spr.getInstanceId());
    // wait for completion
    ProcessEntry pir = waitForCompletion(processApi, spr.getInstanceId());
    // get the name of the agent's log file
    assertNotNull(pir.getLogFileName());
    // check the logs
    byte[] ab = getLog(pir.getLogFileName());
    assertLog(".*Hello, world.*", 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)

Example 13 with ProcessApi

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

the class ProcessStateIT method testSingleFile.

@Test
public void testSingleFile() throws Exception {
    byte[] payload = archive(ProcessIT.class.getResource("stateSingleFile").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());
    assertEquals(ProcessEntry.StatusEnum.FINISHED, pe.getStatus());
    // ---
    File resp = processApi.downloadStateFile(spr.getInstanceId(), "concord.yml");
    assertNotNull(resp);
}
Also used : ProcessApi(com.walmartlabs.concord.client.ProcessApi) HashMap(java.util.HashMap) ProcessEntry(com.walmartlabs.concord.client.ProcessEntry) File(java.io.File) StartProcessResponse(com.walmartlabs.concord.client.StartProcessResponse) Test(org.junit.jupiter.api.Test)

Example 14 with ProcessApi

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

the class ProjectTaskIT method testCreate.

@Test
public void testCreate() throws Exception {
    String orgName = "Default";
    // ---
    String projectName = "project_" + System.currentTimeMillis();
    String repoName = "repo_" + System.currentTimeMillis();
    String repoUrl = "git://127.0.0.1/test.git";
    String repoSecret = "secret_" + System.currentTimeMillis();
    addUsernamePassword(orgName, repoSecret, false, null, "user_" + System.currentTimeMillis(), "pwd_" + System.currentTimeMillis());
    // ---
    byte[] payload = archive(ProcessIT.class.getResource("projectTask").toURI());
    Map<String, Object> input = new HashMap<>();
    input.put("archive", payload);
    Map<String, Object> args = new HashMap<>();
    args.put("projectName", projectName);
    args.put("repoName", repoName);
    args.put("repoUrl", repoUrl);
    args.put("repoSecret", repoSecret);
    input.put("request", Collections.singletonMap("arguments", args));
    // ---
    StartProcessResponse spr = start(input);
    ProcessApi processApi = new ProcessApi(getApiClient());
    ProcessEntry pir = waitForCompletion(processApi, spr.getInstanceId());
    // ---
    byte[] ab = getLog(pir.getLogFileName());
    assertLog(".*CREATED.*", ab);
    assertLog(".*Done!.*", 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 15 with ProcessApi

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

the class MultipleProjectFilesIT method test.

@Test
public void test() throws Exception {
    Path template = zip(Paths.get(MultipleProjectFilesIT.class.getResource("multiProjectTemplate/template").toURI()));
    String templateUrl = "file://" + template.toAbsolutePath();
    // ---
    byte[] payload = archive(ProcessIT.class.getResource("multiProjectTemplate/user").toURI());
    // ---
    ProcessApi processApi = new ProcessApi(getApiClient());
    Map<String, Object> input = new HashMap<>();
    input.put("archive", payload);
    input.put("template", templateUrl);
    StartProcessResponse spr = start(input);
    // ---
    ProcessEntry pir = waitForCompletion(processApi, spr.getInstanceId());
    byte[] ab = getLog(pir.getLogFileName());
    assertLog(".*Hello, Concord!.*", ab);
}
Also used : Path(java.nio.file.Path) 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