@Test public void testWrongMessageType() { AdaptrisMessage message = DefaultMessageFactory.getDefaultInstance().newMessage(PAYLOAD_1); List<AdaptrisMessage> response = (List<AdaptrisMessage>)splitter.splitMessage(message); assertEquals(1, response.size()); }
@Override public Iterable<AdaptrisMessage> splitMessage(AdaptrisMessage msg) { List<AdaptrisMessage> splitMessages = new ArrayList<>(); if (!(msg instanceof MultiPayloadAdaptrisMessage)) { log.warn("Message [{}] is not a multi-payload message!", msg.getUniqueId()); splitMessages.add(msg); } else { MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage)msg; for (String id : message.getPayloadIDs()) { message.switchPayload(id); try { AdaptrisMessage splitMessage = DefaultMessageFactory.getDefaultInstance().newMessage(message, null); splitMessage.setPayload(message.getPayload()); splitMessages.add(splitMessage); } catch (CloneNotSupportedException e) { log.error("Could not clone message [{}]", id, e); } } } log.info("Split multi-payload message into {} standard messages", splitMessages.size()); return splitMessages; }
MultiPayloadMessageSplitter extends MessageSplitterImp { @Override public Iterable<AdaptrisMessage> splitMessage(AdaptrisMessage msg) { List<AdaptrisMessage> splitMessages = new ArrayList<>(); if (!(msg instanceof MultiPayloadAdaptrisMessage)) { log.warn("Message [{}] is not a multi-payload message!", msg.getUniqueId()); splitMessages.add(msg); } else { MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage)msg; for (String id : message.getPayloadIDs()) { message.switchPayload(id); try { AdaptrisMessage splitMessage = DefaultMessageFactory.getDefaultInstance().newMessage(message, null); splitMessage.setPayload(message.getPayload()); splitMessages.add(splitMessage); } catch (CloneNotSupportedException e) { log.error("Could not clone message [{}]", id, e); } } } log.info("Split multi-payload message into {} standard messages", splitMessages.size()); return splitMessages; } }
MultiPayloadMessageSplitter extends MessageSplitterImp { @Override public Iterable<AdaptrisMessage> splitMessage(AdaptrisMessage msg) { List<AdaptrisMessage> splitMessages = new ArrayList<>(); if (!(msg instanceof MultiPayloadAdaptrisMessage)) { log.warn("Message [{}] is not a multi-payload message!", msg.getUniqueId()); splitMessages.add(msg); } else { MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage)msg; for (String id : message.getPayloadIDs()) { message.switchPayload(id); try { AdaptrisMessage splitMessage = DefaultMessageFactory.getDefaultInstance().newMessage(message, null); splitMessage.setPayload(message.getPayload()); splitMessages.add(splitMessage); } catch (CloneNotSupportedException e) { log.error("Could not clone message [{}]", id, e); } } } log.info("Split multi-payload message into {} standard messages", splitMessages.size()); return splitMessages; }  }
MultiPayloadMessageSplitter extends MessageSplitterImp { @Override public Iterable<AdaptrisMessage> splitMessage(AdaptrisMessage msg) { List<AdaptrisMessage> splitMessages = new ArrayList<>(); if (!(msg instanceof MultiPayloadAdaptrisMessage)) { log.warn("Message [{}] is not a multi-payload message!", msg.getUniqueId()); splitMessages.add(msg); } else { MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage)msg; for (String id : message.getPayloadIDs()) { message.switchPayload(id); try { AdaptrisMessage splitMessage = DefaultMessageFactory.getDefaultInstance().newMessage(message, null); splitMessage.setPayload(message.getPayload()); splitMessages.add(splitMessage); } catch (CloneNotSupportedException e) { log.error("Could not clone message [{}]", id, e); } } } log.info("Split multi-payload message into {} standard messages", splitMessages.size()); return splitMessages; }  @Override Iterable<AdaptrisMessage> splitMessage(AdaptrisMessage msg); }
MultiPayloadMessageSplitter extends MessageSplitterImp { @Override public Iterable<AdaptrisMessage> splitMessage(AdaptrisMessage msg) { List<AdaptrisMessage> splitMessages = new ArrayList<>(); if (!(msg instanceof MultiPayloadAdaptrisMessage)) { log.warn("Message [{}] is not a multi-payload message!", msg.getUniqueId()); splitMessages.add(msg); } else { MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage)msg; for (String id : message.getPayloadIDs()) { message.switchPayload(id); try { AdaptrisMessage splitMessage = DefaultMessageFactory.getDefaultInstance().newMessage(message, null); splitMessage.setPayload(message.getPayload()); splitMessages.add(splitMessage); } catch (CloneNotSupportedException e) { log.error("Could not clone message [{}]", id, e); } } } log.info("Split multi-payload message into {} standard messages", splitMessages.size()); return splitMessages; }  @Override Iterable<AdaptrisMessage> splitMessage(AdaptrisMessage msg);  }