javax.jms.QueueSession.createMapMessage()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中javax.jms.QueueSession.createMapMessage方法的一些代码示例,展示了QueueSession.createMapMessage的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。QueueSession.createMapMessage方法的具体详情如下:
包路径:javax.jms.QueueSession
类名称:QueueSession
方法名:createMapMessage

QueueSession.createMapMessage介绍

暂无

代码示例

代码示例来源:origin: apache/activemq

@Override
public MapMessage createMapMessage() throws JMSException {
  return next.createMapMessage();
}

代码示例来源:origin: org.apache.activemq/activemq-client

@Override
public MapMessage createMapMessage() throws JMSException {
  return next.createMapMessage();
}

代码示例来源:origin: pierre/meteo

/**
 * @return
 * @throws JMSException
 */
public MapMessage createMapMessage() throws JMSException {
  return next.createMapMessage();
}

代码示例来源:origin: org.apache.activemq/activemq-osgi

@Override
public MapMessage createMapMessage() throws JMSException {
  return next.createMapMessage();
}

代码示例来源:origin: org.apache.activemq/activemq-all

@Override
public MapMessage createMapMessage() throws JMSException {
  return next.createMapMessage();
}

代码示例来源:origin: objectweb-joramtests/joramtests

/**
* Test that the if the name parameter of the set methods of a <code>MapMessage</code> is an empty String,
* the method must throw the error <code>java.lang.IllegalArgumentException</code>.
* <br />
* @since JMS 1.1
*/
public void testEmptyStringInSetMethodsForMapMessage()
{
 try
 {
   MapMessage message = senderSession.createMapMessage();
   message.setBoolean("", true);
   fail("Should throw an IllegalArgumentException");
 }
 catch (IllegalArgumentException e)
 {
 }
 catch (JMSException e)
 {
   fail("Should throw an IllegalArgumentException, not a" + e);
 }
}

代码示例来源:origin: objectweb-joramtests/joramtests

/**
* Test that the if the name parameter of the set methods of a <code>MapMessage</code> is <code>null</code>, 
* the method must throw the error <code>java.lang.IllegalArgumentException</code>.
* <br />
* @since JMS 1.1
*/
public void testNullInSetMethodsForMapMessage()
{
 try
 {
   MapMessage message = senderSession.createMapMessage();
   message.setBoolean(null, true);
   fail("Should throw an IllegalArgumentException");
 }
 catch (IllegalArgumentException e)
 {
 }
 catch (JMSException e)
 {
   fail("Should throw an IllegalArgumentException, not a" + e);
 }
}

代码示例来源:origin: objectweb-joramtests/joramtests

/**
* Test that the <code>MapMessage.getMapNames()</code> method returns an
* empty <code>Enumeration</code> when no map has been defined before.
* <br />
* Also test that the same method returns the correct names of the map.
*/
public void testgetMapNames()
{
 try
 {
   MapMessage message = senderSession.createMapMessage();
   Enumeration e = message.getMapNames();
   assertTrue("No map yet defined.\n", !e.hasMoreElements());
   message.setDouble("pi", 3.14159);
   e = message.getMapNames();
   assertEquals("pi", (String) (e.nextElement()));
 }
 catch (JMSException e)
 {
   fail(e);
 }
}

代码示例来源:origin: objectweb-joramtests/joramtests

/**
* Send a <code>MapMessage</code> with an empty body.
* <br />
* Receive it and test if the message is effectively an instance of 
* <code>MapMessage</code>
*/
public void testMapMessage_1()
{
 try
 {
   MapMessage message = senderSession.createMapMessage();
   sender.send(message);
   Message msg = receiver.receive(TestConfig.TIMEOUT);
   assertTrue("The message should be an instance of MapMessage.\n", msg instanceof MapMessage);
 }
 catch (JMSException e)
 {
   fail(e);
 }
}

代码示例来源:origin: apache/activemq-artemis

/**
* Test that the if the name parameter of the set methods of a <code>MapMessage</code> is <code>null</code>,
* the method must throw the error <code>java.lang.IllegalArgumentException</code>.
* <br />
*
* @since JMS 1.1
*/
@Test
public void testNullInSetMethodsForMapMessage() {
 try {
   MapMessage message = senderSession.createMapMessage();
   message.setBoolean(null, true);
   Assert.fail("Should throw an IllegalArgumentException");
 } catch (IllegalArgumentException e) {
 } catch (JMSException e) {
   Assert.fail("Should throw an IllegalArgumentException, not a" + e);
 }
}

代码示例来源:origin: objectweb-joramtests/joramtests

/**
* Test in MapMessage the conversion between <code>getObject("foo")</code> and
* <code>getDouble("foo")</code> (the later returning a java.lang.Double and the former a double)
*/
public void testMapMessageConversion()
{
 try
 {
   MapMessage message = senderSession.createMapMessage();
   message.setDouble("pi", 3.14159);
   sender.send(message);
   Message m = receiver.receive(TestConfig.TIMEOUT);
   assertTrue("The message should be an instance of MapMessage.\n", m instanceof MapMessage);
   MapMessage msg = (MapMessage) m;
   assertTrue(msg.getObject("pi") instanceof Double);
   assertEquals(3.14159, ((Double) msg.getObject("pi")).doubleValue(), 0);
   assertEquals(3.14159, msg.getDouble("pi"), 0);
 }
 catch (JMSException e)
 {
   fail(e);
 }
}

代码示例来源:origin: apache/activemq-artemis

/**
* Test that the <code>MapMessage.getMapNames()</code> method returns an
* empty <code>Enumeration</code> when no map has been defined before.
* <br />
* Also test that the same method returns the correct names of the map.
*/
@Test
public void testgetMapNames() {
 try {
   MapMessage message = senderSession.createMapMessage();
   Enumeration<?> e = message.getMapNames();
   Assert.assertTrue("No map yet defined.\n", !e.hasMoreElements());
   message.setDouble("pi", 3.14159);
   e = message.getMapNames();
   Assert.assertEquals("pi", e.nextElement());
 } catch (JMSException e) {
   fail(e);
 }
}

代码示例来源:origin: apache/activemq-artemis

/**
* Test that the if the name parameter of the set methods of a <code>MapMessage</code> is an empty String,
* the method must throw the error <code>java.lang.IllegalArgumentException</code>.
* <br />
*
* @since JMS 1.1
*/
@Test
public void testEmptyStringInSetMethodsForMapMessage() {
 try {
   MapMessage message = senderSession.createMapMessage();
   message.setBoolean("", true);
   Assert.fail("Should throw an IllegalArgumentException");
 } catch (IllegalArgumentException e) {
 } catch (JMSException e) {
   Assert.fail("Should throw an IllegalArgumentException, not a" + e);
 }
}

代码示例来源:origin: apache/activemq-artemis

/**
* Send a <code>MapMessage</code> with an empty body.
* <br />
* Receive it and test if the message is effectively an instance of
* <code>MapMessage</code>
*/
@Test
public void testMapMessage_1() {
 try {
   MapMessage message = senderSession.createMapMessage();
   sender.send(message);
   Message msg = receiver.receive(TestConfig.TIMEOUT);
   Assert.assertTrue("The message should be an instance of MapMessage.\n", msg instanceof MapMessage);
 } catch (JMSException e) {
   fail(e);
 }
}

代码示例来源:origin: objectweb-joramtests/joramtests

/**
* Send a <code>MapMessage</code> with 2 Java primitives in its body (a <code>
* String</code> and a <code>double</code>).
* <br />
* Receive it and test that the values of the primitives of the body are correct
*/
public void testMapMessage_2()
{
 try
 {
   MapMessage message = senderSession.createMapMessage();
   message.setString("name", "pi");
   message.setDouble("value", 3.14159);
   sender.send(message);
   Message m = receiver.receive(TestConfig.TIMEOUT);
   assertTrue("The message should be an instance of MapMessage.\n", m instanceof MapMessage);
   MapMessage msg = (MapMessage) m;
   assertEquals("pi", msg.getString("name"));
   assertEquals(3.14159, msg.getDouble("value"), 0);
 }
 catch (JMSException e)
 {
   fail(e);
 }
}

代码示例来源:origin: apache/activemq-artemis

/**
* Test in MapMessage the conversion between <code>getObject("foo")</code> and
* <code>getDouble("foo")</code> (the later returning a java.lang.Double and the former a double)
*/
@Test
public void testMapMessageConversion() {
 try {
   MapMessage message = senderSession.createMapMessage();
   message.setDouble("pi", 3.14159);
   sender.send(message);
   Message m = receiver.receive(TestConfig.TIMEOUT);
   Assert.assertTrue("The message should be an instance of MapMessage.\n", m instanceof MapMessage);
   MapMessage msg = (MapMessage) m;
   Assert.assertTrue(msg.getObject("pi") instanceof Double);
   Assert.assertEquals(3.14159, ((Double) msg.getObject("pi")).doubleValue(), 0);
   Assert.assertEquals(3.14159, msg.getDouble("pi"), 0);
 } catch (JMSException e) {
   fail(e);
 }
}

代码示例来源:origin: apache/activemq-artemis

/**
* Send a <code>MapMessage</code> with 2 Java primitives in its body (a <code>
* String</code> and a <code>double</code>).
* <br />
* Receive it and test that the values of the primitives of the body are correct
*/
@Test
public void testMapMessage_2() {
 try {
   MapMessage message = senderSession.createMapMessage();
   message.setString("name", "pi");
   message.setDouble("value", 3.14159);
   sender.send(message);
   Message m = receiver.receive(TestConfig.TIMEOUT);
   Assert.assertTrue("The message should be an instance of MapMessage.\n", m instanceof MapMessage);
   MapMessage msg = (MapMessage) m;
   Assert.assertEquals("pi", msg.getString("name"));
   Assert.assertEquals(3.14159, msg.getDouble("value"), 0);
 } catch (JMSException e) {
   fail(e);
 }
}

代码示例来源:origin: apache/activemq-artemis

MapMessage mapMessage = defaultQueueSession.createMapMessage();
mapMessage.setStringProperty("testName", "testSendEmptyMessages");
defaultSender.send(mapMessage);

相关文章