verfication of discovered. params for static discovery

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1097793 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2011-04-29 12:40:27 +00:00
parent 12838c2811
commit 4fb190e444
1 changed files with 20 additions and 1 deletions

View File

@ -136,7 +136,26 @@ public class DiscoveryTransportNoBrokerTest extends CombinationTestSupport {
assertTrue("unable to add parameter to discovered service", parameters.containsKey(extraParameterName));
assertEquals("incorrect value for parameter added to discovered service", parameters.get(extraParameterName), extraParameterValue);
}
public void testSetDiscoveredStaticBrokerProperties() throws Exception {
final String extraParameterName = "connectionTimeout";
final String extraParameterValue = "3000";
final URI uri = new URI("discovery:(static:tcp://localhost:61616)?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.start();
assertEquals("expected added URI after discovery event", 1, compositeTransport.getTransportURIs().length);
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);
}
public void testAddRemoveDiscoveredBroker() throws Exception {
final URI uri = new URI("discovery:(multicast://default)?initialReconnectDelay=100&connectionTimeout=3000");
CompositeData compositeData = URISupport.parseComposite(uri);