use of org.apache.activemq.artemis.utils.collections.TypedProperties in project activemq-artemis by apache.
the class ActiveMQServerControlImpl method onNotification.
@Override
public void onNotification(org.apache.activemq.artemis.core.server.management.Notification notification) {
if (!(notification.getType() instanceof CoreNotificationType))
return;
CoreNotificationType type = (CoreNotificationType) notification.getType();
TypedProperties prop = notification.getProperties();
this.broadcaster.sendNotification(new Notification(type.toString(), this, notifSeq.incrementAndGet(), notification.toString()));
}
use of org.apache.activemq.artemis.utils.collections.TypedProperties in project activemq-artemis by apache.
the class TypedPropertiesTest method testTypedProperties.
@Test
public void testTypedProperties() throws Exception {
SimpleString longKey = RandomUtil.randomSimpleString();
long longValue = RandomUtil.randomLong();
SimpleString simpleStringKey = RandomUtil.randomSimpleString();
SimpleString simpleStringValue = RandomUtil.randomSimpleString();
TypedProperties otherProps = new TypedProperties();
otherProps.putLongProperty(longKey, longValue);
otherProps.putSimpleStringProperty(simpleStringKey, simpleStringValue);
props.putTypedProperties(otherProps);
long ll = props.getLongProperty(longKey);
Assert.assertEquals(longValue, ll);
SimpleString ss = props.getSimpleStringProperty(simpleStringKey);
Assert.assertEquals(simpleStringValue, ss);
}
use of org.apache.activemq.artemis.utils.collections.TypedProperties in project activemq-artemis by apache.
the class TypedPropertiesTest method testEncodeDecodeEmpty.
@Test
public void testEncodeDecodeEmpty() throws Exception {
TypedProperties emptyProps = new TypedProperties();
ActiveMQBuffer buffer = ActiveMQBuffers.dynamicBuffer(1024);
emptyProps.encode(buffer.byteBuf());
Assert.assertEquals(props.getEncodeSize(), buffer.writerIndex());
TypedProperties decodedProps = new TypedProperties();
decodedProps.decode(buffer.byteBuf());
TypedPropertiesTest.assertEqualsTypeProperties(emptyProps, decodedProps);
}
use of org.apache.activemq.artemis.utils.collections.TypedProperties in project activemq-artemis by apache.
the class TypedPropertiesTest method testCopyContructor.
@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));
}
use of org.apache.activemq.artemis.utils.collections.TypedProperties in project activemq-artemis by apache.
the class TypedPropertiesTest method testEmptyTypedProperties.
@Test
public void testEmptyTypedProperties() throws Exception {
Assert.assertEquals(0, props.getPropertyNames().size());
props.putTypedProperties(new TypedProperties());
Assert.assertEquals(0, props.getPropertyNames().size());
}
Aggregations