本文整理了Java中javax.jms.Message.getByteProperty()
方法的一些代码示例,展示了Message.getByteProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getByteProperty()
方法的具体详情如下:
包路径:javax.jms.Message
类名称:Message
方法名:getByteProperty
[英]Returns the value of the byte property with the specified name.
[中]返回具有指定名称的字节属性的值。
代码示例来源:origin: org.apache.tomee/openejb-core
@Override
public byte getByteProperty(final String name) throws JMSException {
return message.getByteProperty(name);
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-connector
public byte getByteProperty(String name) throws JMSException
{
return message.getByteProperty(name);
}
代码示例来源:origin: org.jboss.genericjms/generic-jms-ra-jar
public byte getByteProperty(String name) throws JMSException {
return message.getByteProperty(name);
}
代码示例来源:origin: org.apache.qpid/qpid-jca
/**
* Get property
* @param name The name
* @return The value
* @exception JMSException Thrown if an error occurs
*/
public byte getByteProperty(final String name) throws JMSException
{
if (_log.isTraceEnabled())
{
_log.trace("getByteProperty(" + name + ")");
}
return _message.getByteProperty(name);
}
代码示例来源:origin: apache/activemq-artemis
/**
* Get property
*
* @param name The name
* @return The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public byte getByteProperty(final String name) throws JMSException {
if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
ActiveMQRALogger.LOGGER.trace("getByteProperty(" + name + ")");
}
return message.getByteProperty(name);
}
代码示例来源:origin: objectweb-joramtests/joramtests
/**
* Test that an attempt to get a <code>byte</code> property which does not exist throw
* a <code>java.lang.NumberFormatException</code>
*/
public void testGetByteProperty()
{
try
{
Message message = senderSession.createMessage();
message.getByteProperty("prop");
Assert.fail("Should raise a NumberFormatException.\n");
}
catch (NumberFormatException e)
{
}
catch (JMSException e)
{
fail(e);
}
}
代码示例来源:origin: org.apache.activemq/artemis-ra
/**
* Get property
*
* @param name The name
* @return The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public byte getByteProperty(final String name) throws JMSException {
if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
ActiveMQRALogger.LOGGER.trace("getByteProperty(" + name + ")");
}
return message.getByteProperty(name);
}
代码示例来源:origin: objectweb-joramtests/joramtests
/**
* if a property is set as a <code>java.lang.String</code>,
* it can also be read as a <code>byte</code> if the <code>String</code>
* is a correct representation of a <code>byte</code> (e.g. <code>"0"</code>).
*/
public void testString2Byte_1()
{
try
{
Message message = senderSession.createMessage();
message.setStringProperty("prop", "0");
assertEquals((byte) 0, message.getByteProperty("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>byte</code>.
*/
public void testByte2Byte()
{
try
{
Message message = senderSession.createMessage();
message.setByteProperty("prop", (byte) 127);
assertEquals((byte) 127, message.getByteProperty("prop"));
}
catch (JMSException e)
{
fail(e);
}
}
代码示例来源:origin: apache/activemq-artemis
/**
* Test that an attempt to get a <code>byte</code> property which does not exist throw
* a <code>java.lang.NumberFormatException</code>
*/
@Test
public void testGetByteProperty() {
try {
Message message = senderSession.createMessage();
message.getByteProperty("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>byte</code>.
*/
@Test
public void testByte2Byte() {
try {
Message message = senderSession.createMessage();
message.setByteProperty("prop", (byte) 127);
Assert.assertEquals((byte) 127, message.getByteProperty("prop"));
} 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>byte</code> if the <code>String</code>
* is a correct representation of a <code>byte</code> (e.g. <code>"0"</code>).
*/
@Test
public void testString2Byte_1() {
try {
Message message = senderSession.createMessage();
message.setStringProperty("prop", "0");
Assert.assertEquals((byte) 0, message.getByteProperty("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>byte</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testDouble2Byte() {
try {
Message message = senderSession.createMessage();
// store a value that can't be converted to byte
message.setDoubleProperty("prop", 127.0);
message.getByteProperty("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>short</code>,
* to get is as a <code>byte</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testShort2Byte() {
try {
Message message = senderSession.createMessage();
message.setShortProperty("prop", (short) 127);
message.getByteProperty("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>byte</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testFloat2Byte() {
try {
Message message = senderSession.createMessage();
// store a value that can't be converted to byte
message.setFloatProperty("prop", 127.0F);
message.getByteProperty("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>byte</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testBoolean2Byte() {
try {
Message message = senderSession.createMessage();
// store a value that can't be converted to byte
message.setBooleanProperty("prop", true);
message.getByteProperty("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>long</code>,
* to get is as a <code>byte</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testLong2Byte() {
try {
Message message = senderSession.createMessage();
// store a value that can't be converted to byte
message.setLongProperty("prop", 127L);
message.getByteProperty("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>byte</code> throws a <code>javax.jms.MessageFormatException</code>.
*/
@Test
public void testInt2Byte() {
try {
Message message = senderSession.createMessage();
// store a value that can't be converted to byte
message.setIntProperty("prop", Integer.MAX_VALUE);
message.getByteProperty("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>byte</code> throws a <code>java.lang.NuberFormatException</code>
* if the <code>String</code> is not a correct representation for a <code>byte</code>
* (e.g. <code>"3.14159"</code>).
*/
@Test
public void testString2Byte_2() {
try {
Message message = senderSession.createMessage();
message.setStringProperty("pi", "3.14159");
message.getByteProperty("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());
}
内容来源于网络,如有侵权,请联系作者删除!