public boolean setupDataFiles(String host, String sourceDir, String fileName, String data) {
		Assert.hasText(host, "host must not be empty nor null");
		Assert.hasText(fileName, "fileName must not be empty nor null");
		Assert.notNull(sourceDir, "sourceDir must not be null");
		Assert.notNull(data, "data must not be null");
		boolean result = false;
		if (xdEnvironment.isOnEc2()) {
			result = StreamUtils.createDataFileOnRemote(xdEnvironment.getPrivateKey(), host, sourceDir, fileName, data,
					WAIT_TIME);
		}
		else {
			try {
				File dirs = new File(sourceDir);
				dirs.mkdirs();
				dirs.deleteOnExit();
				File file = new File(sourceDir + "/" + fileName);
				file.deleteOnExit();
				file.createNewFile();
				FileCopyUtils.copy(data.getBytes(), file);
				result = file.exists();
			}
			catch (IOException ioe) {
				throw new IllegalStateException(ioe.getMessage(), ioe);
			}
		}
		return result;
	}
Creates a file in a directory for file based tests.

@param host The host machine that the data will be written
@param sourceDir The directory to place the file
@param fileName The name of the file where the data will be written
@param data The data to be written to the file
@result returns true if file was created else false
spring-xd-integration-test/src/test/java/org/springframework/xd/integration/test/AbstractIntegrationTest.java