Search in sources :

Example 16 with DiscoveryEvent

use of org.apache.activemq.command.DiscoveryEvent in project activemq-artemis by apache.

the class DiscoveryEventTest method createObject.

@Override
public Object createObject() throws Exception {
    DiscoveryEvent info = new DiscoveryEvent();
    populateObject(info);
    return info;
}
Also used : DiscoveryEvent(org.apache.activemq.command.DiscoveryEvent)

Example 17 with DiscoveryEvent

use of org.apache.activemq.command.DiscoveryEvent in project activemq-artemis by apache.

the class DiscoveryTransportNoBrokerTest method testSetDiscoveredBrokerProperties.

public void testSetDiscoveredBrokerProperties() throws Exception {
    final String extraParameterName = "connectionTimeout";
    final String extraParameterValue = "3000";
    final URI uri = new URI("discovery:(multicast://default)?initialReconnectDelay=100&" + DiscoveryListener.DISCOVERED_OPTION_PREFIX + extraParameterName + "=" + extraParameterValue);
    CompositeData compositeData = URISupport.parseComposite(uri);
    StubCompositeTransport compositeTransport = new StubCompositeTransport();
    DiscoveryTransport discoveryTransport = DiscoveryTransportFactory.createTransport(compositeTransport, compositeData, compositeData.getParameters());
    discoveryTransport.onServiceAdd(new DiscoveryEvent("tcp://localhost:61616"));
    assertEquals("expected added URI after discovery event", compositeTransport.getTransportURIs().length, 1);
    URI discoveredServiceURI = compositeTransport.getTransportURIs()[0];
    Map<String, String> parameters = URISupport.parseParameters(discoveredServiceURI);
    assertTrue("unable to add parameter to discovered service", parameters.containsKey(extraParameterName));
    assertEquals("incorrect value for parameter added to discovered service", parameters.get(extraParameterName), extraParameterValue);
}
Also used : CompositeData(org.apache.activemq.util.URISupport.CompositeData) DiscoveryEvent(org.apache.activemq.command.DiscoveryEvent) URI(java.net.URI) StubCompositeTransport(org.apache.activemq.transport.StubCompositeTransport)

Example 18 with DiscoveryEvent

use of org.apache.activemq.command.DiscoveryEvent in project activemq-artemis by apache.

the class DiscoveryEventTest method createObject.

@Override
public Object createObject() throws Exception {
    DiscoveryEvent info = new DiscoveryEvent();
    populateObject(info);
    return info;
}
Also used : DiscoveryEvent(org.apache.activemq.command.DiscoveryEvent)

Example 19 with DiscoveryEvent

use of org.apache.activemq.command.DiscoveryEvent in project activemq-artemis by apache.

the class DiscoveryEventTest method createObject.

@Override
public Object createObject() throws Exception {
    DiscoveryEvent info = new DiscoveryEvent();
    populateObject(info);
    return info;
}
Also used : DiscoveryEvent(org.apache.activemq.command.DiscoveryEvent)

Example 20 with DiscoveryEvent

use of org.apache.activemq.command.DiscoveryEvent in project activemq-artemis by apache.

the class DiscoveryEventTest method populateObject.

@Override
protected void populateObject(Object object) throws Exception {
    super.populateObject(object);
    DiscoveryEvent info = (DiscoveryEvent) object;
    info.setServiceName("ServiceName:1");
    info.setBrokerName("BrokerName:2");
}
Also used : DiscoveryEvent(org.apache.activemq.command.DiscoveryEvent)

Aggregations

DiscoveryEvent (org.apache.activemq.command.DiscoveryEvent)22 URI (java.net.URI)2 StubCompositeTransport (org.apache.activemq.transport.StubCompositeTransport)2 DiscoveryListener (org.apache.activemq.transport.discovery.DiscoveryListener)2 CompositeData (org.apache.activemq.util.URISupport.CompositeData)2 CuratorFramework (org.apache.curator.framework.CuratorFramework)2 FabricDiscoveryAgent (io.fabric8.mq.fabric.discovery.FabricDiscoveryAgent)1 OsgiFabricDiscoveryAgent (io.fabric8.mq.fabric.discovery.OsgiFabricDiscoveryAgent)1 File (java.io.File)1 InputStream (java.io.InputStream)1 Collection (java.util.Collection)1 Properties (java.util.Properties)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 CuratorFrameworkFactory (org.apache.curator.framework.CuratorFrameworkFactory)1 RetryNTimes (org.apache.curator.retry.RetryNTimes)1 Test (org.junit.Test)1