Package org.springframework.jms.support.converter

Examples of org.springframework.jms.support.converter.SimpleMessageConverter


  }

  protected void doTestJmsException(JMSException original, Class thrownExceptionClass) throws Exception {
    JmsTemplate template = createTemplate();
    template.setConnectionFactory(mockConnectionFactory);
    template.setMessageConverter(new SimpleMessageConverter());
    String s = "Hello world";

    MockControl messageProducerControl = MockControl.createControl(MessageProducer.class);
    MessageProducer mockMessageProducer = (MessageProducer) messageProducerControl.getMock();
    MockControl messageControl = MockControl.createControl(TextMessage.class);
View Full Code Here


  }

  public void testConverter() throws Exception {
    JmsTemplate102 template = createTemplate();
    template.setConnectionFactory(mockQueueConnectionFactory);
    template.setMessageConverter(new SimpleMessageConverter());
    String s = "Hello world";

    MockControl queueSenderControl = MockControl.createControl(QueueSender.class);
    QueueSender mockQueueSender = (QueueSender) queueSenderControl.getMock();
    MockControl messageControl = MockControl.createControl(TextMessage.class);
View Full Code Here

  }

  protected void doTestJmsException(JMSException original, Class thrownExceptionClass) throws Exception {
    JmsTemplate template = createTemplate();
    template.setConnectionFactory(mockQueueConnectionFactory);
    template.setMessageConverter(new SimpleMessageConverter());
    String s = "Hello world";

    MockControl queueSenderControl = MockControl.createControl(QueueSender.class);
    QueueSender mockQueueSender = (QueueSender) queueSenderControl.getMock();
    MockControl messageControl = MockControl.createControl(TextMessage.class);
View Full Code Here

        message.getText();
        messageControl.setReturnValue(content, 1);
        sessionControl.replay();
        messageControl.replay();

        SimpleMessageConverter converter = new SimpleMessageConverter();
        Message msg = converter.toMessage(content, session);
        assertEquals(content, converter.fromMessage(msg));

        sessionControl.verify();
        messageControl.verify();
    }
View Full Code Here

        });
        messageControl.setReturnValue(content.length, 1);
        sessionControl.replay();
        messageControl.replay();

        SimpleMessageConverter converter = new SimpleMessageConverter();
        Message msg = converter.toMessage(content, session);
        assertEquals(content.length, ((byte[]) converter.fromMessage(msg)).length);

        sessionControl.verify();
        messageControl.verify();
    }
View Full Code Here

        messageControl.setReturnValue("value2", 1);

        sessionControl.replay();
        messageControl.replay();

        SimpleMessageConverter converter = new SimpleMessageConverter();
        Message msg = converter.toMessage(content, session);
        assertEquals(content, converter.fromMessage(msg));

        sessionControl.verify();
        messageControl.verify();
    }
View Full Code Here

        message.getObject();
        messageControl.setReturnValue(content, 1);
        sessionControl.replay();
        messageControl.replay();

        SimpleMessageConverter converter = new SimpleMessageConverter();
        Message msg = converter.toMessage(content, session);
        assertEquals(content, converter.fromMessage(msg));

        sessionControl.verify();
        messageControl.verify();
    }
View Full Code Here

    }

    public void testToMessageThrowsExceptionIfGivenNullObjectToConvert() throws Exception {
        new AssertThrows(MessageConversionException.class) {
            public void test() throws Exception {
                new SimpleMessageConverter().toMessage(null, null);
            }
        }.runTest();
    }
View Full Code Here

    }

    public void testToMessageThrowsExceptionIfGivenIncompatibleObjectToConvert() throws Exception {
        new AssertThrows(MessageConversionException.class) {
            public void test() throws Exception {
                new SimpleMessageConverter().toMessage(new Object(), null);
            }
        }.runTest();
    }
View Full Code Here

        ObjectMessage message = (ObjectMessage) messageControl.getMock();

        sessionControl.replay();
        messageControl.replay();

        SimpleMessageConverter converter = new SimpleMessageConverter();
        Message msg = converter.toMessage(message, session);
        assertSame(message, msg);

        sessionControl.verify();
        messageControl.verify();
    }
View Full Code Here

TOP

Related Classes of org.springframework.jms.support.converter.SimpleMessageConverter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.