Search in sources :

Example 6 with ReaderInputStream

use of org.apache.tools.ant.util.ReaderInputStream in project kie-wb-common by kiegroup.

the class DMNMarshallerStandaloneTest method test_decisionservice_1outputDecision.

@Test
public void test_decisionservice_1outputDecision() throws IOException {
    final DMNMarshallerStandalone m = getDMNMarshaller();
    @SuppressWarnings("unchecked") final Graph<?, Node<?, ?>> g = m.unmarshall(createMetadata(), this.getClass().getResourceAsStream("/DROOLS-3372.dmn"));
    Node<?, ?> nodeDS = g.getNode("_659a06e2-ae80-496c-8783-f790a640bb49");
    Node<?, ?> nodeDecisionPostfix = g.getNode("_3a69915a-30af-4de3-a07f-6be514f53caa");
    moveNode(nodeDecisionPostfix, 0, -280);
    makeNodeChildOf(nodeDecisionPostfix, nodeDS);
    DiagramImpl diagram = createDiagram();
    diagram.setGraph(g);
    String mString = m.marshall(diagram);
    LOG.debug("MARSHALLED ROUNDTRIP RESULTING xml:\n{}\n", mString);
    roundTripUnmarshalThenMarshalUnmarshal(new ReaderInputStream(new StringReader(mString)), this::check_decisionservice_1outputDecision);
}
Also used : ReaderInputStream(org.apache.tools.ant.util.ReaderInputStream) DiagramImpl(org.kie.workbench.common.stunner.core.diagram.DiagramImpl) BusinessKnowledgeModelNode(org.kie.dmn.api.core.ast.BusinessKnowledgeModelNode) Node(org.kie.workbench.common.stunner.core.graph.Node) StringReader(java.io.StringReader) Test(org.junit.Test)

Example 7 with ReaderInputStream

use of org.apache.tools.ant.util.ReaderInputStream in project kie-wb-common by kiegroup.

the class DMNMarshallerStandaloneTest method test_decisionservice2_remove_1outputDecision1encapsulatedDecision.

@Test
public void test_decisionservice2_remove_1outputDecision1encapsulatedDecision() throws IOException {
    final DMNMarshallerStandalone m = getDMNMarshaller();
    @SuppressWarnings("unchecked") final Graph<?, Node<?, ?>> g = m.unmarshall(createMetadata(), this.getClass().getResourceAsStream("/DROOLS-3372bis.dmn"));
    Node<?, ?> nodeDS = g.getNode("_659a06e2-ae80-496c-8783-f790a640bb49");
    Node<?, ?> nodeDecisionPostfix = g.getNode("_3a69915a-30af-4de3-a07f-6be514f53caa");
    Node<?, ?> nodeDecisionPrefix = g.getNode("_afce4fb3-9a7c-4791-bbfe-63d4b76bd61a");
    moveNode(nodeDecisionPostfix, 0, -280);
    makeNodeChildOf(nodeDecisionPostfix, nodeDS);
    moveNode(nodeDecisionPrefix, 0, -170);
    makeNodeChildOf(nodeDecisionPrefix, nodeDS);
    DiagramImpl diagram = createDiagram();
    Node<?, ?> nodeEncaps1 = g.getNode("_ca9d65e7-a5fa-4a13-98b7-8404f4601147");
    moveNode(nodeEncaps1, 0, +400);
    removeNodeChildOf(nodeEncaps1, nodeDS);
    Node<?, ?> nodeEncaps2 = g.getNode("_4b02cf97-5f9b-48ee-a4ae-229233238876");
    moveNode(nodeEncaps2, 0, +400);
    removeNodeChildOf(nodeEncaps2, nodeDS);
    Node<?, ?> nodeHardcoded2 = g.getNode("_8878539e-1c50-4622-b601-5878c97dc34e");
    moveNode(nodeHardcoded2, 0, +400);
    removeNodeChildOf(nodeHardcoded2, nodeDS);
    diagram.setGraph(g);
    String mString = m.marshall(diagram);
    LOG.debug("MARSHALLED ROUNDTRIP RESULTING xml:\n{}\n", mString);
    roundTripUnmarshalThenMarshalUnmarshal(new ReaderInputStream(new StringReader(mString)), this::check_decisionservice2_remove_1outputDecision1encapsulatedDecision);
}
Also used : ReaderInputStream(org.apache.tools.ant.util.ReaderInputStream) DiagramImpl(org.kie.workbench.common.stunner.core.diagram.DiagramImpl) BusinessKnowledgeModelNode(org.kie.dmn.api.core.ast.BusinessKnowledgeModelNode) Node(org.kie.workbench.common.stunner.core.graph.Node) StringReader(java.io.StringReader) Test(org.junit.Test)

Example 8 with ReaderInputStream

use of org.apache.tools.ant.util.ReaderInputStream in project kie-wb-common by kiegroup.

the class DMNMarshallerStandaloneTest method test_decisionservice_1outputDecision1encapsulatedDecision.

@Test
public void test_decisionservice_1outputDecision1encapsulatedDecision() throws IOException {
    final DMNMarshallerStandalone m = getDMNMarshaller();
    @SuppressWarnings("unchecked") final Graph<?, Node<?, ?>> g = m.unmarshall(createMetadata(), this.getClass().getResourceAsStream("/DROOLS-3372.dmn"));
    Node<?, ?> nodeDS = g.getNode("_659a06e2-ae80-496c-8783-f790a640bb49");
    Node<?, ?> nodeDecisionPostfix = g.getNode("_3a69915a-30af-4de3-a07f-6be514f53caa");
    Node<?, ?> nodeDecisionPrefix = g.getNode("_afce4fb3-9a7c-4791-bbfe-63d4b76bd61a");
    moveNode(nodeDecisionPostfix, 0, -280);
    makeNodeChildOf(nodeDecisionPostfix, nodeDS);
    moveNode(nodeDecisionPrefix, 0, -170);
    makeNodeChildOf(nodeDecisionPrefix, nodeDS);
    DiagramImpl diagram = createDiagram();
    diagram.setGraph(g);
    String mString = m.marshall(diagram);
    LOG.debug("MARSHALLED ROUNDTRIP RESULTING xml:\n{}\n", mString);
    roundTripUnmarshalThenMarshalUnmarshal(new ReaderInputStream(new StringReader(mString)), this::check_decisionservice_1outputDecision1encapsulatedDecision);
}
Also used : ReaderInputStream(org.apache.tools.ant.util.ReaderInputStream) DiagramImpl(org.kie.workbench.common.stunner.core.diagram.DiagramImpl) BusinessKnowledgeModelNode(org.kie.dmn.api.core.ast.BusinessKnowledgeModelNode) Node(org.kie.workbench.common.stunner.core.graph.Node) StringReader(java.io.StringReader) Test(org.junit.Test)

Aggregations

ReaderInputStream (org.apache.tools.ant.util.ReaderInputStream)8 StringReader (java.io.StringReader)7 BusinessKnowledgeModelNode (org.kie.dmn.api.core.ast.BusinessKnowledgeModelNode)5 DiagramImpl (org.kie.workbench.common.stunner.core.diagram.DiagramImpl)5 Node (org.kie.workbench.common.stunner.core.graph.Node)5 Test (org.junit.Test)4 BufferedReader (java.io.BufferedReader)3 IOException (java.io.IOException)3 InputStreamReader (java.io.InputStreamReader)3 InputStream (java.io.InputStream)2 XPathExpressionException (javax.xml.xpath.XPathExpressionException)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 OutputStream (java.io.OutputStream)1 PipedOutputStream (java.io.PipedOutputStream)1 Reader (java.io.Reader)1 BigDecimal (java.math.BigDecimal)1 AbstractMap (java.util.AbstractMap)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1