HadoopWorkflowUtils { public static void unregisterSpringBatchJob(ApplicationContext context, String springBatchJobName) { JobRegistry jobRegistry = context.getBean("jobRegistry", JobRegistry.class); jobRegistry.unregister(springBatchJobName); logger.info("unregister spring batch job:" + springBatchJobName); }  static WorkflowArtifacts getWorkflowArtifacts(File workflowArtifactFolder); static String[] getWorkflowDescriptor(File workflowArtifactFolder); static boolean isValidWorkflow(List<FileInfo> files); static URL[] getWorkflowLibararies(File workflowArtifactFolder); static ClassLoader getWorkflowClassLoader(File workflowArtifactFolder); static boolean isSpringBatchJob(ApplicationContext context, WorkflowArtifacts artifacts); static void createAndRegisterSpringBatchJob(ApplicationContext context, final WorkflowArtifacts artifacts); static String generateSpringBatchJobName(final WorkflowArtifacts artifacts); static void unregisterSpringBatchJob(ApplicationContext context, String springBatchJobName); static String getWorkflowDescriptor(final WorkflowArtifacts artifacts); static void processAndRegisterWorkflow(File parentFolder, ApplicationContext context); static WorkflowArtifacts processUploadedFile(final File parentFolder); static void registerSpringBatchJob(WorkflowArtifacts artifacts, ApplicationContext context); static String fileURLPrefix; static String springHadoopJobPrefix; static String springHadoopTaskName; }
@Test public void testUnregisterSpringBatchJob() throws SpringHadoopAdminWorkflowException { File folder = new File( "src/test/resources/org/springframework/data/hadoop/admin/util/testWithoutSpringBatchJob"); WorkflowArtifacts artifacts = HadoopWorkflowUtils.getWorkflowArtifacts(folder); 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", }); HadoopWorkflowUtils.createAndRegisterSpringBatchJob(context, artifacts); JobRegistry jobRegistry = context.getBean("jobRegistry", JobRegistry.class); HadoopWorkflowUtils.unregisterSpringBatchJob(context, "spring-hadoop-job-context.xml"); Collection<String> jobNames = jobRegistry.getJobNames(); Assert.assertEquals(0, jobNames.size()); }