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