use of org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource in project kie-wb-common by kiegroup.
the class DefaultValueUtilitiesTest method testUpdateNewNodeName_KnowledgeSource.
@Test
public void testUpdateNewNodeName_KnowledgeSource() {
// Add some existing nodes to ensure naming is not affected by existing content
graph.addNode(makeMockNode(new BusinessKnowledgeModel()));
graph.addNode(makeMockNode(new Decision()));
graph.addNode(makeMockNode(new InputData()));
graph.addNode(makeMockNode(new TextAnnotation()));
final KnowledgeSource knowledgeSource1 = new KnowledgeSource();
final KnowledgeSource knowledgeSource2 = new KnowledgeSource();
final KnowledgeSource knowledgeSource3 = new KnowledgeSource();
final KnowledgeSource knowledgeSource4 = new KnowledgeSource();
assertUpdateNewNodeName(knowledgeSource1, knowledgeSource2, (knowledgeSource) -> knowledgeSource.getName().getValue(), () -> KnowledgeSource.class.getSimpleName() + "-1", () -> KnowledgeSource.class.getSimpleName() + "-2");
// Update existing names manually and add two more
knowledgeSource1.getName().setValue("knowledgeSource");
knowledgeSource2.getName().setValue(KnowledgeSource.class.getSimpleName() + "-5");
assertUpdateNewNodeName(knowledgeSource3, knowledgeSource4, (knowledgeSource) -> knowledgeSource.getName().getValue(), () -> KnowledgeSource.class.getSimpleName() + "-6", () -> KnowledgeSource.class.getSimpleName() + "-7");
}
use of org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource in project kie-wb-common by kiegroup.
the class DefaultValueUtilitiesTest method testUpdateNewNodeName_Decision.
@Test
public void testUpdateNewNodeName_Decision() {
// Add some existing nodes to ensure naming is not affected by existing content
graph.addNode(makeMockNode(new BusinessKnowledgeModel()));
graph.addNode(makeMockNode(new InputData()));
graph.addNode(makeMockNode(new KnowledgeSource()));
graph.addNode(makeMockNode(new TextAnnotation()));
final Decision decision1 = new Decision();
final Decision decision2 = new Decision();
final Decision decision3 = new Decision();
final Decision decision4 = new Decision();
assertUpdateNewNodeName(decision1, decision2, (decision) -> decision.getName().getValue(), () -> Decision.class.getSimpleName() + "-1", () -> Decision.class.getSimpleName() + "-2");
// Update existing names manually and add two more
decision1.getName().setValue("decision");
decision2.getName().setValue(Decision.class.getSimpleName() + "-5");
assertUpdateNewNodeName(decision3, decision4, (decision) -> decision.getName().getValue(), () -> Decision.class.getSimpleName() + "-6", () -> Decision.class.getSimpleName() + "-7");
}
use of org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource in project kie-wb-common by kiegroup.
the class DefaultValueUtilitiesTest method testUpdateNewNodeName_BusinessKnowledgeModel.
@Test
public void testUpdateNewNodeName_BusinessKnowledgeModel() {
// Add some existing nodes to ensure naming is not affected by existing content
graph.addNode(makeMockNode(new Decision()));
graph.addNode(makeMockNode(new InputData()));
graph.addNode(makeMockNode(new KnowledgeSource()));
graph.addNode(makeMockNode(new TextAnnotation()));
final BusinessKnowledgeModel bkm1 = new BusinessKnowledgeModel();
final BusinessKnowledgeModel bkm2 = new BusinessKnowledgeModel();
final BusinessKnowledgeModel bkm3 = new BusinessKnowledgeModel();
final BusinessKnowledgeModel bkm4 = new BusinessKnowledgeModel();
assertUpdateNewNodeName(bkm1, bkm2, (bkm) -> bkm.getName().getValue(), () -> BusinessKnowledgeModel.class.getSimpleName() + "-1", () -> BusinessKnowledgeModel.class.getSimpleName() + "-2");
// Update existing names manually and add two more
bkm1.getName().setValue("bkm");
bkm2.getName().setValue(BusinessKnowledgeModel.class.getSimpleName() + "-5");
assertUpdateNewNodeName(bkm3, bkm4, (bkm) -> bkm.getName().getValue(), () -> BusinessKnowledgeModel.class.getSimpleName() + "-6", () -> BusinessKnowledgeModel.class.getSimpleName() + "-7");
}
use of org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource in project kie-wb-common by kiegroup.
the class DMNElementsSynchronizerTest method testSynchronizeKnowledgeSourceNode.
@Test
public void testSynchronizeKnowledgeSourceNode() {
final KnowledgeSource from = mock(KnowledgeSource.class);
final KnowledgeSource to = mock(KnowledgeSource.class);
final KnowledgeSourceType type = mock(KnowledgeSourceType.class);
final LocationURI locationURI = mock(LocationURI.class);
when(from.getType()).thenReturn(type);
when(from.getLocationURI()).thenReturn(locationURI);
synchronizer.synchronizeKnowledgeSourceNode(from, to);
verify(to).setType(type);
verify(to).setLocationURI(locationURI);
}
use of org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource in project kie-wb-common by kiegroup.
the class DMNElementsSynchronizerTest method testSynchronizeSpecializedProperties_KnowledgeSourceNode.
@Test
public void testSynchronizeSpecializedProperties_KnowledgeSourceNode() {
doNothing().when(synchronizer).synchronizeKnowledgeSourceNode(any(KnowledgeSource.class), any(KnowledgeSource.class));
final KnowledgeSource from = mock(KnowledgeSource.class);
final KnowledgeSource to = mock(KnowledgeSource.class);
synchronizer.synchronizeSpecializedProperties(from, to);
verify(synchronizer).synchronizeKnowledgeSourceNode(from, to);
}
Aggregations