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

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

		// appmaster and 4 containers should
		// make it 10 log files
		assertThat(resources, notNullValue());
		assertThat(resources.size(), is(10));

		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("Container.stdout")) {
					Scanner scanner = new Scanner(file);
					String content = scanner.useDelimiter("\\A").next();
					scanner.close();
					// this is what container will log in stdout
					assertThat(content, containsString("Hello from MultiContextContainer"));
				}
			} else if (file.getName().endsWith("stderr")) {
				// can't have anything in stderr files
				assertThat(file.length(), is(0l));
			}
		}
	}
Base test for multi context example.
Tests for multi context example. We're checking that
application status is ok and log files looks
what is expected.

@author Janne Valkealahti
yarn/yarn/multi-context/src/test/java/org/springframework/yarn/examples/MultiContextTests.java