use of org.apache.geode.internal.admin.remote.DistributionLocatorId in project geode by apache.
the class WANTestBase method checkAllSiteMetaDataFor3Sites.
public static Long checkAllSiteMetaDataFor3Sites(final Map<Integer, Set<String>> dsVsPort) {
Awaitility.await().atMost(50, TimeUnit.SECONDS).until(() -> assertEquals("System is not initialized", true, (getSystemStatic() != null)));
List<Locator> locatorsConfigured = Locator.getLocators();
Locator locator = locatorsConfigured.get(0);
LocatorMembershipListener listener = ((InternalLocator) locator).getlocatorMembershipListener();
if (listener == null) {
fail("No locator membership listener available. WAN is likely not enabled. Is this test in the WAN project?");
}
final Map<Integer, Set<DistributionLocatorId>> allSiteMetaData = listener.getAllLocatorsInfo();
System.out.println("allSiteMetaData : " + allSiteMetaData);
Awaitility.await().atMost(300, TimeUnit.SECONDS).until(() -> {
assertEquals(true, (dsVsPort.size() == allSiteMetaData.size()));
boolean completeFlag = true;
for (Map.Entry<Integer, Set<String>> entry : dsVsPort.entrySet()) {
Set<DistributionLocatorId> locators = allSiteMetaData.get(entry.getKey());
for (String locatorInMetaData : entry.getValue()) {
DistributionLocatorId locatorId = new DistributionLocatorId(locatorInMetaData);
if (!locators.contains(locatorId)) {
completeFlag = false;
break;
}
}
if (false == completeFlag) {
break;
}
}
assertEquals("Expected site Metadata: " + dsVsPort + " but actual meta data: " + allSiteMetaData, true, completeFlag);
});
return System.currentTimeMillis();
}
Aggregations