@Test public void testDeleteProcessDefinitionsByKey() { // given for (int i = 0; i < 3; i++) { deployTwoProcessDefinitions(); } // when repositoryService.deleteProcessDefinitions() .byKey("processOne") .withoutTenantId() .delete(); // then assertThat(repositoryService.createProcessDefinitionQuery().count(), is(3L)); }
@Test public void testDeleteProcessDefinitionsByNotExistingKey() { // then thrown.expect(NotFoundException.class); thrown.expectMessage("No process definition found"); // when repositoryService.deleteProcessDefinitions() .byKey("no existing key") .withoutTenantId() .delete(); }
@Test public void testDeleteProcessDefinitionsByKeyIsNull() { // then thrown.expect(NullValueException.class); thrown.expectMessage("cannot be null"); // when repositoryService.deleteProcessDefinitions() .byKey(null) .withoutTenantId() .delete(); }
public void testDeleteProcessDefinitionsByKey() { // given for (int i = 0; i < 3; i++) { deploymentId = repositoryService.createDeployment() .addClasspathResource(PROCESS_PATH) .deploy().getId(); deploymentIds.add(deploymentId); } // when repositoryService.deleteProcessDefinitions() .byKey(PROCESS_KEY) .withoutTenantId() .delete(); // then assertUserOperationLogs(); }
public void testDeleteProcessDefinitionsByKeyCascading() { // given for (int i = 0; i < 3; i++) { deploymentId = repositoryService.createDeployment() .addClasspathResource(PROCESS_PATH) .deploy().getId(); deploymentIds.add(deploymentId); } // when repositoryService.deleteProcessDefinitions() .byKey(PROCESS_KEY) .withoutTenantId() .cascade() .delete(); // then assertUserOperationLogs(); }
@Test public void testDeleteProcessDefinitionsByKeyWithCustomListenersSkipped() { // given IncrementCounterListener.counter = 0; for (int i = 0; i < 3; i++) { deployTwoProcessDefinitions(); } runtimeService.startProcessInstanceByKey("processOne"); // when repositoryService.deleteProcessDefinitions() .byKey("processOne") .withoutTenantId() .cascade() .skipCustomListeners() .delete(); // then assertThat(IncrementCounterListener.counter, is(0)); }
@Test public void testDeleteProcessDefinitionsByKeyCascading() { // given for (int i = 0; i < 3; i++) { deployTwoProcessDefinitions(); } Map<String, Object> variables = new HashMap<String, Object>(); for (int i = 0; i < 3; i++) { variables.put("varName" + i, "varValue"); } for (int i = 0; i < 3; i++) { runtimeService.startProcessInstanceByKey("processOne", variables); runtimeService.startProcessInstanceByKey("processTwo", variables); } // when repositoryService.deleteProcessDefinitions() .byKey("processOne") .withoutTenantId() .cascade() .delete(); repositoryService.deleteProcessDefinitions() .byKey("processTwo") .withoutTenantId() .cascade() .delete(); // then assertThat(historyService.createHistoricVariableInstanceQuery().count(), is(0L)); assertThat(historyService.createHistoricProcessInstanceQuery().count(), is(0L)); assertThat(repositoryService.createProcessDefinitionQuery().count(), is(0L)); }
@Test public void testDeleteProcessDefinitionsByKeyWithIoMappingsSkipped() { // given testHelper.deploy(IO_MAPPING_PROCESS); runtimeService.startProcessInstanceByKey(IO_MAPPING_PROCESS_KEY); testHelper.deploy(IO_MAPPING_PROCESS); runtimeService.startProcessInstanceByKey(IO_MAPPING_PROCESS_KEY); // when repositoryService.deleteProcessDefinitions() .byKey(IO_MAPPING_PROCESS_KEY) .withoutTenantId() .cascade() .skipIoMappings() .delete(); List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().list(); // then assertThat(processDefinitions.size(), is(0)); }
@Test public void testDeleteProcessDefinitionsByKeyWithRunningProcesses() { // given for (int i = 0; i < 3; i++) { deployTwoProcessDefinitions(); } runtimeService.startProcessInstanceByKey("processOne"); // then thrown.expect(ProcessEngineException.class); thrown.expectMessage("Deletion of process definition"); // when repositoryService.deleteProcessDefinitions() .byKey("processOne") .withoutTenantId() .delete(); }
@Test public void failToDeleteProcessDefinitionsByKeyNoAuthenticatedTenant() { // given for (int i = 0; i < 3; i++) { deployProcessDefinitionWithTenant(); } identityService.setAuthentication("user", null, null); // then thrown.expect(ProcessEngineException.class); thrown.expectMessage("No process definition found"); // when repositoryService.deleteProcessDefinitions() .byKey("process") .withoutTenantId() .delete(); }
@Test public void testDeleteProcessDefinitionsByKey() { // given for (int i = 0; i < 3; i++) { deployProcessDefinition(); } authRule.init(scenario) .withUser("userId") .start(); // when repositoryService.deleteProcessDefinitions() .byKey(PROCESS_DEFINITION_KEY) .withoutTenantId() .delete(); // then if (authRule.assertScenario(scenario)) { assertEquals(0, repositoryService.createProcessDefinitionQuery().count()); } }
@Test public void testDeleteProcessDefinitionsByKeyCascade() { // given for (int i = 0; i < 3; i++) { deployProcessDefinition(); } runtimeService.createProcessInstanceByKey(PROCESS_DEFINITION_KEY); authRule.init(scenario) .withUser("userId") .start(); // when repositoryService.deleteProcessDefinitions() .byKey(PROCESS_DEFINITION_KEY) .withoutTenantId() .cascade() .delete(); // then if (authRule.assertScenario(scenario)) { assertEquals(0, runtimeService.createProcessInstanceQuery().count()); assertEquals(0, repositoryService.createProcessDefinitionQuery().count()); if (processEngineConfiguration.getHistoryLevel().getId() >= HistoryLevel.HISTORY_LEVEL_ACTIVITY.getId()) { assertEquals(0, historyService.createHistoricActivityInstanceQuery().count()); } } }
@Test public void testDeleteProcessDefinitionsByKey() { // given for (int i = 0; i < 3; i++) { deployTwoProcessDefinitions(); } // when repositoryService.deleteProcessDefinitions() .byKey("processOne") .withoutTenantId() .delete(); // then assertThat(repositoryService.createProcessDefinitionQuery().count(), is(3L)); }
@Test public void testDeleteProcessDefinitionsByNotExistingKey() { // then thrown.expect(NotFoundException.class); thrown.expectMessage("No process definition found"); // when repositoryService.deleteProcessDefinitions() .byKey("no existing key") .withoutTenantId() .delete(); }
@Test public void testDeleteProcessDefinitionsByKeyIsNull() { // then thrown.expect(NullValueException.class); thrown.expectMessage("cannot be null"); // when repositoryService.deleteProcessDefinitions() .byKey(null) .withoutTenantId() .delete(); }
public void testDeleteProcessDefinitionsByKey() { // given for (int i = 0; i < 3; i++) { deploymentId = repositoryService.createDeployment() .addClasspathResource(PROCESS_PATH) .deploy().getId(); deploymentIds.add(deploymentId); } // when repositoryService.deleteProcessDefinitions() .byKey(PROCESS_KEY) .withoutTenantId() .delete(); // then assertUserOperationLogs(); }
@Test public void testDeleteProcessDefinitionsByKeyWithCustomListenersSkipped() { // given IncrementCounterListener.counter = 0; for (int i = 0; i < 3; i++) { deployTwoProcessDefinitions(); } runtimeService.startProcessInstanceByKey("processOne"); // when repositoryService.deleteProcessDefinitions() .byKey("processOne") .withoutTenantId() .cascade() .skipCustomListeners() .delete(); // then assertThat(IncrementCounterListener.counter, is(0)); }
public void testDeleteProcessDefinitionsByKeyCascading() { // given for (int i = 0; i < 3; i++) { deploymentId = repositoryService.createDeployment() .addClasspathResource(PROCESS_PATH) .deploy().getId(); deploymentIds.add(deploymentId); } // when repositoryService.deleteProcessDefinitions() .byKey(PROCESS_KEY) .withoutTenantId() .cascade() .delete(); // then assertUserOperationLogs(); }
@Test public void testDeleteProcessDefinitionsByKeyWithRunningProcesses() { // given for (int i = 0; i < 3; i++) { deployTwoProcessDefinitions(); } runtimeService.startProcessInstanceByKey("processOne"); // then thrown.expect(ProcessEngineException.class); thrown.expectMessage("Deletion of process definition"); // when repositoryService.deleteProcessDefinitions() .byKey("processOne") .withoutTenantId() .delete(); }
@Test public void failToDeleteProcessDefinitionsByKeyNoAuthenticatedTenant() { // given for (int i = 0; i < 3; i++) { deployProcessDefinitionWithTenant(); } identityService.setAuthentication("user", null, null); // then thrown.expect(ProcessEngineException.class); thrown.expectMessage("No process definition found"); // when repositoryService.deleteProcessDefinitions() .byKey("process") .withoutTenantId() .delete(); }