use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class TestHelper method historyLevelCheck.
private static boolean historyLevelCheck(ProcessEngine processEngine, RequiredHistoryLevel annotation) {
ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration();
HistoryLevel requiredHistoryLevel = getHistoryLevelForName(processEngineConfiguration.getHistoryLevels(), annotation.value());
HistoryLevel currentHistoryLevel = processEngineConfiguration.getHistoryLevel();
return currentHistoryLevel.getId() >= requiredHistoryLevel.getId();
}
use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class TaskAuthorizationTest method testStandaloneTaskRemoveVariablesLocalWithReadPermissionOnTask.
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_AUDIT)
public void testStandaloneTaskRemoveVariablesLocalWithReadPermissionOnTask() {
// given
String taskId = "myTask";
createTask(taskId);
createGrantAuthorization(TASK, taskId, userId, UPDATE);
disableAuthorization();
taskService.setVariable(taskId, VARIABLE_NAME, VARIABLE_VALUE);
enableAuthorization();
// when
taskService.removeVariablesLocal(taskId, Arrays.asList(VARIABLE_NAME));
// then
disableAuthorization();
VariableInstanceQuery query = runtimeService.createVariableInstanceQuery();
verifyQueryResults(query, 0);
enableAuthorization();
deleteTask(taskId, true);
HistoricVariableInstance deletedVariable = historyService.createHistoricVariableInstanceQuery().includeDeleted().singleResult();
Assert.assertEquals("DELETED", deletedVariable.getState());
}
use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class TaskAuthorizationTest method testStandaloneTaskRemoveVariablesLocalWithReadPermissionOnAnyTask.
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_AUDIT)
public void testStandaloneTaskRemoveVariablesLocalWithReadPermissionOnAnyTask() {
// given
String taskId = "myTask";
createTask(taskId);
createGrantAuthorization(TASK, ANY, userId, UPDATE);
disableAuthorization();
taskService.setVariable(taskId, VARIABLE_NAME, VARIABLE_VALUE);
enableAuthorization();
// when
taskService.removeVariablesLocal(taskId, Arrays.asList(VARIABLE_NAME));
// then
disableAuthorization();
VariableInstanceQuery query = runtimeService.createVariableInstanceQuery();
verifyQueryResults(query, 0);
enableAuthorization();
deleteTask(taskId, true);
HistoricVariableInstance deletedVariable = historyService.createHistoricVariableInstanceQuery().includeDeleted().singleResult();
Assert.assertEquals("DELETED", deletedVariable.getState());
}
use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class BatchSuspensionTest method testUserOperationLogQueryByBatchEntityType.
@Test
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
public void testUserOperationLogQueryByBatchEntityType() {
// given
Batch batch1 = helper.migrateProcessInstancesAsync(1);
Batch batch2 = helper.migrateProcessInstancesAsync(1);
// when
identityService.setAuthenticatedUserId(USER_ID);
managementService.suspendBatchById(batch1.getId());
managementService.suspendBatchById(batch2.getId());
managementService.activateBatchById(batch1.getId());
identityService.clearAuthentication();
// then
UserOperationLogQuery query = historyService.createUserOperationLogQuery().entityType(BATCH);
assertEquals(3, query.count());
assertEquals(3, query.list().size());
}
use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class BatchSuspensionTest method shouldCreateUserOperationLogForBatchSuspension.
@Test
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
public void shouldCreateUserOperationLogForBatchSuspension() {
// given
Batch batch = helper.migrateProcessInstancesAsync(1);
// when
identityService.setAuthenticatedUserId(USER_ID);
managementService.suspendBatchById(batch.getId());
identityService.clearAuthentication();
// then
UserOperationLogEntry entry = historyService.createUserOperationLogQuery().singleResult();
assertNotNull(entry);
assertEquals(batch.getId(), entry.getBatchId());
assertEquals(AbstractSetBatchStateCmd.SUSPENSION_STATE_PROPERTY, entry.getProperty());
assertNull(entry.getOrgValue());
assertEquals(SuspensionState.SUSPENDED.getName(), entry.getNewValue());
}
Aggregations