use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class MultiTenancyBatchTest method testHistoricBatchTenantId.
@Test
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
public void testHistoricBatchTenantId() {
// given
batchHelper.migrateProcessInstanceAsync(tenant1Definition, tenant1Definition);
// then
HistoricBatch historicBatch = historyService.createHistoricBatchQuery().singleResult();
Assert.assertEquals(TENANT_ONE, historicBatch.getTenantId());
}
use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class RepositoryServiceTest method testProcessDefinitionUpdateTimeToLiveUserOperationLog.
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testProcessDefinitionUpdateTimeToLiveUserOperationLog() {
// given
ProcessDefinition processDefinition = findOnlyProcessDefinition();
Integer timeToLiveOrgValue = processDefinition.getHistoryTimeToLive();
processEngine.getIdentityService().setAuthenticatedUserId("userId");
// when
Integer timeToLiveNewValue = 6;
repositoryService.updateProcessDefinitionHistoryTimeToLive(processDefinition.getId(), timeToLiveNewValue);
// then
List<UserOperationLogEntry> opLogEntries = processEngine.getHistoryService().createUserOperationLogQuery().list();
Assert.assertEquals(1, opLogEntries.size());
final UserOperationLogEntryEventEntity userOperationLogEntry = (UserOperationLogEntryEventEntity) opLogEntries.get(0);
assertEquals(UserOperationLogEntry.OPERATION_TYPE_UPDATE_HISTORY_TIME_TO_LIVE, userOperationLogEntry.getOperationType());
assertEquals(processDefinition.getKey(), userOperationLogEntry.getProcessDefinitionKey());
assertEquals(processDefinition.getId(), userOperationLogEntry.getProcessDefinitionId());
assertEquals("historyTimeToLive", userOperationLogEntry.getProperty());
assertEquals(timeToLiveOrgValue, Integer.valueOf(userOperationLogEntry.getOrgValue()));
assertEquals(timeToLiveNewValue, Integer.valueOf(userOperationLogEntry.getNewValue()));
}
use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class TaskServiceTest method testCreateTaskAttachmentWithNullTaskAndProcessInstance.
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_AUDIT)
@Test
public void testCreateTaskAttachmentWithNullTaskAndProcessInstance() {
try {
taskService.createAttachment("web page", null, null, "weatherforcast", "temperatures and more", new ByteArrayInputStream("someContent".getBytes()));
fail("expected process engine exception");
} catch (ProcessEngineException e) {
}
}
use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class TaskServiceTest method testCreateTaskAttachmentWithNullTaskId.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_AUDIT)
@Test
public void testCreateTaskAttachmentWithNullTaskId() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
Attachment attachment = taskService.createAttachment("web page", null, processInstance.getId(), "weatherforcast", "temperatures and more", new ByteArrayInputStream("someContent".getBytes()));
Attachment fetched = taskService.getAttachment(attachment.getId());
assertThat(fetched, is(notNullValue()));
assertThat(fetched.getTaskId(), is(nullValue()));
assertThat(fetched.getProcessInstanceId(), is(notNullValue()));
taskService.deleteAttachment(attachment.getId());
}
use of org.camunda.bpm.engine.test.RequiredHistoryLevel in project camunda-bpm-platform by camunda.
the class MigrationHistoricActivityInstanceTest method testHistoricActivityInstanceBecomeScope.
@Test
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_ACTIVITY)
public void testHistoricActivityInstanceBecomeScope() {
// given
ProcessDefinition sourceDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS);
ProcessDefinition targetDefinition = testHelper.deployAndGetDefinition(ProcessModels.SCOPE_TASK_PROCESS);
MigrationPlan migrationPlan = rule.getRuntimeService().createMigrationPlan(sourceDefinition.getId(), targetDefinition.getId()).mapEqualActivities().build();
ProcessInstance processInstance = rule.getRuntimeService().startProcessInstanceById(sourceDefinition.getId());
// when
rule.getRuntimeService().newMigration(migrationPlan).processInstanceIds(Arrays.asList(processInstance.getId())).execute();
// then
List<HistoricActivityInstance> historicInstances = historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstance.getId()).unfinished().orderByActivityId().asc().list();
Assert.assertEquals(1, historicInstances.size());
assertMigratedTo(historicInstances.get(0), targetDefinition, "userTask");
assertEquals(processInstance.getId(), historicInstances.get(0).getParentActivityInstanceId());
}
Aggregations