Search in sources :

Example 26 with DmnDecisionTableResult

use of org.camunda.bpm.dmn.engine.DmnDecisionTableResult in project camunda-bpm-platform by camunda.

the class MultiTenancyDecisionTableEvaluationTest method testEvaluateDecisionByKeyWithoutTenantIdNoAuthenticatedTenants.

public void testEvaluateDecisionByKeyWithoutTenantIdNoAuthenticatedTenants() {
    identityService.setAuthentication("user", null, null);
    deployment(DMN_FILE);
    DmnDecisionTableResult decisionResult = decisionService.evaluateDecisionTableByKey(DECISION_DEFINITION_KEY).decisionDefinitionWithoutTenantId().variables(createVariables()).evaluate();
    assertThatDecisionHasResult(decisionResult, RESULT_OF_FIRST_VERSION);
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult)

Example 27 with DmnDecisionTableResult

use of org.camunda.bpm.dmn.engine.DmnDecisionTableResult in project camunda-bpm-platform by camunda.

the class MultiTenancyDecisionTableEvaluationTest method testEvaluateDecisionByKeyWithTenantIdAuthenticatedTenant.

public void testEvaluateDecisionByKeyWithTenantIdAuthenticatedTenant() {
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
    deploymentForTenant(TENANT_ONE, DMN_FILE);
    deploymentForTenant(TENANT_TWO, DMN_FILE);
    DmnDecisionTableResult decisionResult = decisionService.evaluateDecisionTableByKey(DECISION_DEFINITION_KEY).decisionDefinitionTenantId(TENANT_ONE).variables(createVariables()).evaluate();
    assertThatDecisionHasResult(decisionResult, RESULT_OF_FIRST_VERSION);
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult)

Example 28 with DmnDecisionTableResult

use of org.camunda.bpm.dmn.engine.DmnDecisionTableResult in project camunda-bpm-platform by camunda.

the class EvaluateDecisionAuthorizationTest method evaluateDecisionById.

@Test
@Deployment(resources = DMN_FILE)
public void evaluateDecisionById() {
    // given
    DecisionDefinition decisionDefinition = engineRule.getRepositoryService().createDecisionDefinitionQuery().singleResult();
    // when
    authRule.init(scenario).withUser("userId").bindResource("decisionDefinitionKey", DECISION_DEFINITION_KEY).start();
    DmnDecisionTableResult decisionResult = engineRule.getDecisionService().evaluateDecisionTableById(decisionDefinition.getId(), createVariables());
    // then
    if (authRule.assertScenario(scenario)) {
        assertThatDecisionHasExpectedResult(decisionResult);
    }
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 29 with DmnDecisionTableResult

use of org.camunda.bpm.dmn.engine.DmnDecisionTableResult in project camunda-bpm-platform by camunda.

the class EvaluateDecisionAuthorizationTest method evaluateDecisionByKey.

@Test
@Deployment(resources = DMN_FILE)
public void evaluateDecisionByKey() {
    // given
    DecisionDefinition decisionDefinition = engineRule.getRepositoryService().createDecisionDefinitionQuery().singleResult();
    // when
    authRule.init(scenario).withUser("userId").bindResource("decisionDefinitionKey", DECISION_DEFINITION_KEY).start();
    DmnDecisionTableResult decisionResult = engineRule.getDecisionService().evaluateDecisionTableByKey(decisionDefinition.getKey(), createVariables());
    // then
    if (authRule.assertScenario(scenario)) {
        assertThatDecisionHasExpectedResult(decisionResult);
    }
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 30 with DmnDecisionTableResult

use of org.camunda.bpm.dmn.engine.DmnDecisionTableResult in project camunda-bpm-platform by camunda.

the class EvaluateDecisionAuthorizationTest method evaluateDecisionByKeyAndVersion.

@Test
@Deployment(resources = DMN_FILE)
public void evaluateDecisionByKeyAndVersion() {
    // given
    DecisionDefinition decisionDefinition = engineRule.getRepositoryService().createDecisionDefinitionQuery().singleResult();
    // when
    authRule.init(scenario).withUser("userId").bindResource("decisionDefinitionKey", DECISION_DEFINITION_KEY).start();
    DmnDecisionTableResult decisionResult = engineRule.getDecisionService().evaluateDecisionTableByKeyAndVersion(decisionDefinition.getKey(), decisionDefinition.getVersion(), createVariables());
    // then
    if (authRule.assertScenario(scenario)) {
        assertThatDecisionHasExpectedResult(decisionResult);
    }
}
Also used : DmnDecisionTableResult(org.camunda.bpm.dmn.engine.DmnDecisionTableResult) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

DmnDecisionTableResult (org.camunda.bpm.dmn.engine.DmnDecisionTableResult)56 Test (org.junit.Test)44 DmnEngineTest (org.camunda.bpm.dmn.engine.test.DmnEngineTest)33 DecisionResource (org.camunda.bpm.dmn.engine.test.DecisionResource)20 Deployment (org.camunda.bpm.engine.test.Deployment)9 DmnDecisionRuleResult (org.camunda.bpm.dmn.engine.DmnDecisionRuleResult)5 DecisionDefinition (org.camunda.bpm.engine.repository.DecisionDefinition)5 Map (java.util.Map)4 TypedValue (org.camunda.bpm.engine.variable.value.TypedValue)4 DmnDecisionResultException (org.camunda.bpm.dmn.engine.impl.DmnDecisionResultException)2 AbstractFoxPlatformIntegrationTest (org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)2 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)2 DmnDecisionRequirementsGraph (org.camunda.bpm.dmn.engine.DmnDecisionRequirementsGraph)1 DecisionService (org.camunda.bpm.engine.DecisionService)1 VariableMap (org.camunda.bpm.engine.variable.VariableMap)1 Deployment (org.jboss.arquillian.container.test.api.Deployment)1