本文整理汇总了Java中javax.jms.MapMessage.getBytes方法的典型用法代码示例。如果您正苦于以下问题:Java MapMessage.getBytes方法的具体用法?Java MapMessage.getBytes怎么用?Java MapMessage.getBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.jms.MapMessage
的用法示例。
在下文中一共展示了MapMessage.getBytes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertEquivalent
import javax.jms.MapMessage; //导入方法依赖的package包/类
@Override
protected void assertEquivalent(final Message m, final int mode, final boolean redelivery) throws JMSException {
super.assertEquivalent(m, mode, redelivery);
MapMessage mm = (MapMessage) m;
ProxyAssertSupport.assertEquals(true, mm.getBoolean("boolean"));
ProxyAssertSupport.assertEquals((byte) 3, mm.getByte("byte"));
byte[] bytes = mm.getBytes("bytes");
ProxyAssertSupport.assertEquals((byte) 3, bytes[0]);
ProxyAssertSupport.assertEquals((byte) 4, bytes[1]);
ProxyAssertSupport.assertEquals((byte) 5, bytes[2]);
ProxyAssertSupport.assertEquals((char) 6, mm.getChar("char"));
ProxyAssertSupport.assertEquals(new Double(7.0), new Double(mm.getDouble("double")));
ProxyAssertSupport.assertEquals(new Float(8.0f), new Float(mm.getFloat("float")));
ProxyAssertSupport.assertEquals(9, mm.getInt("int"));
ProxyAssertSupport.assertEquals(10L, mm.getLong("long"));
ProxyAssertSupport.assertEquals("this is an object", mm.getObject("object"));
ProxyAssertSupport.assertEquals((short) 11, mm.getShort("short"));
ProxyAssertSupport.assertEquals("this is a string", mm.getString("string"));
}
示例2: receiveMapMessage
import javax.jms.MapMessage; //导入方法依赖的package包/类
private void receiveMapMessage(boolean useCore) throws Exception {
MapMessage mapMessage = (MapMessage) receiveMessage(useCore);
boolean booleanVal = mapMessage.getBoolean("boolean-type");
assertTrue(booleanVal);
byte byteVal = mapMessage.getByte("byte-type");
assertEquals((byte) 10, byteVal);
byte[] bytesVal = mapMessage.getBytes("bytes-type");
byte[] originVal = TEXT.getBytes();
assertEquals(originVal.length, bytesVal.length);
for (int i = 0; i < bytesVal.length; i++) {
assertTrue(bytesVal[i] == originVal[i]);
}
char charVal = mapMessage.getChar("char-type");
assertEquals('A', charVal);
double doubleVal = mapMessage.getDouble("double-type");
assertEquals(55.3D, doubleVal, 0.1D);
float floatVal = mapMessage.getFloat("float-type");
assertEquals(79.1F, floatVal, 0.1F);
int intVal = mapMessage.getInt("int-type");
assertEquals(37, intVal);
long longVal = mapMessage.getLong("long-type");
assertEquals(56652L, longVal);
Object objectVal = mapMessage.getObject("object-type");
Object origVal = new String("VVVV");
assertTrue(objectVal.equals(origVal));
short shortVal = mapMessage.getShort("short-type");
assertEquals((short) 333, shortVal);
String strVal = mapMessage.getString("string-type");
assertEquals(TEXT, strVal);
}