HadoopWorkflowLaunchRequestAdapter implements ApplicationContextAware { @ServiceActivator public void handleUploadedFile(final File workflowFile) { logger.info("upload file:" + workflowFile.getAbsolutePath()); File parentFolder = workflowFile.getParentFile(); HadoopWorkflowUtils.processAndRegisterWorkflow(parentFolder, context); }  @Override void setApplicationContext(ApplicationContext applicationContext); @ServiceActivator void handleUploadedFile(final File workflowFile);  }
@Test public void testHandleUploadedFile() { ApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "classpath:org/springframework/data/hadoop/admin/env-context.xml", "classpath:org/springframework/data/hadoop/admin/data-source-context.xml", "classpath:org/springframework/data/hadoop/admin/execution-context.xml", }); launchRequest.setApplicationContext(context); File descriptor = new File("src/test/resources/org/springframework/data/hadoop/admin/workflow/context.xml"); launchRequest.handleUploadedFile(descriptor); JobRegistry jobRegistry = context.getBean("jobRegistry", JobRegistry.class); Collection<String> jobNames = jobRegistry.getJobNames(); Assert.assertEquals(1, jobNames.size()); Assert.assertTrue(jobNames.contains("wordcount-withscript-job")); }