use of org.kie.dmn.api.marshalling.DMNMarshaller in project drools by kiegroup.
the class DMNXMLLoaderTest method testLoadingDefinitions.
@Test
public void testLoadingDefinitions() {
final DMNMarshaller DMNMarshaller = DMNMarshallerFactory.newDefaultMarshaller();
final InputStream is = this.getClass().getResourceAsStream("0001-input-data-string.dmn");
final InputStreamReader isr = new InputStreamReader(is);
final Definitions def = DMNMarshaller.unmarshal(isr);
assertThat(def, not(nullValue()));
assertThat(def.getName(), is("0001-input-data-string"));
assertThat(def.getId(), is("_0001-input-data-string"));
assertThat(def.getNamespace(), is("https://github.com/agilepro/dmn-tck"));
assertThat(def.getDrgElement().size(), is(2));
assertThat(def.getDrgElement().get(0), is(instanceOf(Decision.class)));
Decision dec = (Decision) def.getDrgElement().get(0);
assertThat(dec.getName(), is("Greeting Message"));
assertThat(dec.getId(), is("d_GreetingMessage"));
assertThat(dec.getVariable().getName(), is("Greeting Message"));
assertThat(dec.getVariable().getTypeRef().getPrefix(), is("feel"));
assertThat(dec.getVariable().getTypeRef().getLocalPart(), is("string"));
assertThat(dec.getVariable().getTypeRef().getNamespaceURI(), is(XMLConstants.NULL_NS_URI));
assertThat(dec.getInformationRequirement().size(), is(1));
assertThat(dec.getInformationRequirement().get(0).getRequiredInput().getHref(), is("#i_FullName"));
assertThat(dec.getExpression(), is(instanceOf(LiteralExpression.class)));
LiteralExpression le = (LiteralExpression) dec.getExpression();
assertThat(le.getText(), is("\"Hello \" + Full Name"));
InputData idata = (InputData) def.getDrgElement().get(1);
assertThat(idata.getId(), is("i_FullName"));
assertThat(idata.getName(), is("Full Name"));
assertThat(idata.getVariable().getName(), is("Full Name"));
assertThat(idata.getVariable().getTypeRef().getPrefix(), is("feel"));
assertThat(idata.getVariable().getTypeRef().getLocalPart(), is("string"));
assertThat(idata.getVariable().getTypeRef().getNamespaceURI(), is(XMLConstants.NULL_NS_URI));
}
use of org.kie.dmn.api.marshalling.DMNMarshaller in project drools by kiegroup.
the class UnmarshalMarshalTest method testRoundTrip.
public void testRoundTrip(String subdir, String xmlfile) throws Exception {
DMNMarshaller marshaller = DMNMarshallerFactory.newDefaultMarshaller();
testRoundTrip(subdir, xmlfile, marshaller);
}
use of org.kie.dmn.api.marshalling.DMNMarshaller in project drools by kiegroup.
the class UnmarshalMarshalTest method test0004.
@Test
public void test0004() throws Exception {
DMNMarshaller marshaller = DMNMarshallerFactory.newMarshallerWithExtensions(Arrays.asList(new DecisionServicesExtensionRegister()));
testRoundTrip("org/kie/dmn/backend/marshalling/v1_1/", "0004-decision-services.dmn", marshaller);
}
use of org.kie.dmn.api.marshalling.DMNMarshaller in project drools by kiegroup.
the class UnmarshalMarshalTest method testHello_World_semantic_namespace_with_extensions.
@Test
public void testHello_World_semantic_namespace_with_extensions() throws Exception {
DMNMarshaller marshaller = DMNMarshallerFactory.newMarshallerWithExtensions(Arrays.asList(new MyTestRegister()));
testRoundTrip("org/kie/dmn/backend/marshalling/v1_1/", "Hello_World_semantic_namespace_with_extensions.dmn", marshaller);
}
use of org.kie.dmn.api.marshalling.DMNMarshaller in project drools by kiegroup.
the class UnmarshalMarshalTest method testV12_DMNDIDiagramElementExtension_withContent.
@Test
public void testV12_DMNDIDiagramElementExtension_withContent() throws Exception {
DMNMarshaller marshaller = DMNMarshallerFactory.newMarshallerWithExtensions(Arrays.asList(new MyTestRegister()));
testRoundTrip("org/kie/dmn/backend/marshalling/v1_2/", "DMNDIDiagramElementExtension_withContent.dmn", marshaller, DMN12_SCHEMA_SOURCE);
}
Aggregations