Search in sources :

Example 6 with TypedProperties

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()));
}
Also used : TypedProperties(org.apache.activemq.artemis.utils.collections.TypedProperties) CoreNotificationType(org.apache.activemq.artemis.api.core.management.CoreNotificationType) Notification(javax.management.Notification)

Example 7 with TypedProperties

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);
}
Also used : SimpleString(org.apache.activemq.artemis.api.core.SimpleString) TypedProperties(org.apache.activemq.artemis.utils.collections.TypedProperties) Test(org.junit.Test)

Example 8 with TypedProperties

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);
}
Also used : TypedProperties(org.apache.activemq.artemis.utils.collections.TypedProperties) ActiveMQBuffer(org.apache.activemq.artemis.api.core.ActiveMQBuffer) Test(org.junit.Test)

Example 9 with TypedProperties

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));
}
Also used : TypedProperties(org.apache.activemq.artemis.utils.collections.TypedProperties) Test(org.junit.Test)

Example 10 with TypedProperties

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());
}
Also used : TypedProperties(org.apache.activemq.artemis.utils.collections.TypedProperties) Test(org.junit.Test)

Aggregations

TypedProperties (org.apache.activemq.artemis.utils.collections.TypedProperties)43 Notification (org.apache.activemq.artemis.core.server.management.Notification)24 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)23 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)8 Test (org.junit.Test)5 ActiveMQInterruptedException (org.apache.activemq.artemis.api.core.ActiveMQInterruptedException)3 ByteBuf (io.netty.buffer.ByteBuf)2 Channel (io.netty.channel.Channel)2 ServerChannel (io.netty.channel.ServerChannel)2 EpollServerSocketChannel (io.netty.channel.epoll.EpollServerSocketChannel)2 KQueueServerSocketChannel (io.netty.channel.kqueue.KQueueServerSocketChannel)2 LocalServerChannel (io.netty.channel.local.LocalServerChannel)2 NioServerSocketChannel (io.netty.channel.socket.nio.NioServerSocketChannel)2 ActiveMQBuffer (org.apache.activemq.artemis.api.core.ActiveMQBuffer)2 ActiveMQIllegalStateException (org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException)2 ActiveMQNonExistentQueueException (org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException)2 ClusterConnection (org.apache.activemq.artemis.core.server.cluster.ClusterConnection)2 Connection (org.apache.activemq.artemis.spi.core.remoting.Connection)2 ServerBootstrap (io.netty.bootstrap.ServerBootstrap)1 ChannelInitializer (io.netty.channel.ChannelInitializer)1