Fix SpringJMS examples

This commit is contained in:
Grzegorz Piwowarek 2016-10-13 18:35:13 +03:00
parent 6a7e380efd
commit c4638f1b4a
2 changed files with 1 additions and 25 deletions

View File

@ -25,8 +25,8 @@ public class SampleListener implements MessageListener {
public void onMessage(Message message) {
if (message instanceof TextMessage) {
try {
String msg = ((TextMessage) message).getText();
System.out.println("Received message: " + msg);
} catch (JMSException ex) {
throw new RuntimeException(ex);
}

View File

@ -1,24 +0,0 @@
package com.baeldung.spring.jms;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class DefaultTextMessageSenderTest {
private static SampleJmsMessageSender messageProducer;
@SuppressWarnings("resource")
@BeforeClass
public static void setUp() {
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:EmbeddedActiveMQ.xml", "classpath:applicationContext.xml");
messageProducer = (SampleJmsMessageSender) applicationContext.getBean("SampleJmsMessageSender");
}
@Test
public void testSimpleSend() {
messageProducer.simpleSend();
}
}