@Override public void execute(PerfTestRunContext context) { long failedJobs = processEngine.getHistoryService().createHistoricJobLogQuery().failureLog().count(); long createdJobs = processEngine.getHistoryService().createHistoricJobLogQuery().creationLog().count(); long successfulJobs = processEngine.getHistoryService().createHistoricJobLogQuery().successLog().count(); System.out.println("Number of created jobs: " + createdJobs); System.out.println("Number of failed jobs: " + failedJobs); System.out.println("Number of successful jobs: " + successfulJobs); }
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; }
public CountResultDto queryHistoricJobLogsCount(HistoricJobLogQueryDto queryDto) { queryDto.setObjectMapper(objectMapper); HistoricJobLogQuery query = queryDto.toQuery(processEngine); long count = query.count(); CountResultDto result = new CountResultDto(); result.setCount(count); return result; }
public CountResultDto queryHistoricJobLogsCount(HistoricJobLogQueryDto queryDto) { queryDto.setObjectMapper(objectMapper); HistoricJobLogQuery query = queryDto.toQuery(processEngine); long count = query.count(); CountResultDto result = new CountResultDto(); result.setCount(count); return result; }
public void testQueryWithoutTenantId() { HistoricJobLogQuery query = historyService. createHistoricJobLogQuery(); assertThat(query.count(), is(4L)); }
public void testQueryAuthenticatedTenant() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); HistoricJobLogQuery query = historyService.createHistoricJobLogQuery(); assertThat(query.count(), is(2L)); assertThat(query.tenantIdIn(TENANT_ONE).count(), is(2L)); assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L)); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count(), is(2L)); }
public void testQueryAuthenticatedTenants() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE, TENANT_TWO)); HistoricJobLogQuery query = historyService.createHistoricJobLogQuery(); assertThat(query.count(), is(4L)); assertThat(query.tenantIdIn(TENANT_ONE).count(), is(2L)); assertThat(query.tenantIdIn(TENANT_TWO).count(), is(2L)); }
public void testQueryByTenantIds() { HistoricJobLogQuery query = historyService .createHistoricJobLogQuery() .tenantIdIn(TENANT_ONE, TENANT_TWO); assertThat(query.count(), is(4L)); }
public void testQueryByNonExistingTenantId() { HistoricJobLogQuery query = historyService .createHistoricJobLogQuery() .tenantIdIn("nonExisting"); assertThat(query.count(), is(0L)); }
public void testQueryNoAuthenticatedTenants() { identityService.setAuthentication("user", null, null); HistoricJobLogQuery query = historyService.createHistoricJobLogQuery(); assertThat(query.count(), is(0L)); }
@Test public void testQueryCount() { expect() .statusCode(Status.OK.getStatusCode()) .body("count", equalTo(1)) .when() .get(HISTORIC_JOB_LOG_COUNT_RESOURCE_URL); verify(mockedQuery).count(); }
public void testQueryDisabledTenantCheck() { processEngineConfiguration.setTenantCheckEnabled(false); identityService.setAuthentication("user", null, null); HistoricJobLogQuery query = historyService.createHistoricJobLogQuery(); assertThat(query.count(), is(4L)); }
@Test public void testQueryCountForPost() { given() .contentType(POST_JSON_CONTENT_TYPE) .body(EMPTY_JSON_OBJECT) .then() .expect() .body("count", equalTo(1)) .when() .post(HISTORIC_JOB_LOG_COUNT_RESOURCE_URL); verify(mockedQuery).count(); }
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()); } }
@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 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()); }
@Test @Deployment(resources = { "org/camunda/bpm/engine/test/api/mgmt/IncidentTest.testShouldCreateOneIncident.bpmn" }) public void testCleanupHistoricJobLogs() { //given List<String> ids = prepareHistoricProcesses("failingProcess", null, 1); testRule.executeAvailableJobs(); runtimeService.deleteProcessInstances(ids, null, true, true); List<String> byteArrayIds = findExceptionByteArrayIds(); //when historyService.deleteHistoricProcessInstancesBulk(ids); //then assertEquals(0, historyService.createHistoricProcessInstanceQuery().processDefinitionKey("failingProcess").count()); assertEquals(0, historyService.createHistoricJobLogQuery().count()); verifyByteArraysWereRemoved(byteArrayIds.toArray(new String[] {})); }
@Test public void testCleanupHistoricJobLog() { initBatchOperationHistoryTimeToLive(DEFAULT_TTL_DAYS); int daysInThePast = -11; // given prepareHistoricBatches(1, daysInThePast); HistoricBatch batch = historyService.createHistoricBatchQuery().singleResult(); String batchId = batch.getId(); // when runHistoryCleanup(); // then assertEquals(0, historyService.createHistoricBatchQuery().count()); assertEquals(0, historyService.createHistoricJobLogQuery().jobDefinitionConfiguration(batchId).count()); }
public void testAsyncSignalStartEventDeleteDeploymentWhileAsync() { // given a deployment org.camunda.bpm.engine.repository.Deployment deployment = repositoryService.createDeployment() .addClasspathResource("org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventTest.signalStartEvent.bpmn20.xml") .addClasspathResource("org/camunda/bpm/engine/test/bpmn/event/signal/SignalEventTests.throwAlertSignalAsync.bpmn20.xml") .deploy(); // and an active job for asynchronously triggering a signal start event runtimeService.startProcessInstanceByKey("throwSignalAsync"); // then deleting the deployment succeeds repositoryService.deleteDeployment(deployment.getId(), true); assertEquals(0, repositoryService.createDeploymentQuery().count()); int historyLevel = processEngineConfiguration.getHistoryLevel().getId(); if (historyLevel >= HistoryLevel.HISTORY_LEVEL_FULL.getId()) { // and there are no job logs left assertEquals(0, historyService.createHistoricJobLogQuery().count()); } }