Search in sources :

Example 1 with ProcessDefinition

use of io.takari.bpm.model.ProcessDefinition in project concord by walmartlabs.

the class YamlParserTest method test025.

@Test
public void test025() throws Exception {
    deploy("025.yml");
    ProcessDefinition pd = getDefinition("main");
    // /-------------------------------->\
    // start -> subprocess + boundary-event -> task -> end
    assertEquals(9, pd.getChildren().size());
    // subprocess
    // /----------> end
    // start -> task -> gw -> task -> end
    assertEquals(11, findSubprocess(pd).getChildren().size());
    TestBean testBean = spy(new TestBean());
    register("testBean", testBean);
    // ---
    String key = UUID.randomUUID().toString();
    Map<String, Object> args = Collections.singletonMap("aInt", 1);
    start(key, "main", args);
    // ---
    verify(testBean, times(1)).toString(eq("a"));
    verifyNoMoreInteractions(testBean);
}
Also used : ProcessDefinition(io.takari.bpm.model.ProcessDefinition) Mockito.anyString(org.mockito.Mockito.anyString) Test(org.junit.jupiter.api.Test)

Example 2 with ProcessDefinition

use of io.takari.bpm.model.ProcessDefinition in project concord by walmartlabs.

the class YamlParserTest method test010.

@Test
public void test010() throws Exception {
    deploy("010.yml");
    ProcessDefinition pd = getDefinition("main");
    // /----------------------------->\
    // start -> task -> task + boundary-event -> task -> task -> end
    assertEquals(13, pd.getChildren().size());
    TestBean testBean = spy(new TestBean());
    register("testBean", testBean);
    // ---
    String key = UUID.randomUUID().toString();
    start(key, "main", null);
    // ---
    verify(testBean, times(1)).throwBpmnError(anyString());
    verify(testBean, times(1)).toString(eq("a"));
    verify(testBean, times(1)).toString(eq("b"));
    verify(testBean, times(1)).toString(eq("c"));
    verifyNoMoreInteractions(testBean);
}
Also used : ProcessDefinition(io.takari.bpm.model.ProcessDefinition) Mockito.anyString(org.mockito.Mockito.anyString) Test(org.junit.jupiter.api.Test)

Example 3 with ProcessDefinition

use of io.takari.bpm.model.ProcessDefinition in project concord by walmartlabs.

the class YamlParserTest method test014.

@Test
public void test014() throws Exception {
    deploy("014.yml");
    ProcessDefinition pd = getDefinition("main");
    // /------------------->\
    // start -> gw -> callactivity -> end
    assertEquals(8, pd.getChildren().size());
    int loops = 100;
    TestBean testBean = spy(new TestBean());
    register("testBean", testBean);
    // ---
    String key = UUID.randomUUID().toString();
    Map<String, Object> args = new HashMap<>();
    args.put("cnt", 0);
    args.put("loops", loops);
    start(key, "main", args);
    // ---
    verify(testBean, times(loops)).inc(anyInt());
    verifyNoMoreInteractions(testBean);
}
Also used : ProcessDefinition(io.takari.bpm.model.ProcessDefinition) Mockito.anyString(org.mockito.Mockito.anyString) Test(org.junit.jupiter.api.Test)

Example 4 with ProcessDefinition

use of io.takari.bpm.model.ProcessDefinition in project concord by walmartlabs.

the class YamlParserTest method test007.

@Test
public void test007() throws Exception {
    deploy("007.yml");
    ProcessDefinition pd = getDefinition("main");
    // /-> task -\   /-> task -\
    // start -> gw -> task -> gw -> task -> end
    assertEquals(17, pd.getChildren().size());
    TestBean testBean = spy(new TestBean());
    register("testBean", testBean);
    // ---
    String key = UUID.randomUUID().toString();
    Map<String, Object> args = Collections.singletonMap("aInt", 100);
    start(key, "main", args);
    // ---
    verify(testBean, times(1)).toString(eq("a"));
    verify(testBean, times(1)).toString(eq("d"));
    verifyNoMoreInteractions(testBean);
}
Also used : ProcessDefinition(io.takari.bpm.model.ProcessDefinition) Mockito.anyString(org.mockito.Mockito.anyString) Test(org.junit.jupiter.api.Test)

Example 5 with ProcessDefinition

use of io.takari.bpm.model.ProcessDefinition in project concord by walmartlabs.

the class YamlParserTest method test025_2.

@Test
public void test025_2() throws Exception {
    deploy("025.yml");
    ProcessDefinition pd = getDefinition("main");
    // /-------------------------------->\
    // start -> subprocess + boundary-event -> task -> end
    assertEquals(9, pd.getChildren().size());
    // subprocess
    // /----------> end
    // start -> task -> gw -> task -> end
    assertEquals(11, findSubprocess(pd).getChildren().size());
    TestBean testBean = spy(new TestBean());
    register("testBean", testBean);
    // ---
    String key = UUID.randomUUID().toString();
    Map<String, Object> args = Collections.singletonMap("aInt", -1);
    start(key, "main", args);
    // ---
    verify(testBean, times(1)).toString(eq("a"));
    verify(testBean, times(1)).toString(eq("else"));
    verifyNoMoreInteractions(testBean);
}
Also used : ProcessDefinition(io.takari.bpm.model.ProcessDefinition) Mockito.anyString(org.mockito.Mockito.anyString) Test(org.junit.jupiter.api.Test)

Aggregations

ProcessDefinition (io.takari.bpm.model.ProcessDefinition)42 Test (org.junit.jupiter.api.Test)40 Mockito.anyString (org.mockito.Mockito.anyString)40 ExecutionContext (io.takari.bpm.api.ExecutionContext)4 ExecutionException (io.takari.bpm.api.ExecutionException)3 ProcessEventRequest (com.walmartlabs.concord.client.ProcessEventRequest)1 ProcessEventsApi (com.walmartlabs.concord.client.ProcessEventsApi)1 Imports (com.walmartlabs.concord.imports.Imports)1 Profile (com.walmartlabs.concord.project.model.Profile)1 ProjectDefinition (com.walmartlabs.concord.project.model.ProjectDefinition)1 Resources (com.walmartlabs.concord.project.model.Resources)1 Trigger (com.walmartlabs.concord.project.model.Trigger)1 YamlImportConverter.convertImports (com.walmartlabs.concord.project.yaml.YamlImportConverter.convertImports)1 YamlTaskStepConverter (com.walmartlabs.concord.project.yaml.converter.YamlTaskStepConverter)1 YamlProfile (com.walmartlabs.concord.project.yaml.model.YamlProfile)1 BpmnError (io.takari.bpm.api.BpmnError)1 JavaDelegate (io.takari.bpm.api.JavaDelegate)1 AbstractElement (io.takari.bpm.model.AbstractElement)1 SourceAwareProcessDefinition (io.takari.bpm.model.SourceAwareProcessDefinition)1 SourceMap (io.takari.bpm.model.SourceMap)1