AbstractStateCompositeProcessor implements MailProcessor, Configurable { @PreDestroy public void dispose() { String[] names = getProcessorStates(); for (String name : names) { MailProcessor processor = getProcessor(name); if (processor instanceof AbstractStateMailetProcessor) { ((AbstractStateMailetProcessor) processor).destroy(); } } if (jmxListener != null) { jmxListener.dispose(); } }  void addListener(CompositeProcessorListener listener); @Override void configure(HierarchicalConfiguration<ImmutableNode> config); @Override void service(Mail mail); MailProcessor getProcessor(String state); String[] getProcessorStates(); @PostConstruct void init(); @PreDestroy void dispose();  }
@Test public void testGhostProcessor() throws Exception { AbstractStateCompositeProcessor processor = null; try { processor = createProcessor(createConfig(Arrays.asList("root", "error", "ghost"))); fail("ghost processor should not be allowed"); } catch (ConfigurationException e) { } finally { if (processor != null) { processor.dispose(); } } }
@Test public void testNoRootProcessor() throws Exception { AbstractStateCompositeProcessor processor = null; try { processor = createProcessor(createConfig(Arrays.asList("test", "error"))); fail("root processor is needed"); } catch (ConfigurationException e) { } finally { if (processor != null) { processor.dispose(); } } }
@Test public void testNoErrorProcessor() throws Exception { AbstractStateCompositeProcessor processor = null; try { processor = createProcessor(createConfig(Arrays.asList("test", "root"))); fail("error processor is needed"); } catch (ConfigurationException e) { } finally { if (processor != null) { processor.dispose(); } } }