Search in sources :

Example 6 with Decision

use of org.camunda.bpm.model.dmn.instance.Decision in project camunda-dmn-model by camunda.

the class CamundaExtensionsTest method testCamundaVersionTag.

@Test
public void testCamundaVersionTag() {
    Decision decision = modelInstance.getModelElementById("decision");
    assertThat(decision.getVersionTag()).isEqualTo("1.0.0");
    decision.setVersionTag("1.1.0");
    assertThat(decision.getVersionTag()).isEqualTo("1.1.0");
}
Also used : Decision(org.camunda.bpm.model.dmn.instance.Decision) Test(org.junit.Test)

Example 7 with Decision

use of org.camunda.bpm.model.dmn.instance.Decision in project camunda-dmn-model by camunda.

the class CamundaExtensionsTest method testCamundaHistoryTimeToLive.

@Test
public void testCamundaHistoryTimeToLive() {
    Decision decision = modelInstance.getModelElementById("decision");
    assertThat(decision.getCamundaHistoryTimeToLive()).isEqualTo(5);
    decision.setCamundaHistoryTimeToLive(6);
    assertThat(decision.getCamundaHistoryTimeToLive()).isEqualTo(6);
}
Also used : Decision(org.camunda.bpm.model.dmn.instance.Decision) Test(org.junit.Test)

Example 8 with Decision

use of org.camunda.bpm.model.dmn.instance.Decision in project camunda-dmn-model by camunda.

the class ExpressionLanguageTest method shouldWriteExpressionLanguage.

@Test
public void shouldWriteExpressionLanguage() throws Exception {
    modelInstance = Dmn.createEmptyModel();
    Definitions definitions = generateNamedElement(Definitions.class, "definitions");
    definitions.setNamespace(TEST_NAMESPACE);
    definitions.setExpressionLanguage(EXPRESSION_LANGUAGE);
    modelInstance.setDocumentElement(definitions);
    Decision decision = generateNamedElement(Decision.class, "Check Order");
    definitions.addChildElement(decision);
    DecisionTable decisionTable = generateElement(DecisionTable.class);
    decision.addChildElement(decisionTable);
    Input input = generateElement(Input.class);
    decisionTable.getInputs().add(input);
    InputExpression inputExpression = generateElement(InputExpression.class);
    inputExpression.setExpressionLanguage(EXPRESSION_LANGUAGE);
    input.setInputExpression(inputExpression);
    InputValues inputValues = generateElement(InputValues.class);
    inputValues.setExpressionLanguage(EXPRESSION_LANGUAGE);
    inputValues.setText(generateElement(Text.class));
    input.setInputValues(inputValues);
    Output output = generateElement(Output.class);
    decisionTable.getOutputs().add(output);
    OutputValues outputValues = generateElement(OutputValues.class);
    outputValues.setExpressionLanguage(EXPRESSION_LANGUAGE);
    outputValues.setText(generateElement(Text.class));
    output.setOutputValues(outputValues);
    Rule rule = generateElement(Rule.class);
    decisionTable.getRules().add(rule);
    InputEntry inputEntry = generateElement(InputEntry.class);
    inputEntry.setExpressionLanguage(EXPRESSION_LANGUAGE);
    inputEntry.setText(generateElement(Text.class));
    rule.getInputEntries().add(inputEntry);
    OutputEntry outputEntry = generateElement(OutputEntry.class);
    outputEntry.setExpressionLanguage(EXPRESSION_LANGUAGE);
    rule.getOutputEntries().add(outputEntry);
    assertModelEqualsFile(EXPRESSION_LANGUAGE_DMN);
}
Also used : DecisionTable(org.camunda.bpm.model.dmn.instance.DecisionTable) InputValues(org.camunda.bpm.model.dmn.instance.InputValues) Input(org.camunda.bpm.model.dmn.instance.Input) OutputEntry(org.camunda.bpm.model.dmn.instance.OutputEntry) OutputValues(org.camunda.bpm.model.dmn.instance.OutputValues) Definitions(org.camunda.bpm.model.dmn.instance.Definitions) Output(org.camunda.bpm.model.dmn.instance.Output) Text(org.camunda.bpm.model.dmn.instance.Text) Rule(org.camunda.bpm.model.dmn.instance.Rule) InputExpression(org.camunda.bpm.model.dmn.instance.InputExpression) Decision(org.camunda.bpm.model.dmn.instance.Decision) InputEntry(org.camunda.bpm.model.dmn.instance.InputEntry) Test(org.junit.Test)

Example 9 with Decision

use of org.camunda.bpm.model.dmn.instance.Decision in project camunda-bpm-platform by camunda.

the class DecisionDefinitionDeployerTest method createDmnModelInstanceNegativeHistoryTimeToLive.

protected static DmnModelInstance createDmnModelInstanceNegativeHistoryTimeToLive() {
    DmnModelInstance modelInstance = Dmn.createEmptyModel();
    Definitions definitions = modelInstance.newInstance(Definitions.class);
    definitions.setId(DmnModelConstants.DMN_ELEMENT_DEFINITIONS);
    definitions.setName(DmnModelConstants.DMN_ELEMENT_DEFINITIONS);
    definitions.setNamespace(DmnModelConstants.CAMUNDA_NS);
    modelInstance.setDefinitions(definitions);
    Decision decision = modelInstance.newInstance(Decision.class);
    decision.setId("Decision-1");
    decision.setName("foo");
    decision.setCamundaHistoryTimeToLive(-5);
    modelInstance.getDefinitions().addChildElement(decision);
    return modelInstance;
}
Also used : Definitions(org.camunda.bpm.model.dmn.instance.Definitions) Decision(org.camunda.bpm.model.dmn.instance.Decision) DmnModelInstance(org.camunda.bpm.model.dmn.DmnModelInstance)

Example 10 with Decision

use of org.camunda.bpm.model.dmn.instance.Decision in project camunda-bpm-platform by camunda.

the class DecisionDefinitionDeployerTest method createDmnModelInstance.

protected static DmnModelInstance createDmnModelInstance() {
    DmnModelInstance modelInstance = Dmn.createEmptyModel();
    Definitions definitions = modelInstance.newInstance(Definitions.class);
    definitions.setId(DmnModelConstants.DMN_ELEMENT_DEFINITIONS);
    definitions.setName(DmnModelConstants.DMN_ELEMENT_DEFINITIONS);
    definitions.setNamespace(DmnModelConstants.CAMUNDA_NS);
    modelInstance.setDefinitions(definitions);
    Decision decision = modelInstance.newInstance(Decision.class);
    decision.setId("Decision-1");
    decision.setName("foo");
    decision.setCamundaHistoryTimeToLive(5);
    modelInstance.getDefinitions().addChildElement(decision);
    DecisionTable decisionTable = modelInstance.newInstance(DecisionTable.class);
    decisionTable.setId(DmnModelConstants.DMN_ELEMENT_DECISION_TABLE);
    decisionTable.setHitPolicy(HitPolicy.FIRST);
    decision.addChildElement(decisionTable);
    Input input = modelInstance.newInstance(Input.class);
    input.setId("Input-1");
    input.setLabel("Input");
    decisionTable.addChildElement(input);
    InputExpression inputExpression = modelInstance.newInstance(InputExpression.class);
    inputExpression.setId("InputExpression-1");
    Text inputExpressionText = modelInstance.newInstance(Text.class);
    inputExpressionText.setTextContent("input");
    inputExpression.setText(inputExpressionText);
    inputExpression.setTypeRef("string");
    input.setInputExpression(inputExpression);
    Output output = modelInstance.newInstance(Output.class);
    output.setName("output");
    output.setLabel("Output");
    output.setTypeRef("string");
    decisionTable.addChildElement(output);
    return modelInstance;
}
Also used : DecisionTable(org.camunda.bpm.model.dmn.instance.DecisionTable) Input(org.camunda.bpm.model.dmn.instance.Input) Definitions(org.camunda.bpm.model.dmn.instance.Definitions) Output(org.camunda.bpm.model.dmn.instance.Output) Text(org.camunda.bpm.model.dmn.instance.Text) InputExpression(org.camunda.bpm.model.dmn.instance.InputExpression) Decision(org.camunda.bpm.model.dmn.instance.Decision) DmnModelInstance(org.camunda.bpm.model.dmn.DmnModelInstance)

Aggregations

Decision (org.camunda.bpm.model.dmn.instance.Decision)18 Definitions (org.camunda.bpm.model.dmn.instance.Definitions)9 DecisionTable (org.camunda.bpm.model.dmn.instance.DecisionTable)8 Test (org.junit.Test)8 DmnDecision (org.camunda.bpm.dmn.engine.DmnDecision)7 Output (org.camunda.bpm.model.dmn.instance.Output)7 Input (org.camunda.bpm.model.dmn.instance.Input)5 InputExpression (org.camunda.bpm.model.dmn.instance.InputExpression)5 ArrayList (java.util.ArrayList)4 DmnModelInstance (org.camunda.bpm.model.dmn.DmnModelInstance)4 Rule (org.camunda.bpm.model.dmn.instance.Rule)4 DmnDecisionImpl (org.camunda.bpm.dmn.engine.impl.DmnDecisionImpl)3 InputEntry (org.camunda.bpm.model.dmn.instance.InputEntry)3 InputValues (org.camunda.bpm.model.dmn.instance.InputValues)3 OutputEntry (org.camunda.bpm.model.dmn.instance.OutputEntry)3 OutputValues (org.camunda.bpm.model.dmn.instance.OutputValues)3 Text (org.camunda.bpm.model.dmn.instance.Text)3 DrgElement (org.camunda.bpm.model.dmn.instance.DrgElement)2 InputStream (java.io.InputStream)1 List (java.util.List)1