org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery Java Examples
The following examples show how to use
org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MultiTenancyHistoricDataCmdsTenantCheckTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void deleteHistoricDecisionInstanceByInstanceIdWithAuthenticatedTenant() { // given testRule.deployForTenant(TENANT_ONE, DMN); evaluateDecisionTable(null); HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); HistoricDecisionInstance historicDecisionInstance = query.includeInputs().includeOutputs().singleResult(); // when identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); historyService.deleteHistoricDecisionInstanceByInstanceId(historicDecisionInstance.getId()); // then identityService.clearAuthentication(); assertThat(query.count(), is(0L)); }
Example #2
Source File: BatchHistoricDecisionInstanceDeletionTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void createMonitorJobByQuery() { // given HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION); Batch batch = historyService.deleteHistoricDecisionInstancesAsync(query, null); // when helper.completeSeedJobs(batch); // then the seed job definition still exists but the seed job is removed JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch); assertNotNull(seedJobDefinition); Job seedJob = helper.getSeedJob(batch); assertNull(seedJob); // and a monitor job definition and job exists JobDefinition monitorJobDefinition = helper.getMonitorJobDefinition(batch); assertNotNull(monitorJobDefinition); Job monitorJob = helper.getMonitorJob(batch); assertNotNull(monitorJob); }
Example #3
Source File: BatchSetRemovalTimeUserOperationLogTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @Deployment(resources = { "org/camunda/bpm/engine/test/dmn/deployment/drdDish.dmn11.xml" }) public void shouldWriteUserOperationLogForDecisionInstances_HierarchicalFalse() { // given evaluate(); identityService.setAuthenticatedUserId("aUserId"); HistoricDecisionInstanceQuery historicDecisionInstanceQuery = historyService.createHistoricDecisionInstanceQuery(); // when historyService.setRemovalTimeToHistoricDecisionInstances() .clearedRemovalTime() .byQuery(historicDecisionInstanceQuery) .executeAsync(); UserOperationLogEntry userOperationLogEntry = historyService.createUserOperationLogQuery() .property("hierarchical") .singleResult(); // then assertThat(userOperationLogEntry.getOrgValue()).isNull(); assertThat(userOperationLogEntry.getNewValue()).isEqualTo("false"); }
Example #4
Source File: BatchHistoricDecisionInstanceDeletionTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void deleteInstancesByIdsAndQuery() { // given HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION); Batch batch = historyService.deleteHistoricDecisionInstancesAsync(decisionInstanceIds, query, null); helper.completeSeedJobs(batch); List<Job> deletionJobs = helper.getExecutionJobs(batch); // when for (Job deletionJob : deletionJobs) { helper.executeJob(deletionJob); } // then assertEquals(0, historyService.createHistoricDecisionInstanceQuery().count()); }
Example #5
Source File: BatchHistoricDecisionInstanceDeletionTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void deleteInstancesByQuery() { // given HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION); Batch batch = historyService.deleteHistoricDecisionInstancesAsync(query, null); helper.completeSeedJobs(batch); List<Job> deletionJobs = helper.getExecutionJobs(batch); // when for (Job deletionJob : deletionJobs) { helper.executeJob(deletionJob); } // then assertEquals(0, historyService.createHistoricDecisionInstanceQuery().count()); }
Example #6
Source File: BatchHistoricDecisionInstanceDeletionAuthorizationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void executeBatch() { // given authRule.init(scenario) .withUser("userId") .start(); HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION); Batch batch = historyService.deleteHistoricDecisionInstancesAsync(decisionInstanceIds, query, null); if (batch != null) { Job job = managementService.createJobQuery().jobDefinitionId(batch.getSeedJobDefinitionId()).singleResult(); // seed job managementService.executeJob(job.getId()); for (Job pending : managementService.createJobQuery().jobDefinitionId(batch.getBatchJobDefinitionId()).list()) { managementService.executeJob(pending.getId()); } } // then if (authRule.assertScenario(scenario)) { assertEquals("userId", batch.getCreateUserId()); } }
Example #7
Source File: HistoricDecisionInstanceQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN }) public void testQueryByEvaluatedBefore() { Date beforeEvaluated = new Date(1441612000); Date evaluated = new Date(1441613000); Date afterEvaluated = new Date(1441614000); ClockUtil.setCurrentTime(evaluated); startProcessInstanceAndEvaluateDecision(); HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); assertThat(query.evaluatedBefore(afterEvaluated).count(), is(1L)); assertThat(query.evaluatedBefore(evaluated).count(), is(1L)); assertThat(query.evaluatedBefore(beforeEvaluated).count(), is(0L)); ClockUtil.reset(); }
Example #8
Source File: BatchSetRemovalTimeUserOperationLogTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @Deployment(resources = { "org/camunda/bpm/engine/test/dmn/deployment/drdDish.dmn11.xml" }) public void shouldWriteUserOperationLogForDecisionInstances_ModeAbsoluteRemovalTime() { // given evaluate(); identityService.setAuthenticatedUserId("aUserId"); HistoricDecisionInstanceQuery historicDecisionInstanceQuery = historyService.createHistoricDecisionInstanceQuery(); // when historyService.setRemovalTimeToHistoricDecisionInstances() .absoluteRemovalTime(new Date()) .byQuery(historicDecisionInstanceQuery) .executeAsync(); UserOperationLogEntry userOperationLogEntry = historyService.createUserOperationLogQuery() .property("mode") .singleResult(); // then assertThat(userOperationLogEntry.getOrgValue()).isNull(); assertThat(userOperationLogEntry.getNewValue()).isEqualTo("ABSOLUTE_REMOVAL_TIME"); }
Example #9
Source File: BatchSetRemovalTimeUserOperationLogTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @Deployment(resources = { "org/camunda/bpm/engine/test/dmn/deployment/drdDish.dmn11.xml" }) public void shouldWriteUserOperationLogForDecisionInstances() { // given evaluate(); identityService.setAuthenticatedUserId("aUserId"); HistoricDecisionInstanceQuery historicDecisionInstanceQuery = historyService.createHistoricDecisionInstanceQuery(); // when historyService.setRemovalTimeToHistoricDecisionInstances() .calculatedRemovalTime() .byQuery(historicDecisionInstanceQuery) .executeAsync(); List<UserOperationLogEntry> userOperationLogEntries = historyService.createUserOperationLogQuery().list(); // then assertProperties(userOperationLogEntries, "mode", "removalTime", "hierarchical", "nrOfInstances", "async"); assertOperationType(userOperationLogEntries, "SetRemovalTime"); assertCategory(userOperationLogEntries, "Operator"); assertEntityType(userOperationLogEntries, "DecisionInstance"); }
Example #10
Source File: BatchSetRemovalTimeUserOperationLogTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test @Deployment(resources = { "org/camunda/bpm/engine/test/dmn/deployment/drdDish.dmn11.xml" }) public void shouldWriteUserOperationLogForDecisionInstances_ModeCalculatedRemovalTime() { // given evaluate(); identityService.setAuthenticatedUserId("aUserId"); HistoricDecisionInstanceQuery historicDecisionInstanceQuery = historyService.createHistoricDecisionInstanceQuery(); // when historyService.setRemovalTimeToHistoricDecisionInstances() .calculatedRemovalTime() .byQuery(historicDecisionInstanceQuery) .executeAsync(); UserOperationLogEntry userOperationLogEntry = historyService.createUserOperationLogQuery() .property("mode") .singleResult(); // then assertThat(userOperationLogEntry.getOrgValue()).isNull(); assertThat(userOperationLogEntry.getNewValue()).isEqualTo("CALCULATED_REMOVAL_TIME"); }
Example #11
Source File: HistoricDecisionInstanceResourceImpl.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public HistoricDecisionInstanceDto getHistoricDecisionInstance(Boolean includeInputs, Boolean includeOutputs, Boolean disableBinaryFetching, Boolean disableCustomObjectDeserialization) { HistoryService historyService = engine.getHistoryService(); HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionInstanceId(decisionInstanceId); if (includeInputs != null && includeInputs) { query.includeInputs(); } if (includeOutputs != null && includeOutputs) { query.includeOutputs(); } if (disableBinaryFetching != null && disableBinaryFetching) { query.disableBinaryFetching(); } if (disableCustomObjectDeserialization != null && disableCustomObjectDeserialization) { query.disableCustomObjectDeserialization(); } HistoricDecisionInstance instance = query.singleResult(); if (instance == null) { throw new InvalidRequestException(Status.NOT_FOUND, "Historic decision instance with id '" + decisionInstanceId + "' does not exist"); } return HistoricDecisionInstanceDto.fromHistoricDecisionInstance(instance); }
Example #12
Source File: HistoricDecisionInstanceTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public void testDeleteHistoricDecisionInstanceByUndeployment() { String firstDeploymentId = repositoryService.createDeployment() .addClasspathResource(DECISION_PROCESS) .addClasspathResource(DECISION_SINGLE_OUTPUT_DMN) .deploy().getId(); startProcessInstanceAndEvaluateDecision(); String secondDeploymentId = repositoryService.createDeployment() .addClasspathResource(DECISION_PROCESS) .addClasspathResource(DECISION_MULTIPLE_OUTPUT_DMN) .deploy().getId(); HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); assertThat(query.count(), is(1L)); repositoryService.deleteDeployment(secondDeploymentId, true); assertThat(query.count(), is(1L)); repositoryService.deleteDeployment(firstDeploymentId, true); assertThat(query.count(), is(0L)); }
Example #13
Source File: HistoricDecisionInstanceQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN }) public void testQueryByInvalidDecisionDefinitionNameLike() { startProcessInstanceAndEvaluateDecision(); HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); assertThat(query.decisionDefinitionNameLike("%invalid%").count(), is(0L)); try { query.decisionDefinitionNameLike(null); fail(); } catch (NotValidException e) { // Expected exception } }
Example #14
Source File: HistoricDecisionInstanceRestServiceImpl.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public List<HistoricDecisionInstanceDto> queryHistoricDecisionInstances(HistoricDecisionInstanceQueryDto queryDto, Integer firstResult, Integer maxResults) { HistoricDecisionInstanceQuery query = queryDto.toQuery(processEngine); List<HistoricDecisionInstance> matchingHistoricDecisionInstances; if (firstResult != null || maxResults != null) { matchingHistoricDecisionInstances = executePaginatedQuery(query, firstResult, maxResults); } else { matchingHistoricDecisionInstances = query.list(); } List<HistoricDecisionInstanceDto> historicDecisionInstanceDtoResults = new ArrayList<HistoricDecisionInstanceDto>(); for (HistoricDecisionInstance historicDecisionInstance : matchingHistoricDecisionInstances) { HistoricDecisionInstanceDto resultHistoricDecisionInstanceDto = HistoricDecisionInstanceDto.fromHistoricDecisionInstance(historicDecisionInstance); historicDecisionInstanceDtoResults.add(resultHistoricDecisionInstanceDto); } return historicDecisionInstanceDtoResults; }
Example #15
Source File: BatchSetRemovalTimeTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void shouldThrowBadUserRequestExceptionForStandaloneDecision() { // given // then thrown.expect(BadUserRequestException.class); thrown.expectMessage("historicDecisionInstances is empty"); HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); // when historyService.setRemovalTimeToHistoricDecisionInstances() .absoluteRemovalTime(REMOVAL_TIME) .byQuery(query) .executeAsync(); }
Example #16
Source File: HistoricDecisionInstanceRestServiceImpl.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public BatchDto deleteAsync(DeleteHistoricDecisionInstancesDto dto) { HistoricDecisionInstanceQuery decisionInstanceQuery = null; if (dto.getHistoricDecisionInstanceQuery() != null) { decisionInstanceQuery = dto.getHistoricDecisionInstanceQuery().toQuery(processEngine); } try { List<String> historicDecisionInstanceIds = dto.getHistoricDecisionInstanceIds(); String deleteReason = dto.getDeleteReason(); Batch batch = processEngine.getHistoryService().deleteHistoricDecisionInstancesAsync(historicDecisionInstanceIds, decisionInstanceQuery, deleteReason); return BatchDto.fromBatch(batch); } catch (BadUserRequestException e) { throw new InvalidRequestException(Status.BAD_REQUEST, e.getMessage()); } }
Example #17
Source File: HistoricDecisionInstanceAuthorizationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public void testDeleteHistoricDecisionInstanceByInstanceIdWithoutAuthorization() { // given createGrantAuthorization(DECISION_DEFINITION, DECISION_DEFINITION_KEY, userId, READ_HISTORY); startProcessInstanceAndEvaluateDecision(); HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); HistoricDecisionInstance historicDecisionInstance = query.includeInputs().includeOutputs().singleResult(); try { // when historyService.deleteHistoricDecisionInstanceByInstanceId(historicDecisionInstance.getId()); fail("expect authorization exception"); } catch (AuthorizationException e) { // then assertThat(e.getMessage(), is("The user with id 'test' does not have 'DELETE_HISTORY' permission on resource 'testDecision' of type 'DecisionDefinition'.")); } }
Example #18
Source File: BatchSetRemovalTimeHierarchicalTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test @Deployment(resources = { "org/camunda/bpm/engine/test/dmn/deployment/drdDish.dmn11.xml" }) public void shouldSetRemovalTimeToStandaloneDecision_ChildDecisionInstance() { // given decisionService.evaluateDecisionByKey("dish-decision") .variables( Variables.createVariables() .putValue("temperature", 32) .putValue("dayType", "Weekend") ).evaluate(); List<HistoricDecisionInstance> historicDecisionInstances = historyService.createHistoricDecisionInstanceQuery() .decisionDefinitionKey("season") .list(); // assume assertThat(historicDecisionInstances.get(0).getRemovalTime()).isNull(); testRule.updateHistoryTimeToLiveDmn("dish-decision", 5); HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().rootDecisionInstancesOnly(); // when testRule.syncExec( historyService.setRemovalTimeToHistoricDecisionInstances() .calculatedRemovalTime() .byQuery(query) .hierarchical() .executeAsync() ); historicDecisionInstances = historyService.createHistoricDecisionInstanceQuery() .decisionDefinitionKey("season") .list(); // then assertThat(historicDecisionInstances.get(0).getRemovalTime()).isEqualTo(addDays(CURRENT_DATE, 5)); }
Example #19
Source File: HistoricDecisionInstanceRestServiceInteractionTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void testDeleteAsyncWithIdsAndQuery() { Batch batchEntity = MockProvider.createMockBatch(); when(historyServiceMock.deleteHistoricDecisionInstancesAsync( anyListOf(String.class), any(HistoricDecisionInstanceQuery.class), anyString() )).thenReturn(batchEntity); Map<String, Object> messageBodyJson = new HashMap<String, Object>(); HistoricDecisionInstanceQueryDto query = new HistoricDecisionInstanceQueryDto(); query.setDecisionDefinitionKey("decision"); messageBodyJson.put("historicDecisionInstanceQuery", query); List<String> ids = Arrays.asList(EXAMPLE_DECISION_INSTANCE_ID); messageBodyJson.put("historicDecisionInstanceIds", ids); messageBodyJson.put("deleteReason", "a-delete-reason"); Response response = given() .contentType(ContentType.JSON).body(messageBodyJson) .then().expect() .statusCode(Status.OK.getStatusCode()) .when().post(HISTORIC_DECISION_INSTANCES_DELETE_ASYNC_URL); verifyBatchJson(response.asString()); verify(historyServiceMock, times(1)).deleteHistoricDecisionInstancesAsync(eq(ids), any(HistoricDecisionInstanceQuery.class), eq("a-delete-reason")); }
Example #20
Source File: HistoricDecisionInstanceQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN }) public void testQueryByDecisionInstanceIds() { ProcessInstance pi1 = startProcessInstanceAndEvaluateDecision(); ProcessInstance pi2 = startProcessInstanceAndEvaluateDecision(); String decisionInstanceId1 = historyService.createHistoricDecisionInstanceQuery().processInstanceId(pi1.getId()).singleResult().getId(); String decisionInstanceId2 = historyService.createHistoricDecisionInstanceQuery().processInstanceId(pi2.getId()).singleResult().getId(); HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); assertThat(query.decisionInstanceIdIn(decisionInstanceId1).count(), is(1L)); assertThat(query.decisionInstanceIdIn(decisionInstanceId2).count(), is(1L)); assertThat(query.decisionInstanceIdIn(decisionInstanceId1, decisionInstanceId2).count(), is(2L)); }
Example #21
Source File: HistoricDecisionInstanceQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN }) public void testQueryByProcessDefinitionId() { String processDefinitionId = repositoryService.createProcessDefinitionQuery().singleResult().getId(); startProcessInstanceAndEvaluateDecision(); HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); assertThat(query.processDefinitionId(processDefinitionId).count(), is(1L)); assertThat(query.processDefinitionId("other process").count(), is(0L)); }
Example #22
Source File: HistoryCleanupRemovalTimeTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test @Deployment(resources = { "org/camunda/bpm/engine/test/dmn/deployment/drdDish.dmn11.xml" }) public void shouldDistributeWorkForDecisions() { // given testRule.deploy(CALLING_PROCESS_CALLS_DMN); for (int i = 0; i < 60; i++) { if (i%4 == 0) { runtimeService.startProcessInstanceByKey(CALLING_PROCESS_CALLS_DMN_KEY, Variables.createVariables() .putValue("temperature", 32) .putValue("dayType", "Weekend")); ClockUtil.setCurrentTime(addMinutes(END_DATE, i)); String jobId = managementService.createJobQuery().singleResult().getId(); managementService.executeJob(jobId); } } ClockUtil.setCurrentTime(addDays(END_DATE, 6)); engineConfiguration.setHistoryCleanupDegreeOfParallelism(3); engineConfiguration.initHistoryCleanup(); historyService.cleanUpHistoryAsync(true); List<Job> jobs = historyService.findHistoryCleanupJobs(); HistoricDecisionInstanceQuery decisionInstanceQuery = historyService.createHistoricDecisionInstanceQuery(); // assume, when & then assumeWhenThenParallelizedCleanup(jobs, decisionInstanceQuery::count, 45L); }
Example #23
Source File: HistoricDecisionInstanceQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN }) public void testQueryByDecisionDefinitionId() { String decisionDefinitionId = repositoryService.createDecisionDefinitionQuery() .decisionDefinitionKey(DECISION_DEFINITION_KEY).singleResult().getId(); startProcessInstanceAndEvaluateDecision(); HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); assertThat(query.decisionDefinitionId(decisionDefinitionId).count(), is(1L)); assertThat(query.decisionDefinitionId("other id").count(), is(0L)); }
Example #24
Source File: HistoricDecisionInstanceRestServiceImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
private List<HistoricDecisionInstance> executePaginatedQuery(HistoricDecisionInstanceQuery query, Integer firstResult, Integer maxResults) { if (firstResult == null) { firstResult = 0; } if (maxResults == null) { maxResults = Integer.MAX_VALUE; } return query.listPage(firstResult, maxResults); }
Example #25
Source File: BatchHistoricDecisionInstanceDeletionTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void createSeedJobByIdsAndQuery() { // given HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION); // when Batch batch = historyService.deleteHistoricDecisionInstancesAsync(query, null); // then there exists a seed job definition with the batch id as // configuration JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch); assertNotNull(seedJobDefinition); assertNotNull(seedJobDefinition.getDeploymentId()); assertEquals(batch.getId(), seedJobDefinition.getJobConfiguration()); assertEquals(BatchSeedJobHandler.TYPE, seedJobDefinition.getJobType()); // and there exists a deletion job definition JobDefinition deletionJobDefinition = helper.getExecutionJobDefinition(batch); assertNotNull(deletionJobDefinition); assertEquals(Batch.TYPE_HISTORIC_DECISION_INSTANCE_DELETION, deletionJobDefinition.getJobType()); // and a seed job with no relation to a process or execution etc. Job seedJob = helper.getSeedJob(batch); assertNotNull(seedJob); assertEquals(seedJobDefinition.getId(), seedJob.getJobDefinitionId()); assertEquals(currentTime, seedJob.getDuedate()); assertEquals(seedJobDefinition.getDeploymentId(), seedJob.getDeploymentId()); assertNull(seedJob.getProcessDefinitionId()); assertNull(seedJob.getProcessDefinitionKey()); assertNull(seedJob.getProcessInstanceId()); assertNull(seedJob.getExecutionId()); // but no deletion jobs where created List<Job> deletionJobs = helper.getExecutionJobs(batch); assertEquals(0, deletionJobs.size()); }
Example #26
Source File: BatchHistoricDecisionInstanceDeletionTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void createSeedJobByQuery() { // given HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION); // when Batch batch = historyService.deleteHistoricDecisionInstancesAsync(decisionInstanceIds, query, null); // then there exists a seed job definition with the batch id as // configuration JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch); assertNotNull(seedJobDefinition); assertNotNull(seedJobDefinition.getDeploymentId()); assertEquals(batch.getId(), seedJobDefinition.getJobConfiguration()); assertEquals(BatchSeedJobHandler.TYPE, seedJobDefinition.getJobType()); // and there exists a deletion job definition JobDefinition deletionJobDefinition = helper.getExecutionJobDefinition(batch); assertNotNull(deletionJobDefinition); assertEquals(Batch.TYPE_HISTORIC_DECISION_INSTANCE_DELETION, deletionJobDefinition.getJobType()); // and a seed job with no relation to a process or execution etc. Job seedJob = helper.getSeedJob(batch); assertNotNull(seedJob); assertEquals(seedJobDefinition.getId(), seedJob.getJobDefinitionId()); assertEquals(currentTime, seedJob.getDuedate()); assertEquals(seedJobDefinition.getDeploymentId(), seedJob.getDeploymentId()); assertNull(seedJob.getProcessDefinitionId()); assertNull(seedJob.getProcessDefinitionKey()); assertNull(seedJob.getProcessInstanceId()); assertNull(seedJob.getExecutionId()); // but no deletion jobs where created List<Job> deletionJobs = helper.getExecutionJobs(batch); assertEquals(0, deletionJobs.size()); }
Example #27
Source File: BatchHistoricDecisionInstanceDeletionTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void createBatchDeletionByIdsAndQuery() { // given HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION); // when Batch batch = historyService.deleteHistoricDecisionInstancesAsync(decisionInstanceIds, query, null); // then assertBatchCreated(batch, 10); }
Example #28
Source File: BatchHistoricDecisionInstanceDeletionTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void createBatchDeletionByInvalidQueryByKey() { // given HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey("foo"); // then thrown.expect(BadUserRequestException.class); // when historyService.deleteHistoricDecisionInstancesAsync(query, null); }
Example #29
Source File: BatchHistoricDecisionInstanceDeletionTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void createBatchDeletionByInvalidQuery() { // then thrown.expect(BadUserRequestException.class); // when historyService.deleteHistoricDecisionInstancesAsync((HistoricDecisionInstanceQuery) null, null); }
Example #30
Source File: BatchHistoricDecisionInstanceDeletionTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void createBatchDeletionByQuery() { // given HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION); // when Batch batch = historyService.deleteHistoricDecisionInstancesAsync(query, null); // then assertBatchCreated(batch, 10); }