@Test public void testWorkflow() throws Exception { GenericXmlApplicationContext ctx = new GenericXmlApplicationContext("/org/springframework/data/hadoop/batch/in-do-out.xml"); ctx.registerShutdownHook(); FileSystem fs = FileSystem.get(ctx.getBean(Configuration.class)); System.out.println("FS is " + fs.getClass().getName()); HdfsResourceLoader hrl = ctx.getBean(HdfsResourceLoader.class); Resource resource = hrl.getResource("/ide-test/output/word/"); assertTrue(ctx.isPrototype("script-tasklet")); fs.delete(new Path(resource.getURI().toString()), true); JobsTrigger.startJobs(ctx); Path p = new Path("/ide-test/output/word/"); Job job = (Job) ctx.getBean("mr-job"); Configuration c = job.getConfiguration(); FileSystem fs2 = p.getFileSystem(c); System.out.println("FS is " + fs2.getClass().getName()); fs2.exists(p); ctx.close(); }
@Test public void testWorkflowNS() throws Exception { GenericXmlApplicationContext ctx = new GenericXmlApplicationContext("/org/springframework/data/hadoop/batch/in-do-out-ns.xml"); ctx.registerShutdownHook(); FileSystem fs = FileSystem.get(ctx.getBean(Configuration.class)); fs.delete(new Path("/ide-test/output/word/"), true); assertTrue(ctx.isPrototype("hadoop-tasklet")); JobsTrigger.startJobs(ctx); ctx.close(); }