protected void verifyJobState(String jobName, DeploymentUnitStatus.State expected)
			throws InterruptedException {
		long expiry = System.currentTimeMillis() + STATE_TRANSITION_TIMEOUT;
		DeploymentUnitStatus.State state = null;

		while (state != expected && System.currentTimeMillis() < expiry) {
			Thread.sleep(500);
			state = getJobState(jobName);
		}

		logger.debug("Job '{}' state: {}", jobName, state);
		assertEquals("Failed assertion for job " + jobName, expected, state);
	}
Block the executing thread until either the job state
matches the indicated state or 30 seconds have elapsed.

@param jobName name of job to verify
@param expected   the expected state of the job
@throws InterruptedException
@see #STATE_TRANSITION_TIMEOUT
spring-xd-distributed-test/src/test/java/org/springframework/xd/distributed/test/AbstractDistributedTests.java