javax.jms.Message.getShortProperty()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(93)

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

Message.getShortProperty介绍

[英]Returns the value of the short property with the specified name.
[中]返回具有指定名称的short属性的值。

代码示例

代码示例来源:origin: org.jboss.jbossas/jboss-as-connector

public short getShortProperty(String name) throws JMSException
{
 return message.getShortProperty(name);
}

代码示例来源:origin: org.apache.tomee/openejb-core

@Override
public short getShortProperty(final String name) throws JMSException {
  return message.getShortProperty(name);
}

代码示例来源:origin: org.jboss.genericjms/generic-jms-ra-jar

public short getShortProperty(String name) throws JMSException {
  return message.getShortProperty(name);
}

代码示例来源:origin: org.apache.qpid/qpid-jca

/**
* Get property
* @param name The name
* @return The value
* @exception JMSException Thrown if an error occurs
*/
public short getShortProperty(final String name) throws JMSException
{
 if (_log.isTraceEnabled())
 {
   _log.trace("getShortProperty(" + name + ")");
 }
 return _message.getShortProperty(name);
}

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

/** 
* Test that an attempt to get a <code>short</code> property which does not exist throw
* a <code>java.lang.NumberFormatException</code>
*/
public void testGetShortProperty()
{
 try
 {
   Message message = senderSession.createMessage();
   message.getShortProperty("prop");
   Assert.fail("Should raise a NumberFormatException.\n");
 }
 catch (NumberFormatException e)
 {
 }
 catch (JMSException e)
 {
   fail(e);
 }
}

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

/**
* Get property
*
* @param name The name
* @return The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public short getShortProperty(final String name) throws JMSException {
 if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
   ActiveMQRALogger.LOGGER.trace("getShortProperty(" + name + ")");
 }
 return message.getShortProperty(name);
}

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

/**
* Get property
*
* @param name The name
* @return The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public short getShortProperty(final String name) throws JMSException {
 if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
   ActiveMQRALogger.LOGGER.trace("getShortProperty(" + name + ")");
 }
 return message.getShortProperty(name);
}

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

/**
* if a property is set as a <code>short</code>, 
* it can also be read as a <code>short</code>.
*/
public void testShort2Short()
{
 try
 {
   Message message = senderSession.createMessage();
   message.setShortProperty("prop", (short) 127);
   assertEquals((short) 127, message.getShortProperty("prop"));
 }
 catch (JMSException e)
 {
   fail(e);
 }
}

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

/**
* if a property is set as a <code>byte</code>, 
* it can also be read as a <code>short</code>.
*/
public void testByte2Short()
{
 try
 {
   Message message = senderSession.createMessage();
   message.setByteProperty("prop", (byte) 127);
   assertEquals((short) 127, message.getShortProperty("prop"));
 }
 catch (JMSException e)
 {
   fail(e);
 }
}

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

/**
* Test that an attempt to get a <code>short</code> property which does not exist throw
* a <code>java.lang.NumberFormatException</code>
*/
@Test
public void testGetShortProperty() {
 try {
   Message message = senderSession.createMessage();
   message.getShortProperty("prop");
   Assert.fail("Should raise a NumberFormatException.\n");
 } catch (NumberFormatException e) {
 } catch (JMSException e) {
   fail(e);
 }
}

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

/**
* if a property is set as a <code>byte</code>,
* it can also be read as a <code>short</code>.
*/
@Test
public void testByte2Short() {
 try {
   Message message = senderSession.createMessage();
   message.setByteProperty("prop", (byte) 127);
   Assert.assertEquals((short) 127, message.getShortProperty("prop"));
 } catch (JMSException e) {
   fail(e);
 }
}

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

/**
* if a property is set as a <code>short</code>,
* it can also be read as a <code>short</code>.
*/
@Test
public void testShort2Short() {
 try {
   Message message = senderSession.createMessage();
   message.setShortProperty("prop", (short) 127);
   Assert.assertEquals((short) 127, message.getShortProperty("prop"));
 } catch (JMSException e) {
   fail(e);
 }
}

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

/**
* if a property is set as a <code>long</code>,
* to get is as a <code>short</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testLong2Short() {
 try {
   Message message = senderSession.createMessage();
   // store a value that can't be converted to short
   message.setLongProperty("prop", 127L);
   message.getShortProperty("prop");
   Assert.fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
 } catch (MessageFormatException e) {
 } catch (JMSException e) {
   fail(e);
 }
}

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

/**
* if a property is set as a <code>java.lang.String</code>,
* it can also be read as a <code>short</code> as long as the <code>String</code>
* is a correct representation of a <code>short</code> (e.g. <code>"0"</code>).
*/
@Test
public void testString2Short_1() {
 try {
   Message message = senderSession.createMessage();
   message.setStringProperty("prop", "0");
   Assert.assertEquals((short) 0, message.getShortProperty("prop"));
 } catch (JMSException e) {
   fail(e);
 }
}

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

/**
* if a property is set as a <code>double</code>,
* to get is as a <code>short</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testDouble2Short() {
 try {
   Message message = senderSession.createMessage();
   // store a value that can't be converted to short
   message.setDoubleProperty("prop", 127.0);
   message.getShortProperty("prop");
   Assert.fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
 } catch (MessageFormatException e) {
 } catch (JMSException e) {
   fail(e);
 }
}

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

/**
* if a property is set as a <code>int</code>,
* to get is as a <code>short</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testInt2Short() {
 try {
   Message message = senderSession.createMessage();
   // store a value that can't be converted to short
   message.setIntProperty("prop", Integer.MAX_VALUE);
   message.getShortProperty("prop");
   Assert.fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
 } catch (MessageFormatException e) {
 } catch (JMSException e) {
   fail(e);
 }
}

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

/**
* if a property is set as a <code>float</code>,
* to get is as a <code>short</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testFloat2Short() {
 try {
   Message message = senderSession.createMessage();
   // store a value that can't be converted to short
   message.setFloatProperty("prop", 127.0F);
   message.getShortProperty("prop");
   Assert.fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
 } catch (MessageFormatException e) {
 } catch (JMSException e) {
   fail(e);
 }
}

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

/**
* if a property is set as a <code>boolean</code>,
* to get is as a <code>short</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testBoolean2Short() {
 try {
   Message message = senderSession.createMessage();
   // store a value that can't be converted to short
   message.setBooleanProperty("prop", true);
   message.getShortProperty("prop");
   Assert.fail("sec. 3.5.4 The unmarked cases [of Table 0-4] should raise a JMS MessageFormatException.\n");
 } catch (MessageFormatException e) {
 } catch (JMSException e) {
   fail(e);
 }
}

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

/**
* if a property is set as a <code>java.lang.String</code>,
* to get it as a <code>short</code> throws a <code>java.lang.NuberFormatException</code>
* if the <code>String</code> is not a correct representation for a <code>short</code>
* (e.g. <code>"3.14159"</code>).
*/
@Test
public void testString2Short_2() {
 try {
   Message message = senderSession.createMessage();
   message.setStringProperty("pi", "3.14159");
   message.getShortProperty("pi");
   Assert.fail("sec. 3.5.4 The String to numeric conversions must throw the java.lang.NumberFormatException " + " if the numeric's valueOf() method does not accept the String value as a valid representation.\n");
 } catch (java.lang.NumberFormatException e) {
 } catch (JMSException e) {
   fail(e);
 }
}

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

protected void assertEquivalent(final Message m, final int mode, final boolean redelivered) throws JMSException {
 ProxyAssertSupport.assertNotNull(m);
 ProxyAssertSupport.assertEquals(true, m.getBooleanProperty("booleanProperty"));
 ProxyAssertSupport.assertEquals((byte) 3, m.getByteProperty("byteProperty"));
 ProxyAssertSupport.assertEquals(new Double(4.0), new Double(m.getDoubleProperty("doubleProperty")));
 ProxyAssertSupport.assertEquals(new Float(5.0f), new Float(m.getFloatProperty("floatProperty")));
 ProxyAssertSupport.assertEquals(6, m.getIntProperty("intProperty"));
 ProxyAssertSupport.assertEquals(7, m.getLongProperty("longProperty"));
 ProxyAssertSupport.assertEquals((short) 8, m.getShortProperty("shortProperty"));
 ProxyAssertSupport.assertEquals("this is a String property", m.getStringProperty("stringProperty"));
 ProxyAssertSupport.assertEquals("this is the correlation ID", m.getJMSCorrelationID());
 ProxyAssertSupport.assertEquals(ActiveMQServerTestCase.topic1, m.getJMSReplyTo());
 ProxyAssertSupport.assertEquals("someArbitraryType", m.getJMSType());
 ProxyAssertSupport.assertEquals(queue1, m.getJMSDestination());
 ProxyAssertSupport.assertEquals("JMS Redelivered property", m.getJMSRedelivered(), redelivered);
 ProxyAssertSupport.assertEquals(mode, m.getJMSDeliveryMode());
}

相关文章

微信公众号

最新文章

更多