activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmdr <spc...@yahoo.fr>
Subject spring jms test
Date Thu, 17 Jun 2010 21:17:53 GMT

Hi

Can someone explain me the reason why this test failed

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:applicationContext.xml" })
public class SenderTest
{
	@Autowired
	private JmsTemplate jmsTemplate;

	@Test
	public void testSend() throws JMSException
	{
		jmsTemplate.send
		(
			new MessageCreator()
			{
				public Message createMessage(Session session) throws JMSException
				{
					return session.createTextMessage("hello");
				}
			}
		);
		
		Message message = jmsTemplate.receive();
		
		if (message instanceof TextMessage)
		{
			TextMessage textMessage = (TextMessage) message;
			Assert.assertEquals("The message received is not the right one", "hello",
textMessage.getText());
		}
		else
		{
			Assert.assertNotNull("The message is null", message);
			Assert.fail("The message is not a text message");
		}
	}
}

It fail with these activemq configurations
vm://localhost?broker.persistent=false
vm://localhost?broker.deleteAllMessagesOnStartup=true

bu work with this configuration
vm://localhost

I need a clean queue for my junit test, what is the right what to achieve
that

Regards


-- 
View this message in context: http://old.nabble.com/spring-jms-test-tp28919788p28919788.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message