@Test
	public void testCreateUndeployAndDeleteOfStream() throws Exception {
		mockMvc.perform(
				post("/streams/definitions").param("name", "mystream").param("definition", "time | log").param(
						"deploy", "true")
						.accept(MediaType.APPLICATION_JSON)).andExpect(status().isCreated());

		StreamDefinition definition = streamDefinitionRepository.findOne("mystream");
		assertNotNull(definition);
		assertNotNull(streamRepository.findOne("mystream"));

		mockMvc.perform(delete("/streams/deployments/mystream").accept(MediaType.APPLICATION_JSON)).andExpect(
				status().isOk());

		StreamDefinition undeployedDefinition = streamDefinitionRepository.findOne("mystream");
		assertNotNull(undeployedDefinition);
		assertNull(streamRepository.findOne("mystream"));

		mockMvc.perform(delete("/streams/definitions/mystream").accept(MediaType.APPLICATION_JSON)).andExpect(
				status().isOk());

		assertNull(streamDefinitionRepository.findOne("mystream"));
		assertNull(streamRepository.findOne("mystream"));

		mockMvc.perform(delete("/streams/definitions/mystream").accept(MediaType.APPLICATION_JSON)).andExpect(
				status().isNotFound());
	}
Tests REST compliance of streams-related end-points. Unlike {@link StreamsControllerIntegrationTests}, instead of
mocks, this class provides access to actual repositories: {@link ZooKeeperStreamRepository} and
{@link ZooKeeperStreamDefinitionRepository}.

@author Gunnar Hillert
@author Glenn Renfro
@author David Turanski
@author Florent Biville
spring-xd-dirt/src/test/java/org/springframework/xd/dirt/rest/StreamsControllerIntegrationWithRepositoryTests.java