@Test
	@Timed(millis=70000)
	public void testAppSubmission() throws Exception {
		ApplicationInfo info = submitApplicationAndWait();
		assertThat(info, notNullValue());
		assertThat(info.getYarnApplicationState(), notNullValue());
		assertThat(info.getApplicationId(), notNullValue());
		assertThat(info.getYarnApplicationState(), is(YarnApplicationState.FINISHED));

		List<Resource> resources = ContainerLogUtils.queryContainerLogs(getYarnCluster(), info.getApplicationId());

		// only appmaster, 2 log files
		assertThat(resources, notNullValue());
		assertThat(resources.size(), is(2));

		for (Resource res : resources) {
			File file = res.getFile();
			if (file.getName().endsWith("stdout")) {
				// there has to be some content in stdout file
				assertThat(file.length(), greaterThan(0l));
				if (file.getName().equals("Appmaster.stdout")) {
					Scanner scanner = new Scanner(file);
					String content = scanner.useDelimiter("\\A").next();
					scanner.close();
					// this is what appmaster will log in stdout
					assertThat(content, containsString("Hello1"));
				}
			} else if (file.getName().endsWith("stderr")) {
				String content = "";
				if (file.length() > 0) {
					Scanner scanner = new Scanner(file);
					content = scanner.useDelimiter("\\A").next();
					scanner.close();
				}
				// can't have anything in stderr files
				assertThat("stderr file is not empty: " + content, file.length(), is(0l));
			}
		}
	}
Tests for batch amjob example.

@author Janne Valkealahti
yarn/yarn/batch-amjob/src/test/java/org/springframework/yarn/examples/BatchAmjobTests.java