@Test public void testAdaptrisMessageToObjectMessage() throws Exception { EmbeddedActiveMq broker = new EmbeddedActiveMq(); MessageTypeTranslatorImp trans = new ObjectMessageTranslator(); try { broker.start(); Session session = broker.createConnection().createSession(false, Session.CLIENT_ACKNOWLEDGE); start(trans, session); AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(); Exception e = new Exception("This is an Exception that was serialized"); write(e, msg); addMetadata(msg); Message jmsMsg = trans.translate(msg); assertTrue("jmsMsg instanceof ObjectMessage", jmsMsg instanceof ObjectMessage); assertJmsProperties(jmsMsg); assertException(e, (Exception) ((ObjectMessage) jmsMsg).getObject()); } finally { stop(trans); broker.destroy(); } }
public Message translate(AdaptrisMessage msg) throws JMSException { ObjectMessage result = session.createObjectMessage(); try { if (msg.getSize() > 0) { InputStream in = msg.getInputStream(); ObjectInputStream object = new ObjectInputStream(in); result.setObject((Serializable) object.readObject()); object.close(); in.close(); } } catch (Exception e) { JmsUtils.rethrowJMSException(e); } return helper.moveMetadata(msg, result); }
ObjectMessageTranslator extends MessageTypeTranslatorImp { public Message translate(AdaptrisMessage msg) throws JMSException { ObjectMessage result = session.createObjectMessage(); try { if (msg.getSize() > 0) { InputStream in = msg.getInputStream(); ObjectInputStream object = new ObjectInputStream(in); result.setObject((Serializable) object.readObject()); object.close(); in.close(); } } catch (Exception e) { JmsUtils.rethrowJMSException(e); } return helper.moveMetadata(msg, result); } }
ObjectMessageTranslator extends MessageTypeTranslatorImp { public Message translate(AdaptrisMessage msg) throws JMSException { ObjectMessage result = session.createObjectMessage(); try { if (msg.getSize() > 0) { InputStream in = msg.getInputStream(); ObjectInputStream object = new ObjectInputStream(in); result.setObject((Serializable) object.readObject()); object.close(); in.close(); } } catch (Exception e) { JmsUtils.rethrowJMSException(e); } return helper.moveMetadata(msg, result); }  }
ObjectMessageTranslator extends MessageTypeTranslatorImp { public Message translate(AdaptrisMessage msg) throws JMSException { ObjectMessage result = session.createObjectMessage(); try { if (msg.getSize() > 0) { InputStream in = msg.getInputStream(); ObjectInputStream object = new ObjectInputStream(in); result.setObject((Serializable) object.readObject()); object.close(); in.close(); } } catch (Exception e) { JmsUtils.rethrowJMSException(e); } return helper.moveMetadata(msg, result); }  Message translate(AdaptrisMessage msg); AdaptrisMessage translate(Message msg); }
ObjectMessageTranslator extends MessageTypeTranslatorImp { public Message translate(AdaptrisMessage msg) throws JMSException { ObjectMessage result = session.createObjectMessage(); try { if (msg.getSize() > 0) { InputStream in = msg.getInputStream(); ObjectInputStream object = new ObjectInputStream(in); result.setObject((Serializable) object.readObject()); object.close(); in.close(); } } catch (Exception e) { JmsUtils.rethrowJMSException(e); } return helper.moveMetadata(msg, result); }  Message translate(AdaptrisMessage msg); AdaptrisMessage translate(Message msg);  }