use of org.kie.workbench.common.dmn.api.definition.model.InputData in project kie-wb-common by kiegroup.
the class DecisionTableEditorDefinitionEnricherTest method setupGraphWithInputData.
@SuppressWarnings("unchecked")
private void setupGraphWithInputData() {
Node<Definition, Edge> targetNode = graph.getNode(NODE_UUID);
if (Objects.isNull(targetNode)) {
targetNode = new NodeImpl<>(NODE_UUID);
graph.addNode(targetNode);
}
final Node<Definition, Edge> sourceNode1 = new NodeImpl<>(UUID.uuid());
final Node<Definition, Edge> sourceNode2 = new NodeImpl<>(UUID.uuid());
inputData1.getName().setValue(INPUT_DATA_NAME_1);
inputData2.getName().setValue(INPUT_DATA_NAME_2);
final QName inputData1QName = new QName(QName.NULL_NS_URI, STRING.getName());
final QName inputData2QName = new QName(QName.NULL_NS_URI, NUMBER.getName());
inputData1.getVariable().setTypeRef(inputData1QName);
inputData2.getVariable().setTypeRef(inputData2QName);
final Definition<InputData> sourceNode1Definition = new DefinitionImpl<>(inputData1);
final Definition<InputData> sourceNode2Definition = new DefinitionImpl<>(inputData2);
sourceNode1.setContent(sourceNode1Definition);
sourceNode2.setContent(sourceNode2Definition);
final Edge edge1 = new EdgeImpl<>(UUID.uuid());
final Edge edge2 = new EdgeImpl<>(UUID.uuid());
edge1.setTargetNode(targetNode);
edge1.setSourceNode(sourceNode1);
edge2.setTargetNode(targetNode);
edge2.setSourceNode(sourceNode2);
targetNode.getInEdges().add(edge1);
targetNode.getInEdges().add(edge2);
sourceNode1.getOutEdges().add(edge1);
sourceNode2.getOutEdges().add(edge2);
graph.addNode(sourceNode1);
graph.addNode(sourceNode2);
}
use of org.kie.workbench.common.dmn.api.definition.model.InputData 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());
}
Aggregations