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(); }
@Deployment(resources = {"org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml"}) public void testQueryByJobId() { runtimeService.startProcessInstanceByKey("process"); String jobId = managementService.createJobQuery().singleResult().getId(); HistoricJobLogQuery query = historyService.createHistoricJobLogQuery().jobId(jobId); verifyQueryResults(query, 1); }
public List<HistoricJobLog> getHistoricMonitorJobLog(Batch batch, Job monitorJob) { return getHistoryService() .createHistoricJobLogQuery() .jobDefinitionId(batch.getMonitorJobDefinitionId()) .jobId(monitorJob.getId()) .orderPartiallyByOccurrence() .asc() .list(); }
@Deployment(resources = {"org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml"}) public void testDeletedJob() { // given runtimeService.startProcessInstanceByKey("process"); String jobId = managementService.createJobQuery().singleResult().getId(); HistoricJobLogQuery query = historyService.createHistoricJobLogQuery().jobId(jobId); HistoricJobLogQuery createdQuery = historyService.createHistoricJobLogQuery().jobId(jobId).creationLog(); HistoricJobLogQuery deletedQuery = historyService.createHistoricJobLogQuery().jobId(jobId).deletionLog(); // there exists one historic job log entry assertEquals(1, query.count()); assertEquals(1, createdQuery.count()); assertEquals(0, deletedQuery.count()); // when managementService.deleteJob(jobId); // then assertEquals(2, query.count()); assertEquals(1, createdQuery.count()); assertEquals(1, deletedQuery.count()); HistoricJobLog createdJobLogEntry = createdQuery.singleResult(); assertEquals(3, createdJobLogEntry.getJobRetries()); HistoricJobLog deletedJobLogEntry = deletedQuery.singleResult(); assertEquals(3, deletedJobLogEntry.getJobRetries()); }
@Deployment(resources = {"org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml"}) public void testDeletedProcessInstance() { // given String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId(); String jobId = managementService.createJobQuery().singleResult().getId(); HistoricJobLogQuery query = historyService.createHistoricJobLogQuery().jobId(jobId); HistoricJobLogQuery createdQuery = historyService.createHistoricJobLogQuery().jobId(jobId).creationLog(); HistoricJobLogQuery deletedQuery = historyService.createHistoricJobLogQuery().jobId(jobId).deletionLog(); // there exists one historic job log entry assertEquals(1, query.count()); assertEquals(1, createdQuery.count()); assertEquals(0, deletedQuery.count()); // when runtimeService.deleteProcessInstance(processInstanceId, null); // then assertEquals(2, query.count()); assertEquals(1, createdQuery.count()); assertEquals(1, deletedQuery.count()); HistoricJobLog createdJobLogEntry = createdQuery.singleResult(); assertEquals(3, createdJobLogEntry.getJobRetries()); HistoricJobLog deletedJobLogEntry = deletedQuery.singleResult(); assertEquals(3, deletedJobLogEntry.getJobRetries()); }
@Deployment(resources = {"org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml"}) public void testSuccessfulJobEvent() { // given runtimeService.startProcessInstanceByKey("process", Variables.createVariables().putValue("fail", false)); String jobId = managementService.createJobQuery().singleResult().getId(); HistoricJobLogQuery query = historyService.createHistoricJobLogQuery().jobId(jobId); HistoricJobLogQuery createdQuery = historyService.createHistoricJobLogQuery().jobId(jobId).creationLog(); HistoricJobLogQuery succeededQuery = historyService.createHistoricJobLogQuery().jobId(jobId).successLog(); // there exists one historic job log entry assertEquals(1, query.count()); assertEquals(1, createdQuery.count()); assertEquals(0, succeededQuery.count()); // when managementService.executeJob(jobId); // then assertEquals(2, query.count()); assertEquals(1, createdQuery.count()); assertEquals(1, succeededQuery.count()); HistoricJobLog createdJobLogEntry = createdQuery.singleResult(); assertEquals(3, createdJobLogEntry.getJobRetries()); HistoricJobLog succeededJobLogEntry = succeededQuery.singleResult(); assertEquals(3, succeededJobLogEntry.getJobRetries()); }
@Deployment(resources = {"org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml"}) public void testSuccessfulJobEventExecutedByJobExecutor() { // given runtimeService.startProcessInstanceByKey("process", Variables.createVariables().putValue("fail", false)); String jobId = managementService.createJobQuery().singleResult().getId(); HistoricJobLogQuery query = historyService.createHistoricJobLogQuery().jobId(jobId); HistoricJobLogQuery createdQuery = historyService.createHistoricJobLogQuery().jobId(jobId).creationLog(); HistoricJobLogQuery succeededQuery = historyService.createHistoricJobLogQuery().jobId(jobId).successLog(); // there exists one historic job log entry assertEquals(1, query.count()); assertEquals(1, createdQuery.count()); assertEquals(0, succeededQuery.count()); // when executeAvailableJobs(); // then assertEquals(2, query.count()); assertEquals(1, createdQuery.count()); assertEquals(1, succeededQuery.count()); HistoricJobLog createdJobLogEntry = createdQuery.singleResult(); assertEquals(3, createdJobLogEntry.getJobRetries()); HistoricJobLog succeededJobLogEntry = succeededQuery.singleResult(); assertEquals(3, succeededJobLogEntry.getJobRetries()); }
@Deployment(resources = {"org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml"}) public void testAsyncBeforeJobHandlerType() { processEngineConfiguration.setEnsureJobDueDateNotNull(false); runtimeService.startProcessInstanceByKey("process"); Job job = managementService .createJobQuery() .singleResult(); HistoricJobLog historicJob = historyService .createHistoricJobLogQuery() .jobId(job.getId()) .singleResult(); assertNotNull(historicJob); assertNull(historicJob.getJobDueDate()); assertEquals(job.getJobDefinitionId(), historicJob.getJobDefinitionId()); assertEquals("serviceTask", historicJob.getActivityId()); assertEquals(AsyncContinuationJobHandler.TYPE, historicJob.getJobDefinitionType()); assertEquals(MessageJobDeclaration.ASYNC_BEFORE, historicJob.getJobDefinitionConfiguration()); }
@Deployment(resources = {"org/camunda/bpm/engine/test/history/HistoricJobLogTest.testStartTimerEvent.bpmn20.xml"}) public void testStartTimerEventJobHandlerType() { Job job = managementService .createJobQuery() .singleResult(); HistoricJobLog historicJob = historyService .createHistoricJobLogQuery() .jobId(job.getId()) .singleResult(); assertNotNull(historicJob); assertEquals(job.getId(), historicJob.getJobId()); assertEquals(job.getJobDefinitionId(), historicJob.getJobDefinitionId()); assertEquals("theStart", historicJob.getActivityId()); assertEquals(TimerStartEventJobHandler.TYPE, historicJob.getJobDefinitionType()); assertEquals("CYCLE: 0 0/5 * * * ?", historicJob.getJobDefinitionConfiguration()); assertEquals(job.getDuedate(), historicJob.getJobDueDate()); }
@Deployment(resources = {"org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml"}) public void testAsyncAfterJobHandlerType() { processEngineConfiguration.setEnsureJobDueDateNotNull(false); runtimeService.startProcessInstanceByKey("process", Variables.createVariables().putValue("fail", false)); Job job = managementService .createJobQuery() .singleResult(); managementService.executeJob(job.getId()); Job anotherJob = managementService .createJobQuery() .singleResult(); assertFalse(job.getId().equals(anotherJob.getId())); HistoricJobLog historicJob = historyService .createHistoricJobLogQuery() .jobId(anotherJob.getId()) .singleResult(); assertNotNull(historicJob); assertNull(historicJob.getJobDueDate()); assertEquals(anotherJob.getJobDefinitionId(), historicJob.getJobDefinitionId()); assertEquals("serviceTask", historicJob.getActivityId()); assertEquals(AsyncContinuationJobHandler.TYPE, historicJob.getJobDefinitionType()); assertEquals(MessageJobDeclaration.ASYNC_AFTER, historicJob.getJobDefinitionConfiguration()); }
@Deployment(resources = {"org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml"}) public void testAsyncAfterJobHandlerTypeDueDateSet() { processEngineConfiguration.setEnsureJobDueDateNotNull(true); Date testDate = ClockTestUtil.setClockToDateWithoutMilliseconds(); runtimeService.startProcessInstanceByKey("process", Variables.createVariables().putValue("fail", false)); Job job = managementService .createJobQuery() .singleResult(); managementService.executeJob(job.getId()); Job anotherJob = managementService .createJobQuery() .singleResult(); assertFalse(job.getId().equals(anotherJob.getId())); HistoricJobLog historicJob = historyService .createHistoricJobLogQuery() .jobId(anotherJob.getId()) .singleResult(); assertNotNull(historicJob); assertEquals(testDate, historicJob.getJobDueDate()); assertEquals(anotherJob.getJobDefinitionId(), historicJob.getJobDefinitionId()); assertEquals("serviceTask", historicJob.getActivityId()); assertEquals(AsyncContinuationJobHandler.TYPE, historicJob.getJobDefinitionType()); assertEquals(MessageJobDeclaration.ASYNC_AFTER, historicJob.getJobDefinitionConfiguration()); }
@Deployment(resources = {"org/camunda/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml"}) public void testAsyncBeforeJobHandlerTypeDueDateSet() { processEngineConfiguration.setEnsureJobDueDateNotNull(true); Date testDate = ClockTestUtil.setClockToDateWithoutMilliseconds(); runtimeService.startProcessInstanceByKey("process"); Job job = managementService .createJobQuery() .singleResult(); HistoricJobLog historicJob = historyService .createHistoricJobLogQuery() .jobId(job.getId()) .singleResult(); assertNotNull(historicJob); assertEquals(testDate, historicJob.getJobDueDate()); assertEquals(job.getJobDefinitionId(), historicJob.getJobDefinitionId()); assertEquals("serviceTask", historicJob.getActivityId()); assertEquals(AsyncContinuationJobHandler.TYPE, historicJob.getJobDefinitionType()); assertEquals(MessageJobDeclaration.ASYNC_BEFORE, historicJob.getJobDefinitionConfiguration()); }
@Deployment(resources = {"org/camunda/bpm/engine/test/history/HistoricJobLogTest.testIntermediateTimerEvent.bpmn20.xml"}) public void testIntermediateTimerEventJobHandlerType() { runtimeService.startProcessInstanceByKey("process"); Job job = managementService .createJobQuery() .singleResult(); HistoricJobLog historicJob = historyService .createHistoricJobLogQuery() .jobId(job.getId()) .singleResult(); assertNotNull(historicJob); assertEquals(job.getId(), historicJob.getJobId()); assertEquals(job.getJobDefinitionId(), historicJob.getJobDefinitionId()); assertEquals("timer", historicJob.getActivityId()); assertEquals(TimerCatchIntermediateEventJobHandler.TYPE, historicJob.getJobDefinitionType()); assertEquals("DURATION: PT1M", historicJob.getJobDefinitionConfiguration()); assertEquals(job.getDuedate(), historicJob.getJobDueDate()); }
@Deployment(resources = {"org/camunda/bpm/engine/test/history/HistoricJobLogTest.testBoundaryTimerEvent.bpmn20.xml"}) public void testBoundaryTimerEventJobHandlerType() { runtimeService.startProcessInstanceByKey("process"); Job job = managementService .createJobQuery() .singleResult(); HistoricJobLog historicJob = historyService .createHistoricJobLogQuery() .jobId(job.getId()) .singleResult(); assertNotNull(historicJob); assertEquals(job.getId(), historicJob.getJobId()); assertEquals(job.getJobDefinitionId(), historicJob.getJobDefinitionId()); assertEquals("timer", historicJob.getActivityId()); assertEquals(TimerExecuteNestedActivityJobHandler.TYPE, historicJob.getJobDefinitionType()); assertEquals("DURATION: PT5M", historicJob.getJobDefinitionConfiguration()); assertEquals(job.getDuedate(), historicJob.getJobDueDate()); }
@Deployment(resources = {"org/camunda/bpm/engine/test/history/HistoricJobLogTest.testStartTimerEventInsideEventSubProcess.bpmn20.xml"}) public void testStartTimerEventInsideEventSubProcessJobHandlerType() { runtimeService.startProcessInstanceByKey("process"); Job job = managementService .createJobQuery() .singleResult(); HistoricJobLog historicJob = historyService .createHistoricJobLogQuery() .jobId(job.getId()) .singleResult(); assertNotNull(historicJob); assertEquals(job.getId(), historicJob.getJobId()); assertEquals(job.getJobDefinitionId(), historicJob.getJobDefinitionId()); assertEquals("subprocessStartEvent", historicJob.getActivityId()); assertEquals(TimerStartEventSubprocessJobHandler.TYPE, historicJob.getJobDefinitionType()); assertEquals("DURATION: PT1M", historicJob.getJobDefinitionConfiguration()); assertEquals(job.getDuedate(), historicJob.getJobDueDate()); }
@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricJobLogTest.testCatchingSignalEvent.bpmn20.xml", "org/camunda/bpm/engine/test/history/HistoricJobLogTest.testThrowingSignalEventAsync.bpmn20.xml" }) public void testCatchingSignalEventJobHandlerType() { processEngineConfiguration.setEnsureJobDueDateNotNull(false); runtimeService.startProcessInstanceByKey("catchSignal"); runtimeService.startProcessInstanceByKey("throwSignal"); Job job = managementService .createJobQuery() .singleResult(); HistoricJobLog historicJob = historyService .createHistoricJobLogQuery() .jobId(job.getId()) .singleResult(); assertNotNull(historicJob); assertNull(historicJob.getJobDueDate()); assertEquals(job.getId(), historicJob.getJobId()); assertEquals(job.getJobDefinitionId(), historicJob.getJobDefinitionId()); assertEquals("signalEvent", historicJob.getActivityId()); assertEquals(ProcessEventJobHandler.TYPE, historicJob.getJobDefinitionType()); assertNull(historicJob.getJobDefinitionConfiguration()); }
@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricJobLogTest.testCatchingSignalEvent.bpmn20.xml", "org/camunda/bpm/engine/test/history/HistoricJobLogTest.testThrowingSignalEventAsync.bpmn20.xml" }) public void testCatchingSignalEventJobHandlerTypeDueDateSet() { processEngineConfiguration.setEnsureJobDueDateNotNull(true); Date testDate = ClockTestUtil.setClockToDateWithoutMilliseconds(); runtimeService.startProcessInstanceByKey("catchSignal"); runtimeService.startProcessInstanceByKey("throwSignal"); Job job = managementService .createJobQuery() .singleResult(); HistoricJobLog historicJob = historyService .createHistoricJobLogQuery() .jobId(job.getId()) .singleResult(); assertNotNull(historicJob); assertEquals(testDate, historicJob.getJobDueDate()); assertEquals(job.getId(), historicJob.getJobId()); assertEquals(job.getJobDefinitionId(), historicJob.getJobDefinitionId()); assertEquals("signalEvent", historicJob.getActivityId()); assertEquals(ProcessEventJobHandler.TYPE, historicJob.getJobDefinitionType()); assertNull(historicJob.getJobDefinitionConfiguration()); }