use of org.codice.ddf.itests.common.csw.CswTestCommons.CSW_FEDERATED_SOURCE_FACTORY_PID in project ddf by codice.
the class TestFanout method startCswSource.
private void startCswSource() throws Exception {
getServiceManager().waitForHttpEndpoint(CSW_PATH + "?_wadl");
getServiceManager().createManagedService(CSW_FEDERATED_SOURCE_FACTORY_PID, getCswSourceProperties(CSW_SOURCE_ID, CSW_PATH.getUrl(), getServiceManager()));
long timeout = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(10);
boolean available = false;
FederatedSource source = null;
while (!available) {
if (source == null) {
source = getServiceManager().getServiceReferences(FederatedSource.class, null).stream().map(getServiceManager()::getService).filter(src -> CSW_SOURCE_ID.equals(src.getId())).findFirst().orElse(null);
} else {
available = source.isAvailable();
}
if (System.currentTimeMillis() > timeout) {
fail("CSW source failed to initialize in time.");
}
Thread.sleep(1000);
}
}
Aggregations