Search in sources :

Example 16 with DataEvent

use of io.automatiko.engine.api.event.DataEvent in project automatiko-engine by automatiko-io.

the class VerificationTest method testProcessAsyncCallFailure.

@Test
public void testProcessAsyncCallFailure() {
    String addPayload = "{\"name\" : null}";
    given().contentType(ContentType.JSON).accept(ContentType.JSON).body(addPayload).when().post("/async").then().statusCode(200).body("id", notNullValue(), "name", nullValue());
    List<DataEvent<?>> received = publisher.events();
    assertEquals(2, received.size());
    ProcessInstanceDataEvent piEvent = (ProcessInstanceDataEvent) received.stream().filter(pi -> ((ProcessInstanceDataEvent) pi).getData().getState().equals(ProcessInstance.STATE_COMPLETED)).findFirst().get();
    assertEquals(null, piEvent.getData().getVariables().get("name"));
    given().accept(ContentType.JSON).when().get("/async").then().statusCode(200).body("$.size()", is(0));
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) BeforeEach(org.junit.jupiter.api.BeforeEach) CoreMatchers.equalTo(org.hamcrest.CoreMatchers.equalTo) ContentType(io.restassured.http.ContentType) DataEvent(io.automatiko.engine.api.event.DataEvent) ProcessInstance(io.automatiko.engine.api.workflow.ProcessInstance) CoreMatchers.notNullValue(org.hamcrest.CoreMatchers.notNullValue) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Inject(javax.inject.Inject) Test(org.junit.jupiter.api.Test) List(java.util.List) ProcessInstanceDataEvent(io.automatiko.engine.services.event.ProcessInstanceDataEvent) RestAssured.given(io.restassured.RestAssured.given) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) CoreMatchers.nullValue(org.hamcrest.CoreMatchers.nullValue) DataEvent(io.automatiko.engine.api.event.DataEvent) ProcessInstanceDataEvent(io.automatiko.engine.services.event.ProcessInstanceDataEvent) ProcessInstanceDataEvent(io.automatiko.engine.services.event.ProcessInstanceDataEvent) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Aggregations

DataEvent (io.automatiko.engine.api.event.DataEvent)16 ProcessInstanceDataEvent (io.automatiko.engine.services.event.ProcessInstanceDataEvent)16 Test (org.junit.jupiter.api.Test)13 UserTaskInstanceDataEvent (io.automatiko.engine.services.event.UserTaskInstanceDataEvent)9 List (java.util.List)9 Application (io.automatiko.engine.api.Application)8 Model (io.automatiko.engine.api.Model)8 UnitOfWork (io.automatiko.engine.api.uow.UnitOfWork)8 AbstractCodegenTest (io.automatiko.engine.codegen.AbstractCodegenTest)8 HashMap (java.util.HashMap)8 ProcessInstance (io.automatiko.engine.api.workflow.ProcessInstance)7 ProcessInstanceEventBody (io.automatiko.engine.services.event.impl.ProcessInstanceEventBody)7 QuarkusTest (io.quarkus.test.junit.QuarkusTest)5 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)5 WorkItem (io.automatiko.engine.api.workflow.WorkItem)4 StaticIdentityProvider (io.automatiko.engine.services.identity.StaticIdentityProvider)4 RestAssured.given (io.restassured.RestAssured.given)4 ContentType (io.restassured.http.ContentType)4 ArrayList (java.util.ArrayList)4 Collection (java.util.Collection)4