use of com.walmartlabs.concord.client.StartProcessResponse in project concord by walmartlabs.
the class FormsIT method testDateTimeField.
@Test
public void testDateTimeField() throws Exception {
ApiClient apiClient = serverRule.getClient();
// ---
byte[] payload = archive(FormsIT.class.getResource("dateTimeField").toURI());
Map<String, Object> input = new HashMap<>();
input.put("archive", payload);
ProcessApi processApi = new ProcessApi(apiClient);
StartProcessResponse spr = serverRule.start(input);
assertNotNull(spr.getInstanceId());
ProcessEntry pir = waitForStatus(processApi, spr.getInstanceId(), ProcessEntry.StatusEnum.SUSPENDED);
// ---
consoleRule.login(Concord.ADMIN_API_KEY);
String url = "/#/process/" + pir.getInstanceId();
consoleRule.navigateToRelative(url);
WebElement wizardButton = consoleRule.waitFor(By.id("formWizardButton"));
wizardButton.click();
WebElement dateField = consoleRule.waitFor(By.name("dateField"));
dateField.sendKeys("2019-09-04");
WebElement dateTimeField = consoleRule.waitFor(By.name("dateTimeField"));
dateTimeField.sendKeys("2019-09-04T01:05:00.000-04:00");
// close the popup
consoleRule.waitFor(By.id("root")).click();
Thread.sleep(1000);
WebElement submitButton = consoleRule.waitFor(By.id("formSubmitButton"));
submitButton.click();
// ---
pir = waitForCompletion(processApi, pir.getInstanceId());
byte[] ab = serverRule.getLog(pir.getLogFileName());
assertLog(".*dateField=2019-09-04.*", ab);
assertLog(".*dateTimeField=2019-09-04T05:05:00.000Z.*", ab);
}
use of com.walmartlabs.concord.client.StartProcessResponse in project concord by walmartlabs.
the class DependenciesIT method testUploadAndRun.
@Test
public void testUploadAndRun() throws Exception {
String dep = "file:///" + ITConstants.DEPENDENCIES_DIR + "/example.jar";
String request = "{ \"entryPoint\": \"main\", \"dependencies\": [ \"" + dep + "\" ] }";
Path tmpDir = createTempDir();
Path requestFile = tmpDir.resolve(Constants.Files.CONFIGURATION_FILE_NAME);
Files.write(requestFile, Collections.singletonList(request));
Path src = Paths.get(DependenciesIT.class.getResource("deps").toURI());
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (ZipArchiveOutputStream zip = new ZipArchiveOutputStream(baos)) {
IOUtils.zip(zip, src);
IOUtils.zip(zip, tmpDir);
}
byte[] payload = baos.toByteArray();
// ---
ProcessApi processApi = new ProcessApi(getApiClient());
StartProcessResponse spr = start(payload);
assertNotNull(spr.getInstanceId());
ProcessEntry psr = waitForCompletion(processApi, spr.getInstanceId());
assertEquals(ProcessEntry.StatusEnum.FINISHED, psr.getStatus());
// ---
byte[] ab = getLog(psr.getLogFileName());
assertLog(".*Hello!.*", ab);
}
use of com.walmartlabs.concord.client.StartProcessResponse in project concord by walmartlabs.
the class DependencyManagerIT method test.
@Test
public void test() throws Exception {
byte[] payload = archive(DependencyManagerIT.class.getResource("dependencyManager").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:dependency-manager-test:" + ITConstants.PROJECT_VERSION });
String url = "http://" + env("IT_DOCKER_HOST_ADDR", "localhost") + ":" + rule.getPort() + "/item.txt";
cfg.put("arguments", Collections.singletonMap("url", url));
input.put("request", cfg);
StartProcessResponse spr = start(input);
// ---
ProcessApi processApi = new ProcessApi(getApiClient());
ProcessEntry pir = waitForStatus(processApi, spr.getInstanceId(), ProcessEntry.StatusEnum.SUSPENDED);
byte[] ab = getLog(pir.getLogFileName());
assertLog(".*downloading.*", ab);
assertLog(".*using a cached copy.*", ab);
assertLog(".*Got: Hello!.*", ab);
}
use of com.walmartlabs.concord.client.StartProcessResponse in project concord by walmartlabs.
the class DockerAnsibleIT method test.
@Test
public void test() throws Exception {
byte[] payload = archive(DockerIT.class.getResource("dockerAnsible").toURI(), ITConstants.DEPENDENCIES_DIR);
Map<String, Object> input = new HashMap<>();
input.put("archive", payload);
input.put("arguments.image", ITConstants.DOCKER_ANSIBLE_IMAGE);
StartProcessResponse spr = start(input);
// --
ProcessApi processApi = new ProcessApi(getApiClient());
ProcessEntry pir = waitForCompletion(processApi, spr.getInstanceId());
assertNotNull(pir.getLogFileName());
assertEquals(ProcessEntry.StatusEnum.FINISHED, pir.getStatus());
byte[] ab = getLog(pir.getLogFileName());
assertLog(".*\"msg\": \"Hello from Docker!\".*", ab);
// --
File resp = processApi.downloadAttachment(pir.getInstanceId(), "ansible_stats.json");
assertNotNull(resp);
}
use of com.walmartlabs.concord.client.StartProcessResponse in project concord by walmartlabs.
the class DockerIT method testTaskSyntaxOut.
@Test
public void testTaskSyntaxOut() throws Exception {
byte[] payload = archive(DockerIT.class.getResource("dockerTaskSyntaxOut").toURI());
Map<String, Object> input = new HashMap<>();
input.put("archive", payload);
input.put("arguments.image", ITConstants.DOCKER_ANSIBLE_IMAGE);
StartProcessResponse spr = start(input);
ProcessApi processApi = new ProcessApi(getApiClient());
ProcessEntry pir = waitForCompletion(processApi, spr.getInstanceId());
assertNotNull(pir.getLogFileName());
byte[] ab = getLog(pir.getLogFileName());
assertLog(".*!! Hello, world.*", ab);
assertLog(".*DOCKER: STDERR STILL WORKS.*", ab);
}
Aggregations