use of org.kie.workbench.common.dmn.api.definition.model.Definitions in project kie-wb-common by kiegroup.
the class DMNMarshallerTest method testConnect.
@Test
public void testConnect() {
final DMNMarshaller dmnMarshaller = new DMNMarshaller();
final JSIDMNDiagram diagram = mock(JSIDMNDiagram.class);
final List<String> dmnDiagramElementIds = mock(List.class);
final Definitions definitionsStunnerPojo = mock(Definitions.class);
final List<JSIDMNEdge> dmnEdges = new ArrayList<>();
final Node<?, ?> node = mock(Node.class);
final List inEdges = new ArrayList<>();
final Edge edge = mock(Edge.class);
final Node sourceNode = mock(Node.class);
final View sourceView = mock(View.class);
final ViewConnector viewConnector = mock(ViewConnector.class);
final DiscreteConnection sourceConnection = mock(DiscreteConnection.class);
final DiscreteConnection targetConnection = mock(DiscreteConnection.class);
final View<?> view = mock(View.class);
inEdges.add(edge);
when(edge.getSourceNode()).thenReturn(sourceNode);
when(sourceNode.getContent()).thenReturn(sourceView);
when(node.getInEdges()).thenReturn(inEdges);
when(edge.getContent()).thenReturn(viewConnector);
when(viewConnector.getControlPoints()).thenReturn(new ControlPoint[] {});
when(sourceConnection.isAuto()).thenReturn(true);
when(targetConnection.isAuto()).thenReturn(true);
when(diagram.getName()).thenReturn("dmnEdge");
when(definitionsStunnerPojo.getDefaultNamespace()).thenReturn("org.edge");
when(viewConnector.getSourceConnection()).thenReturn(Optional.of(sourceConnection));
when(viewConnector.getTargetConnection()).thenReturn(Optional.of(targetConnection));
dmnMarshaller.connect(diagram, dmnDiagramElementIds, definitionsStunnerPojo, dmnEdges, node, view);
when(viewConnector.getSourceConnection()).thenReturn(Optional.empty());
when(viewConnector.getTargetConnection()).thenReturn(Optional.empty());
dmnMarshaller.connect(diagram, dmnDiagramElementIds, definitionsStunnerPojo, dmnEdges, node, view);
when(viewConnector.getSourceConnection()).thenReturn(Optional.of(sourceConnection));
when(viewConnector.getTargetConnection()).thenReturn(Optional.empty());
dmnMarshaller.connect(diagram, dmnDiagramElementIds, definitionsStunnerPojo, dmnEdges, node, view);
verify(sourceConnection).isAuto();
verify(targetConnection).isAuto();
}
use of org.kie.workbench.common.dmn.api.definition.model.Definitions in project kie-wb-common by kiegroup.
the class DataTypesPageTest method testCurrentDMNModelNamespace.
@Test
public void testCurrentDMNModelNamespace() {
final Definitions definitions = mock(Definitions.class);
final Text text = mock(Text.class);
final String expected = "currentDMNModelNamespace";
when(text.getValue()).thenReturn(expected);
when(definitions.getNamespace()).thenReturn(text);
when(dmnGraphUtils.getModelDefinitions()).thenReturn(definitions);
final String actual = page.currentDMNModelNamespace();
assertEquals(expected, actual);
}
use of org.kie.workbench.common.dmn.api.definition.model.Definitions in project kie-wb-common by kiegroup.
the class DataTypesPageTest method testCurrentDMNModelNamespaceWhenNamespaceIsNull.
@Test
public void testCurrentDMNModelNamespaceWhenNamespaceIsNull() {
final Definitions definitions = mock(Definitions.class);
when(definitions.getNamespace()).thenReturn(null);
when(dmnGraphUtils.getModelDefinitions()).thenReturn(definitions);
final String actual = page.currentDMNModelNamespace();
final String expected = "";
assertEquals(expected, actual);
}
use of org.kie.workbench.common.dmn.api.definition.model.Definitions in project kie-wb-common by kiegroup.
the class DataTypeUtilsTest method makeModelDefinitions.
private Definitions makeModelDefinitions() {
final Definitions definitions = mock(Definitions.class);
final List<Import> imports = singletonList(makeImport());
when(definitions.getImport()).thenReturn(imports);
return definitions;
}
use of org.kie.workbench.common.dmn.api.definition.model.Definitions in project kie-wb-common by kiegroup.
the class IncludedModelsPageStateProviderImplTest method testGetCurrentDiagramNamespace.
@Test
public void testGetCurrentDiagramNamespace() {
final Definitions definitions = mock(Definitions.class);
final String expectedNamespace = "://namespace";
when(dmnGraphUtils.getDefinitions(diagram)).thenReturn(definitions);
when(definitions.getNamespace()).thenReturn(new Text(expectedNamespace));
final String actualNamespace = stateProvider.getCurrentDiagramNamespace();
assertEquals(expectedNamespace, actualNamespace);
}
Aggregations