Author: ron.sigal(a)jboss.com
Date: 2008-05-01 02:02:03 -0400 (Thu, 01 May 2008)
New Revision: 4104
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/registry/NetworkRegistryTestCase.java
Log:
JBREM-930: Ignores extraneous servers.
Modified:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/registry/NetworkRegistryTestCase.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/registry/NetworkRegistryTestCase.java 2008-05-01
03:09:40 UTC (rev 4103)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/detection/registry/NetworkRegistryTestCase.java 2008-05-01
06:02:03 UTC (rev 4104)
@@ -52,6 +52,8 @@
private String subSystem = null;
private int numOfAdded = 0;
private int numOfUpdated = 0;
+ private InvokerLocator locator1;
+ private InvokerLocator locator2;
public void testRegistration() throws Exception
{
@@ -84,7 +86,8 @@
int port = TestUtil.getRandomPort();
String host = InetAddress.getLocalHost().getHostAddress();
String bindAddr = System.getProperty("jrunit.bind_addr", host);
- InvokerLocator locator1 = new InvokerLocator("socket://" + bindAddr +
":" + port);
+ locator1 = new InvokerLocator("socket://" + bindAddr + ":" +
port);
+ log.info("InvokerLocator1: " + locator1);
Connector connector1 = new Connector(locator1);
ObjectName obj = new
ObjectName("jboss.remoting:type=Connector,transport=" +
locator1.getProtocol());
registerMBean(server1, connector1, obj);
@@ -122,7 +125,8 @@
addNotificationListener(server2, new
ObjectName("remoting:type=NetworkRegistry"), this);
port = TestUtil.getRandomPort();
- InvokerLocator locator2 = new InvokerLocator("socket://" + bindAddr +
":" + port);
+ locator2 = new InvokerLocator("socket://" + bindAddr + ":" +
port);
+ log.info("InvokerLocator2: " + locator2);
Connector connector2 = new Connector(locator2);
ObjectName obj2 = new
ObjectName("jboss.remoting:type=Connector,transport=" +
locator2.getProtocol());
registerMBean(server2, connector2, obj2);
@@ -180,13 +184,25 @@
NetworkNotification netNot = (NetworkNotification) notification;
if(NetworkNotification.SERVER_ADDED.equals(netNot.getType()))
{
- numOfAdded = netNot.getLocator().length;
+ numOfAdded = 0;
+ InvokerLocator[] locators = netNot.getLocator();
+ for (int i = 0; i < locators.length; i++)
+ {
+ if (locators[i].isSameEndpoint(locator1) ||
locators[i].isSameEndpoint(locator2))
+ numOfAdded++;
+ }
log.info("server added. num of locators added = " + numOfAdded);
}
else if(NetworkNotification.SERVER_UPDATED.equals(netNot.getType()))
{
- numOfUpdated = netNot.getLocator().length;
- log.info("server updated. num of locators in update = " +
numOfAdded);
+ numOfUpdated = 0;
+ InvokerLocator[] locators = netNot.getLocator();
+ for (int i = 0; i < locators.length; i++)
+ {
+ if (locators[i].isSameEndpoint(locator1) ||
locators[i].isSameEndpoint(locator2))
+ numOfUpdated++;
+ }
+ log.info("server updated. num of locators in update = " +
numOfUpdated);
}
ServerInvokerMetadata[] serverMetadata = netNot.getServerInvokers();
log.info(netNot.getIdentity());
Show replies by date