public double getDouble(String name) throws JMSException { return ((MapMessage) message).getDouble(name); }
@Override public double getDouble(final String name) throws JMSException { return message.getDouble(name); }
public double getDouble(String name) throws JMSException { return ((MapMessage) message).getDouble(name); }
/** * Get * @param name The name * @return The value * @exception JMSException Thrown if an error occurs */ public double getDouble(final String name) throws JMSException { if (_log.isTraceEnabled()) { _log.trace("getDouble(" + name + ")"); } return ((MapMessage)_message).getDouble(name); }
/** * Get * * @param name The name * @return The value * @throws JMSException Thrown if an error occurs */ @Override public double getDouble(final String name) throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getDouble(" + name + ")"); } return ((MapMessage) message).getDouble(name); }
/** * Get * * @param name The name * @return The value * @throws JMSException Thrown if an error occurs */ @Override public double getDouble(final String name) throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getDouble(" + name + ")"); } return ((MapMessage) message).getDouble(name); }
/** * 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); } }
/** * 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); } }
/** * 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); } }
@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")); } }
/** * 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); } }
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); }
assertEquals((byte) 5, bytes[1]); assertEquals('a', mapMessage.getChar("achar")); Double doubleVal = mapMessage.getDouble("adouble"); assertTrue(doubleVal.equals(Double.valueOf(4.4))); Float floatVal = mapMessage.getFloat("afloat");
@Override protected void assertEquivalent(final Message m, final int mode, final boolean redelivery) throws JMSException { super.assertEquivalent(m, mode, redelivery); MapMessage map = (MapMessage) m; ProxyAssertSupport.assertTrue(map.getBoolean("boolean1")); ProxyAssertSupport.assertEquals(map.getChar("char1"), 'c'); ProxyAssertSupport.assertEquals(map.getDouble("double1"), 1.0D, 0.0D); ProxyAssertSupport.assertEquals(map.getFloat("float1"), 2.0F, 0.0F); ProxyAssertSupport.assertEquals(map.getInt("int1"), 3); ProxyAssertSupport.assertEquals(map.getLong("long1"), 4L); ProxyAssertSupport.assertEquals(map.getObject("object1"), obj); ProxyAssertSupport.assertEquals(map.getShort("short1"), (short) 5); ProxyAssertSupport.assertEquals(map.getString("string1"), "stringvalue"); } }
ProxyAssertSupport.assertEquals(myLong, m2.getLong("myLong")); ProxyAssertSupport.assertEquals(myFloat, m2.getFloat("myFloat"), 0); ProxyAssertSupport.assertEquals(myDouble, m2.getDouble("myDouble"), 0); ProxyAssertSupport.assertEquals(myString, m2.getString("myString")); m2.getDouble("myBool"); ProxyAssertSupport.fail(); } catch (MessageFormatException e) { m2.getDouble("myByte"); ProxyAssertSupport.fail(); } catch (MessageFormatException e) { m2.getDouble("myShort"); ProxyAssertSupport.fail(); } catch (MessageFormatException e) { m2.getDouble("myInt"); ProxyAssertSupport.fail(); } catch (MessageFormatException e) { m2.getDouble("myLong"); ProxyAssertSupport.fail(); } catch (MessageFormatException e) { ProxyAssertSupport.assertEquals(myFloat, m2.getDouble("myFloat"), 0); ProxyAssertSupport.assertEquals(myLong, m3.getLong("myLong")); ProxyAssertSupport.assertEquals(myFloat, m3.getFloat("myFloat"), 0);
assertEquals((byte) 5, bytes[1]); assertEquals('a', mapMessage.getChar("achar")); Double doubleVal = mapMessage.getDouble("adouble"); assertTrue(doubleVal.equals(Double.valueOf(4.4))); Float floatVal = mapMessage.getFloat("afloat");