private void createHistoricJobLogMock() { HistoricJobLogQuery mockHistoricJobLogQuery = mock(HistoricJobLogQuery.class); List<HistoricJobLog> historicJobLogs = MockProvider.createMockHistoricJobLogs(); when(mockHistoricJobLogQuery.list()).thenReturn(historicJobLogs); when(mockHistoryService.createHistoricJobLogQuery()).thenReturn(mockHistoricJobLogQuery); }
protected void verifyIntegerParameterQueryInvocations() { verify(mockedQuery).jobPriorityLowerThanOrEquals(JOB_LOG_QUERY_MAX_PRIORITY); verify(mockedQuery).jobPriorityHigherThanOrEquals(JOB_LOG_QUERY_MIN_PRIORITY); verify(mockedQuery).list(); verifyNoMoreInteractions(mockedQuery); }
protected HistoricJobLogQuery setUpMockHistoricJobLogQuery(List<HistoricJobLog> mockedHistoricJogLogs) { HistoricJobLogQuery mockedhistoricJobLogQuery = mock(HistoricJobLogQuery.class); when(mockedhistoricJobLogQuery.list()).thenReturn(mockedHistoricJogLogs); when(mockedhistoricJobLogQuery.count()).thenReturn((long) mockedHistoricJogLogs.size()); when(processEngine.getHistoryService().createHistoricJobLogQuery()).thenReturn(mockedhistoricJobLogQuery); return mockedhistoricJobLogQuery; }
protected void verifyBooleanParameterQueryInvocations() { verify(mockedQuery).creationLog(); verify(mockedQuery).failureLog(); verify(mockedQuery).successLog(); verify(mockedQuery).deletionLog(); verify(mockedQuery).list(); }
private List<String> findExceptionByteArrayIds() { List<String> exceptionByteArrayIds = new ArrayList<String>(); List<HistoricJobLog> historicJobLogs = historyService.createHistoricJobLogQuery().list(); for (HistoricJobLog historicJobLog : historicJobLogs) { HistoricJobLogEventEntity historicJobLogEventEntity = (HistoricJobLogEventEntity) historicJobLog; if (historicJobLogEventEntity.getExceptionByteArrayId() != null) { exceptionByteArrayIds.add(historicJobLogEventEntity.getExceptionByteArrayId()); } } return exceptionByteArrayIds; }
private List<String> findExceptionByteArrayIds() { List<String> exceptionByteArrayIds = new ArrayList<String>(); List<HistoricJobLog> historicJobLogs = historyService.createHistoricJobLogQuery().list(); for (HistoricJobLog historicJobLog : historicJobLogs) { HistoricJobLogEventEntity historicJobLogEventEntity = (HistoricJobLogEventEntity) historicJobLog; if (historicJobLogEventEntity.getExceptionByteArrayId() != null) { exceptionByteArrayIds.add(historicJobLogEventEntity.getExceptionByteArrayId()); } } return exceptionByteArrayIds; }
protected void verifyQueryWithOrdering(HistoricJobLogQuery query, int countExpected, NullTolerantComparator<HistoricJobLog> expectedOrdering) { verifyQueryResults(query, countExpected); TestOrderingUtil.verifySorting(query.list(), expectedOrdering); }
protected List<ByteArrayEntity> findByteArrays() { List<HistoricJobLog> jobLogs = historyService.createHistoricJobLogQuery() .failureLog() .list(); List<ByteArrayEntity> byteArrays = new ArrayList<>(); for (HistoricJobLog jobLog: jobLogs) { byteArrays.add(findByteArrayById(((HistoricJobLogEventEntity) jobLog).getExceptionByteArrayId())); } return byteArrays; }
@Test public void testNoParametersQuery() { expect() .statusCode(Status.OK.getStatusCode()) .when() .get(HISTORIC_JOB_LOG_RESOURCE_URL); verify(mockedQuery).list(); verifyNoMoreInteractions(mockedQuery); }
public void testQuerySortingAsc() { List<HistoricJobLog> historicJobLogs = historyService.createHistoricJobLogQuery() .orderByTenantId() .asc() .list(); assertThat(historicJobLogs.size(), is(4)); assertThat(historicJobLogs.get(0).getTenantId(), is(TENANT_ONE)); assertThat(historicJobLogs.get(1).getTenantId(), is(TENANT_ONE)); assertThat(historicJobLogs.get(2).getTenantId(), is(TENANT_TWO)); assertThat(historicJobLogs.get(3).getTenantId(), is(TENANT_TWO)); }
public void testQuerySortingDesc() { List<HistoricJobLog> historicJobLogs = historyService.createHistoricJobLogQuery() .orderByTenantId() .desc() .list(); assertThat(historicJobLogs.size(), is(4)); assertThat(historicJobLogs.get(0).getTenantId(), is(TENANT_TWO)); assertThat(historicJobLogs.get(1).getTenantId(), is(TENANT_TWO)); assertThat(historicJobLogs.get(2).getTenantId(), is(TENANT_ONE)); assertThat(historicJobLogs.get(3).getTenantId(), is(TENANT_ONE)); }
@Test public void testEmptyQuery() { String queryKey = ""; given() .queryParam("processDefinitionKey", queryKey) .then() .expect() .statusCode(Status.OK.getStatusCode()) .when() .get(HISTORIC_JOB_LOG_RESOURCE_URL); verify(mockedQuery).list(); }
@Test public void testNoParametersQueryAsPost() { given() .contentType(POST_JSON_CONTENT_TYPE) .body(EMPTY_JSON_OBJECT) .then() .expect() .statusCode(Status.OK.getStatusCode()) .when() .post(HISTORIC_JOB_LOG_RESOURCE_URL); verify(mockedQuery).list(); verifyNoMoreInteractions(mockedQuery); }
public Void execute(CommandContext commandContext) { List<HistoricJobLog> jobLogs = processEngine.getHistoryService().createHistoricJobLogQuery().list(); for (HistoricJobLog jobLog : jobLogs) { commandContext.getHistoricJobLogManager().deleteHistoricJobLogById(jobLog.getId()); } return null; } });
public Void execute(CommandContext commandContext) { List<HistoricJobLog> historicJobLogs = processEngineConfiguration .getHistoryService() .createHistoricJobLogQuery() .list(); for (HistoricJobLog historicJobLog : historicJobLogs) { commandContext .getHistoricJobLogManager() .deleteHistoricJobLogById(historicJobLog.getId()); } return null; } });
protected void verifyQueryResults(HistoricJobLogQuery query, int countExpected) { assertEquals(countExpected, query.list().size()); assertEquals(countExpected, query.count()); if (countExpected == 1) { assertNotNull(query.singleResult()); } else if (countExpected > 1){ verifySingleResultFails(query); } else if (countExpected == 0) { assertNull(query.singleResult()); } }
public List<HistoricJobLog> getHistoricMonitorJobLog(Batch batch) { return getHistoryService() .createHistoricJobLogQuery() .jobDefinitionId(batch.getMonitorJobDefinitionId()) .orderPartiallyByOccurrence() .asc() .list(); }
public List<HistoricJobLog> getHistoricSeedJobLog(Batch batch) { return getHistoryService() .createHistoricJobLogQuery() .jobDefinitionId(batch.getSeedJobDefinitionId()) .orderPartiallyByOccurrence() .asc() .list(); }
public List<HistoricJobLog> getHistoricBatchJobLog(Batch batch) { return getHistoryService() .createHistoricJobLogQuery() .jobDefinitionId(batch.getBatchJobDefinitionId()) .orderPartiallyByOccurrence() .asc() .list(); }
public List<HistoricJobLog> getHistoricMonitorJobLog(Batch batch, Job monitorJob) { return getHistoryService() .createHistoricJobLogQuery() .jobDefinitionId(batch.getMonitorJobDefinitionId()) .jobId(monitorJob.getId()) .orderPartiallyByOccurrence() .asc() .list(); }