@Test
public void testWritesWithPartition() throws Exception {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"org/springframework/xd/integration/hadoop/config/HdfsOutboundChannelAdapterIntegrationPartitionTests.xml");
MessageChannel channel = context.getBean("hdfsOut", MessageChannel.class);
FileSystem fileSystem = context.getBean("hadoopFs", FileSystem.class);
String path = context.getBean("path", String.class);
String YYYYMM = new SimpleDateFormat("yyyy/MM").format(new Date());
Path basepath = new Path(path + "/testdir2/");
Path filepath0 = new Path(basepath, YYYYMM + "/0_hash/foos_list/testfile-0");
Path filepath1 = new Path(basepath, YYYYMM + "/0_hash/bars_list/testfile-0");
fileSystem.delete(basepath, true);
channel.send(MessageBuilder.withPayload("foo").build());
channel.send(MessageBuilder.withPayload("bar").build());
context.close();
assertTrue(fileSystem.exists(basepath));
assertTrue(fileSystem.exists(filepath0));
assertTrue(fileSystem.exists(filepath1));
BufferedReader reader0 = new BufferedReader(new InputStreamReader(fileSystem.open(filepath0)));