Search in sources :

Example 46 with DecisionDefinition

use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.

the class MultiTenancyDecisionDefinitionQueryTest method testQueryByLatestWithTenantId.

public void testQueryByLatestWithTenantId() {
    // deploy a second version for tenant one
    deploymentForTenant(TENANT_ONE, DMN);
    DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY).latestVersion().tenantIdIn(TENANT_ONE);
    assertThat(query.count(), is(1L));
    DecisionDefinition decisionDefinition = query.singleResult();
    assertThat(decisionDefinition.getTenantId(), is(TENANT_ONE));
    assertThat(decisionDefinition.getVersion(), is(2));
    query = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY).latestVersion().tenantIdIn(TENANT_TWO);
    assertThat(query.count(), is(1L));
    decisionDefinition = query.singleResult();
    assertThat(decisionDefinition.getTenantId(), is(TENANT_TWO));
    assertThat(decisionDefinition.getVersion(), is(1));
}
Also used : DecisionDefinitionQuery(org.camunda.bpm.engine.repository.DecisionDefinitionQuery) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition)

Example 47 with DecisionDefinition

use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.

the class MultiTenancyDecisionDefinitionQueryTest method testQueryByLatestWithoutTenantId.

public void testQueryByLatestWithoutTenantId() {
    // deploy a second version without tenant id
    deployment(DMN);
    DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY).latestVersion().withoutTenantId();
    assertThat(query.count(), is(1L));
    DecisionDefinition decisionDefinition = query.singleResult();
    assertThat(decisionDefinition.getTenantId(), is(nullValue()));
    assertThat(decisionDefinition.getVersion(), is(2));
}
Also used : DecisionDefinitionQuery(org.camunda.bpm.engine.repository.DecisionDefinitionQuery) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition)

Example 48 with DecisionDefinition

use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.

the class HistoricDecisionInstanceAuthorizationTest method prepareDecisionInstances.

protected void prepareDecisionInstances(String key, int daysInThePast, Integer historyTimeToLive, int instanceCount) {
    DecisionDefinition decisionDefinition = selectDecisionDefinitionByKey(key);
    disableAuthorization();
    repositoryService.updateDecisionDefinitionHistoryTimeToLive(decisionDefinition.getId(), historyTimeToLive);
    enableAuthorization();
    Date oldCurrentTime = ClockUtil.getCurrentTime();
    ClockUtil.setCurrentTime(DateUtils.addDays(oldCurrentTime, daysInThePast));
    Map<String, Object> variables = Variables.createVariables().putValue("input1", null);
    for (int i = 0; i < instanceCount; i++) {
        disableAuthorization();
        decisionService.evaluateDecisionByKey(key).variables(variables).evaluate();
        enableAuthorization();
    }
    ClockUtil.setCurrentTime(oldCurrentTime);
}
Also used : DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition) Date(java.util.Date)

Example 49 with DecisionDefinition

use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.

the class VersionTagTest method testParsingNullVersionTagDecisionDefinition.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/repository/noVersionTag.dmn" })
public void testParsingNullVersionTagDecisionDefinition() {
    DecisionDefinition decision = repositoryService.createDecisionDefinitionQuery().orderByDecisionDefinitionVersion().asc().singleResult();
    assertEquals(null, decision.getVersionTag());
}
Also used : DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 50 with DecisionDefinition

use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.

the class DecisionDefinitionQueryTest method decisionDefinitionProperties.

@Test
public void decisionDefinitionProperties() {
    List<DecisionDefinition> decisionDefinitions = repositoryService.createDecisionDefinitionQuery().orderByDecisionDefinitionName().asc().orderByDecisionDefinitionVersion().asc().orderByDecisionDefinitionCategory().asc().list();
    DecisionDefinition decisionDefinition = decisionDefinitions.get(0);
    assertEquals("one", decisionDefinition.getKey());
    assertEquals("One", decisionDefinition.getName());
    assertTrue(decisionDefinition.getId().startsWith("one:1"));
    assertEquals("Examples", decisionDefinition.getCategory());
    assertEquals(1, decisionDefinition.getVersion());
    assertEquals("org/camunda/bpm/engine/test/repository/one.dmn", decisionDefinition.getResourceName());
    assertEquals(firstDeploymentId, decisionDefinition.getDeploymentId());
    decisionDefinition = decisionDefinitions.get(1);
    assertEquals("one", decisionDefinition.getKey());
    assertEquals("One", decisionDefinition.getName());
    assertTrue(decisionDefinition.getId().startsWith("one:2"));
    assertEquals("Examples", decisionDefinition.getCategory());
    assertEquals(2, decisionDefinition.getVersion());
    assertEquals("org/camunda/bpm/engine/test/repository/one.dmn", decisionDefinition.getResourceName());
    assertEquals(secondDeploymentId, decisionDefinition.getDeploymentId());
    decisionDefinition = decisionDefinitions.get(2);
    assertEquals("two", decisionDefinition.getKey());
    assertEquals("Two", decisionDefinition.getName());
    assertTrue(decisionDefinition.getId().startsWith("two:1"));
    assertEquals("Examples2", decisionDefinition.getCategory());
    assertEquals(1, decisionDefinition.getVersion());
    assertEquals("org/camunda/bpm/engine/test/repository/two.dmn", decisionDefinition.getResourceName());
    assertEquals(firstDeploymentId, decisionDefinition.getDeploymentId());
}
Also used : DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition) Test(org.junit.Test)

Aggregations

DecisionDefinition (org.camunda.bpm.engine.repository.DecisionDefinition)68 Test (org.junit.Test)21 Deployment (org.camunda.bpm.engine.test.Deployment)18 DecisionDefinitionQuery (org.camunda.bpm.engine.repository.DecisionDefinitionQuery)10 Date (java.util.Date)6 DmnDecisionTableResult (org.camunda.bpm.dmn.engine.DmnDecisionTableResult)5 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)5 InputStream (java.io.InputStream)4 ArrayList (java.util.ArrayList)4 DmnDecisionResult (org.camunda.bpm.dmn.engine.DmnDecisionResult)4 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)3 HistoricDecisionInstanceEntity (org.camunda.bpm.engine.impl.history.event.HistoricDecisionInstanceEntity)3 Response (com.jayway.restassured.response.Response)2 HistoricCaseInstance (org.camunda.bpm.engine.history.HistoricCaseInstance)2 HistoricDecisionInstanceQuery (org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery)2 HistoricDecisionOutputInstance (org.camunda.bpm.engine.history.HistoricDecisionOutputInstance)2 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)2 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)2 GetDeploymentResourceCmd (org.camunda.bpm.engine.impl.cmd.GetDeploymentResourceCmd)2 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)2