Search in sources :

Example 1 with TypedValue

use of org.camunda.bpm.engine.variable.value.TypedValue in project camunda-engine-dmn by camunda.

the class DmnDecisionResultTest method testSingleOutputUntypedValue.

@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testSingleOutputUntypedValue() {
    DmnDecisionResult decisionResult = evaluateWithMatchingRules(SINGLE_OUTPUT_VALUE);
    assertThat(decisionResult).hasSize(1);
    DmnDecisionResultEntries ruleResult = decisionResult.getFirstResult();
    TypedValue typedEntry = ruleResult.getEntryTyped("firstOutput");
    assertThat(typedEntry).isEqualTo(Variables.untypedValue("singleValue"));
    typedEntry = ruleResult.getEntryTyped("secondOutput");
    assertThat(typedEntry).isNull();
    typedEntry = ruleResult.getFirstEntryTyped();
    assertThat(typedEntry).isEqualTo(Variables.untypedValue("singleValue"));
    typedEntry = ruleResult.getSingleEntryTyped();
    assertThat(typedEntry).isEqualTo(Variables.untypedValue("singleValue"));
}
Also used : DmnDecisionResultEntries(org.camunda.bpm.dmn.engine.DmnDecisionResultEntries) DmnDecisionResult(org.camunda.bpm.dmn.engine.DmnDecisionResult) TypedValue(org.camunda.bpm.engine.variable.value.TypedValue) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 2 with TypedValue

use of org.camunda.bpm.engine.variable.value.TypedValue in project camunda-engine-dmn by camunda.

the class DmnDecisionTableResultTest method testSingleOutputUntypedValue.

@Test
@DecisionResource(resource = RESULT_TEST_DMN)
public void testSingleOutputUntypedValue() {
    DmnDecisionTableResult decisionResult = evaluateWithMatchingRules(SINGLE_OUTPUT_VALUE);
    assertThat(decisionResult).hasSize(1);
    DmnDecisionRuleResult ruleResult = decisionResult.getFirstResult();
    TypedValue typedEntry = ruleResult.getEntryTyped("firstOutput");
    assertThat(typedEntry).isEqualTo(Variables.untypedValue("singleValue"));
    typedEntry = ruleResult.getEntryTyped("secondOutput");
    assertThat(typedEntry).isNull();
    typedEntry = ruleResult.getFirstEntryTyped();
    assertThat(typedEntry).isEqualTo(Variables.untypedValue("singleValue"));
    typedEntry = ruleResult.getSingleEntryTyped();
    assertThat(typedEntry).isEqualTo(Variables.untypedValue("singleValue"));
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) DmnDecisionRuleResult(org.camunda.bpm.dmn.engine.DmnDecisionRuleResult) TypedValue(org.camunda.bpm.engine.variable.value.TypedValue) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 3 with TypedValue

use of org.camunda.bpm.engine.variable.value.TypedValue in project camunda-engine-dmn by camunda.

the class DmnDecisionTableResultTest method testSingleOutputTypedValue.

@Test
@DecisionResource(resource = RESULT_TEST_WITH_TYPES_DMN)
public void testSingleOutputTypedValue() {
    DmnDecisionTableResult decisionResult = evaluateWithMatchingRules(SINGLE_OUTPUT_VALUE);
    assertThat(decisionResult).hasSize(1);
    DmnDecisionRuleResult ruleResult = decisionResult.getFirstResult();
    TypedValue typedValue = ruleResult.getEntryTyped("firstOutput");
    assertThat(typedValue).isEqualTo(Variables.stringValue("singleValue"));
    typedValue = ruleResult.getEntryTyped("secondOutput");
    assertThat(typedValue).isNull();
    typedValue = ruleResult.getFirstEntryTyped();
    assertThat(typedValue).isEqualTo(Variables.stringValue("singleValue"));
    typedValue = ruleResult.getSingleEntryTyped();
    assertThat(typedValue).isEqualTo(Variables.stringValue("singleValue"));
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) DmnDecisionRuleResult(org.camunda.bpm.dmn.engine.DmnDecisionRuleResult) TypedValue(org.camunda.bpm.engine.variable.value.TypedValue) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest) DecisionResource(org.camunda.bpm.dmn.engine.test.DecisionResource)

Example 4 with TypedValue

use of org.camunda.bpm.engine.variable.value.TypedValue in project camunda-engine-dmn by camunda.

the class DmnDecisionRuleResultAssert method hasSingleEntryTyped.

public DmnDecisionRuleResultAssert hasSingleEntryTyped(TypedValue value) {
    hasSize(1);
    TypedValue actualValue = actual.getSingleEntryTyped();
    failIfTypedValuesAreNotEqual(value, actualValue);
    return this;
}
Also used : TypedValue(org.camunda.bpm.engine.variable.value.TypedValue)

Example 5 with TypedValue

use of org.camunda.bpm.engine.variable.value.TypedValue in project camunda-engine-dmn by camunda.

the class DmnDataTypeTransformerTest method booleanType.

@Test
public void booleanType() {
    DmnDataTypeTransformer typeTransformer = registry.getTransformer("boolean");
    assertThat(typeTransformer.transform(true), is((TypedValue) Variables.booleanValue(true)));
    assertThat(typeTransformer.transform(false), is((TypedValue) Variables.booleanValue(false)));
    assertThat(typeTransformer.transform("true"), is((TypedValue) Variables.booleanValue(true)));
    assertThat(typeTransformer.transform("false"), is((TypedValue) Variables.booleanValue(false)));
}
Also used : DmnDataTypeTransformer(org.camunda.bpm.dmn.engine.impl.spi.type.DmnDataTypeTransformer) TypedValue(org.camunda.bpm.engine.variable.value.TypedValue) Test(org.junit.Test) DmnEngineTest(org.camunda.bpm.dmn.engine.test.DmnEngineTest)

Aggregations

TypedValue (org.camunda.bpm.engine.variable.value.TypedValue)81 Test (org.junit.Test)25 Deployment (org.camunda.bpm.engine.test.Deployment)15 DmnEngineTest (org.camunda.bpm.dmn.engine.test.DmnEngineTest)14 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)11 DecisionResource (org.camunda.bpm.dmn.engine.test.DecisionResource)8 VariableMap (org.camunda.bpm.engine.variable.VariableMap)7 DmnDataTypeTransformer (org.camunda.bpm.dmn.engine.impl.spi.type.DmnDataTypeTransformer)6 BusinessProcess (org.camunda.bpm.engine.cdi.BusinessProcess)6 DmnDecisionResult (org.camunda.bpm.dmn.engine.DmnDecisionResult)4 DmnDecisionTableResult (org.camunda.bpm.dmn.engine.DmnDecisionTableResult)4 DmnExpressionImpl (org.camunda.bpm.dmn.engine.impl.DmnExpressionImpl)3 DeclarativeProcessController (org.camunda.bpm.engine.cdi.test.impl.beans.DeclarativeProcessController)3 RestException (org.camunda.bpm.engine.rest.exception.RestException)3 Task (org.camunda.bpm.engine.task.Task)3 ArrayList (java.util.ArrayList)2 DmnDecisionResultEntries (org.camunda.bpm.dmn.engine.DmnDecisionResultEntries)2 DmnDecisionRuleResult (org.camunda.bpm.dmn.engine.DmnDecisionRuleResult)2 AuthorizationException (org.camunda.bpm.engine.AuthorizationException)2 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)2