@Test public void testSimpleSendNoXAJMS1() throws Exception { Queue q = ActiveMQJMSClient.createQueue(MDBQUEUE); try (ClientSessionFactory sf = locator.createSessionFactory(); ClientSession session = sf.createSession(); ClientConsumer consVerify = session.createConsumer(MDBQUEUE); Connection conn = qraConnectionFactory.createConnection(); ) { Session jmsSess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); session.start(); MessageProducer producer = jmsSess.createProducer(q); // These next 4 lines could be written in a single line however it makes difficult for debugging TextMessage msgsend = jmsSess.createTextMessage("hello"); msgsend.setStringProperty("strvalue", "hello"); producer.send(msgsend); ClientMessage msg = consVerify.receive(1000); assertNotNull(msg); assertEquals("hello", msg.getStringProperty("strvalue")); } }
@Test public void testSimpleSendNoXAJMS1() throws Exception { Queue q = ActiveMQJMSClient.createQueue(MDBQUEUE); try (ClientSessionFactory sf = locator.createSessionFactory(); ClientSession session = sf.createSession(); ClientConsumer consVerify = session.createConsumer(MDBQUEUE); Connection conn = qraConnectionFactory.createConnection(); ) { Session jmsSess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); session.start(); MessageProducer producer = jmsSess.createProducer(q); // These next 4 lines could be written in a single line however it makes difficult for debugging TextMessage msgsend = jmsSess.createTextMessage("hello"); msgsend.setStringProperty("strvalue", "hello"); producer.send(msgsend); ClientMessage msg = consVerify.receive(1000); assertNotNull(msg); assertEquals("hello", msg.getStringProperty("strvalue")); } } }
conn = qraConnectionFactory.createConnection("IDont", "Exist"); fail("Exception was expected"); } catch (JMSSecurityException expected) { conn = qraConnectionFactory.createConnection("testuser", "testpassword"); conn.close();