StandardFDProcessorService extends BaseExtensionComponentService<VersionedProcessor, ProcessorDefinition, FDProcessor> implements FDProcessorService { @Override public void delete(final String flowId, final String processorId) { deleteExtensionComponent(flowId, processorId, VersionedProcessGroup::getProcessors); } @Autowired  StandardFDProcessorService(final FDFlowManager flowManager, final FDExtensionManagers extensionManagers, final ValidationService validationService); @Override FDComponentTypes getProcessorTypes(final String flowId); @Override FDPropertyDescriptor getPropertyDescriptor(final String flowId, final String processorId, final String propertyName); @Override FDProcessor create(final String flowId, final String processGroupId, final VersionedProcessor requestComponentConfig); @Override FDProcessor get(final String flowId, final String processorId); @Override FDProcessor update(final String flowId, final VersionedProcessor requestComponentConfig); @Override void delete(final String flowId, final String processorId); @Override ProcessorDefinition getComponentDefinition(final String agentClass, final VersionedProcessor componentConfig);  }
@Test(expected = ResourceNotFoundException.class) public void testDeleteProcessorWhenFlowDoesNotExist() { final String flowId = "DOES-NOT-EXIST"; when(flowManager.getFlow(flowId)).thenReturn(Optional.empty()); processorService.delete(flowId, group2Processor1.getIdentifier()); }
@Test(expected = ResourceNotFoundException.class) public void testDeleteProcessorWhenProcessGroupDoesNotExist() { when(flowManager.getFlow(flow.getFlowMetadata().getIdentifier())).thenReturn(Optional.of(flow)); group2Processor1.setGroupIdentifier("does-not-exist"); processorService.delete(flow.getFlowMetadata().getIdentifier(), group2Processor1.getIdentifier()); }
@Test public void testDeleteProcessorWithNoConnections() { when(flowManager.getFlow(flow.getFlowMetadata().getIdentifier())).thenReturn(Optional.of(flow)); assertEquals(3, group2.getProcessors().size()); assertEquals(1, group2.getConnections().size()); processorService.delete( flow.getFlowMetadata().getIdentifier(), group2Processor1.getIdentifier()); assertEquals(2, group2.getProcessors().size()); assertEquals(1, group2.getConnections().size()); }