@Test
	public void testKillAllContainers() throws Exception {
			for (int i = 0; i < 2; i++) {
				startContainer();
			}

		SpringXDTemplate template = ensureTemplate();
		logger.info("Waiting for containers...");
		waitForContainers();
		logger.info("Containers running");

		String streamName = testName.getMethodName() + "-ticktock";
		template.streamOperations().createStream(streamName, "time|log", true);
		verifyStreamDeployed(streamName);

		// verify modules
		retrieveModuleRuntimeContainers(streamName);

		// kill all the containers
		shutdownContainers();
		Map<Long, String> map = waitForContainers();
		assertTrue(map.isEmpty());

		startContainer();
		Map<Long, String> mapPidUuid = waitForContainers();
		assertEquals(1, mapPidUuid.size());
		String containerUuid = mapPidUuid.values().iterator().next();

		verifyStreamDeployed(streamName);

		ModuleRuntimeContainers moduleContainers = retrieveModuleRuntimeContainers(streamName);
		assertTrue(moduleContainers.getSourceContainers().contains(containerUuid));
		assertTrue(moduleContainers.getSinkContainers().contains(containerUuid));
	}
Start two containers and deploy a simple two module stream.
Shut down all of the containers. Start a new container and
assert that the stream modules are deployed to the new container.

@throws Exception
spring-xd-distributed-test/src/test/java/org/springframework/xd/distributed/test/StreamDeploymentTests.java