public void testQueryByInvalidProcessInstanceId() { HistoricJobLogQuery query = historyService.createHistoricJobLogQuery().processInstanceId("invalid"); verifyQueryResults(query, 0); try { query.processInstanceId(null); fail(); } catch (Exception e) { } }
protected void verifyStringParameterQueryInvocations() { Map<String, String> stringQueryParameters = getCompleteStringQueryParameters(); verify(mockedQuery).logId(stringQueryParameters.get("logId")); verify(mockedQuery).jobId(stringQueryParameters.get("jobId")); verify(mockedQuery).jobExceptionMessage(stringQueryParameters.get("jobExceptionMessage")); verify(mockedQuery).jobDefinitionId(stringQueryParameters.get("jobDefinitionId")); verify(mockedQuery).jobDefinitionType(stringQueryParameters.get("jobDefinitionType")); verify(mockedQuery).jobDefinitionConfiguration(stringQueryParameters.get("jobDefinitionConfiguration")); verify(mockedQuery).processInstanceId(stringQueryParameters.get("processInstanceId")); verify(mockedQuery).processDefinitionId(stringQueryParameters.get("processDefinitionId")); verify(mockedQuery).processDefinitionKey(stringQueryParameters.get("processDefinitionKey")); verify(mockedQuery).deploymentId(stringQueryParameters.get("deploymentId")); verify(mockedQuery).list(); }
@Test public void getHistoricJobLogExceptionStacktraceWithAuthenticatedTenant() { testRule.deployForTenant(TENANT_ONE, FAILING_BPMN_PROCESS); String processInstanceId = startProcessInstance(null); testRule.executeAvailableJobs(); HistoricJobLog log = historyService.createHistoricJobLogQuery() .processInstanceId(processInstanceId).failureLog().listPage(0, 1).get(0); identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); String historicJobLogExceptionStacktrace = historyService.getHistoricJobLogExceptionStacktrace(log.getId()); assertThat(historicJobLogExceptionStacktrace, notNullValue()); }
@Test public void testSimpleHistoricJobLogQueryAsPost() { String processInstanceId = MockProvider.EXAMPLE_HISTORIC_JOB_LOG_PROC_INST_ID; Map<String, Object> json = new HashMap<String, Object>(); json.put("processInstanceId", processInstanceId); Response response = given() .contentType(POST_JSON_CONTENT_TYPE) .body(json) .then() .expect() .statusCode(Status.OK.getStatusCode()) .when() .post(HISTORIC_JOB_LOG_RESOURCE_URL); InOrder inOrder = inOrder(mockedQuery); inOrder.verify(mockedQuery).processInstanceId(processInstanceId); inOrder.verify(mockedQuery).list(); String content = response.asString(); List<String> logs = from(content).getList(""); Assert.assertEquals("There should be one historic job log returned.", 1, logs.size()); Assert.assertNotNull("The returned historic job log should not be null.", logs.get(0)); verifyHistoricJobLogEntries(content); }
@Test public void testSimpleHistoricJobLogQuery() { String processInstanceId = MockProvider.EXAMPLE_PROCESS_INSTANCE_ID; Response response = given() .queryParam("processInstanceId", processInstanceId) .then() .expect() .statusCode(Status.OK.getStatusCode()) .when() .get(HISTORIC_JOB_LOG_RESOURCE_URL); InOrder inOrder = inOrder(mockedQuery); inOrder.verify(mockedQuery).processInstanceId(processInstanceId); inOrder.verify(mockedQuery).list(); String content = response.asString(); List<String> logs = from(content).getList(""); Assert.assertEquals("There should be one historic job log returned.", 1, logs.size()); Assert.assertNotNull("The returned historic job log should not be null.", logs.get(0)); verifyHistoricJobLogEntries(content); }
query.processInstanceId(processInstanceId);
query.processInstanceId(processInstanceId);
@Test public void getHistoricJobLogExceptionStacktraceWithDisabledTenantCheck() { testRule.deployForTenant(TENANT_ONE, FAILING_BPMN_PROCESS); String processInstanceId = startProcessInstance(TENANT_ONE); testRule.executeAvailableJobs(); HistoricJobLog log = historyService.createHistoricJobLogQuery() .processInstanceId(processInstanceId).failureLog().listPage(0, 1).get(0); identityService.setAuthentication("user", null, null); processEngineConfiguration.setTenantCheckEnabled(false); String historicJobLogExceptionStacktrace = historyService.getHistoricJobLogExceptionStacktrace(log.getId()); assertThat(historicJobLogExceptionStacktrace, notNullValue()); }
@Deployment(resources = {"org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml"}) public void testQueryByProcessInstanceId() { runtimeService.startProcessInstanceByKey("process"); String processInstanceId = managementService.createJobQuery().singleResult().getProcessInstanceId(); HistoricJobLogQuery query = historyService.createHistoricJobLogQuery().processInstanceId(processInstanceId); verifyQueryResults(query, 1); }
@Test public void failToGetHistoricJobLogExceptionStacktraceNoAuthenticatedTenants() { testRule.deployForTenant(TENANT_ONE, FAILING_BPMN_PROCESS); String processInstanceId = startProcessInstance(null); String historicJobLogId = historyService.createHistoricJobLogQuery() .processInstanceId(processInstanceId).singleResult().getId(); identityService.setAuthentication("user", null, null); thrown.expect(ProcessEngineException.class); thrown.expectMessage("Cannot get the historic job log"); historyService.getHistoricJobLogExceptionStacktrace(historicJobLogId); }
public void testQueryByInvalidProcessInstanceId() { HistoricJobLogQuery query = historyService.createHistoricJobLogQuery().processInstanceId("invalid"); verifyQueryResults(query, 0); try { query.processInstanceId(null); fail(); } catch (Exception e) { } }
@Test public void getHistoricJobLogExceptionStacktraceWithAuthenticatedTenant() { testRule.deployForTenant(TENANT_ONE, FAILING_BPMN_PROCESS); String processInstanceId = startProcessInstance(null); testRule.executeAvailableJobs(); HistoricJobLog log = historyService.createHistoricJobLogQuery() .processInstanceId(processInstanceId).failureLog().listPage(0, 1).get(0); identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); String historicJobLogExceptionStacktrace = historyService.getHistoricJobLogExceptionStacktrace(log.getId()); assertThat(historicJobLogExceptionStacktrace, notNullValue()); }
@Test public void getHistoricJobLogExceptionStacktraceWithDisabledTenantCheck() { testRule.deployForTenant(TENANT_ONE, FAILING_BPMN_PROCESS); String processInstanceId = startProcessInstance(TENANT_ONE); testRule.executeAvailableJobs(); HistoricJobLog log = historyService.createHistoricJobLogQuery() .processInstanceId(processInstanceId).failureLog().listPage(0, 1).get(0); identityService.setAuthentication("user", null, null); processEngineConfiguration.setTenantCheckEnabled(false); String historicJobLogExceptionStacktrace = historyService.getHistoricJobLogExceptionStacktrace(log.getId()); assertThat(historicJobLogExceptionStacktrace, notNullValue()); }
@Deployment(resources = {"org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml"}) public void testQueryByProcessInstanceId() { runtimeService.startProcessInstanceByKey("process"); String processInstanceId = managementService.createJobQuery().singleResult().getProcessInstanceId(); HistoricJobLogQuery query = historyService.createHistoricJobLogQuery().processInstanceId(processInstanceId); verifyQueryResults(query, 1); }
query.processInstanceId(processInstanceId);
@Test public void failToGetHistoricJobLogExceptionStacktraceNoAuthenticatedTenants() { testRule.deployForTenant(TENANT_ONE, FAILING_BPMN_PROCESS); String processInstanceId = startProcessInstance(null); String historicJobLogId = historyService.createHistoricJobLogQuery() .processInstanceId(processInstanceId).singleResult().getId(); identityService.setAuthentication("user", null, null); thrown.expect(ProcessEngineException.class); thrown.expectMessage("Cannot get the historic job log"); historyService.getHistoricJobLogExceptionStacktrace(historicJobLogId); }