@Override public Set<SimpleString> getPropertyNames() { checkProperties(); return properties.getPropertyNames(); }
@Override public Enumeration getMapNames() throws JMSException { Set<SimpleString> simplePropNames = map.getPropertyNames(); Set<String> propNames = new HashSet<>(simplePropNames.size()); for (SimpleString str : simplePropNames) { propNames.add(str.toString()); } return Collections.enumeration(propNames); }
@Override public Set<String> getPropertyNames() { try { Set<SimpleString> simplePropNames = properties.getPropertyNames(); Set<String> propNames = new HashSet<>(simplePropNames.size()); for (SimpleString str : simplePropNames) { propNames.add(str.toString()); } return propNames; } catch (ActiveMQPropertyConversionException ce) { throw new MessageFormatRuntimeException(ce.getMessage()); } catch (RuntimeException e) { throw new JMSRuntimeException(e.getMessage()); } }
/** * 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 Set<SimpleString> getPropertyNames() { checkProperties(); return properties.getPropertyNames(); }
@Override public Enumeration getMapNames() throws JMSException { Set<SimpleString> simplePropNames = map.getPropertyNames(); Set<String> propNames = new HashSet<>(simplePropNames.size()); for (SimpleString str : simplePropNames) { propNames.add(str.toString()); } return Collections.enumeration(propNames); }
@Override public Set<SimpleString> getPropertyNames() { checkProperties(); return properties.getPropertyNames(); }
@Override public Set<SimpleString> getPropertyNames() { return getProperties().getPropertyNames(); }
@Override public Set<SimpleString> getPropertyNames() { return getProperties().getPropertyNames(); }
@Override public Set<SimpleString> getPropertyNames() { checkProperties(); return properties.getPropertyNames(); }
@Override public Set<SimpleString> getPropertyNames() { return getProperties().getPropertyNames(); }
@Override public Set<String> getPropertyNames() { try { Set<SimpleString> simplePropNames = properties.getPropertyNames(); Set<String> propNames = new HashSet<>(simplePropNames.size()); for (SimpleString str : simplePropNames) { propNames.add(str.toString()); } return propNames; } catch (ActiveMQPropertyConversionException ce) { throw new MessageFormatRuntimeException(ce.getMessage()); } catch (RuntimeException e) { throw new JMSRuntimeException(e.getMessage()); } }
/** * 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)); } }
@Test public void testNullTypedProperties() throws Exception { Assert.assertEquals(0, props.getPropertyNames().size()); props.putTypedProperties(null); Assert.assertEquals(0, props.getPropertyNames().size()); }
@Test public void testEmptyTypedProperties() throws Exception { Assert.assertEquals(0, props.getPropertyNames().size()); props.putTypedProperties(new TypedProperties()); Assert.assertEquals(0, props.getPropertyNames().size()); }
private static void assertEqualsTypeProperties(final TypedProperties expected, final TypedProperties actual) { Assert.assertNotNull(expected); Assert.assertNotNull(actual); Assert.assertEquals(expected.getEncodeSize(), actual.getEncodeSize()); Assert.assertEquals(expected.getPropertyNames(), actual.getPropertyNames()); Iterator<SimpleString> iterator = actual.getPropertyNames().iterator(); while (iterator.hasNext()) { SimpleString key = iterator.next(); Object expectedValue = expected.getProperty(key); Object actualValue = actual.getProperty(key); if (expectedValue instanceof byte[] && actualValue instanceof byte[]) { byte[] expectedBytes = (byte[]) expectedValue; byte[] actualBytes = (byte[]) actualValue; Assert.assertArrayEquals(expectedBytes, actualBytes); } else { Assert.assertEquals(expectedValue, actualValue); } } }
props.putSimpleStringProperty(SimpleString.toSimpleString("S" + h), SimpleString.toSimpleString("hello")); props.getPropertyNames().clear(); } catch (UnsupportedOperationException uoe) {
@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)); }