Search in sources :

Example 1 with DMNDiagramUtils

use of org.kie.workbench.common.dmn.api.graph.DMNDiagramUtils in project kie-wb-common by kiegroup.

the class DMNMarshallerStandaloneTest method checkImports.

@SuppressWarnings("unchecked")
private void checkImports(final Graph<?, Node<?, ?>> graph) {
    assertNotNull(graph);
    final DMNDiagramUtils utils = new DMNDiagramUtils();
    final Diagram mockDiagram = mock(Diagram.class);
    when(mockDiagram.getGraph()).thenReturn(graph);
    final org.kie.workbench.common.dmn.api.definition.model.Definitions definitions = utils.getDefinitions(mockDiagram);
    final List<org.kie.workbench.common.dmn.api.definition.model.Import> imports = definitions.getImport();
    assertTrue(imports.get(0) instanceof ImportDMN);
    assertTrue(imports.get(1) instanceof ImportPMML);
    final ImportDMN dmnImport = (ImportDMN) imports.get(0);
    assertEquals("dmn-import", dmnImport.getName().getValue());
    assertEquals("https://kiegroup.org/dmn/_46EB0D0D-7241-4629-A38E-0377AA5B32D1", dmnImport.getNamespace());
    assertEquals(DMNImportTypes.DMN.getDefaultNamespace(), dmnImport.getImportType());
    final ImportPMML pmmlImport = (ImportPMML) imports.get(1);
    assertEquals("pmml-import", pmmlImport.getName().getValue());
    assertEquals("pmml-import", pmmlImport.getNamespace());
    assertEquals(DMNImportTypes.PMML.getDefaultNamespace(), pmmlImport.getImportType());
}
Also used : Import(org.kie.dmn.model.api.Import) ImportDMN(org.kie.workbench.common.dmn.api.definition.model.ImportDMN) DMNDiagramUtils(org.kie.workbench.common.dmn.api.graph.DMNDiagramUtils) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) DMNDiagram(org.kie.workbench.common.dmn.api.definition.model.DMNDiagram) ImportPMML(org.kie.workbench.common.dmn.api.definition.model.ImportPMML)

Example 2 with DMNDiagramUtils

use of org.kie.workbench.common.dmn.api.graph.DMNDiagramUtils in project kie-wb-common by kiegroup.

the class BaseDecisionTableEditorDefinitionTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    when(sessionManager.getCurrentSession()).thenReturn(session);
    when(session.getGridPanel()).thenReturn(gridPanel);
    when(session.getGridLayer()).thenReturn(gridLayer);
    when(session.getCellEditorControls()).thenReturn(cellEditorControls);
    when(session.getCanvasHandler()).thenReturn(canvasHandler);
    this.definition = new DecisionTableEditorDefinition(definitionUtils, sessionManager, sessionCommandManager, canvasCommandFactory, editorSelectedEvent, refreshFormPropertiesEvent, domainObjectSelectionEvent, listSelector, translationService, hitPolicyEditor, headerEditors, new DecisionTableEditorDefinitionEnricher(sessionManager, new DMNGraphUtils(sessionManager, new DMNDiagramUtils(), dmnDiagramsSession), itemDefinitionUtils), readOnlyProvider);
    when(session.getCanvasHandler()).thenReturn(canvasHandler);
    when(canvasHandler.getDiagram()).thenReturn(diagram);
    when(dmnDiagramsSession.getDRGDiagram()).thenReturn(diagram);
    when(diagram.getGraph()).thenReturn(graph);
    when(headerEditors.get()).thenReturn(headerEditor);
    doAnswer((i) -> i.getArguments()[0].toString()).when(translationService).format(Mockito.<String>any());
    doAnswer((i) -> i.getArguments()[0].toString()).when(translationService).getTranslation(Mockito.<String>any());
}
Also used : DMNGraphUtils(org.kie.workbench.common.dmn.client.graph.DMNGraphUtils) DMNDiagramUtils(org.kie.workbench.common.dmn.api.graph.DMNDiagramUtils) Before(org.junit.Before)

Aggregations

DMNDiagramUtils (org.kie.workbench.common.dmn.api.graph.DMNDiagramUtils)2 Before (org.junit.Before)1 Import (org.kie.dmn.model.api.Import)1 DMNDiagram (org.kie.workbench.common.dmn.api.definition.model.DMNDiagram)1 ImportDMN (org.kie.workbench.common.dmn.api.definition.model.ImportDMN)1 ImportPMML (org.kie.workbench.common.dmn.api.definition.model.ImportPMML)1 DMNGraphUtils (org.kie.workbench.common.dmn.client.graph.DMNGraphUtils)1 Diagram (org.kie.workbench.common.stunner.core.diagram.Diagram)1