Source:
public void testOpLogSetProcessDefinitionVersionCmd() { try { identityService.setAuthenticatedUserId("demo"); String resource = "org/camunda/bpm/engine/test/api/runtime/migration/SetProcessDefinitionVersionCmdTest.bpmn"; org.camunda.bpm.engine.repository.Deployment firstDeployment = repositoryService .createDeployment() .addClasspathResource(resource) .deploy(); org.camunda.bpm.engine.repository.Deployment secondDeployment = repositoryService .createDeployment() .addClasspathResource(resource) .deploy(); ProcessDefinition processDefinitionV1 = repositoryService .createProcessDefinitionQuery() .deploymentId(firstDeployment.getId()) .singleResult(); ProcessDefinition processDefinitionV2 = repositoryService .createProcessDefinitionQuery() .deploymentId(secondDeployment.getId()) .singleResult(); ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinitionV1.getId()); setProcessDefinitionVersion(processInstance.getId(), 2); ProcessInstance processInstanceAfterMigration = runtimeService .createProcessInstanceQuery() .processInstanceId(processInstance.getId()) .singleResult(); assertEquals(processDefinitionV2.getId(), processInstanceAfterMigration.getProcessDefinitionId()); if (processEngineConfiguration.getHistoryLevel().equals(HistoryLevel.HISTORY_LEVEL_FULL)) { List<UserOperationLogEntry> userOperations = historyService .createUserOperationLogQuery() .processInstanceId(processInstance.getId()) .list(); assertEquals(2, userOperations.size()); UserOperationLogEntry userOperationLogEntry = userOperations.get(0); assertEquals(UserOperationLogEntry.OPERATION_TYPE_MODIFY_PROCESS_INSTANCE, userOperationLogEntry.getOperationType()); assertEquals("processDefinitionVersion", userOperationLogEntry.getProperty()); assertEquals("1", userOperationLogEntry.getOrgValue()); assertEquals("2", userOperationLogEntry.getNewValue()); } repositoryService.deleteDeployment(firstDeployment.getId(), true); repositoryService.deleteDeployment(secondDeployment.getId(), true); } finally { identityService.clearAuthentication(); } }

Target:
public void testOpLogSetProcessDefinitionVersionCmd() { try { identityService.setAuthenticatedUserId("demo"); String resource = "org/camunda/bpm/engine/test/api/runtime/migration/SetProcessDefinitionVersionCmdTest.bpmn"; org.camunda.bpm.engine.repository.Deployment firstDeployment = repositoryService .createDeployment() .addClasspathResource(resource) .deploy(); org.camunda.bpm.engine.repository.Deployment secondDeployment = repositoryService .createDeployment() .addClasspathResource(resource) .deploy(); ProcessDefinition processDefinitionV1 = repositoryService .createProcessDefinitionQuery() .deploymentId(firstDeployment.getId()) .singleResult(); ProcessDefinition processDefinitionV2 = repositoryService .createProcessDefinitionQuery() .deploymentId(secondDeployment.getId()) .singleResult(); ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinitionV1.getId()); setProcessDefinitionVersion(processInstance.getId(), 2); ProcessInstance processInstanceAfterMigration = runtimeService .createProcessInstanceQuery() .processInstanceId(processInstance.getId()) .singleResult(); assertEquals(processDefinitionV2.getId(), processInstanceAfterMigration.getProcessDefinitionId()); if (processEngineConfiguration.getHistoryLevel().equals(HistoryLevel.HISTORY_LEVEL_FULL)) { List<UserOperationLogEntry> userOperations = historyService .createUserOperationLogQuery() .processInstanceId(processInstance.getId()) .operationType(UserOperationLogEntry.OPERATION_TYPE_MODIFY_PROCESS_INSTANCE) .list(); assertEquals(1, userOperations.size()); UserOperationLogEntry userOperationLogEntry = userOperations.get(0); assertEquals("processDefinitionVersion", userOperationLogEntry.getProperty()); assertEquals("1", userOperationLogEntry.getOrgValue()); assertEquals("2", userOperationLogEntry.getNewValue()); } repositoryService.deleteDeployment(firstDeployment.getId(), true); repositoryService.deleteDeployment(secondDeployment.getId(), true); } finally { identityService.clearAuthentication(); } }