Search in sources :

Example 16 with KnowledgeSource

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");
}
Also used : KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) BusinessKnowledgeModel(org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel) InputData(org.kie.workbench.common.dmn.api.definition.model.InputData) TextAnnotation(org.kie.workbench.common.dmn.api.definition.model.TextAnnotation) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) Test(org.junit.Test)

Example 17 with KnowledgeSource

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");
}
Also used : KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) BusinessKnowledgeModel(org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel) InputData(org.kie.workbench.common.dmn.api.definition.model.InputData) TextAnnotation(org.kie.workbench.common.dmn.api.definition.model.TextAnnotation) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) Test(org.junit.Test)

Example 18 with KnowledgeSource

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");
}
Also used : KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) BusinessKnowledgeModel(org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel) InputData(org.kie.workbench.common.dmn.api.definition.model.InputData) TextAnnotation(org.kie.workbench.common.dmn.api.definition.model.TextAnnotation) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) Test(org.junit.Test)

Example 19 with KnowledgeSource

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);
}
Also used : LocationURI(org.kie.workbench.common.dmn.api.property.dmn.LocationURI) KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) KnowledgeSourceType(org.kie.workbench.common.dmn.api.property.dmn.KnowledgeSourceType) Test(org.junit.Test)

Example 20 with KnowledgeSource

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);
}
Also used : KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) Test(org.junit.Test)

Aggregations

KnowledgeSource (org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource)23 BusinessKnowledgeModel (org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel)16 Decision (org.kie.workbench.common.dmn.api.definition.model.Decision)16 InputData (org.kie.workbench.common.dmn.api.definition.model.InputData)16 Test (org.junit.Test)11 TextAnnotation (org.kie.workbench.common.dmn.api.definition.model.TextAnnotation)11 View (org.kie.workbench.common.stunner.core.graph.content.view.View)10 DecisionService (org.kie.workbench.common.dmn.api.definition.model.DecisionService)9 List (java.util.List)8 DRGElement (org.kie.workbench.common.dmn.api.definition.model.DRGElement)8 Edge (org.kie.workbench.common.stunner.core.graph.Edge)7 ArrayList (java.util.ArrayList)5 KnowledgeRequirement (org.kie.workbench.common.dmn.api.definition.model.KnowledgeRequirement)5 Node (org.kie.workbench.common.stunner.core.graph.Node)5 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)4 StylingSet (org.kie.workbench.common.dmn.api.property.styling.StylingSet)4 BindableAdapterUtils.getDefinitionId (org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils.getDefinitionId)4 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)3 KnowledgeSourceType (org.kie.workbench.common.dmn.api.property.dmn.KnowledgeSourceType)3 LocationURI (org.kie.workbench.common.dmn.api.property.dmn.LocationURI)3