@Test public void testBug2356() throws Exception { ServiceImp failingService = new ThrowExceptionService(new ConfiguredException("Fail")); AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(XML_PAYLOAD); ExceptionReportService service = new ExceptionReportService( new ExceptionAsXml().withExceptionGenerator(new SimpleExceptionReport()).withDocumentMerge(new InsertNode(XPATH_ROOT))); MockMessageProducer mockProducer = new MockMessageProducer(); StandardProcessingExceptionHandler speh = new StandardProcessingExceptionHandler(new ServiceList(new Service[] { service, new StandaloneProducer(mockProducer) })); MockChannel channel = new MockChannel(); MockMessageConsumer consumer = new MockMessageConsumer(); StandardWorkflow wf = new StandardWorkflow(); wf.getServiceCollection().add(failingService); wf.setConsumer(consumer); channel.setMessageErrorHandler(speh); channel.getWorkflowList().add(wf); try { channel.prepare(); channel.requestStart(); consumer.submitMessage(msg); assertEquals(1, mockProducer.getMessages().size()); AdaptrisMessage failedMessage = mockProducer.getMessages().get(0); assertNotSame(XML_PAYLOAD, failedMessage.getContent()); XmlUtils xml = XmlHelper.createXmlUtils(failedMessage); assertEquals(RAW_DATA, xml.getSingleTextItem(XPATH_ORIGINAL_NODE)); assertNotNull(xml.getSingleNode(XPATH_ROOT + "/Exception")); String xmlElement = xml.getSingleTextItem(XPATH_ROOT + "/Exception"); assertTrue(xmlElement.contains("com.adaptris.core.services.exception.ThrowExceptionService.doService")); } finally { channel.requestClose(); } }
@Override public void prepare() throws CoreException { try { Args.notNull(getExceptionSerializer(), "exceptionSerializer"); } catch (IllegalArgumentException e) { throw ExceptionHelper.wrapCoreException(e); } }
ExceptionReportService extends ServiceImp { @Override public void prepare() throws CoreException { try { Args.notNull(getExceptionSerializer(), "exceptionSerializer"); } catch (IllegalArgumentException e) { throw ExceptionHelper.wrapCoreException(e); } } }
ExceptionReportService extends ServiceImp { @Override public void prepare() throws CoreException { try { Args.notNull(getExceptionSerializer(), "exceptionSerializer"); } catch (IllegalArgumentException e) { throw ExceptionHelper.wrapCoreException(e); } } ExceptionReportService();  ExceptionReportService(ExceptionSerializer e); }
ExceptionReportService extends ServiceImp { @Override public void prepare() throws CoreException { try { Args.notNull(getExceptionSerializer(), "exceptionSerializer"); } catch (IllegalArgumentException e) { throw ExceptionHelper.wrapCoreException(e); } } ExceptionReportService();  ExceptionReportService(ExceptionSerializer e); @Override void doService(AdaptrisMessage msg); @Override void prepare(); ExceptionSerializer getExceptionSerializer(); void setExceptionSerializer(ExceptionSerializer exceptionSerializer); }
ExceptionReportService extends ServiceImp { @Override public void prepare() throws CoreException { try { Args.notNull(getExceptionSerializer(), "exceptionSerializer"); } catch (IllegalArgumentException e) { throw ExceptionHelper.wrapCoreException(e); } } ExceptionReportService();  ExceptionReportService(ExceptionSerializer e); @Override void doService(AdaptrisMessage msg); @Override void prepare(); ExceptionSerializer getExceptionSerializer(); void setExceptionSerializer(ExceptionSerializer exceptionSerializer);  }