use of com.walmartlabs.concord.client.ProcessEntry in project concord by walmartlabs.
the class ProcessIT method testTags.
@Test
public void testTags() throws Exception {
byte[] archive = archive(ProcessIT.class.getResource("example").toURI());
ConcordProcess parent = concord.processes().start(new Payload().archive(archive));
// ---
parent.expectStatus(StatusEnum.FINISHED);
// ---
archive = archive(ProcessIT.class.getResource("tags").toURI());
Payload payload = new Payload().archive(archive).parent(parent.instanceId());
ConcordProcess child = concord.processes().start(payload);
// ---
child.expectStatus(StatusEnum.FINISHED);
// ---
List<ProcessEntry> l = parent.subprocesses("abc");
assertTrue(l.isEmpty());
l = parent.subprocesses("test");
assertEquals(1, l.size());
ProcessEntry e = l.get(0);
assertEquals(child.instanceId(), e.getInstanceId());
// ---
l = concord.processes().list(ProcessListQuery.builder().addTags("xyz").build());
assertTrue(l.isEmpty());
l = concord.processes().list(ProcessListQuery.builder().addTags("IT").build());
assertEquals(1, l.size());
e = l.get(0);
assertEquals(child.instanceId(), e.getInstanceId());
}
use of com.walmartlabs.concord.client.ProcessEntry in project concord by walmartlabs.
the class FormIT method testFormValues.
@Test
public void testFormValues() throws Exception {
Payload payload = new Payload().archive(resource("customFormValues"));
// ---
ConcordProcess proc = concord.processes().start(payload);
ProcessEntry pe = expectStatus(proc, ProcessEntry.StatusEnum.SUSPENDED);
// ---
List<FormListEntry> forms = proc.forms();
assertEquals(1, forms.size());
// ---
String formName = forms.get(0).getName();
assertEquals("myForm", formName);
// start session
startCustomFormSession(concord, pe.getInstanceId(), formName);
// get data.js
Map<String, Object> dataJs = getDataJs(concord, pe.getInstanceId(), formName);
Map<String, Object> values = MapUtils.get(dataJs, "values", Collections.emptyMap());
assertEquals(4, values.size());
assertEquals("Moo", values.get("firstName"));
assertEquals("Xaa", values.get("lastName"));
assertEquals(3, values.get("sum"));
assertEquals(ImmutableMap.of("city", "Toronto", "province", "Ontario"), values.get("address"));
}
use of com.walmartlabs.concord.client.ProcessEntry in project concord by walmartlabs.
the class ProcessIT method testForkCheckpoints.
@Test
public void testForkCheckpoints() throws Exception {
String forkTag = "fork_" + randomString();
Payload payload = new Payload().arg("forkTag", forkTag).archive(resource("forkCheckpoints"));
ConcordProcess parent = concord.processes().start(payload);
expectStatus(parent, ProcessEntry.StatusEnum.FINISHED);
parent.assertLog(".*#1.*");
parent.assertLog(".*#2.*");
// ---
List<ProcessEntry> children = concord.processes().list(ProcessListQuery.builder().parentInstanceId(parent.instanceId()).limit(10).build());
assertEquals(1, children.size());
ProcessEntry fork = children.get(0);
assertEquals(fork.getTags().get(0), forkTag);
// ---
List<ProcessCheckpointEntry> checkpoints = parent.checkpoints();
assertEquals(1, checkpoints.size());
parent.restoreCheckpoint(checkpoints.get(0).getId());
expectStatus(parent, ProcessEntry.StatusEnum.FINISHED);
// ---
children = concord.processes().list(ProcessListQuery.builder().parentInstanceId(parent.instanceId()).limit(10).build());
assertEquals(2, children.size());
for (ProcessEntry child : children) {
ConcordProcess proc = concord.processes().get(child.getInstanceId());
proc.assertNoLog(".*#1.*");
proc.assertNoLog(".*#2.*");
proc.assertLog(".*#3.*");
}
}
use of com.walmartlabs.concord.client.ProcessEntry in project concord by walmartlabs.
the class ProcessIT method testMetaUpdate.
/**
* Test the process metadata.
*/
@Test
public void testMetaUpdate() throws Exception {
Payload payload = new Payload().archive(resource("meta")).arg("name", "Concord");
ConcordProcess proc = concord.processes().start(payload);
ProcessEntry pe = expectStatus(proc, ProcessEntry.StatusEnum.SUSPENDED);
// ---
proc.assertLog(".*Runtime: concord-v2.*");
proc.assertLog(".*Hello, Concord!.*");
assertNotNull(pe.getMeta());
// 2 + plus system meta + entryPoint
assertEquals(4, pe.getMeta().size());
assertEquals("init-value", pe.getMeta().get("test"));
assertEquals("xxx", pe.getMeta().get("myForm.action"));
assertEquals("default", pe.getMeta().get("entryPoint"));
// ---
List<FormListEntry> forms = proc.forms();
assertEquals(1, forms.size());
Map<String, Object> data = new HashMap<>();
data.put("action", "Reject");
FormSubmitResponse fsr = proc.submitForm(forms.get(0).getName(), data);
assertTrue(fsr.isOk());
pe = expectStatus(proc, ProcessEntry.StatusEnum.FINISHED);
// ---
proc.assertLog(".*Action: Reject.*");
assertNotNull(pe.getMeta());
// 2 + plus system meta + entryPoint
assertEquals(4, pe.getMeta().size());
assertEquals("init-value", pe.getMeta().get("test"));
assertEquals("Reject", pe.getMeta().get("myForm.action"));
assertEquals("default", pe.getMeta().get("entryPoint"));
}
use of com.walmartlabs.concord.client.ProcessEntry 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);
}
Aggregations