public void appendDataToSourceTestFile(String sourceDir, String fileName, String dataToAppend) {
		Assert.hasText(fileName, "fileName must not be empty nor null");
		Assert.notNull(sourceDir, "sourceDir must not be null");
		Assert.notNull(dataToAppend, "dataToAppend must not be null");

		if (xdEnvironment.isOnEc2()) {
			StreamUtils.appendToRemoteFile(xdEnvironment.getPrivateKey(), containerResolver.getContainerHostForSource(), sourceDir,
					fileName,
					dataToAppend);
		}
		else {
			PrintWriter out = null;
			try {
				out = new PrintWriter(new BufferedWriter(new FileWriter(sourceDir + "/" + fileName, true)));
				out.println(dataToAppend);
				out.close();
			}
			catch (IOException ioe) {
				throw new IllegalStateException(ioe.getMessage(), ioe);
			}
			finally {
				if (out != null) {
					out.close();
				}
			}
		}
	}
Appends data to the specified file wherever the source module for the stream is deployed.

@param sourceDir The location of the file
@param fileName The name of the file to be appended
@param dataToAppend The data to be appended to the file
spring-xd-integration-test/src/test/java/org/springframework/xd/integration/test/AbstractIntegrationTest.java