@Test
	public void testThatJobEventsChannelsAreBound() {

		ModuleDescriptor moduleDescriptor = new ModuleDescriptor.Builder()
				.setModuleDefinition(TestModuleDefinitions.dummy("myjob", ModuleType.job))
				.setGroup("myjob")
				.setIndex(0)
				.build();

		final Module module = new ResourceConfiguredModule(moduleDescriptor,
				new ModuleDeploymentProperties());

		final TestMessageBus messageBus = new TestMessageBus();
		final JobEventsListenerPlugin eventsListenerPlugin = new JobEventsListenerPlugin(messageBus);
		final SubscribableChannel jobExecutionEventsChannel = new PublishSubscribeChannel();
		final SubscribableChannel stepExecutionEventsChannel = new PublishSubscribeChannel();
		final SubscribableChannel chunkEventsChannel = new PublishSubscribeChannel();
		final SubscribableChannel itemEventsChannel = new PublishSubscribeChannel();
		final SubscribableChannel skipEventsChannel = new PublishSubscribeChannel();
		final SubscribableChannel aggregatedEventsChannel = new PublishSubscribeChannel();

		final Module spiedModule = spy(module);

		doReturn(messageBus).when(spiedModule).getComponent(MessageBus.class);
		doReturn(jobExecutionEventsChannel).when(spiedModule).getComponent("xd.job.jobExecutionEvents",
				SubscribableChannel.class);
		doReturn(stepExecutionEventsChannel).when(spiedModule).getComponent("xd.job.stepExecutionEvents",
				SubscribableChannel.class);
		doReturn(chunkEventsChannel).when(spiedModule).getComponent("xd.job.chunkEvents", SubscribableChannel.class);
		doReturn(itemEventsChannel).when(spiedModule).getComponent("xd.job.itemEvents", SubscribableChannel.class);
		doReturn(skipEventsChannel).when(spiedModule).getComponent("xd.job.skipEvents", SubscribableChannel.class);
		doReturn(aggregatedEventsChannel).when(spiedModule).getComponent("xd.job.aggregatedEvents",
				SubscribableChannel.class);

		eventsListenerPlugin.preProcessModule(spiedModule);
		eventsListenerPlugin.postProcessModule(spiedModule);

		assertEquals(Integer.valueOf(0), Integer.valueOf(messageBus.getConsumerNames().size()));
		assertEquals(Integer.valueOf(6), Integer.valueOf(messageBus.getProducerNames().size()));

		assertTrue(messageBus.getProducerNames().contains("tap:job:myjob.job"));
		assertTrue(messageBus.getProducerNames().contains("tap:job:myjob.step"));
		assertTrue(messageBus.getProducerNames().contains("tap:job:myjob.chunk"));
		assertTrue(messageBus.getProducerNames().contains("tap:job:myjob.item"));
		assertTrue(messageBus.getProducerNames().contains("tap:job:myjob.skip"));
		assertTrue(messageBus.getProducerNames().contains("tap:job:myjob"));

	}
@author Michael Minella
@author Gunnar Hillert
@author Gary Russell
@author Ilayaperumal Gopinathan
@author David Turanski
spring-xd-dirt/src/test/java/org/springframework/xd/dirt/plugins/job/JobPluginTests.java