Search in sources :

Example 21 with InputData

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

the class DMNIncludedModelHandlerTest method makeInputData.

private InputData makeInputData(final String name, final String type, final boolean allowOnlyVisualChange) {
    final InputData inputData = new InputData();
    setName(inputData, name);
    setType(inputData, type);
    inputData.setAllowOnlyVisualChange(allowOnlyVisualChange);
    return inputData;
}
Also used : InputData(org.kie.workbench.common.dmn.api.definition.model.InputData)

Example 22 with InputData

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

the class DefaultValueUtilitiesTest method testUpdateNewNodeName_DecisionService.

@Test
public void testUpdateNewNodeName_DecisionService() {
    // 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 KnowledgeSource()));
    final DecisionService decisionService1 = new DecisionService();
    final DecisionService decisionService2 = new DecisionService();
    final DecisionService decisionService3 = new DecisionService();
    final DecisionService decisionService4 = new DecisionService();
    assertUpdateNewNodeName(decisionService1, decisionService2, (decisionService) -> decisionService.getName().getValue(), () -> DecisionService.class.getSimpleName() + "-1", () -> DecisionService.class.getSimpleName() + "-2");
    // Update existing names manually and add two more
    decisionService1.getName().setValue("decisionService");
    decisionService2.getName().setValue(DecisionService.class.getSimpleName() + "-5");
    assertUpdateNewNodeName(decisionService3, decisionService4, (decisionService) -> decisionService.getName().getValue(), () -> DecisionService.class.getSimpleName() + "-6", () -> DecisionService.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) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) DecisionService(org.kie.workbench.common.dmn.api.definition.model.DecisionService) Test(org.junit.Test)

Example 23 with InputData

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

the class DefaultValueUtilitiesTest method testUpdateNewNodeName_InputData.

@Test
public void testUpdateNewNodeName_InputData() {
    // 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 KnowledgeSource()));
    graph.addNode(makeMockNode(new TextAnnotation()));
    final InputData inputData1 = new InputData();
    final InputData inputData2 = new InputData();
    final InputData inputData3 = new InputData();
    final InputData inputData4 = new InputData();
    assertUpdateNewNodeName(inputData1, inputData2, (inputData) -> inputData.getName().getValue(), () -> InputData.class.getSimpleName() + "-1", () -> InputData.class.getSimpleName() + "-2");
    // Update existing names manually and add two more
    inputData1.getName().setValue("inputData");
    inputData2.getName().setValue(InputData.class.getSimpleName() + "-5");
    assertUpdateNewNodeName(inputData3, inputData4, (inputData) -> inputData.getName().getValue(), () -> InputData.class.getSimpleName() + "-6", () -> InputData.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) TextAnnotation(org.kie.workbench.common.dmn.api.definition.model.TextAnnotation) InputData(org.kie.workbench.common.dmn.api.definition.model.InputData) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) Test(org.junit.Test)

Example 24 with InputData

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

the class DefaultValueUtilitiesTest method testUpdateNewNodeName_TextAnnotation.

@Test
public void testUpdateNewNodeName_TextAnnotation() {
    // 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 KnowledgeSource()));
    final TextAnnotation textAnnotation1 = new TextAnnotation();
    final TextAnnotation textAnnotation2 = new TextAnnotation();
    final TextAnnotation textAnnotation3 = new TextAnnotation();
    final TextAnnotation textAnnotation4 = new TextAnnotation();
    assertUpdateNewNodeName(textAnnotation1, textAnnotation2, (textAnnotation) -> textAnnotation.getText().getValue(), () -> TextAnnotation.class.getSimpleName() + "-1", () -> TextAnnotation.class.getSimpleName() + "-2");
    // Update existing names manually and add two more
    textAnnotation1.getText().setValue("textAnnotation");
    textAnnotation2.getText().setValue(TextAnnotation.class.getSimpleName() + "-5");
    assertUpdateNewNodeName(textAnnotation3, textAnnotation4, (textAnnotation) -> textAnnotation.getText().getValue(), () -> TextAnnotation.class.getSimpleName() + "-6", () -> TextAnnotation.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 25 with InputData

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

the class DecisionServiceParametersListWidgetTest method createInputData.

private InputData createInputData(final String name, final String type) {
    final InputData input = mock(InputData.class);
    final InformationItemPrimary variable = mock(InformationItemPrimary.class);
    final QName typeRef = mock(QName.class);
    when(input.getVariable()).thenReturn(variable);
    when(input.getName()).thenReturn(new Name(name));
    when(typeRef.getLocalPart()).thenReturn(type);
    when(variable.getTypeRef()).thenReturn(typeRef);
    return input;
}
Also used : InformationItemPrimary(org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) InputData(org.kie.workbench.common.dmn.api.definition.model.InputData) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) Name(org.kie.workbench.common.dmn.api.property.dmn.Name)

Aggregations

InputData (org.kie.workbench.common.dmn.api.definition.model.InputData)67 Test (org.junit.Test)42 Decision (org.kie.workbench.common.dmn.api.definition.model.Decision)37 View (org.kie.workbench.common.stunner.core.graph.content.view.View)26 Node (org.kie.workbench.common.stunner.core.graph.Node)22 Edge (org.kie.workbench.common.stunner.core.graph.Edge)21 DRGElement (org.kie.workbench.common.dmn.api.definition.model.DRGElement)17 KnowledgeSource (org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource)17 BusinessKnowledgeModel (org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel)15 DecisionService (org.kie.workbench.common.dmn.api.definition.model.DecisionService)15 ArrayList (java.util.ArrayList)14 List (java.util.List)14 InformationItemPrimary (org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary)13 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)13 TextAnnotation (org.kie.workbench.common.dmn.api.definition.model.TextAnnotation)12 Child (org.kie.workbench.common.stunner.core.graph.content.relationship.Child)11 Optional (java.util.Optional)9 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)8 Definition (org.kie.workbench.common.stunner.core.graph.content.definition.Definition)8 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)7