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());
}
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());
}
Aggregations