List of usage examples for java.util.function Predicate toString
public String toString()
From source file:ddf.common.test.ServiceManager.java
public void waitForFeature(String featureName, Predicate<FeatureState> predicate) throws Exception { boolean ready = false; long timeoutLimit = System.currentTimeMillis() + REQUIRED_BUNDLES_TIMEOUT; FeaturesService featuresService = getFeaturesService(); while (!ready) { if (featuresService != null) { Feature feature = featuresService.getFeature(featureName); FeatureState state = featuresService.getState(feature.getName() + "/" + feature.getVersion()); if (state == null) { LOGGER.warn("No Feature found for featureName: {}", featureName); return; } else if (predicate.test(state)) { ready = true;/*from w ww . j a v a 2 s . co m*/ } } if (!ready) { if (System.currentTimeMillis() > timeoutLimit) { printInactiveBundles(); fail(String.format( "Feature did not change to State [" + predicate.toString() + "] within %d minutes.", TimeUnit.MILLISECONDS.toMinutes(REQUIRED_BUNDLES_TIMEOUT))); } LOGGER.info("Feature [{}] not [{}], sleeping...", featureName, predicate.toString()); Thread.sleep(1000); } } }