Search in sources :

Example 1 with DecisionModelMetadata

use of org.kie.kogito.decision.DecisionModelMetadata in project kogito-runtimes by kiegroup.

the class SpringBootModelEventEmitterTest method makeModel.

private DecisionModelResource makeModel() {
    final DecisionModelResource model = mock(DecisionModelResource.class);
    when(model.getGav()).thenReturn(new KogitoGAV("groupId", "artifactId", "version"));
    when(model.getModelName()).thenReturn("name");
    when(model.getNamespace()).thenReturn("namespace");
    when(model.getModelMetadata()).thenReturn(new DecisionModelMetadata("http://www.omg.org/spec/DMN/20151101/dmn.xsd"));
    when(model.get()).thenReturn("model");
    return model;
}
Also used : DecisionModelMetadata(org.kie.kogito.decision.DecisionModelMetadata) DecisionModelResource(org.kie.kogito.decision.DecisionModelResource) KogitoGAV(org.kie.kogito.KogitoGAV)

Example 2 with DecisionModelMetadata

use of org.kie.kogito.decision.DecisionModelMetadata in project kogito-runtimes by kiegroup.

the class DecisionModelEventTest method testGetters.

@Test
public void testGetters() {
    final KogitoGAV gav = new KogitoGAV("groupID", "artifactId", "version");
    final DecisionModelEvent e = new DecisionModelEvent(gav, "name", "namespace", new DecisionModelMetadata("http://www.omg.org/spec/DMN/20151101/dmn.xsd"), "definition");
    assertEquals(gav.getGroupId(), e.getGav().getGroupId());
    assertEquals(gav.getArtifactId(), e.getGav().getArtifactId());
    assertEquals(gav.getVersion(), e.getGav().getVersion());
    assertEquals("name", e.getName());
    assertEquals("namespace", e.getNamespace());
    assertEquals(ModelDomain.DECISION, e.getModelMetadata().getModelDomain());
    assertEquals("http://www.omg.org/spec/DMN/20151101/dmn.xsd", e.getModelMetadata().getSpecVersion());
    assertEquals("definition", e.getDefinition());
}
Also used : DecisionModelMetadata(org.kie.kogito.decision.DecisionModelMetadata) KogitoGAV(org.kie.kogito.KogitoGAV) DecisionModelEvent(org.kie.kogito.tracing.event.model.models.DecisionModelEvent) Test(org.junit.jupiter.api.Test)

Example 3 with DecisionModelMetadata

use of org.kie.kogito.decision.DecisionModelMetadata in project kogito-runtimes by kiegroup.

the class DecisionModelMetadataTest method testDeserialization.

@Test
public void testDeserialization() throws JsonProcessingException {
    String toRead = TracingTestUtils.readResourceAsString("/decisionmodelmetadata.json");
    ModelMetadata retrieved = new ObjectMapper().readValue(toRead, ModelMetadata.class);
    assertNotNull(retrieved);
    assertTrue(retrieved instanceof DecisionModelMetadata);
}
Also used : DecisionModelMetadata(org.kie.kogito.decision.DecisionModelMetadata) DecisionModelMetadata(org.kie.kogito.decision.DecisionModelMetadata) ModelMetadata(org.kie.kogito.event.ModelMetadata) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.jupiter.api.Test)

Example 4 with DecisionModelMetadata

use of org.kie.kogito.decision.DecisionModelMetadata in project kogito-runtimes by kiegroup.

the class DefaultDecisionModelResourceTest method testGetters.

@Test
public void testGetters() {
    final DecisionModelResource resource = new DefaultDecisionModelResource(GAV, "namespace", "name", new DecisionModelMetadata("http://www.omg.org/spec/DMN/20151101/dmn.xsd"), new InputStreamReader(new ByteArrayInputStream(CONTENT.getBytes())));
    assertEquals(GAV, resource.getGav());
    assertEquals("name", resource.getModelName());
    assertEquals("namespace", resource.getNamespace());
    assertEquals(ModelDomain.DECISION, resource.getModelMetadata().getModelDomain());
    assertEquals("http://www.omg.org/spec/DMN/20151101/dmn.xsd", resource.getModelMetadata().getSpecVersion());
}
Also used : DecisionModelMetadata(org.kie.kogito.decision.DecisionModelMetadata) DecisionModelResource(org.kie.kogito.decision.DecisionModelResource) InputStreamReader(java.io.InputStreamReader) ByteArrayInputStream(java.io.ByteArrayInputStream) Test(org.junit.jupiter.api.Test)

Example 5 with DecisionModelMetadata

use of org.kie.kogito.decision.DecisionModelMetadata in project kogito-runtimes by kiegroup.

the class DefaultDecisionModelResourceTest method testLoad.

@Test
public void testLoad() {
    final DecisionModelResource resource = new DefaultDecisionModelResource(GAV, "namespace", "name", new DecisionModelMetadata("http://www.omg.org/spec/DMN/20151101/dmn.xsd"), new InputStreamReader(new ByteArrayInputStream(CONTENT.getBytes())));
    assertEquals(CONTENT, resource.get().trim());
}
Also used : DecisionModelMetadata(org.kie.kogito.decision.DecisionModelMetadata) DecisionModelResource(org.kie.kogito.decision.DecisionModelResource) InputStreamReader(java.io.InputStreamReader) ByteArrayInputStream(java.io.ByteArrayInputStream) Test(org.junit.jupiter.api.Test)

Aggregations

DecisionModelMetadata (org.kie.kogito.decision.DecisionModelMetadata)6 Test (org.junit.jupiter.api.Test)4 DecisionModelResource (org.kie.kogito.decision.DecisionModelResource)4 KogitoGAV (org.kie.kogito.KogitoGAV)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 InputStreamReader (java.io.InputStreamReader)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ModelMetadata (org.kie.kogito.event.ModelMetadata)1 DecisionModelEvent (org.kie.kogito.tracing.event.model.models.DecisionModelEvent)1