@Override public void deleteProcessDefinition(String processDefinitionId, boolean cascade, boolean skipCustomListeners, boolean skipIoMappings) { DeleteProcessDefinitionsBuilder builder = deleteProcessDefinitions().byIds(processDefinitionId); if (cascade) { builder.cascade(); } if (skipCustomListeners) { builder.skipCustomListeners(); } if (skipIoMappings) { builder.skipIoMappings(); } builder.delete(); }
@Test public void testDeleteProcessDefinitionsByIdIsNull() { // then thrown.expect(NullValueException.class); thrown.expectMessage("cannot be null"); // when repositoryService.deleteProcessDefinitions() .byIds(null) .delete(); }
@Test public void testDeleteProcessDefinitionsByNotExistingIds() { // then thrown.expect(NotFoundException.class); thrown.expectMessage("No process definition found"); // when repositoryService.deleteProcessDefinitions() .byIds("not existing", "also not existing") .delete(); }
@Test public void testDeleteProcessDefinitionsByIds() { // given for (int i = 0; i < 3; i++) { deployTwoProcessDefinitions(); } String[] processDefinitionIds = findProcessDefinitionIdsByKey("processOne"); // when repositoryService.deleteProcessDefinitions() .byIds(processDefinitionIds) .delete(); // then assertThat(repositoryService.createProcessDefinitionQuery().count(), is(3L)); }
public void testDeleteProcessDefinitionsByIds() { // given for (int i = 0; i < 3; i++) { deploymentId = repositoryService.createDeployment() .addClasspathResource(PROCESS_PATH) .deploy().getId(); deploymentIds.add(deploymentId); } // when repositoryService.deleteProcessDefinitions() .byIds(findProcessDefinitionIdsByKey(PROCESS_KEY)) .delete(); // then assertUserOperationLogs(); }
@Test public void testMixedSubscriptionsWhenDeletingProcessDefinitionsInOneTransactionById2() { // given second version without condition String definitionId1 = deployProcess(SINGLE_CONDITIONAL_XML); String definitionId2 = deployModel(MODEL_WITHOUT_CONDITION); String definitionId3 = deployProcess(SINGLE_CONDITIONAL_XML); // when repositoryService.deleteProcessDefinitions() .byIds(definitionId1, definitionId2, definitionId3) .delete(); // then assertEquals(0, runtimeService.createEventSubscriptionQuery().count()); }
@Test public void testMixedSubscriptionsWhenDeletingProcessDefinitionsInOneTransactionById3() { // given third version without condition String definitionId1 = deployProcess(SINGLE_MESSAGE_START_EVENT_XML); String definitionId2 = deployProcess(SINGLE_MESSAGE_START_EVENT_XML); String definitionId3 = deployModel(MODEL_WITHOUT_MESSAGE); // when repositoryService.deleteProcessDefinitions() .byIds(definitionId1, definitionId2, definitionId3) .delete(); // then assertEquals(0, runtimeService.createEventSubscriptionQuery().count()); }
@Test public void testMixedSubscriptionsWhenDeletingProcessDefinitionsInOneTransactionById1() { // given first version without condition String definitionId1 = deployModel(MODEL_WITHOUT_CONDITION); String definitionId2 = deployProcess(SINGLE_CONDITIONAL_XML); String definitionId3 = deployProcess(SINGLE_CONDITIONAL_XML); // when repositoryService.deleteProcessDefinitions() .byIds(definitionId1, definitionId2, definitionId3) .delete(); // then assertEquals(0, runtimeService.createEventSubscriptionQuery().count()); }
@Test public void testMixedSubscriptionsWhenDeletingProcessDefinitionsInOneTransactionById3() { // given third version without condition String definitionId1 = deployProcess(SINGLE_CONDITIONAL_XML); String definitionId2 = deployProcess(SINGLE_CONDITIONAL_XML); String definitionId3 = deployModel(MODEL_WITHOUT_CONDITION); // when repositoryService.deleteProcessDefinitions() .byIds(definitionId1, definitionId2, definitionId3) .delete(); // then assertEquals(0, runtimeService.createEventSubscriptionQuery().count()); }
@Test public void testSubscriptionsWhenDeletingProcessDefinitionsInOneTransactionByIdOrdered() { // given String definitionId1 = deployProcess(SINGLE_MESSAGE_START_EVENT_XML); String definitionId2 = deployProcess(SINGLE_MESSAGE_START_EVENT_XML); String definitionId3 = deployProcess(SINGLE_MESSAGE_START_EVENT_XML); // when repositoryService.deleteProcessDefinitions() .byIds(definitionId1, definitionId2, definitionId3) .delete(); // then assertEquals(0, runtimeService.createEventSubscriptionQuery().count()); }
@Test public void testSubscriptionsWhenDeletingProcessDefinitionsInOneTransactionByIdOrdered() { // given String definitionId1 = deployProcess(SINGLE_CONDITIONAL_XML); String definitionId2 = deployProcess(SINGLE_CONDITIONAL_XML); String definitionId3 = deployProcess(SINGLE_CONDITIONAL_XML); // when repositoryService.deleteProcessDefinitions() .byIds(definitionId1, definitionId2, definitionId3) .delete(); // then assertEquals(0, runtimeService.createEventSubscriptionQuery().count()); }
@Test public void testSubscriptionsWhenDeletingProcessDefinitionsInOneTransactionByIdReverseOrder() { // given String definitionId1 = deployProcess(SINGLE_CONDITIONAL_XML); String definitionId2 = deployProcess(SINGLE_CONDITIONAL_XML); String definitionId3 = deployProcess(SINGLE_CONDITIONAL_XML); // when repositoryService.deleteProcessDefinitions() .byIds(definitionId3, definitionId2, definitionId1) .delete(); // then assertEquals(0, runtimeService.createEventSubscriptionQuery().count()); }
@Test public void testSubscriptionsWhenDeletingProcessDefinitionsInOneTransactionByIdReverseOrder() { // given String definitionId1 = deployProcess(SINGLE_MESSAGE_START_EVENT_XML); String definitionId2 = deployProcess(SINGLE_MESSAGE_START_EVENT_XML); String definitionId3 = deployProcess(SINGLE_MESSAGE_START_EVENT_XML); // when repositoryService.deleteProcessDefinitions() .byIds(definitionId3, definitionId2, definitionId1) .delete(); // then assertEquals(0, runtimeService.createEventSubscriptionQuery().count()); }
@Test public void testMixedSubscriptionsWhenDeletingProcessDefinitionsInOneTransactionById1() { // given first version without condition String definitionId1 = deployModel(MODEL_WITHOUT_MESSAGE); String definitionId2 = deployProcess(SINGLE_MESSAGE_START_EVENT_XML); String definitionId3 = deployProcess(SINGLE_MESSAGE_START_EVENT_XML); // when repositoryService.deleteProcessDefinitions() .byIds(definitionId1, definitionId2, definitionId3) .delete(); // then assertEquals(0, runtimeService.createEventSubscriptionQuery().count()); }
@Test public void testMixedSubscriptionsWhenDeletingProcessDefinitionsInOneTransactionById2() { // given second version without condition String definitionId1 = deployProcess(SINGLE_MESSAGE_START_EVENT_XML); String definitionId2 = deployModel(MODEL_WITHOUT_MESSAGE); String definitionId3 = deployProcess(SINGLE_MESSAGE_START_EVENT_XML); // when repositoryService.deleteProcessDefinitions() .byIds(definitionId1, definitionId2, definitionId3) .delete(); // then assertEquals(0, runtimeService.createEventSubscriptionQuery().count()); }
@Test public void testMixedSubscriptionsWhenDeletingTwoProcessDefinitionsInOneTransaction1() { // given first version without condition String definitionId1 = deployModel(MODEL_WITHOUT_CONDITION); String definitionId2 = deployProcess(SINGLE_CONDITIONAL_XML); String definitionId3 = deployProcess(SINGLE_CONDITIONAL_XML); // when repositoryService.deleteProcessDefinitions() .byIds(definitionId2, definitionId3) .delete(); // then assertEquals(0, runtimeService.createEventSubscriptionQuery().count()); assertEquals(definitionId1, repositoryService.createProcessDefinitionQuery().singleResult().getId()); }
@Test public void testMixedSubscriptionsWhenDeletingTwoProcessDefinitionsInOneTransaction3() { // given third version without condition String definitionId1 = deployProcess(SINGLE_MESSAGE_START_EVENT_XML); String definitionId2 = deployProcess(SINGLE_MESSAGE_START_EVENT_XML); String definitionId3 = deployModel(MODEL_WITHOUT_MESSAGE); // when repositoryService.deleteProcessDefinitions() .byIds(definitionId2, definitionId3) .delete(); // then assertEquals(1, runtimeService.createEventSubscriptionQuery().count()); assertEquals(definitionId1, ((EventSubscriptionEntity) runtimeService.createEventSubscriptionQuery().singleResult()).getConfiguration()); }
@Test public void testMixedSubscriptionsWhenDeletingTwoProcessDefinitionsInOneTransaction2() { // given second version without condition String definitionId1 = deployProcess(SINGLE_CONDITIONAL_XML); String definitionId2 = deployModel(MODEL_WITHOUT_CONDITION); String definitionId3 = deployProcess(SINGLE_CONDITIONAL_XML); // when repositoryService.deleteProcessDefinitions() .byIds(definitionId2, definitionId3) .delete(); // then assertEquals(1, runtimeService.createEventSubscriptionQuery().count()); assertEquals(definitionId1, ((EventSubscriptionEntity) runtimeService.createEventSubscriptionQuery().singleResult()).getConfiguration()); }
@Test public void testMixedSubscriptionsWhenDeletingTwoProcessDefinitionsInOneTransaction1() { // given first version without condition String definitionId1 = deployModel(MODEL_WITHOUT_MESSAGE); String definitionId2 = deployProcess(SINGLE_MESSAGE_START_EVENT_XML); String definitionId3 = deployProcess(SINGLE_MESSAGE_START_EVENT_XML); // when repositoryService.deleteProcessDefinitions() .byIds(definitionId2, definitionId3) .delete(); // then assertEquals(0, runtimeService.createEventSubscriptionQuery().count()); assertEquals(definitionId1, repositoryService.createProcessDefinitionQuery().singleResult().getId()); }
@Test public void testMixedSubscriptionsWhenDeletingTwoProcessDefinitionsInOneTransaction3() { // given third version without condition String definitionId1 = deployProcess(SINGLE_CONDITIONAL_XML); String definitionId2 = deployProcess(SINGLE_CONDITIONAL_XML); String definitionId3 = deployModel(MODEL_WITHOUT_CONDITION); // when repositoryService.deleteProcessDefinitions() .byIds(definitionId2, definitionId3) .delete(); // then assertEquals(1, runtimeService.createEventSubscriptionQuery().count()); assertEquals(definitionId1, ((EventSubscriptionEntity) runtimeService.createEventSubscriptionQuery().singleResult()).getConfiguration()); }