Search in sources :

Example 6 with DMNEdge

use of org.kie.dmn.model.api.dmndi.DMNEdge in project drools by kiegroup.

the class DMNEdgeConverter method writeAttributes.

@Override
protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) {
    super.writeAttributes(writer, parent);
    DMNEdge concrete = (DMNEdge) parent;
    if (concrete.getDmnElementRef() != null) {
        writer.addAttribute(DMN_ELEMENT_REF, MarshallingUtils.formatQName(concrete.getDmnElementRef(), concrete));
    }
}
Also used : DMNEdge(org.kie.dmn.model.api.dmndi.DMNEdge)

Example 7 with DMNEdge

use of org.kie.dmn.model.api.dmndi.DMNEdge in project drools by kiegroup.

the class DMNEdgeConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    DMNEdge concrete = (DMNEdge) parent;
    if (concrete.getDMNLabel() != null) {
        writeChildrenNode(writer, context, concrete.getDMNLabel(), DMN_LABEL);
    }
}
Also used : DMNEdge(org.kie.dmn.model.api.dmndi.DMNEdge)

Example 8 with DMNEdge

use of org.kie.dmn.model.api.dmndi.DMNEdge in project kie-wb-common by kiegroup.

the class DMNMarshallerStandaloneTest method testStunnerConstellationButtonCausingPoint2DbeingNull.

/**
 * DROOLS-3184: If the "connection source/target location is null" assume it's the centre of the shape.
 * [source/target location is null] If the connection was created from the Toolbox (i.e. add a InputData and then the Decision from it using the Decision toolbox icon).
 * <p>
 * This test re-create by hard-code the behavior of the Stunner framework "Toolbox" by instrumenting API calls to achieve the same behavior.
 */
@SuppressWarnings("unchecked")
@Test
public void testStunnerConstellationButtonCausingPoint2DbeingNull() throws IOException {
    final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer = (uuid, hcw) -> {
    /*NOP*/
    };
    Diagram diagram = createDiagram();
    Graph g = diagram.getGraph();
    Node diagramRoot = DMNMarshallerStandalone.findDMNDiagramRoot(g);
    testAugmentWithNSPrefixes(((DMNDiagram) ((View<?>) diagramRoot.getContent()).getDefinition()).getDefinitions());
    org.kie.dmn.model.api.InputData dmnInputData = new TInputData();
    dmnInputData.setId("inputDataID");
    dmnInputData.setName(dmnInputData.getId());
    Node inputDataNode = new InputDataConverter(api.getFactoryManager()).nodeFromDMN(dmnInputData, hasComponentWidthsConsumer);
    org.kie.dmn.model.api.Decision dmnDecision = new TDecision();
    dmnDecision.setId("decisionID");
    dmnDecision.setName(dmnDecision.getId());
    Node decisionNode = new DecisionConverter(api.getFactoryManager()).nodeFromDMN(dmnDecision, hasComponentWidthsConsumer);
    g.addNode(inputDataNode);
    g.addNode(decisionNode);
    View content = (View) decisionNode.getContent();
    content.setBounds(org.kie.workbench.common.stunner.core.graph.content.Bounds.create(200, 200, 300, 250));
    final String irID = "irID";
    Edge myEdge = api.getFactoryManager().newElement(irID, DMNMarshallerStandalone.INFO_REQ_ID).asEdge();
    myEdge.setSourceNode(inputDataNode);
    myEdge.setTargetNode(decisionNode);
    inputDataNode.getOutEdges().add(myEdge);
    decisionNode.getInEdges().add(myEdge);
    ViewConnector connectionContent = (ViewConnector) myEdge.getContent();
    // DROOLS-3184: If the "connection source/target location is null" assume it's the centre of the shape.
    // keep Stunner behavior of constellation button
    connectionContent.setSourceConnection(MagnetConnection.Builder.atCenter(inputDataNode).setLocation(null).setAuto(true));
    connectionContent.setTargetConnection(MagnetConnection.Builder.atCenter(decisionNode).setLocation(null).setAuto(true));
    DMNMarshallerStandalone.connectRootWithChild(diagramRoot, inputDataNode);
    DMNMarshallerStandalone.connectRootWithChild(diagramRoot, decisionNode);
    DMNMarshallerStandalone m = getDMNMarshaller();
    String output = m.marshall(diagram);
    LOG.debug(output);
    Definitions dmnDefinitions = DMNMarshallerFactory.newDefaultMarshaller().unmarshal(output);
    DMNEdge dmndiEdge = findEdgeByDMNI(dmnDefinitions.getDMNDI().getDMNDiagram().get(0), irID);
    assertThat(dmndiEdge.getWaypoint()).hasSize(2);
    Point wpSource = dmndiEdge.getWaypoint().get(0);
    assertThat(wpSource.getX()).isEqualByComparingTo(50d);
    assertThat(wpSource.getY()).isEqualByComparingTo(25d);
    Point wpTarget = dmndiEdge.getWaypoint().get(1);
    assertThat(wpTarget.getX()).isEqualByComparingTo(250d);
    assertThat(wpTarget.getY()).isEqualByComparingTo(225d);
}
Also used : Arrays(java.util.Arrays) DMNMessage(org.kie.dmn.api.core.DMNMessage) Edge(org.kie.workbench.common.stunner.core.graph.Edge) TInputData(org.kie.dmn.model.v1_2.TInputData) StringUtils(org.apache.commons.lang3.StringUtils) Collections.singletonList(java.util.Collections.singletonList) BigDecimal(java.math.BigDecimal) Bounds(org.kie.dmn.model.api.dmndi.Bounds) Arrays.asList(java.util.Arrays.asList) Map(java.util.Map) TItemDefinition(org.kie.dmn.model.v1_2.TItemDefinition) NamespaceContext(javax.xml.namespace.NamespaceContext) Namespace(org.kie.workbench.common.dmn.api.definition.model.DMNModelInstrumentedBase.Namespace) StringInputStream(org.apache.tools.ant.filters.StringInputStream) Mockito.doReturn(org.mockito.Mockito.doReturn) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) HasComponentWidths(org.kie.workbench.common.dmn.api.definition.HasComponentWidths) Point2D(org.kie.workbench.common.stunner.core.graph.content.view.Point2D) BusinessKnowledgeModel(org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel) Results(org.kie.api.builder.Results) Child(org.kie.workbench.common.stunner.core.graph.content.relationship.Child) ItemDefinition(org.kie.workbench.common.dmn.api.definition.model.ItemDefinition) FunctionKind(org.kie.dmn.model.api.FunctionKind) ArgumentMatchers.anyList(org.mockito.ArgumentMatchers.anyList) BusinessKnowledgeModelNode(org.kie.dmn.api.core.ast.BusinessKnowledgeModelNode) DMNGraphFactoryImpl(org.kie.workbench.common.dmn.api.factory.DMNGraphFactoryImpl) Stream(java.util.stream.Stream) Assert.assertFalse(org.junit.Assert.assertFalse) DMNContext(org.kie.dmn.api.core.DMNContext) KieHelper(org.kie.dmn.core.util.KieHelper) QName(javax.xml.namespace.QName) DMNDiagramUtils(org.kie.workbench.common.dmn.api.graph.DMNDiagramUtils) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) Mockito.mock(org.mockito.Mockito.mock) DMNDefinitionSet(org.kie.workbench.common.dmn.api.DMNDefinitionSet) XPath(javax.xml.xpath.XPath) DMNStyle(org.kie.dmn.model.api.dmndi.DMNStyle) Point(org.kie.dmn.model.api.dmndi.Point) Connection(org.kie.workbench.common.stunner.core.graph.content.view.Connection) Mock(org.mockito.Mock) RunWith(org.junit.runner.RunWith) Color(org.kie.dmn.model.api.dmndi.Color) Mockito.spy(org.mockito.Mockito.spy) Definitions(org.kie.dmn.model.api.Definitions) ArrayList(java.util.ArrayList) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) DMNMarshallerFactory(org.kie.dmn.backend.marshalling.v1x.DMNMarshallerFactory) BiConsumer(java.util.function.BiConsumer) Message(org.kie.api.builder.Message) StreamSupport(java.util.stream.StreamSupport) DMNRuntime(org.kie.dmn.api.core.DMNRuntime) MapIndexBuilder(org.kie.workbench.common.stunner.core.graph.processing.index.map.MapIndexBuilder) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Context(org.kie.workbench.common.dmn.api.definition.model.Context) FunctionDefinition(org.kie.workbench.common.dmn.api.definition.model.FunctionDefinition) CoreMatchers.nullValue(org.hamcrest.CoreMatchers.nullValue) Before(org.junit.Before) BindableAdapterUtils(org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils) Assert.assertTrue(org.junit.Assert.assertTrue) IOException(java.io.IOException) Test(org.junit.Test) InputData(org.kie.workbench.common.dmn.api.definition.model.InputData) UUID(org.uberfire.commons.uuid.UUID) InputStreamReader(java.io.InputStreamReader) InputDataConverter(org.kie.workbench.common.dmn.backend.definition.v1_1.InputDataConverter) Association(org.kie.workbench.common.dmn.api.definition.model.Association) TDecision(org.kie.dmn.model.v1_2.TDecision) DecisionService(org.kie.workbench.common.dmn.api.definition.model.DecisionService) Graph(org.kie.workbench.common.stunner.core.graph.Graph) Assert.assertNull(org.junit.Assert.assertNull) StringReader(java.io.StringReader) BufferedReader(java.io.BufferedReader) DRGElement(org.kie.dmn.model.api.DRGElement) Assert(org.junit.Assert) Expression(org.kie.workbench.common.dmn.api.definition.model.Expression) MagnetConnection(org.kie.workbench.common.stunner.core.graph.content.view.MagnetConnection) Assert.assertEquals(org.junit.Assert.assertEquals) CoreMatchers.is(org.hamcrest.CoreMatchers.is) TextAnnotation(org.kie.workbench.common.dmn.api.definition.model.TextAnnotation) DecisionTable(org.kie.dmn.model.api.DecisionTable) DecisionConverter(org.kie.workbench.common.dmn.backend.definition.v1_1.DecisionConverter) DefinitionUtils(org.kie.workbench.common.stunner.core.util.DefinitionUtils) XPathExpressionException(javax.xml.xpath.XPathExpressionException) DMNResult(org.kie.dmn.api.core.DMNResult) Spliterators(java.util.Spliterators) LiteralExpression(org.kie.workbench.common.dmn.api.definition.model.LiteralExpression) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) LoggerFactory(org.slf4j.LoggerFactory) Scanner(java.util.Scanner) DMNEdge(org.kie.dmn.model.api.dmndi.DMNEdge) ViewImpl(org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl) EdgeImpl(org.kie.workbench.common.stunner.core.graph.impl.EdgeImpl) TextAnnotationConverter(org.kie.workbench.common.dmn.backend.definition.v1_1.TextAnnotationConverter) DMNElement(org.kie.workbench.common.dmn.api.definition.model.DMNElement) DMNModel(org.kie.dmn.api.core.DMNModel) DecisionEvaluationStatus(org.kie.dmn.api.core.DMNDecisionResult.DecisionEvaluationStatus) InformationRequirement(org.kie.workbench.common.dmn.api.definition.model.InformationRequirement) DMNMarshallerProducer(org.kie.workbench.common.dmn.backend.producers.DMNMarshallerProducer) TTextAnnotation(org.kie.dmn.model.v1_2.TTextAnnotation) ContextEntry(org.kie.workbench.common.dmn.api.definition.model.ContextEntry) Collections.emptyList(java.util.Collections.emptyList) Collection(java.util.Collection) Import(org.kie.dmn.model.api.Import) DMNDiagram(org.kie.workbench.common.dmn.api.definition.model.DMNDiagram) Collectors(java.util.stream.Collectors) DMNRuntimeUtil(org.kie.dmn.core.util.DMNRuntimeUtil) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) DiagramElement(org.kie.dmn.model.api.dmndi.DiagramElement) List(java.util.List) DMNShape(org.kie.dmn.model.api.dmndi.DMNShape) InformationItem(org.kie.workbench.common.dmn.api.definition.model.InformationItem) DMNImportTypes(org.kie.workbench.common.dmn.api.editors.included.DMNImportTypes) BuiltInType(org.kie.workbench.common.dmn.api.property.dmn.types.BuiltInType) Optional(java.util.Optional) MappingContextSingleton(org.jboss.errai.marshalling.server.MappingContextSingleton) Spliterator(java.util.Spliterator) Node(org.kie.workbench.common.stunner.core.graph.Node) DMNDecisionResult(org.kie.dmn.api.core.DMNDecisionResult) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) PMMLDocumentMetadata(org.kie.workbench.common.dmn.api.editors.included.PMMLDocumentMetadata) ControlPoint(org.kie.workbench.common.stunner.core.graph.content.view.ControlPoint) HashMap(java.util.HashMap) OptionalInt(java.util.OptionalInt) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Level(org.kie.api.builder.Message.Level) ImportPMML(org.kie.workbench.common.dmn.api.definition.model.ImportPMML) Bound(org.kie.workbench.common.stunner.core.graph.content.Bound) ReaderInputStream(org.apache.tools.ant.util.ReaderInputStream) KieServices(org.kie.api.KieServices) DiagramImpl(org.kie.workbench.common.stunner.core.diagram.DiagramImpl) KnowledgeRequirement(org.kie.workbench.common.dmn.api.definition.model.KnowledgeRequirement) Assume(org.junit.Assume) InputSource(org.xml.sax.InputSource) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) XMLEncoderDiagramMetadataMarshaller(org.kie.workbench.common.stunner.core.backend.service.XMLEncoderDiagramMetadataMarshaller) Assert.assertNotNull(org.junit.Assert.assertNotNull) KieContainer(org.kie.api.runtime.KieContainer) DMNMarshallerImportsHelperStandalone(org.kie.workbench.common.dmn.backend.common.DMNMarshallerImportsHelperStandalone) StunnerTestingGraphBackendAPI(org.kie.workbench.common.stunner.core.backend.StunnerTestingGraphBackendAPI) DMNMarshallerStandalone.getDmnElementRef(org.kie.workbench.common.dmn.backend.DMNMarshallerStandalone.getDmnElementRef) Mockito.when(org.mockito.Mockito.when) DefinitionSet(org.kie.workbench.common.stunner.core.graph.content.definition.DefinitionSet) ViewConnector(org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector) AuthorityRequirement(org.kie.workbench.common.dmn.api.definition.model.AuthorityRequirement) Mockito.verify(org.mockito.Mockito.verify) Consumer(java.util.function.Consumer) DMNModelInstrumentedBase(org.kie.workbench.common.dmn.api.definition.model.DMNModelInstrumentedBase) XPathFactory(javax.xml.xpath.XPathFactory) AbstractMap(java.util.AbstractMap) ImportDMN(org.kie.workbench.common.dmn.api.definition.model.ImportDMN) KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) Collections(java.util.Collections) InputStream(java.io.InputStream) TInputData(org.kie.dmn.model.v1_2.TInputData) DecisionConverter(org.kie.workbench.common.dmn.backend.definition.v1_1.DecisionConverter) ViewConnector(org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector) BusinessKnowledgeModelNode(org.kie.dmn.api.core.ast.BusinessKnowledgeModelNode) Node(org.kie.workbench.common.stunner.core.graph.Node) Definitions(org.kie.dmn.model.api.Definitions) Point(org.kie.dmn.model.api.dmndi.Point) ControlPoint(org.kie.workbench.common.stunner.core.graph.content.view.ControlPoint) HasComponentWidths(org.kie.workbench.common.dmn.api.definition.HasComponentWidths) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) DMNDiagram(org.kie.workbench.common.dmn.api.definition.model.DMNDiagram) Graph(org.kie.workbench.common.stunner.core.graph.Graph) InputDataConverter(org.kie.workbench.common.dmn.backend.definition.v1_1.InputDataConverter) TDecision(org.kie.dmn.model.v1_2.TDecision) DMNEdge(org.kie.dmn.model.api.dmndi.DMNEdge) Edge(org.kie.workbench.common.stunner.core.graph.Edge) DMNEdge(org.kie.dmn.model.api.dmndi.DMNEdge) Test(org.junit.Test)

Example 9 with DMNEdge

use of org.kie.dmn.model.api.dmndi.DMNEdge in project kie-wb-common by kiegroup.

the class DMNMarshallerStandaloneTest method testIsAutoConnection.

@Test
public void testIsAutoConnection() {
    String id = "DMNEdge-ID";
    String autoConnectionID = "-AUTO-CONNECTION";
    DMNEdge dmnEdge1 = mock(DMNEdge.class);
    when(dmnEdge1.getId()).thenReturn(id);
    DMNEdge dmnEdge2 = mock(DMNEdge.class);
    when(dmnEdge2.getId()).thenReturn(id + autoConnectionID);
    DMNEdge dmnEdge3 = mock(DMNEdge.class);
    when(dmnEdge3.getId()).thenReturn(null);
    DMNMarshallerStandalone dmnMarshallerStandalone = new DMNMarshallerStandalone();
    assertFalse(dmnMarshallerStandalone.isAutoConnection(dmnEdge1, autoConnectionID));
    assertTrue(dmnMarshallerStandalone.isAutoConnection(dmnEdge2, autoConnectionID));
    assertFalse(dmnMarshallerStandalone.isAutoConnection(dmnEdge3, autoConnectionID));
}
Also used : DMNEdge(org.kie.dmn.model.api.dmndi.DMNEdge) Test(org.junit.Test)

Example 10 with DMNEdge

use of org.kie.dmn.model.api.dmndi.DMNEdge in project kie-wb-common by kiegroup.

the class DMNMarshallerStandaloneTest method testAssociationEdgeDMNDI.

/**
 * DROOLS-2569 [DMN Designer] Marshalling of magnet positions -- Association DMN Edge DMNDI serialization.
 * This test re-create by hard-code the graph to simulate the behavior of the Stunner framework programmatically.
 */
@SuppressWarnings("unchecked")
@Test
public void testAssociationEdgeDMNDI() throws IOException {
    final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer = (uuid, hcw) -> {
    /*NOP*/
    };
    Diagram diagram = createDiagram();
    Graph g = diagram.getGraph();
    Node diagramRoot = DMNMarshallerStandalone.findDMNDiagramRoot(g);
    testAugmentWithNSPrefixes(((DMNDiagram) ((View<?>) diagramRoot.getContent()).getDefinition()).getDefinitions());
    org.kie.dmn.model.api.InputData dmnInputData = new TInputData();
    dmnInputData.setId("inputDataID");
    dmnInputData.setName(dmnInputData.getId());
    Node inputDataNode = new InputDataConverter(api.getFactoryManager()).nodeFromDMN(dmnInputData, hasComponentWidthsConsumer);
    org.kie.dmn.model.api.TextAnnotation dmnTextAnnotation = new TTextAnnotation();
    dmnTextAnnotation.setId("textAnnotationID");
    Node textAnnotationNode = new TextAnnotationConverter(api.getFactoryManager()).nodeFromDMN(dmnTextAnnotation, hasComponentWidthsConsumer);
    g.addNode(inputDataNode);
    g.addNode(textAnnotationNode);
    View content = (View) textAnnotationNode.getContent();
    content.setBounds(org.kie.workbench.common.stunner.core.graph.content.Bounds.create(200, 200, 300, 250));
    final String edgeID = "edgeID";
    final String associationID = "associationID";
    Edge myEdge = api.getFactoryManager().newElement(edgeID, DMNMarshallerStandalone.ASSOCIATION_ID).asEdge();
    final View<?> edgeView = (View<?>) myEdge.getContent();
    ((Association) edgeView.getDefinition()).setId(new Id(associationID));
    myEdge.setSourceNode(inputDataNode);
    myEdge.setTargetNode(textAnnotationNode);
    inputDataNode.getOutEdges().add(myEdge);
    textAnnotationNode.getInEdges().add(myEdge);
    ViewConnector connectionContent = (ViewConnector) myEdge.getContent();
    connectionContent.setSourceConnection(MagnetConnection.Builder.atCenter(inputDataNode));
    connectionContent.setTargetConnection(MagnetConnection.Builder.atCenter(textAnnotationNode));
    DMNMarshallerStandalone.connectRootWithChild(diagramRoot, inputDataNode);
    DMNMarshallerStandalone.connectRootWithChild(diagramRoot, textAnnotationNode);
    DMNMarshallerStandalone m = getDMNMarshaller();
    String output = m.marshall(diagram);
    LOG.debug(output);
    Definitions dmnDefinitions = DMNMarshallerFactory.newDefaultMarshaller().unmarshal(output);
    assertThat(dmnDefinitions.getDMNDI().getDMNDiagram().get(0).getDMNDiagramElement().stream().filter(DMNEdge.class::isInstance).count()).isEqualTo(1);
    DMNEdge dmndiEdge = findEdgeByDMNI(dmnDefinitions.getDMNDI().getDMNDiagram().get(0), associationID);
    assertThat(dmndiEdge.getWaypoint()).hasSize(2);
}
Also used : Arrays(java.util.Arrays) DMNMessage(org.kie.dmn.api.core.DMNMessage) Edge(org.kie.workbench.common.stunner.core.graph.Edge) TInputData(org.kie.dmn.model.v1_2.TInputData) StringUtils(org.apache.commons.lang3.StringUtils) Collections.singletonList(java.util.Collections.singletonList) BigDecimal(java.math.BigDecimal) Bounds(org.kie.dmn.model.api.dmndi.Bounds) Arrays.asList(java.util.Arrays.asList) Map(java.util.Map) TItemDefinition(org.kie.dmn.model.v1_2.TItemDefinition) NamespaceContext(javax.xml.namespace.NamespaceContext) Namespace(org.kie.workbench.common.dmn.api.definition.model.DMNModelInstrumentedBase.Namespace) StringInputStream(org.apache.tools.ant.filters.StringInputStream) Mockito.doReturn(org.mockito.Mockito.doReturn) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) HasComponentWidths(org.kie.workbench.common.dmn.api.definition.HasComponentWidths) Point2D(org.kie.workbench.common.stunner.core.graph.content.view.Point2D) BusinessKnowledgeModel(org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel) Results(org.kie.api.builder.Results) Child(org.kie.workbench.common.stunner.core.graph.content.relationship.Child) ItemDefinition(org.kie.workbench.common.dmn.api.definition.model.ItemDefinition) FunctionKind(org.kie.dmn.model.api.FunctionKind) ArgumentMatchers.anyList(org.mockito.ArgumentMatchers.anyList) BusinessKnowledgeModelNode(org.kie.dmn.api.core.ast.BusinessKnowledgeModelNode) DMNGraphFactoryImpl(org.kie.workbench.common.dmn.api.factory.DMNGraphFactoryImpl) Stream(java.util.stream.Stream) Assert.assertFalse(org.junit.Assert.assertFalse) DMNContext(org.kie.dmn.api.core.DMNContext) KieHelper(org.kie.dmn.core.util.KieHelper) QName(javax.xml.namespace.QName) DMNDiagramUtils(org.kie.workbench.common.dmn.api.graph.DMNDiagramUtils) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) Mockito.mock(org.mockito.Mockito.mock) DMNDefinitionSet(org.kie.workbench.common.dmn.api.DMNDefinitionSet) XPath(javax.xml.xpath.XPath) DMNStyle(org.kie.dmn.model.api.dmndi.DMNStyle) Point(org.kie.dmn.model.api.dmndi.Point) Connection(org.kie.workbench.common.stunner.core.graph.content.view.Connection) Mock(org.mockito.Mock) RunWith(org.junit.runner.RunWith) Color(org.kie.dmn.model.api.dmndi.Color) Mockito.spy(org.mockito.Mockito.spy) Definitions(org.kie.dmn.model.api.Definitions) ArrayList(java.util.ArrayList) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) DMNMarshallerFactory(org.kie.dmn.backend.marshalling.v1x.DMNMarshallerFactory) BiConsumer(java.util.function.BiConsumer) Message(org.kie.api.builder.Message) StreamSupport(java.util.stream.StreamSupport) DMNRuntime(org.kie.dmn.api.core.DMNRuntime) MapIndexBuilder(org.kie.workbench.common.stunner.core.graph.processing.index.map.MapIndexBuilder) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Context(org.kie.workbench.common.dmn.api.definition.model.Context) FunctionDefinition(org.kie.workbench.common.dmn.api.definition.model.FunctionDefinition) CoreMatchers.nullValue(org.hamcrest.CoreMatchers.nullValue) Before(org.junit.Before) BindableAdapterUtils(org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils) Assert.assertTrue(org.junit.Assert.assertTrue) IOException(java.io.IOException) Test(org.junit.Test) InputData(org.kie.workbench.common.dmn.api.definition.model.InputData) UUID(org.uberfire.commons.uuid.UUID) InputStreamReader(java.io.InputStreamReader) InputDataConverter(org.kie.workbench.common.dmn.backend.definition.v1_1.InputDataConverter) Association(org.kie.workbench.common.dmn.api.definition.model.Association) TDecision(org.kie.dmn.model.v1_2.TDecision) DecisionService(org.kie.workbench.common.dmn.api.definition.model.DecisionService) Graph(org.kie.workbench.common.stunner.core.graph.Graph) Assert.assertNull(org.junit.Assert.assertNull) StringReader(java.io.StringReader) BufferedReader(java.io.BufferedReader) DRGElement(org.kie.dmn.model.api.DRGElement) Assert(org.junit.Assert) Expression(org.kie.workbench.common.dmn.api.definition.model.Expression) MagnetConnection(org.kie.workbench.common.stunner.core.graph.content.view.MagnetConnection) Assert.assertEquals(org.junit.Assert.assertEquals) CoreMatchers.is(org.hamcrest.CoreMatchers.is) TextAnnotation(org.kie.workbench.common.dmn.api.definition.model.TextAnnotation) DecisionTable(org.kie.dmn.model.api.DecisionTable) DecisionConverter(org.kie.workbench.common.dmn.backend.definition.v1_1.DecisionConverter) DefinitionUtils(org.kie.workbench.common.stunner.core.util.DefinitionUtils) XPathExpressionException(javax.xml.xpath.XPathExpressionException) DMNResult(org.kie.dmn.api.core.DMNResult) Spliterators(java.util.Spliterators) LiteralExpression(org.kie.workbench.common.dmn.api.definition.model.LiteralExpression) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) LoggerFactory(org.slf4j.LoggerFactory) Scanner(java.util.Scanner) DMNEdge(org.kie.dmn.model.api.dmndi.DMNEdge) ViewImpl(org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl) EdgeImpl(org.kie.workbench.common.stunner.core.graph.impl.EdgeImpl) TextAnnotationConverter(org.kie.workbench.common.dmn.backend.definition.v1_1.TextAnnotationConverter) DMNElement(org.kie.workbench.common.dmn.api.definition.model.DMNElement) DMNModel(org.kie.dmn.api.core.DMNModel) DecisionEvaluationStatus(org.kie.dmn.api.core.DMNDecisionResult.DecisionEvaluationStatus) InformationRequirement(org.kie.workbench.common.dmn.api.definition.model.InformationRequirement) DMNMarshallerProducer(org.kie.workbench.common.dmn.backend.producers.DMNMarshallerProducer) TTextAnnotation(org.kie.dmn.model.v1_2.TTextAnnotation) ContextEntry(org.kie.workbench.common.dmn.api.definition.model.ContextEntry) Collections.emptyList(java.util.Collections.emptyList) Collection(java.util.Collection) Import(org.kie.dmn.model.api.Import) DMNDiagram(org.kie.workbench.common.dmn.api.definition.model.DMNDiagram) Collectors(java.util.stream.Collectors) DMNRuntimeUtil(org.kie.dmn.core.util.DMNRuntimeUtil) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) DiagramElement(org.kie.dmn.model.api.dmndi.DiagramElement) List(java.util.List) DMNShape(org.kie.dmn.model.api.dmndi.DMNShape) InformationItem(org.kie.workbench.common.dmn.api.definition.model.InformationItem) DMNImportTypes(org.kie.workbench.common.dmn.api.editors.included.DMNImportTypes) BuiltInType(org.kie.workbench.common.dmn.api.property.dmn.types.BuiltInType) Optional(java.util.Optional) MappingContextSingleton(org.jboss.errai.marshalling.server.MappingContextSingleton) Spliterator(java.util.Spliterator) Node(org.kie.workbench.common.stunner.core.graph.Node) DMNDecisionResult(org.kie.dmn.api.core.DMNDecisionResult) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) PMMLDocumentMetadata(org.kie.workbench.common.dmn.api.editors.included.PMMLDocumentMetadata) ControlPoint(org.kie.workbench.common.stunner.core.graph.content.view.ControlPoint) HashMap(java.util.HashMap) OptionalInt(java.util.OptionalInt) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Level(org.kie.api.builder.Message.Level) ImportPMML(org.kie.workbench.common.dmn.api.definition.model.ImportPMML) Bound(org.kie.workbench.common.stunner.core.graph.content.Bound) ReaderInputStream(org.apache.tools.ant.util.ReaderInputStream) KieServices(org.kie.api.KieServices) DiagramImpl(org.kie.workbench.common.stunner.core.diagram.DiagramImpl) KnowledgeRequirement(org.kie.workbench.common.dmn.api.definition.model.KnowledgeRequirement) Assume(org.junit.Assume) InputSource(org.xml.sax.InputSource) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) XMLEncoderDiagramMetadataMarshaller(org.kie.workbench.common.stunner.core.backend.service.XMLEncoderDiagramMetadataMarshaller) Assert.assertNotNull(org.junit.Assert.assertNotNull) KieContainer(org.kie.api.runtime.KieContainer) DMNMarshallerImportsHelperStandalone(org.kie.workbench.common.dmn.backend.common.DMNMarshallerImportsHelperStandalone) StunnerTestingGraphBackendAPI(org.kie.workbench.common.stunner.core.backend.StunnerTestingGraphBackendAPI) DMNMarshallerStandalone.getDmnElementRef(org.kie.workbench.common.dmn.backend.DMNMarshallerStandalone.getDmnElementRef) Mockito.when(org.mockito.Mockito.when) DefinitionSet(org.kie.workbench.common.stunner.core.graph.content.definition.DefinitionSet) ViewConnector(org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector) AuthorityRequirement(org.kie.workbench.common.dmn.api.definition.model.AuthorityRequirement) Mockito.verify(org.mockito.Mockito.verify) Consumer(java.util.function.Consumer) DMNModelInstrumentedBase(org.kie.workbench.common.dmn.api.definition.model.DMNModelInstrumentedBase) XPathFactory(javax.xml.xpath.XPathFactory) AbstractMap(java.util.AbstractMap) ImportDMN(org.kie.workbench.common.dmn.api.definition.model.ImportDMN) KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) Collections(java.util.Collections) InputStream(java.io.InputStream) BusinessKnowledgeModelNode(org.kie.dmn.api.core.ast.BusinessKnowledgeModelNode) Node(org.kie.workbench.common.stunner.core.graph.Node) HasComponentWidths(org.kie.workbench.common.dmn.api.definition.HasComponentWidths) TTextAnnotation(org.kie.dmn.model.v1_2.TTextAnnotation) Association(org.kie.workbench.common.dmn.api.definition.model.Association) InputDataConverter(org.kie.workbench.common.dmn.backend.definition.v1_1.InputDataConverter) TInputData(org.kie.dmn.model.v1_2.TInputData) ViewConnector(org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector) TextAnnotationConverter(org.kie.workbench.common.dmn.backend.definition.v1_1.TextAnnotationConverter) Definitions(org.kie.dmn.model.api.Definitions) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) DMNDiagram(org.kie.workbench.common.dmn.api.definition.model.DMNDiagram) Graph(org.kie.workbench.common.stunner.core.graph.Graph) DMNEdge(org.kie.dmn.model.api.dmndi.DMNEdge) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) Edge(org.kie.workbench.common.stunner.core.graph.Edge) DMNEdge(org.kie.dmn.model.api.dmndi.DMNEdge) Test(org.junit.Test)

Aggregations

DMNEdge (org.kie.dmn.model.api.dmndi.DMNEdge)11 Point (org.kie.dmn.model.api.dmndi.Point)4 IOException (java.io.IOException)3 InputStream (java.io.InputStream)3 InputStreamReader (java.io.InputStreamReader)3 ArrayList (java.util.ArrayList)3 Collections.emptyList (java.util.Collections.emptyList)3 HashMap (java.util.HashMap)3 List (java.util.List)3 Map (java.util.Map)3 Optional (java.util.Optional)3 BiConsumer (java.util.function.BiConsumer)3 Consumer (java.util.function.Consumer)3 Collectors (java.util.stream.Collectors)3 Stream (java.util.stream.Stream)3 StreamSupport (java.util.stream.StreamSupport)3 QName (javax.xml.namespace.QName)3 Test (org.junit.Test)3 DMNDiagram (org.kie.workbench.common.dmn.api.definition.model.DMNDiagram)3 Edge (org.kie.workbench.common.stunner.core.graph.Edge)3