int nRegs = regList.size();
for(int i=0;i<nRegs;i++) {
/* Pop the stack of lookups */
ServiceRegistrar reg = (ServiceRegistrar)regList.remove(0);
/* Verify 1 service registered with lookup service i */
ServiceMatches matches = reg.lookup(template,
Integer.MAX_VALUE);
if(matches.totalMatches == 0) {
throw new TestException("lookup service "+i
+" -- no matching service found");
} else if(matches.totalMatches != 1) {
throw new TestException("lookup service "+i
+" -- totalMatches ("
+matches.totalMatches
+") != 1");
}//endif
/* Verify that the given attributes were propagated */
Entry[] lookupAttrs = matches.items[0].attributeSets;
logger.log(Level.FINE, "lookup service "+i
+" -- comparing attributes");
if(!AttributesUtil.compareAttributeSets(attrs,
lookupAttrs,
Level.OFF))
{
logger.log(Level.FINE,
" -- NO MATCH");
regList.add(reg);// push it back on the stack
} else {
logger.log(Level.FINE,
" -- attributes MATCH");
}//endif
}//end loop
if(regList.size() == 0) break;
DiscoveryServiceUtil.delayMS(1000);
deltaT = System.currentTimeMillis() - T0;
}//end loop
/* If propagation failed, display expected & actual attributes */
if(regList.size() > 0) {
String retStr = "attributes not propagated successfully "
+"on "+regList.size()+" lookup service(s)";
logger.log(Level.FINE, retStr);
AttributesUtil.displayAttributeSet(attrs,
"expectedAttrs",
Level.FINE);
for(int i=0;i<regList.size();i++) {
ServiceRegistrar reg = (ServiceRegistrar)regList.get(i);
ServiceMatches matches = reg.lookup(template,
Integer.MAX_VALUE);
if(matches.totalMatches != 1) {
logger.log(Level.FINE,
"lookup service "+i+" -- totalMatches "
+"invalid ("+matches.totalMatches+") ... "