@Override public Object getObjectProperty(final SimpleString key) { checkProperties(); return properties.getProperty(key); }
/** * Sets all properties we carry onto the message. * * @param message * @throws JMSException */ private void setProperties(Message message) throws JMSException { for (SimpleString name : properties.getPropertyNames()) { message.setObjectProperty(name.toString(), properties.getProperty(name)); } }
@Override public Object getObject(final String name) throws JMSException { Object val = map.getProperty(new SimpleString(name)); if (val instanceof SimpleString) { val = ((SimpleString) val).toString(); } return val; }
/** * Sets all properties we carry onto the message. * * @param message * @throws JMSException */ private void setProperties(Message message) throws JMSException { for (SimpleString name : properties.getPropertyNames()) { message.setObjectProperty(name.toString(), properties.getProperty(name)); } }
@Override public Object getObjectProperty(String name) { try { SimpleString key = new SimpleString(name); Object property = properties.getProperty(key); if (stringPropertyNames.contains(key)) { property = property.toString(); } return property; } catch (ActiveMQPropertyConversionException ce) { throw new MessageFormatRuntimeException(ce.getMessage()); } catch (RuntimeException e) { throw new JMSRuntimeException(e.getMessage()); } }
@Test public void testCopyContructor() throws Exception { props.putSimpleStringProperty(key, RandomUtil.randomSimpleString()); TypedProperties copy = new TypedProperties(props); Assert.assertEquals(props.getEncodeSize(), copy.getEncodeSize()); Assert.assertEquals(props.getPropertyNames(), copy.getPropertyNames()); Assert.assertTrue(copy.containsProperty(key)); Assert.assertEquals(props.getProperty(key), copy.getProperty(key)); }
@Override public Object getObjectProperty(final SimpleString key) { checkProperties(); return properties.getProperty(key); }
@Override public Object getObjectProperty(final SimpleString key) { checkProperties(); return properties.getProperty(key); }
@Override public Object getObjectProperty(final SimpleString key) { checkProperties(); return properties.getProperty(key); }
@Override public Long getScheduledDeliveryTime() { Object property = getProperties().getProperty(Message.HDR_SCHEDULED_DELIVERY_TIME); if (property != null && property instanceof Number) { return ((Number) property).longValue(); } return 0L; }
@Override public Object getObjectProperty(final SimpleString key) { return getProperties().getProperty(key); }
@Override public Object getObjectProperty(final SimpleString key) { return getProperties().getProperty(key); }
@Override public Object getObject(final String name) throws JMSException { Object val = map.getProperty(new SimpleString(name)); if (val instanceof SimpleString) { val = ((SimpleString) val).toString(); } return val; }
@Override public Object getObject(final String name) throws JMSException { Object val = map.getProperty(new SimpleString(name)); if (val instanceof SimpleString) { val = ((SimpleString) val).toString(); } return val; }
@Override public Object getObject(final String name) throws JMSException { Object val = map.getProperty(new SimpleString(name)); if (val instanceof SimpleString) { val = ((SimpleString) val).toString(); } return val; }
@Override public Object getObject(final String name) throws JMSException { Object val = map.getProperty(new SimpleString(name)); if (val instanceof SimpleString) { val = ((SimpleString) val).toString(); } return val; }
@Test public void testKey() throws Exception { props.putBooleanProperty(key, true); boolean bool = (Boolean) props.getProperty(key); Assert.assertEquals(true, bool); props.putCharProperty(key, 'a'); char c = (Character) props.getProperty(key); Assert.assertEquals('a', c); }
@Test public void testGetPropertyOnEmptyProperties() throws Exception { Assert.assertFalse(props.containsProperty(key)); Assert.assertNull(props.getProperty(key)); }
@Test public void testNullProperty() throws Exception { props.putSimpleStringProperty(key, null); Assert.assertTrue(props.containsProperty(key)); Assert.assertNull(props.getProperty(key)); }
@Test public void testBytesPropertyWithNull() throws Exception { props.putBytesProperty(key, null); Assert.assertTrue(props.containsProperty(key)); byte[] bb = (byte[]) props.getProperty(key); Assert.assertNull(bb); }