@Test public void testHandleChannelUnavailableForever() throws Exception { MockMessageProducer producer = new MockMessageProducer(); final MockChannel channel = createChannel(producer, Arrays.asList(new Service[] { new AddMetadataService(Arrays.asList(new MetadataElement[] { new MetadataElement(METADATA_KEY, METADATA_VALUE) })), new PayloadFromMetadataService(PAYLOAD_2) })); MockMessageProducer meh = new MockMessageProducer(); try { StandardWorkflow workflow = (StandardWorkflow) channel.getWorkflowList().get(0); workflow.setMessageErrorHandler(new StandardProcessingExceptionHandler( new ServiceList(new ArrayList<Service>(Arrays.asList(new Service[] { new StandaloneProducer(meh) }))))); workflow.setChannelUnavailableWaitInterval(new TimeInterval(100L, TimeUnit.MILLISECONDS)); AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(PAYLOAD_1); channel.prepare(); start(channel); channel.toggleAvailability(false); workflow.onAdaptrisMessage(msg); assertEquals("Make none produced", 0, producer.getMessages().size()); assertEquals(1, meh.getMessages().size()); for (Iterator i = meh.getMessages().iterator(); i.hasNext();) { AdaptrisMessage m = (AdaptrisMessage) i.next(); assertEquals(PAYLOAD_1, m.getContent()); assertFalse("Does not contains correct metadata key", m.containsKey(METADATA_KEY)); } } finally { stop(channel); } }
@Override public synchronized void onAdaptrisMessage(AdaptrisMessage msg, Consumer<AdaptrisMessage> success, Consumer<AdaptrisMessage> failure) { super.onAdaptrisMessage(msg, success, failure); }
StandardWorkflow extends StandardWorkflowImpl { @Override public synchronized void onAdaptrisMessage(AdaptrisMessage msg, Consumer<AdaptrisMessage> success, Consumer<AdaptrisMessage> failure) { super.onAdaptrisMessage(msg, success, failure); } }
StandardWorkflow extends StandardWorkflowImpl { @Override public synchronized void onAdaptrisMessage(AdaptrisMessage msg, Consumer<AdaptrisMessage> success, Consumer<AdaptrisMessage> failure) { super.onAdaptrisMessage(msg, success, failure); } StandardWorkflow();  StandardWorkflow(AdaptrisMessageConsumer consumer, AdaptrisMessageProducer producer);  StandardWorkflow(AdaptrisMessageConsumer consumer, ServiceCollection services, AdaptrisMessageProducer producer); }
StandardWorkflow extends StandardWorkflowImpl { @Override public synchronized void onAdaptrisMessage(AdaptrisMessage msg, Consumer<AdaptrisMessage> success, Consumer<AdaptrisMessage> failure) { super.onAdaptrisMessage(msg, success, failure); } StandardWorkflow();  StandardWorkflow(AdaptrisMessageConsumer consumer, AdaptrisMessageProducer producer);  StandardWorkflow(AdaptrisMessageConsumer consumer, ServiceCollection services, AdaptrisMessageProducer producer); @Override synchronized void onAdaptrisMessage(AdaptrisMessage msg, Consumer<AdaptrisMessage> success, Consumer<AdaptrisMessage> failure); }
StandardWorkflow extends StandardWorkflowImpl { @Override public synchronized void onAdaptrisMessage(AdaptrisMessage msg, Consumer<AdaptrisMessage> success, Consumer<AdaptrisMessage> failure) { super.onAdaptrisMessage(msg, success, failure); } StandardWorkflow();  StandardWorkflow(AdaptrisMessageConsumer consumer, AdaptrisMessageProducer producer);  StandardWorkflow(AdaptrisMessageConsumer consumer, ServiceCollection services, AdaptrisMessageProducer producer); @Override synchronized void onAdaptrisMessage(AdaptrisMessage msg, Consumer<AdaptrisMessage> success, Consumer<AdaptrisMessage> failure);  }