public static boolean waitForMetric(String name, URL adminServer, int waitTime) {
		Assert.hasText(name, "name must not be empty nor null");
		Assert.notNull(adminServer, "The admin server must be specified.");

		SpringXDTemplate xdTemplate = createSpringXDTemplate(adminServer);
		boolean result = isMetricPresent(xdTemplate, name);
		long timeout = System.currentTimeMillis() + waitTime;
		while (!result && System.currentTimeMillis() < timeout) {
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				Thread.currentThread().interrupt();
				throw new IllegalStateException(e.getMessage(), e);
			}
			result = isMetricPresent(xdTemplate, name);
		}
		return result;
	}
Waits up to the wait time for a metric to be created.

@param name        The name of the metric to be evaluated.
@param adminServer The admin server URL that will be queried.
@param waitTime    the amount of time in millis to wait.
@return true if the metric is created else false.
spring-xd-integration-test/src/main/java/org/springframework/xd/integration/util/StreamUtils.java