@Override public float getFloatProperty(final String name) throws JMSException { return message.getFloatProperty(name); }
public float getFloatProperty(String name) throws JMSException { return message.getFloatProperty(name); }
public float getFloatProperty(String name) throws JMSException { return message.getFloatProperty(name); }
/** * Get property * @param name The name * @return The value * @exception JMSException Thrown if an error occurs */ public float getFloatProperty(final String name) throws JMSException { if (_log.isTraceEnabled()) { _log.trace("getFloatProperty(" + name + ")"); } return _message.getFloatProperty(name); }
/** * Get property * * @param name The name * @return The value * @throws JMSException Thrown if an error occurs */ @Override public float getFloatProperty(final String name) throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getFloatProperty(" + name + ")"); } return message.getFloatProperty(name); }
/** * Get property * * @param name The name * @return The value * @throws JMSException Thrown if an error occurs */ @Override public float getFloatProperty(final String name) throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace("getFloatProperty(" + name + ")"); } return message.getFloatProperty(name); }
/** * if a property is set as a <code>float</code>, * it can also be read as a <code>float</code>. */ public void testFloat2Float() { try { Message message = senderSession.createMessage(); message.setFloatProperty("prop", 127.0F); assertEquals(127.0F, message.getFloatProperty("prop"), 0); } catch (JMSException e) { fail(e); } }
@Override public void execute(Context context, CallableUnitCallback callableUnitCallback) { Struct messageStruct = BallerinaAdapter.getReceiverObject(context); Message message = BallerinaAdapter.getNativeObject(messageStruct, Constants.JMS_MESSAGE_OBJECT, Message.class, context); String key = context.getStringArgument(0); try { float booleanProperty = message.getFloatProperty(key); context.setReturnValues(new BFloat(booleanProperty)); } catch (JMSException e) { BallerinaAdapter.returnError("Error when retrieving float property", context, e); } } }
/** * if a property is set as a <code>Float</code> with the <code>Message.setObjectProperty()</code> * method, it can be retrieve directly as a <code>double</code> by <code>Message.getFloatProperty()</code> */ @Test public void testSetObjectProperty_1() { try { Message message = senderSession.createMessage(); message.setObjectProperty("pi", new Float(3.14159f)); Assert.assertEquals(3.14159f, message.getFloatProperty("pi"), 0); } catch (JMSException e) { fail(e); } }
/** * Test that an attempt to get a <code>float</code> property which does not exist throw * a <code>java.lang.NullPointerException</code> */ @Test public void testGetFloatProperty() { try { Message message = senderSession.createMessage(); message.getFloatProperty("prop"); Assert.fail("Should raise a NullPointerException.\n"); } catch (NullPointerException e) { } catch (JMSException e) { fail(e); } }
/** * if a property is set as a <code>float</code>, * it can also be read as a <code>float</code>. */ @Test public void testFloat2Float() { try { Message message = senderSession.createMessage(); message.setFloatProperty("prop", 127.0F); Assert.assertEquals(127.0F, message.getFloatProperty("prop"), 0); } catch (JMSException e) { fail(e); } }
/** * if a property is set as a <code>java.lang.String</code>, * it can also be read as a <code>float</code> as long as the <code>String</code> * is a correct representation of a <code>float</code> (e.g. <code>"3.14159"</code>). */ @Test public void testString2Float_1() { try { Message message = senderSession.createMessage(); message.setStringProperty("pi", "3.14159"); Assert.assertEquals(3.14159F, message.getFloatProperty("pi"), 0); } catch (JMSException e) { fail(e); } }
/** * if a property is set as a <code>int</code>, * to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>. */ @Test public void testInt2Float() { try { Message message = senderSession.createMessage(); message.setIntProperty("prop", 127); message.getFloatProperty("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); } }
/** * if a property is set as a <code>long</code>, * to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>. */ @Test public void testLong2Float() { try { Message message = senderSession.createMessage(); message.setLongProperty("prop", 127L); message.getFloatProperty("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); } }
/** * if a property is set as a <code>byte</code>, * to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>. */ @Test public void testByte2Float() { try { Message message = senderSession.createMessage(); message.setByteProperty("prop", (byte) 127); message.getFloatProperty("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); } }
/** * if a property is set as a <code>double</code>, * to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>. */ @Test public void testDouble2Float() { try { Message message = senderSession.createMessage(); message.setDoubleProperty("prop", 127.0); message.getFloatProperty("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); } }
/** * if a property is set as a <code>short</code>, * to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>. */ @Test public void testShort2Float() { try { Message message = senderSession.createMessage(); message.setShortProperty("prop", (short) 127); message.getFloatProperty("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); } }
/** * if a property is set as a <code>boolean</code>, * to get is as a <code>float</code> throws a <code>javax.jms.MessageFormatException</code>. */ @Test public void testBoolean2Float() { try { Message message = senderSession.createMessage(); // store a value that can't be converted to float message.setBooleanProperty("prop", true); message.getFloatProperty("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); } }
/** * if a property is set as a <code>java.lang.String</code>, * to get it as a <code>float</code> throws a <code>java.lang.NuberFormatException</code> * if the <code>String</code> is not a correct representation for a <code>float</code> * (e.g. <code>"not_a_number"</code>). */ @Test public void testString2Float_2() { try { Message message = senderSession.createMessage(); message.setStringProperty("pi", "not_a_number"); message.getFloatProperty("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); } }
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()); }