Java Code Examples for org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity#setCaseDefinition()

The following examples show how to use org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity#setCaseDefinition() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CaseDefinitionIdUpdateTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public void testUpdateCaseDefinitionIdInCaseExecutionEntity() {
  // given
  final CaseDefinitionEntity caseDefinitionEntity1 = prepareCaseDefinition(UUID.randomUUID().toString());
  final CaseDefinitionEntity caseDefinitionEntity2 = prepareCaseDefinition(UUID.randomUUID().toString());

  final CaseExecutionEntity caseExecutionEntity = prepareCaseExecution(caseDefinitionEntity1);

  assertThat(caseExecutionEntity.getCaseDefinitionId()).isEqualTo(caseDefinitionEntity1.getId());

  createCaseExecution(caseExecutionEntity);
  final CaseExecutionEntity createdCaseExecution = findCaseExecution(caseExecutionEntity.getId());

  assertThat(createdCaseExecution).isNotNull();

  createdCaseExecution.setCaseDefinition(caseDefinitionEntity2);

  assertThat(createdCaseExecution.getCaseDefinitionId()).isEqualTo(caseDefinitionEntity2.getId());

  // when
  update(createdCaseExecution);

  // then
  final CaseExecutionEntity updatedCaseExecution = findCaseExecution(createdCaseExecution.getId());
  assertThat(updatedCaseExecution.getCaseDefinitionId()).isEqualTo(caseDefinitionEntity2.getId());

  deleteCaseExecution(updatedCaseExecution);
  deleteCaseDefinition(caseDefinitionEntity1);
  deleteCaseDefinition(caseDefinitionEntity2);
}
 
Example 2
Source File: CaseDefinitionIdHistoryUpdateTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_ACTIVITY)
public void testUpdateCaseDefinitionIdInCaseExecutionEntity() {
  // given
  final CaseDefinitionEntity caseDefinitionEntity1 = prepareCaseDefinition(UUID.randomUUID().toString());
  final CaseDefinitionEntity caseDefinitionEntity2 = prepareCaseDefinition(UUID.randomUUID().toString());

  final CaseExecutionEntity caseExecutionEntity = prepareCaseExecution(caseDefinitionEntity1);

  assertThat(caseExecutionEntity.getCaseDefinitionId()).isEqualTo(caseDefinitionEntity1.getId());

  createCaseExecution(caseExecutionEntity);

  caseExecutionEntity.setCaseDefinition(caseDefinitionEntity2);

  // Create
  final HistoricCaseActivityInstanceEventEntity historicCaseActivityInstanceEntity = prepareHistoricCaseActivityInstance(caseDefinitionEntity1);
  createCaseExecutionHistory(historicCaseActivityInstanceEntity);

  // when
  // Set new caseDefinitionId and update
  historicCaseActivityInstanceEntity.setCaseDefinitionId(caseDefinitionEntity2.getId());
  historicCaseActivityInstanceEntity.setEventType(HistoryEventTypes.CASE_ACTIVITY_INSTANCE_UPDATE.getEventName());
  updateCaseExecutionHistory(historicCaseActivityInstanceEntity);

  // then
  // Read from DB and assert
  HistoricCaseActivityInstanceEntity updatedInstance = findHistoricCaseActivityInstance(historicCaseActivityInstanceEntity.getId());
  assertThat(updatedInstance.getCaseDefinitionId()).isEqualTo(caseDefinitionEntity2.getId());

  deleteHistoricCaseActivityInstance(historicCaseActivityInstanceEntity);
  deleteCaseExecution(caseExecutionEntity);
  deleteCaseDefinition(caseDefinitionEntity1);
  deleteCaseDefinition(caseDefinitionEntity2);
}
 
Example 3
Source File: CaseDefinitionIdUpdateTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
private CaseExecutionEntity prepareCaseExecution(CaseDefinitionEntity caseDefinitionEntity1) {
  final CaseExecutionEntity caseExecutionEntity = new CaseExecutionEntity();
  caseExecutionEntity.setId(UUID.randomUUID().toString());
  caseExecutionEntity.setCaseDefinition(caseDefinitionEntity1);
  return caseExecutionEntity;
}
 
Example 4
Source File: CaseDefinitionIdHistoryUpdateTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
private CaseExecutionEntity prepareCaseExecution(CaseDefinitionEntity caseDefinitionEntity1) {
  final CaseExecutionEntity caseExecutionEntity = new CaseExecutionEntity();
  caseExecutionEntity.setId(UUID.randomUUID().toString());
  caseExecutionEntity.setCaseDefinition(caseDefinitionEntity1);
  return caseExecutionEntity;
}