protected CaseExecution queryCaseExecutionById(String caseExecutionId) { return caseService .createCaseExecutionQuery() .caseExecutionId(caseExecutionId) .singleResult(); }
protected CaseExecution queryCaseExecutionById(String caseExecutionId) { return caseService .createCaseExecutionQuery() .caseExecutionId(caseExecutionId) .singleResult(); }
protected CmmnExecution getExecution(String caseExecutionId) { return (CmmnExecution) caseService .createCaseExecutionQuery() .caseExecutionId(caseExecutionId) .singleResult(); }
protected CmmnExecution getExecution(String caseExecutionId) { return (CmmnExecution) caseService .createCaseExecutionQuery() .caseExecutionId(caseExecutionId) .singleResult(); }
public void testQueryByInvalidCaseExecutionId() { CaseExecutionQuery query = caseService.createCaseExecutionQuery(); query.caseExecutionId("invalid"); verifyQueryResults(query, 0); try { query.caseExecutionId(null); fail(); } catch (NotValidException e) {} }
public CaseExecutionDto getCaseExecution() { CaseService caseService = engine.getCaseService(); CaseExecution execution = caseService .createCaseExecutionQuery() .caseExecutionId(caseExecutionId) .singleResult(); if (execution == null) { throw new InvalidRequestException(Status.NOT_FOUND, "Case execution with id " + caseExecutionId + " does not exist."); } CaseExecutionDto result = CaseExecutionDto.fromCaseExecution(execution); return result; }
public CaseExecutionDto getCaseExecution() { CaseService caseService = engine.getCaseService(); CaseExecution execution = caseService .createCaseExecutionQuery() .caseExecutionId(caseExecutionId) .singleResult(); if (execution == null) { throw new InvalidRequestException(Status.NOT_FOUND, "Case execution with id " + caseExecutionId + " does not exist."); } CaseExecutionDto result = CaseExecutionDto.fromCaseExecution(execution); return result; }
protected CaseExecution queryCaseExecutionById(String id) { return caseService .createCaseExecutionQuery() .caseExecutionId(id) .singleResult(); }
protected CaseExecution queryCaseExecutionById(String id) { return caseService .createCaseExecutionQuery() .caseExecutionId(id) .singleResult(); }
@Before public void setUpRuntime() { CaseExecution mockCaseExecution = MockProvider.createMockCaseExecution(); caseServiceMock = mock(CaseService.class); when(processEngine.getCaseService()).thenReturn(caseServiceMock); caseExecutionQueryMock = mock(CaseExecutionQuery.class); when(caseServiceMock.createCaseExecutionQuery()).thenReturn(caseExecutionQueryMock); when(caseExecutionQueryMock.caseExecutionId(MockProvider.EXAMPLE_CASE_EXECUTION_ID)).thenReturn(caseExecutionQueryMock); when(caseExecutionQueryMock.singleResult()).thenReturn(mockCaseExecution); when(caseServiceMock.getVariableTyped(anyString(), anyString(), eq(true))).thenReturn(EXAMPLE_VARIABLE_VALUE); when(caseServiceMock.getVariablesTyped(anyString(), eq(true))).thenReturn(EXAMPLE_VARIABLES); when(caseServiceMock.getVariableLocalTyped(anyString(), eq(EXAMPLE_VARIABLE_KEY), anyBoolean())).thenReturn(EXAMPLE_VARIABLE_VALUE); when(caseServiceMock.getVariableLocalTyped(anyString(), eq(EXAMPLE_BYTES_VARIABLE_KEY), eq(false))).thenReturn(EXAMPLE_VARIABLE_VALUE_BYTES); when(caseServiceMock.getVariablesLocalTyped(anyString(), eq(true))).thenReturn(EXAMPLE_VARIABLES); when(caseServiceMock.getVariablesTyped(anyString(), Matchers.<Collection<String>>any(), eq(true))).thenReturn(EXAMPLE_VARIABLES); when(caseServiceMock.getVariablesLocalTyped(anyString(), Matchers.<Collection<String>>any(), eq(true))).thenReturn(EXAMPLE_VARIABLES); caseExecutionCommandBuilderMock = mock(CaseExecutionCommandBuilder.class); when(caseServiceMock.withCaseExecution(MockProvider.EXAMPLE_CASE_EXECUTION_ID)).thenReturn(caseExecutionCommandBuilderMock); when(caseExecutionCommandBuilderMock.setVariable(anyString(), any())).thenReturn(caseExecutionCommandBuilderMock); when(caseExecutionCommandBuilderMock.setVariableLocal(anyString(), any())).thenReturn(caseExecutionCommandBuilderMock); when(caseExecutionCommandBuilderMock.setVariables(Matchers.<Map<String, Object>>any())).thenReturn(caseExecutionCommandBuilderMock); when(caseExecutionCommandBuilderMock.setVariablesLocal(Matchers.<Map<String, Object>>any())).thenReturn(caseExecutionCommandBuilderMock); when(caseExecutionCommandBuilderMock.removeVariable(anyString())).thenReturn(caseExecutionCommandBuilderMock); when(caseExecutionCommandBuilderMock.removeVariableLocal(anyString())).thenReturn(caseExecutionCommandBuilderMock); when(caseExecutionCommandBuilderMock.removeVariables(Matchers.<Collection<String>>any())).thenReturn(caseExecutionCommandBuilderMock); when(caseExecutionCommandBuilderMock.removeVariablesLocal(Matchers.<Collection<String>>any())).thenReturn(caseExecutionCommandBuilderMock); }
@Override public Void execute(CommandContext commandContext) { CmmnExecution caseTask = (CmmnExecution) caseService .createCaseExecutionQuery() .caseExecutionId(caseExecutionId) .singleResult(); caseTask.terminate(); return null; }
@Override protected void applyFilters(CaseExecutionQuery query) { if (caseExecutionId != null) { query.caseExecutionId(caseExecutionId);
@Override protected void applyFilters(CaseExecutionQuery query) { if (caseExecutionId != null) { query.caseExecutionId(caseExecutionId);
.get(CASE_EXECUTION_QUERY_URL); verify(mockedQuery).caseExecutionId(queryParameters.get("caseExecutionId")); verify(mockedQuery).caseDefinitionKey(queryParameters.get("caseDefinitionKey")); verify(mockedQuery).caseDefinitionId(queryParameters.get("caseDefinitionId"));
.post(CASE_EXECUTION_QUERY_URL); verify(mockedQuery).caseExecutionId(aCaseExecutionId); verify(mockedQuery).caseDefinitionKey(aCaseDefKey); verify(mockedQuery).caseDefinitionId(aCaseDefId);
@Test public void testCaseExecutionRetrieval() { Map<String, String> params = new HashMap<String, String>(); params.put("id", MockProvider.EXAMPLE_CASE_EXECUTION_ID); given() .pathParam("id", MockProvider.EXAMPLE_CASE_EXECUTION_ID) .then() .expect() .statusCode(Status.OK.getStatusCode()) .body("id", equalTo(MockProvider.EXAMPLE_CASE_EXECUTION_ID)) .body("caseInstanceId", equalTo(MockProvider.EXAMPLE_CASE_EXECUTION_CASE_INSTANCE_ID)) .body("parentId", equalTo(MockProvider.EXAMPLE_CASE_EXECUTION_PARENT_ID)) .body("caseDefinitionId", equalTo(MockProvider.EXAMPLE_CASE_EXECUTION_CASE_DEFINITION_ID)) .body("activityId", equalTo(MockProvider.EXAMPLE_CASE_EXECUTION_ACTIVITY_ID)) .body("activityName", equalTo(MockProvider.EXAMPLE_CASE_EXECUTION_ACTIVITY_NAME)) .body("activityType", equalTo(MockProvider.EXAMPLE_CASE_EXECUTION_ACTIVITY_TYPE)) .body("activityDescription", equalTo(MockProvider.EXAMPLE_CASE_EXECUTION_ACTIVITY_DESCRIPTION)) .body("tenantId", equalTo(MockProvider.EXAMPLE_TENANT_ID)) .body("required", equalTo(MockProvider.EXAMPLE_CASE_EXECUTION_IS_REQUIRED)) .body("active", equalTo(MockProvider.EXAMPLE_CASE_EXECUTION_IS_ACTIVE)) .body("enabled", equalTo(MockProvider.EXAMPLE_CASE_EXECUTION_IS_ENABLED)) .body("disabled", equalTo(MockProvider.EXAMPLE_CASE_EXECUTION_IS_DISABLED)) .when() .get(SINGLE_CASE_EXECUTION_URL); verify(caseServiceMock).createCaseExecutionQuery(); verify(caseExecutionQueryMock).caseExecutionId(MockProvider.EXAMPLE_CASE_EXECUTION_ID); verify(caseExecutionQueryMock).singleResult(); }
public void testQueryByCaseExecutionId() { CaseExecutionQuery query = caseService.createCaseExecutionQuery(); List<CaseExecution> executions = caseService .createCaseExecutionQuery() .caseDefinitionKey(CASE_DEFINITION_KEY_2) .list(); for (CaseExecution execution : executions) { query.caseExecutionId(execution.getId()); verifyQueryResults(query, 1); } }
inOrder.verify(mockedQuery).caseExecutionId(queryCaseExecutionId); inOrder.verify(mockedQuery).list();
inOrder.verify(mockedQuery).caseExecutionId(queryCaseExecutionId); inOrder.verify(mockedQuery).list();
/** * CAM-3226 */ @Deployment public void testSentryShouldNotBeEvaluatedAfterStageComplete() { // given String caseInstanceId = createCaseInstance().getId(); // when CaseExecution stageExecution = caseService.createCaseExecutionQuery().activityId("PI_Stage_1").singleResult(); assertNotNull(stageExecution); // .. there is a local stage variable caseService.setVariableLocal(stageExecution.getId(), "value", 99); // .. and the stage is activated (such that the tasks are instantiated) caseService.manuallyStartCaseExecution(stageExecution.getId()); CaseExecution task1Execution = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult(); assertNotNull(task1Execution); // then // .. completing the stage should be successful; evaluating Sentry_1 should not fail caseService.completeCaseExecution(task1Execution.getId()); stageExecution = caseService.createCaseExecutionQuery().activityId("PI_Stage_1").singleResult(); assertNull(stageExecution); // .. and the case plan model should have completed CaseExecution casePlanModelExecution = caseService.createCaseExecutionQuery().caseExecutionId(caseInstanceId).singleResult(); assertNotNull(casePlanModelExecution); assertFalse(casePlanModelExecution.isActive()); caseService.closeCaseInstance(caseInstanceId); }