Search in sources :

Example 36 with HistoricDecisionInstanceQuery

use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.

the class HistoricDecisionInstanceQueryTest method testQueryByRootDecisionInstanceId.

@Deployment(resources = { DRG_DMN })
public void testQueryByRootDecisionInstanceId() {
    decisionService.evaluateDecisionTableByKey(DISH_DECISION).variables(Variables.createVariables().putValue("temperature", 21).putValue("dayType", "Weekend")).evaluate();
    HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery();
    assertThat(query.count(), is(3L));
    String rootDecisionInstanceId = query.decisionDefinitionKey(DISH_DECISION).singleResult().getId();
    String requiredDecisionInstanceId1 = query.decisionDefinitionKey("season").singleResult().getId();
    String requiredDecisionInstanceId2 = query.decisionDefinitionKey("guestCount").singleResult().getId();
    query = historyService.createHistoricDecisionInstanceQuery();
    assertThat(query.rootDecisionInstanceId(rootDecisionInstanceId).count(), is(3L));
    assertThat(query.rootDecisionInstanceId(requiredDecisionInstanceId1).count(), is(0L));
    assertThat(query.rootDecisionInstanceId(requiredDecisionInstanceId2).count(), is(0L));
}
Also used : NativeHistoricDecisionInstanceQuery(org.camunda.bpm.engine.history.NativeHistoricDecisionInstanceQuery) HistoricDecisionInstanceQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 37 with HistoricDecisionInstanceQuery

use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.

the class HistoricDecisionInstanceQueryTest method testQueryIncludeInputsForNonExistingDecision.

@Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN })
public void testQueryIncludeInputsForNonExistingDecision() {
    HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().includeInputs();
    assertThat(query.singleResult(), is(nullValue()));
    startProcessInstanceAndEvaluateDecision();
    assertThat(query.decisionInstanceId("nonExisting").singleResult(), is(nullValue()));
}
Also used : NativeHistoricDecisionInstanceQuery(org.camunda.bpm.engine.history.NativeHistoricDecisionInstanceQuery) HistoricDecisionInstanceQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 38 with HistoricDecisionInstanceQuery

use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.

the class HistoricDecisionInstanceQueryTest method testQueryByInvalidCaseInstanceId.

public void testQueryByInvalidCaseInstanceId() {
    HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery();
    assertThat(query.caseInstanceId("invalid").count(), is(0L));
    try {
        query.caseInstanceId(null);
        fail("exception expected");
    } catch (ProcessEngineException e) {
    }
}
Also used : NativeHistoricDecisionInstanceQuery(org.camunda.bpm.engine.history.NativeHistoricDecisionInstanceQuery) HistoricDecisionInstanceQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 39 with HistoricDecisionInstanceQuery

use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.

the class HistoricDecisionInstanceQueryTest method testQueryByProcessDefinitionId.

@Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN })
public void testQueryByProcessDefinitionId() {
    String processDefinitionId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
    startProcessInstanceAndEvaluateDecision();
    HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery();
    assertThat(query.processDefinitionId(processDefinitionId).count(), is(1L));
    assertThat(query.processDefinitionId("other process").count(), is(0L));
}
Also used : NativeHistoricDecisionInstanceQuery(org.camunda.bpm.engine.history.NativeHistoricDecisionInstanceQuery) HistoricDecisionInstanceQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 40 with HistoricDecisionInstanceQuery

use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.

the class HistoricDecisionInstanceQueryTest method testQueryByDecisionInstanceIds.

@Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN })
public void testQueryByDecisionInstanceIds() {
    ProcessInstance pi1 = startProcessInstanceAndEvaluateDecision();
    ProcessInstance pi2 = startProcessInstanceAndEvaluateDecision();
    String decisionInstanceId1 = historyService.createHistoricDecisionInstanceQuery().processInstanceId(pi1.getId()).singleResult().getId();
    String decisionInstanceId2 = historyService.createHistoricDecisionInstanceQuery().processInstanceId(pi2.getId()).singleResult().getId();
    HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery();
    assertThat(query.decisionInstanceIdIn(decisionInstanceId1).count(), is(1L));
    assertThat(query.decisionInstanceIdIn(decisionInstanceId2).count(), is(1L));
    assertThat(query.decisionInstanceIdIn(decisionInstanceId1, decisionInstanceId2).count(), is(2L));
}
Also used : ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) NativeHistoricDecisionInstanceQuery(org.camunda.bpm.engine.history.NativeHistoricDecisionInstanceQuery) HistoricDecisionInstanceQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

HistoricDecisionInstanceQuery (org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery)82 Deployment (org.camunda.bpm.engine.test.Deployment)37 NativeHistoricDecisionInstanceQuery (org.camunda.bpm.engine.history.NativeHistoricDecisionInstanceQuery)36 Test (org.junit.Test)22 Batch (org.camunda.bpm.engine.batch.Batch)17 Job (org.camunda.bpm.engine.runtime.Job)9 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)7 HistoricDecisionInstance (org.camunda.bpm.engine.history.HistoricDecisionInstance)7 JobDefinition (org.camunda.bpm.engine.management.JobDefinition)6 AbstractRestServiceTest (org.camunda.bpm.engine.rest.AbstractRestServiceTest)4 Response (com.jayway.restassured.response.Response)3 HashMap (java.util.HashMap)3 HistoricBatch (org.camunda.bpm.engine.batch.history.HistoricBatch)3 Matchers.anyString (org.mockito.Matchers.anyString)3 Date (java.util.Date)2 List (java.util.List)2 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)2 UserOperationLogEntry (org.camunda.bpm.engine.history.UserOperationLogEntry)2 DecisionDefinition (org.camunda.bpm.engine.repository.DecisionDefinition)2 DecisionRequirementsDefinition (org.camunda.bpm.engine.repository.DecisionRequirementsDefinition)2