use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class BatchHistoricDecisionInstanceDeletionUserOperationTest method testCreationByIdsAndQuery.
@Test
public void testCreationByIdsAndQuery() {
// given
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION);
// when
identityService.setAuthenticatedUserId(USER_ID);
historyService.deleteHistoricDecisionInstancesAsync(decisionInstanceIds, query, "a-delete-reason");
identityService.clearAuthentication();
// then
List<UserOperationLogEntry> opLogEntries = engineRule.getHistoryService().createUserOperationLogQuery().list();
Assert.assertEquals(4, opLogEntries.size());
Map<String, UserOperationLogEntry> entries = asMap(opLogEntries);
UserOperationLogEntry typeEntry = entries.get("type");
assertNotNull(typeEntry);
assertEquals(EntityTypes.DECISION_INSTANCE, typeEntry.getEntityType());
assertEquals(UserOperationLogEntry.OPERATION_TYPE_DELETE, typeEntry.getOperationType());
assertNull(typeEntry.getProcessDefinitionId());
assertNull(typeEntry.getProcessDefinitionKey());
assertNull(typeEntry.getProcessInstanceId());
assertNull(typeEntry.getOrgValue());
assertEquals("history", typeEntry.getNewValue());
UserOperationLogEntry asyncEntry = entries.get("async");
assertNotNull(asyncEntry);
assertEquals(EntityTypes.DECISION_INSTANCE, typeEntry.getEntityType());
assertEquals(UserOperationLogEntry.OPERATION_TYPE_DELETE, typeEntry.getOperationType());
assertNull(typeEntry.getProcessDefinitionId());
assertNull(typeEntry.getProcessDefinitionKey());
assertNull(typeEntry.getProcessInstanceId());
assertNull(typeEntry.getOrgValue());
assertEquals("true", asyncEntry.getNewValue());
UserOperationLogEntry numInstancesEntry = entries.get("nrOfInstances");
assertNotNull(numInstancesEntry);
assertEquals(EntityTypes.DECISION_INSTANCE, typeEntry.getEntityType());
assertEquals(UserOperationLogEntry.OPERATION_TYPE_DELETE, typeEntry.getOperationType());
assertNull(typeEntry.getProcessDefinitionId());
assertNull(typeEntry.getProcessDefinitionKey());
assertNull(typeEntry.getProcessInstanceId());
assertNull(typeEntry.getOrgValue());
assertEquals("10", numInstancesEntry.getNewValue());
UserOperationLogEntry deleteReasonEntry = entries.get("deleteReason");
assertNotNull(deleteReasonEntry);
assertEquals(EntityTypes.DECISION_INSTANCE, typeEntry.getEntityType());
assertEquals(UserOperationLogEntry.OPERATION_TYPE_DELETE, typeEntry.getOperationType());
assertNull(typeEntry.getProcessDefinitionId());
assertNull(typeEntry.getProcessDefinitionKey());
assertNull(typeEntry.getProcessInstanceId());
assertNull(typeEntry.getOrgValue());
assertEquals("a-delete-reason", deleteReasonEntry.getNewValue());
assertEquals(typeEntry.getOperationId(), asyncEntry.getOperationId());
assertEquals(asyncEntry.getOperationId(), numInstancesEntry.getOperationId());
assertEquals(numInstancesEntry.getOperationId(), deleteReasonEntry.getOperationId());
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class BatchHistoricDecisionInstanceDeletionUserOperationTest method testNoCreationOnSyncBatchJobExecutionByIds.
@Test
public void testNoCreationOnSyncBatchJobExecutionByIds() {
// given
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION);
Batch batch = historyService.deleteHistoricDecisionInstancesAsync(query, null);
// when
engineRule.getIdentityService().setAuthenticatedUserId(USER_ID);
executeJobs(batch);
engineRule.getIdentityService().clearAuthentication();
// then
assertEquals(0, engineRule.getHistoryService().createUserOperationLogQuery().count());
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class BatchHistoricDecisionInstanceDeletionTest method deleteInstancesByQuery.
@Test
public void deleteInstancesByQuery() {
// given
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION);
Batch batch = historyService.deleteHistoricDecisionInstancesAsync(query, null);
helper.executeSeedJob(batch);
List<Job> deletionJobs = helper.getExecutionJobs(batch);
// when
for (Job deletionJob : deletionJobs) {
helper.executeJob(deletionJob);
}
// then
assertEquals(0, historyService.createHistoricDecisionInstanceQuery().count());
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class BatchHistoricDecisionInstanceDeletionTest method createBatchDeletionByIdsAndQuery.
@Test
public void createBatchDeletionByIdsAndQuery() {
// given
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION);
// when
Batch batch = historyService.deleteHistoricDecisionInstancesAsync(decisionInstanceIds, query, null);
// then
assertBatchCreated(batch, 10);
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class BatchHistoricDecisionInstanceDeletionTest method deleteInstancesByIdsAndQuery.
@Test
public void deleteInstancesByIdsAndQuery() {
// given
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION);
Batch batch = historyService.deleteHistoricDecisionInstancesAsync(decisionInstanceIds, query, null);
helper.executeSeedJob(batch);
List<Job> deletionJobs = helper.getExecutionJobs(batch);
// when
for (Job deletionJob : deletionJobs) {
helper.executeJob(deletionJob);
}
// then
assertEquals(0, historyService.createHistoricDecisionInstanceQuery().count());
}
Aggregations