Java Code Examples for org.camunda.bpm.engine.runtime.CaseInstance#getId()
The following examples show how to use
org.camunda.bpm.engine.runtime.CaseInstance#getId() .
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: SentryScenario.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@DescribesScenario("triggerStageEntryCriterion") public static ScenarioSetup completeStage() { return new ScenarioSetup() { public void execute(ProcessEngine engine, String scenarioName) { CaseService caseService = engine.getCaseService(); CaseInstance caseInstance = caseService.createCaseInstanceByKey("case", scenarioName); String caseInstanceId = caseInstance.getId(); CaseExecutionQuery query = caseService.createCaseExecutionQuery().caseInstanceId(caseInstanceId); String firstHumanTaskId = query.activityId("PI_HumanTask_1").singleResult().getId(); caseService.manuallyStartCaseExecution(firstHumanTaskId); caseService.completeCaseExecution(firstHumanTaskId); String secondHumanTaskId = query.activityId("PI_HumanTask_2").singleResult().getId(); caseService.manuallyStartCaseExecution(secondHumanTaskId); } }; }
Example 2
Source File: SentryScenario.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@DescribesScenario("newSentryInstance") public static ScenarioSetup newSentryInstance() { return new ScenarioSetup() { public void execute(ProcessEngine engine, String scenarioName) { CaseService caseService = engine.getCaseService(); CaseInstance caseInstance = caseService.createCaseInstanceByKey("case", scenarioName); String caseInstanceId = caseInstance.getId(); CaseExecutionQuery query = caseService.createCaseExecutionQuery().caseInstanceId(caseInstanceId); String firstHumanTaskId = query.activityId("PI_HumanTask_1").singleResult().getId(); caseService.manuallyStartCaseExecution(firstHumanTaskId); caseService.completeCaseExecution(firstHumanTaskId); String secondHumanTaskId = query.activityId("PI_HumanTask_2").singleResult().getId(); caseService.manuallyStartCaseExecution(secondHumanTaskId); caseService.completeCaseExecution(secondHumanTaskId); } }; }
Example 3
Source File: ShipmentCaseModelTest.java From Showcase with Apache License 2.0 | 5 votes |
@Test public void testCaseInitializationWithIncompleteShipmentData() { Shipment shipment = shipmentRepository.findOne(this.shipmentId); shipment.trackingId = UUID.randomUUID().toString(); shipmentRepository.save(shipment); CaseInstance caseInstance = processEngine().getCaseService() .createCaseInstanceByKey(ShipmentCaseConstants.SHIPMENTCASEKEY, shipment.trackingId); this.caseInstanceId = caseInstance.getId(); showCaseOverview(caseInstance); // Case Instance active? assertTrue(caseInstance.isActive()); // Milestone 'Shipment order completed' not reached? assertTrue(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_MILESTONE_SHIPMENT_ORDER_COMPLETED) .caseInstanceBusinessKey(shipment.trackingId).singleResult().isAvailable()); // Task 'Complete shipment order' active? assertTrue(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_HUMAN_TASK_COMPLETE_SHIPMENT_ORDER) .caseInstanceBusinessKey(shipment.trackingId).active().singleResult().isActive()); // Stage 'Process shipment order' is not enabled? assertFalse(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_STAGE_PROCESS_SHIPMENT_ORDER) .caseInstanceBusinessKey(shipment.trackingId).singleResult().isEnabled()); }
Example 4
Source File: BulkHistoryDeleteTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
private List<String> prepareHistoricCaseInstance(int instanceCount) { List<String> caseInstanceIds = new ArrayList<String>(); for (int i = 0; i < instanceCount; i++) { CaseInstance caseInstance = caseService.createCaseInstanceByKey("oneTaskCase"); String caseInstanceId = caseInstance.getId(); caseInstanceIds.add(caseInstanceId); terminateAndCloseCaseInstance(caseInstanceId, null); } return caseInstanceIds; }
Example 5
Source File: HistoricCaseInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment(resources={"org/camunda/bpm/engine/test/api/cmmn/emptyStageWithManualActivationCase.cmmn"}) public void testDeleteHistoricCaseInstance() { CaseInstance caseInstance = createCaseInstance(); String caseInstanceId = caseInstance.getId(); HistoricCaseInstance historicInstance = queryHistoricCaseInstance(caseInstanceId); assertNotNull(historicInstance); try { // should not be able to delete historic case instance cause the case instance is still running historyService.deleteHistoricCaseInstance(historicInstance.getId()); fail("Exception expected"); } catch (NullValueException e) { // expected } terminate(caseInstanceId); close(caseInstanceId); identityService.setAuthenticatedUserId("testUser"); historyService.deleteHistoricCaseInstance(historicInstance.getId()); identityService.clearAuthentication(); if (processEngineConfiguration.getHistoryLevel().getId() >= HistoryLevel.HISTORY_LEVEL_FULL.getId()) { // a user operation log should have been created assertEquals(1, historyService.createUserOperationLogQuery().count()); UserOperationLogEntry entry = historyService.createUserOperationLogQuery().singleResult(); assertEquals(UserOperationLogEntry.CATEGORY_OPERATOR, entry.getCategory()); assertEquals(EntityTypes.CASE_INSTANCE, entry.getEntityType()); assertEquals(UserOperationLogEntry.OPERATION_TYPE_DELETE_HISTORY, entry.getOperationType()); assertEquals(caseInstanceId, entry.getCaseInstanceId()); assertNull(entry.getProperty()); assertNull(entry.getOrgValue()); assertNull(entry.getNewValue()); } assertCount(0, historicQuery()); }
Example 6
Source File: CaseInstanceDto.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public static CaseInstanceDto fromCaseInstance(CaseInstance instance) { CaseInstanceDto result = new CaseInstanceDto(); result.id = instance.getId(); result.caseDefinitionId = instance.getCaseDefinitionId(); result.businessKey = instance.getBusinessKey(); result.tenantId = instance.getTenantId(); result.active = instance.isActive(); result.completed = instance.isCompleted(); result.terminated = instance.isTerminated(); return result; }
Example 7
Source File: ShipmentCaseModelTest.java From Showcase with Apache License 2.0 | 4 votes |
@Test public void testCaseInitializationWithIncompleteShipmentDataWithModelUpdate() { Shipment shipment = shipmentRepository.findOne(this.shipmentId); shipment.trackingId = UUID.randomUUID().toString(); shipmentRepository.save(shipment); CaseInstance caseInstance = processEngine().getCaseService() .createCaseInstanceByKey(ShipmentCaseConstants.SHIPMENTCASEKEY, shipment.trackingId); this.caseInstanceId = caseInstance.getId(); showCaseOverview(caseInstance); // Case Instance active? assertTrue(caseInstance.isActive()); // Milestone 'Shipment order completed' not reached? assertTrue(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_MILESTONE_SHIPMENT_ORDER_COMPLETED) .caseInstanceBusinessKey(shipment.trackingId) .singleResult() .isAvailable()); // Task 'Complete shipment order' active? CaseExecution completeShipmentOrderCaseExecution = processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_HUMAN_TASK_COMPLETE_SHIPMENT_ORDER) .caseInstanceBusinessKey(shipment.trackingId) .active() .singleResult(); assertTrue(completeShipmentOrderCaseExecution.isActive()); // Stage 'Process shipment order' is not enabled? assertFalse(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_STAGE_PROCESS_SHIPMENT_ORDER) .caseInstanceBusinessKey(shipment.trackingId) .singleResult() .isEnabled()); Shipment shipment2 = shipmentRepository.findOne(this.shipmentId); shipment2.shipmentCargo = new Cargo(1, 2.0, 123.0, "Don't Panic!", true); shipmentRepository.save(shipment2); // Complete task 'Complete shipment order' Task task = processEngine().getTaskService().createTaskQuery() .caseExecutionId(completeShipmentOrderCaseExecution.getId()) .singleResult(); processEngine().getTaskService().complete(task.getId()); // evaluate System.out.println("CREATING..."); caseModelHandler.reevaluateCase(shipment.trackingId); // print showCaseOverview(caseInstance); // Task 'Complete shipment order' completed? assertNull(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_HUMAN_TASK_COMPLETE_SHIPMENT_ORDER) .caseInstanceBusinessKey(shipment.trackingId).singleResult()); // Stage 'Process shipment order' is active? assertTrue(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_STAGE_PROCESS_SHIPMENT_ORDER) .caseInstanceBusinessKey(shipment.trackingId).singleResult().isActive()); }
Example 8
Source File: ShipmentCaseModelTest.java From Showcase with Apache License 2.0 | 4 votes |
@Test public void testCaseAfterCreation() { Shipment shipment = shipmentRepository.findOne(this.shipmentId); shipment.shipmentCargo.numberPackages = 2; shipment.trackingId = UUID.randomUUID().toString(); shipmentRepository.save(shipment); CaseInstance caseInstance = processEngine().getCaseService() .createCaseInstanceByKey(ShipmentCaseConstants.SHIPMENTCASEKEY, shipment.trackingId); this.caseInstanceId = caseInstance.getId(); // Case Instance active? assertTrue(caseInstance.isActive()); showCaseOverview(caseInstance); // Milestone reached and stage activated? assertNull(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_MILESTONE_SHIPMENT_ORDER_COMPLETED) .caseInstanceBusinessKey(shipment.trackingId).singleResult()); // Milestone 'Flight departed' not reached? assertTrue(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_MILESTONE_FLIGHT_DEPARTED) .caseInstanceBusinessKey(shipment.trackingId) .singleResult() .isAvailable()); // Stage "PlanItem_Stage_ProcessShipmentOrder" automatically active with // the input data? assertTrue(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_STAGE_PROCESS_SHIPMENT_ORDER) .caseInstanceBusinessKey(shipment.trackingId).singleResult().isActive()); // Task 'PlanItem_HumanTask_ChangeShipmentOrder' enabled? -> Manual Task assertTrue(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_HUMAN_TASK_CHANGE_SHIPMENT_ORDER) .caseInstanceBusinessKey(shipment.trackingId).singleResult().isEnabled()); // Stage 'PlanItem_HumanTask_CreateInvoice' is available? assertTrue(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_HUMAN_TASK_CREATE_INVOICE) .caseInstanceBusinessKey(shipment.trackingId).singleResult().isAvailable()); // Stage 'PlanItem_HumanTask_OrganizeFlight' is active? assertTrue(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_HUMAN_TASK_ORGANIZE_FLIGHT) .caseInstanceBusinessKey(shipment.trackingId).singleResult().isActive()); }
Example 9
Source File: ShipmentCaseModelTest.java From Showcase with Apache License 2.0 | 4 votes |
@Test public void testCaseAfterOrganizeFlight() { Shipment shipment = shipmentRepository.findOne(this.shipmentId); shipment.shipmentCargo.numberPackages = 2; shipment.trackingId = UUID.randomUUID().toString(); shipmentRepository.save(shipment); CaseInstance caseInstance = processEngine().getCaseService() .createCaseInstanceByKey(ShipmentCaseConstants.SHIPMENTCASEKEY, shipment.trackingId); this.caseInstanceId = caseInstance.getId(); // Case Instance active? assertTrue(caseInstance.isActive()); showCaseOverview(caseInstance); // Task 'organize flight' active? CaseExecution organizeFlightCaseExecution = processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_HUMAN_TASK_ORGANIZE_FLIGHT) .caseInstanceBusinessKey(shipment.trackingId) .active() .singleResult(); assertTrue(organizeFlightCaseExecution.isActive()); // Complete task 'organize flight' Task task = processEngine().getTaskService().createTaskQuery() .caseExecutionId(organizeFlightCaseExecution.getId()) .singleResult(); processEngine().getTaskService().complete(task.getId()); // Milestone "Shipment order complete" reached and stage activated? assertNull(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_MILESTONE_SHIPMENT_ORDER_COMPLETED) .caseInstanceBusinessKey(shipment.trackingId).singleResult()); // Milestone 'Flight departed' not reached? assertTrue(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_MILESTONE_FLIGHT_DEPARTED) .caseInstanceBusinessKey(shipment.trackingId) .singleResult() .isAvailable()); // Stage "PlanItem_Stage_ProcessShipmentOrder" automatically active with // the input data? assertTrue(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_STAGE_PROCESS_SHIPMENT_ORDER) .caseInstanceBusinessKey(shipment.trackingId).singleResult().isActive()); // Task 'PlanItem_HumanTask_ChangeShipmentOrder' enabled? -> Manual Task assertTrue(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_HUMAN_TASK_CHANGE_SHIPMENT_ORDER) .caseInstanceBusinessKey(shipment.trackingId).singleResult().isEnabled()); // Stage 'PlanItem_HumanTask_CreateInvoice' is active? assertTrue(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_HUMAN_TASK_CREATE_INVOICE) .caseInstanceBusinessKey(shipment.trackingId).singleResult().isActive()); // Task 'PlanItem_HumanTask_OrganizeFlight' is completed? assertNull(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_HUMAN_TASK_ORGANIZE_FLIGHT) .caseInstanceBusinessKey(shipment.trackingId).singleResult()); showCaseOverview(caseInstance); }
Example 10
Source File: ShipmentCaseModelTest.java From Showcase with Apache License 2.0 | 4 votes |
@Test public void testCaseAfterOrganizeFlightAndFlightDeparted() { Shipment shipment = shipmentRepository.findOne(this.shipmentId); shipment.shipmentCargo.numberPackages = 2; shipment.trackingId = UUID.randomUUID().toString(); shipmentRepository.save(shipment); CaseInstance caseInstance = processEngine().getCaseService() .createCaseInstanceByKey(ShipmentCaseConstants.SHIPMENTCASEKEY, shipment.trackingId); this.caseInstanceId = caseInstance.getId(); // Case Instance active? assertTrue(caseInstance.isActive()); showCaseOverview(caseInstance); // Task 'organize flight' active? CaseExecution organizeFlightCaseExecution = processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_HUMAN_TASK_ORGANIZE_FLIGHT) .caseInstanceBusinessKey(shipment.trackingId) .active() .singleResult(); assertTrue(organizeFlightCaseExecution.isActive()); // Complete task 'organize flight' Task task = processEngine().getTaskService().createTaskQuery() .caseExecutionId(organizeFlightCaseExecution.getId()) .singleResult(); processEngine().getTaskService().complete(task.getId()); // Milestone 'Flight departed' not reached? CaseExecution flightDepartedCaseExecution = processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_MILESTONE_FLIGHT_DEPARTED) .caseInstanceBusinessKey(shipment.trackingId) .available() .singleResult(); assertTrue(flightDepartedCaseExecution.isAvailable()); // Achieve Milestone ´Flight deaparted` flightDepartedSentry.setDeparted(flightDepartedCaseExecution.getId(), true); HistoricCaseActivityInstance milestoneInstanceFlightDeparted = historyService .createHistoricCaseActivityInstanceQuery() .caseInstanceId(flightDepartedCaseExecution.getCaseInstanceId()) .caseActivityId(ShipmentCaseConstants.PLAN_ITEM_MILESTONE_FLIGHT_DEPARTED) .singleResult(); assertTrue(milestoneInstanceFlightDeparted.isCompleted()); // Milestone "Shipment order complete" reached and stage activated? assertNull(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_MILESTONE_SHIPMENT_ORDER_COMPLETED) .caseInstanceBusinessKey(shipment.trackingId).singleResult()); // Stage "PlanItem_Stage_ProcessShipmentOrder" automatically active with // the input data? assertTrue(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_STAGE_PROCESS_SHIPMENT_ORDER) .caseInstanceBusinessKey(shipment.trackingId).singleResult().isActive()); // Task 'PlanItem_HumanTask_ChangeShipmentOrder' is not available? -> Manual Task assertNull(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_HUMAN_TASK_CHANGE_SHIPMENT_ORDER) .caseInstanceBusinessKey(shipment.trackingId).singleResult()); // Stage 'PlanItem_HumanTask_CreateInvoice' is active? assertTrue(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_HUMAN_TASK_CREATE_INVOICE) .caseInstanceBusinessKey(shipment.trackingId).singleResult().isActive()); // Task 'PlanItem_HumanTask_OrganizeFlight' is completed? assertNull(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_HUMAN_TASK_ORGANIZE_FLIGHT) .caseInstanceBusinessKey(shipment.trackingId).singleResult()); showCaseOverview(caseInstance); }
Example 11
Source File: ShipmentCaseModelTest.java From Showcase with Apache License 2.0 | 4 votes |
@Test public void testCaseAfterOrganizeFlightAndFlightDepartedAndCreateInvoice() { Shipment shipment = shipmentRepository.findOne(this.shipmentId); shipment.shipmentCargo.numberPackages = 2; shipment.trackingId = UUID.randomUUID().toString(); shipmentRepository.save(shipment); CaseInstance caseInstance = processEngine().getCaseService() .createCaseInstanceByKey(ShipmentCaseConstants.SHIPMENTCASEKEY, shipment.trackingId); this.caseInstanceId = caseInstance.getId(); // Case Instance active? assertTrue(caseInstance.isActive()); showCaseOverview(caseInstance); // Task 'organize flight' active? CaseExecution organizeFlightCaseExecution = processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_HUMAN_TASK_ORGANIZE_FLIGHT) .caseInstanceBusinessKey(shipment.trackingId) .active() .singleResult(); assertTrue(organizeFlightCaseExecution.isActive()); // Complete task 'organize flight' Task task = processEngine().getTaskService().createTaskQuery() .caseExecutionId(organizeFlightCaseExecution.getId()) .singleResult(); processEngine().getTaskService().complete(task.getId()); // Milestone 'Flight departed' not reached? CaseExecution flightDepartedCaseExecution = processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_MILESTONE_FLIGHT_DEPARTED) .caseInstanceBusinessKey(shipment.trackingId) .available() .singleResult(); assertTrue(flightDepartedCaseExecution.isAvailable()); // Achieve Milestone ´Flight deaparted` flightDepartedSentry.setDeparted(flightDepartedCaseExecution.getId(), true); HistoricCaseActivityInstance milestoneInstanceFlightDeparted = historyService .createHistoricCaseActivityInstanceQuery() .caseInstanceId(flightDepartedCaseExecution.getCaseInstanceId()) .caseActivityId(ShipmentCaseConstants.PLAN_ITEM_MILESTONE_FLIGHT_DEPARTED) .singleResult(); assertTrue(milestoneInstanceFlightDeparted.isCompleted()); // Task 'PlanItem_HumanTask_ChangeShipmentOrder' is not available? -> Manual Task assertNull(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_HUMAN_TASK_CHANGE_SHIPMENT_ORDER) .caseInstanceBusinessKey(shipment.trackingId).singleResult()); // Task 'create invoice' is active CaseExecution createInvoiceCaseExecution = processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_HUMAN_TASK_CREATE_INVOICE) .caseInstanceBusinessKey(shipment.trackingId).singleResult(); assertTrue(createInvoiceCaseExecution.isActive()); // Complete Task 'Create Invoice' Task task1 = processEngine().getTaskService().createTaskQuery() .caseExecutionId(createInvoiceCaseExecution.getId()) .singleResult(); processEngine().getTaskService().complete(task1.getId()); // Task 'create invoice' is completed assertNull(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_HUMAN_TASK_CREATE_INVOICE) .caseInstanceBusinessKey(shipment.trackingId).singleResult()); showCaseOverview(caseInstance); // Shipment case instance is terminated? HistoricCaseInstance terminatedCaseInstance = historyService .createHistoricCaseInstanceQuery() .caseInstanceId(caseInstanceId) .terminated() .singleResult(); assertTrue(terminatedCaseInstance.isTerminated()); }
Example 12
Source File: ShipmentCaseModelTest.java From Showcase with Apache License 2.0 | 4 votes |
@Test public void testNullValueDataAfterCreation() { Shipment shipment = shipmentRepository.findOne(this.shipmentId); shipment.trackingId = UUID.randomUUID().toString(); shipmentRepository.save(shipment); CaseInstance caseInstance = processEngine().getCaseService() .createCaseInstanceByKey(ShipmentCaseConstants.SHIPMENTCASEKEY, shipment.trackingId); this.caseInstanceId = caseInstance.getId(); showCaseOverview(caseInstance); // Milestone reached and stage activated? assertTrue(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_MILESTONE_SHIPMENT_ORDER_COMPLETED) .caseInstanceBusinessKey(shipment.trackingId).singleResult().isAvailable()); // Milestone 'Flight departed' not reached? assertNull(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_MILESTONE_FLIGHT_DEPARTED) .caseInstanceBusinessKey(shipment.trackingId) .singleResult()); // Stage "PlanItem_Stage_ProcessShipmentOrder" automatically active with // the input data? assertTrue(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_STAGE_PROCESS_SHIPMENT_ORDER) .caseInstanceBusinessKey(shipment.trackingId).singleResult().isAvailable()); // Task 'PlanItem_HumanTask_ChangeShipmentOrder' enabled? -> Manual Task assertNull(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_HUMAN_TASK_CHANGE_SHIPMENT_ORDER) .caseInstanceBusinessKey(shipment.trackingId).singleResult()); // Stage 'PlanItem_HumanTask_CreateInvoice' is available? assertNull(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_HUMAN_TASK_CREATE_INVOICE) .caseInstanceBusinessKey(shipment.trackingId).singleResult()); // Stage 'PlanItem_HumanTask_OrganizeFlight' is available? assertNull(processEngine().getCaseService().createCaseExecutionQuery() .activityId(ShipmentCaseConstants.PLAN_ITEM_HUMAN_TASK_ORGANIZE_FLIGHT) .caseInstanceBusinessKey(shipment.trackingId).singleResult()); }
Example 13
Source File: FullHistoryTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Test @Deployment(resources = "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn") public void testHistoricVariableUpdateCaseDefinitionProperty() { // given String key = "oneTaskCase"; CaseInstance caseInstance = caseService.createCaseInstanceByKey(key); String caseInstanceId = caseInstance.getId(); String humanTask = caseService .createCaseExecutionQuery() .activityId("PI_HumanTask_1") .singleResult() .getId(); String taskId = taskService.createTaskQuery().singleResult().getId(); caseService.setVariable(caseInstanceId, "aVariable", "aValue"); taskService.setVariableLocal(taskId, "aLocalVariable", "anotherValue"); String firstVariable = runtimeService .createVariableInstanceQuery() .variableName("aVariable") .singleResult() .getId(); String secondVariable = runtimeService .createVariableInstanceQuery() .variableName("aLocalVariable") .singleResult() .getId(); // when (1) HistoricVariableUpdate instance = (HistoricVariableUpdate) historyService .createHistoricDetailQuery() .variableUpdates() .variableInstanceId(firstVariable) .singleResult(); // then (1) assertNotNull(instance.getCaseDefinitionKey()); assertEquals(key, instance.getCaseDefinitionKey()); assertNotNull(instance.getCaseDefinitionId()); assertEquals(caseInstance.getCaseDefinitionId(), instance.getCaseDefinitionId()); assertNull(instance.getProcessDefinitionKey()); assertNull(instance.getProcessDefinitionId()); // when (2) instance = (HistoricVariableUpdate) historyService .createHistoricDetailQuery() .variableUpdates() .variableInstanceId(secondVariable) .singleResult(); // then (2) assertNotNull(instance.getCaseDefinitionKey()); assertEquals(key, instance.getCaseDefinitionKey()); assertNotNull(instance.getCaseDefinitionId()); assertEquals(caseInstance.getCaseDefinitionId(), instance.getCaseDefinitionId()); assertNull(instance.getProcessDefinitionKey()); assertNull(instance.getProcessDefinitionId()); }