Search in sources :

Example 71 with DRGElement

use of org.kie.workbench.common.dmn.api.definition.model.DRGElement in project kie-wb-common by kiegroup.

the class DMNIncludedModelHandlerTest method testUpdate.

@Test
public void testUpdate() {
    final Decision drgElement1 = makeDecision("model1.tUUID", "string", true);
    final Decision drgElement2 = makeDecision("model1.imported person", "model1.tPerson", true);
    final InputData drgElement3 = makeInputData("local person", "model1.tPerson", false);
    final InputData drgElement4 = makeInputData("regular DRG Element", "boolean", false);
    setId(drgElement2, "model1.uuid");
    final List<DRGElement> drgElements = asList(drgElement1, drgElement2, drgElement3, drgElement4);
    doNothing().when(handler).updateDRGElementName(any(), Mockito.<String>any());
    when(dmnGraphUtils.getModelDRGElements()).thenReturn(drgElements);
    handler.update("model1", "model2");
    verify(handler).updateDRGElementName(drgElement1, "model2.tUUID");
    verify(handler).updateDRGElementName(drgElement2, "model2.imported person");
    assertEquals("string", drgElement1.getVariable().getTypeRef().getLocalPart());
    assertEquals("model2.uuid", drgElement2.getId().getValue());
    assertEquals("model2.tPerson", drgElement2.getVariable().getTypeRef().getLocalPart());
    assertEquals("model2.tPerson", drgElement3.getVariable().getTypeRef().getLocalPart());
    assertEquals("boolean", drgElement4.getVariable().getTypeRef().getLocalPart());
}
Also used : InputData(org.kie.workbench.common.dmn.api.definition.model.InputData) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) DRGElement(org.kie.workbench.common.dmn.api.definition.model.DRGElement) Test(org.junit.Test)

Example 72 with DRGElement

use of org.kie.workbench.common.dmn.api.definition.model.DRGElement in project kie-wb-common by kiegroup.

the class DMNIncludedModelHandlerTest method testDeleteDRGElement.

@Test
public void testDeleteDRGElement() {
    final DRGElement drgElement = mock(DRGElement.class);
    final AbstractCanvasHandler canvasHandler = mock(AbstractCanvasHandler.class);
    when(dmnGraphUtils.getCanvasHandler()).thenReturn(canvasHandler);
    doReturn(compositeCommand).when(handler).buildDeleteCommand(drgElement);
    handler.deleteDRGElement(drgElement);
    verify(sessionCommandManager).execute(canvasHandler, compositeCommand);
}
Also used : AbstractCanvasHandler(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler) DRGElement(org.kie.workbench.common.dmn.api.definition.model.DRGElement) Test(org.junit.Test)

Aggregations

DRGElement (org.kie.workbench.common.dmn.api.definition.model.DRGElement)72 Test (org.junit.Test)45 Node (org.kie.workbench.common.stunner.core.graph.Node)27 ArrayList (java.util.ArrayList)25 Edge (org.kie.workbench.common.stunner.core.graph.Edge)17 View (org.kie.workbench.common.stunner.core.graph.content.view.View)17 Decision (org.kie.workbench.common.dmn.api.definition.model.Decision)16 List (java.util.List)15 Definitions (org.kie.workbench.common.dmn.api.definition.model.Definitions)15 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)15 Definition (org.kie.workbench.common.stunner.core.graph.content.definition.Definition)15 InputData (org.kie.workbench.common.dmn.api.definition.model.InputData)14 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)13 DecisionService (org.kie.workbench.common.dmn.api.definition.model.DecisionService)10 BusinessKnowledgeModel (org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel)9 Import (org.kie.workbench.common.dmn.api.definition.model.Import)9 KnowledgeSource (org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource)8 KnowledgeRequirement (org.kie.workbench.common.dmn.api.definition.model.KnowledgeRequirement)7 JSITDefinitions (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDefinitions)7 Optional (java.util.Optional)6