Search in sources :

Example 6 with JITDMNPayload

use of org.kie.kogito.jitexecutor.dmn.requests.JITDMNPayload in project kogito-apps by kiegroup.

the class MultipleModelsTest method testjitEndpoint.

@Test
public void testjitEndpoint() {
    JITDMNPayload jitdmnpayload = new JITDMNPayload(URI1, List.of(model1, model2), buildContext());
    given().contentType(ContentType.JSON).body(jitdmnpayload).when().post("/jitdmn").then().statusCode(200).body("'my decision'", is("Ciao, John Doe (age:47)."));
}
Also used : JITDMNPayload(org.kie.kogito.jitexecutor.dmn.requests.JITDMNPayload) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 7 with JITDMNPayload

use of org.kie.kogito.jitexecutor.dmn.requests.JITDMNPayload in project kogito-apps by kiegroup.

the class MultipleModelsTest method testjitEndpointCH11.

@Test
public void testjitEndpointCH11() {
    JITDMNPayload jitdmnpayload = new JITDMNPayload(CH11URI1, List.of(ch11model1, ch11model2), buildCH11Context());
    given().contentType(ContentType.JSON).body(jitdmnpayload).when().post("/jitdmn").then().statusCode(200).body("Strategy", is("THROUGH"));
}
Also used : JITDMNPayload(org.kie.kogito.jitexecutor.dmn.requests.JITDMNPayload) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 8 with JITDMNPayload

use of org.kie.kogito.jitexecutor.dmn.requests.JITDMNPayload in project kogito-apps by kiegroup.

the class MultipleModelsTest method testjitdmnResultEndpointCH11_withErrors.

@Test
public void testjitdmnResultEndpointCH11_withErrors() throws Exception {
    // will omit `Applicant data` intentionally.
    Map<String, Object> context = new HashMap<>();
    context.put("Bureau data", Map.of("Bankrupt", false, "CreditScore", 600));
    context.put("Requested product", Map.of("ProductType", "STANDARD LOAN", "Rate", 0.08d, "Term", 36, "Amount", 100_00));
    JITDMNPayload jitdmnpayload = new JITDMNPayload(CH11URI1, List.of(ch11model1, ch11model2), context);
    String response = given().contentType(ContentType.JSON).body(jitdmnpayload).when().post("/jitdmn/dmnresult").then().statusCode(200).body("dmnContext.'Required monthly installment'", notNullValue()).extract().asString();
    JITDMNResult result = MAPPER.readValue(response, JITDMNResult.class);
    assertThat(result.getMessages()).isNotEmpty().allMatch(m -> m.getPath().equals(CH11URI1));
}
Also used : JITDMNPayload(org.kie.kogito.jitexecutor.dmn.requests.JITDMNPayload) HashMap(java.util.HashMap) JITDMNResult(org.kie.kogito.jitexecutor.dmn.responses.JITDMNResult) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 9 with JITDMNPayload

use of org.kie.kogito.jitexecutor.dmn.requests.JITDMNPayload in project kogito-apps by kiegroup.

the class MultipleModelsTest method testjitdmnResultEndpoint.

@Test
public void testjitdmnResultEndpoint() {
    JITDMNPayload jitdmnpayload = new JITDMNPayload(URI1, List.of(model1, model2), buildContext());
    given().contentType(ContentType.JSON).body(jitdmnpayload).when().post("/jitdmn/dmnresult").then().statusCode(200).body("dmnContext.'my decision'", is("Ciao, John Doe (age:47)."));
}
Also used : JITDMNPayload(org.kie.kogito.jitexecutor.dmn.requests.JITDMNPayload) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 10 with JITDMNPayload

use of org.kie.kogito.jitexecutor.dmn.requests.JITDMNPayload in project kogito-apps by kiegroup.

the class MultipleModelsTest method testjitdmnResultEndpointCH11.

@Test
public void testjitdmnResultEndpointCH11() {
    JITDMNPayload jitdmnpayload = new JITDMNPayload(CH11URI1, List.of(ch11model1, ch11model2), buildCH11Context());
    given().contentType(ContentType.JSON).body(jitdmnpayload).when().post("/jitdmn/dmnresult").then().statusCode(200).body("dmnContext.Strategy", is("THROUGH"));
}
Also used : JITDMNPayload(org.kie.kogito.jitexecutor.dmn.requests.JITDMNPayload) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Aggregations

QuarkusTest (io.quarkus.test.junit.QuarkusTest)10 Test (org.junit.jupiter.api.Test)10 JITDMNPayload (org.kie.kogito.jitexecutor.dmn.requests.JITDMNPayload)10 HashMap (java.util.HashMap)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 JITDMNResult (org.kie.kogito.jitexecutor.dmn.responses.JITDMNResult)1