@Test public void testService() throws Exception { Service service = getService(ID[0]); MultiPayloadAdaptrisMessage message = getMessage(); assertEquals(ID[1], message.getCurrentPayloadId()); assertEquals(new String(PAYLOAD), message.getContent()); assertEquals(PAYLOAD.length, message.getSize()); service.doService(message); assertEquals(2, message.getPayloadCount()); assertEquals(ID[0], message.getCurrentPayloadId()); assertEquals(CONTENT, message.getContent()); assertArrayEquals(CONTENT.getBytes(ENCODING), message.getPayload()); }
@Override public void doService(AdaptrisMessage msg) throws ServiceException { String id = msg.resolve(getNewPayloadId()); log.debug("Attempting to switch message payload to [" + id + "]"); if (!(msg instanceof MultiPayloadAdaptrisMessage)) { throw new ServiceException("Message [" + msg.getUniqueId() + "] is not a multi-payload message"); } MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage) msg; log.debug("Switching message payload from [" + message.getCurrentPayloadId() + "]"); message.switchPayload(id); log.debug("Switched message payload to [" + id + "]"); }
SwitchPayloadService extends ServiceImp { @Override public void doService(AdaptrisMessage msg) throws ServiceException { String id = msg.resolve(getNewPayloadId()); log.debug("Attempting to switch message payload to [" + id + "]"); if (!(msg instanceof MultiPayloadAdaptrisMessage)) { throw new ServiceException("Message [" + msg.getUniqueId() + "] is not a multi-payload message"); } MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage) msg; log.debug("Switching message payload from [" + message.getCurrentPayloadId() + "]"); message.switchPayload(id); log.debug("Switched message payload to [" + id + "]"); } }
SwitchPayloadService extends ServiceImp { @Override public void doService(AdaptrisMessage msg) throws ServiceException { String id = msg.resolve(getNewPayloadId()); log.debug("Attempting to switch message payload to [" + id + "]"); if (!(msg instanceof MultiPayloadAdaptrisMessage)) { throw new ServiceException("Message [" + msg.getUniqueId() + "] is not a multi-payload message"); } MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage) msg; log.debug("Switching message payload from [" + message.getCurrentPayloadId() + "]"); message.switchPayload(id); log.debug("Switched message payload to [" + id + "]"); }  }
SwitchPayloadService extends ServiceImp { @Override public void doService(AdaptrisMessage msg) throws ServiceException { String id = msg.resolve(getNewPayloadId()); log.debug("Attempting to switch message payload to [" + id + "]"); if (!(msg instanceof MultiPayloadAdaptrisMessage)) { throw new ServiceException("Message [" + msg.getUniqueId() + "] is not a multi-payload message"); } MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage) msg; log.debug("Switching message payload from [" + message.getCurrentPayloadId() + "]"); message.switchPayload(id); log.debug("Switched message payload to [" + id + "]"); }  void setNewPayloadId(String newPayloadId); String getNewPayloadId(); @Override void doService(AdaptrisMessage msg); @Override void prepare(); }
SwitchPayloadService extends ServiceImp { @Override public void doService(AdaptrisMessage msg) throws ServiceException { String id = msg.resolve(getNewPayloadId()); log.debug("Attempting to switch message payload to [" + id + "]"); if (!(msg instanceof MultiPayloadAdaptrisMessage)) { throw new ServiceException("Message [" + msg.getUniqueId() + "] is not a multi-payload message"); } MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage) msg; log.debug("Switching message payload from [" + message.getCurrentPayloadId() + "]"); message.switchPayload(id); log.debug("Switched message payload to [" + id + "]"); }  void setNewPayloadId(String newPayloadId); String getNewPayloadId(); @Override void doService(AdaptrisMessage msg); @Override void prepare();  }