LoadIO { @VisibleForTesting String filename(Args args) { StringBuilder sb = prefix(args); sb.append(DATE_FORMAT_SAVE.format(load.getTimestampIteration())).append(".csv"); return DIRECTORY_NAME + "/" + sb.toString(); } LoadIO(Load load); String save(Args args); void load(Args args, String input); String showSavedFiles(Args args); static final String NO_SAVED_FILE; }
@Test public void testFilename() throws Exception { String[] strings; Args args; Load load = new Load(new LevelClass(TableName.class), null); LoadIO loadIO = new LoadIO(load); strings = new String[]{"zookeeper", "table"}; args = new StatArgs(strings); assertEquals(LoadIO.DIRECTORY_NAME + "/zookeeper_table_19700101090000000.csv", loadIO.filename(args)); strings = new String[]{"zookeeper"}; args = new StatArgs(strings); assertEquals(LoadIO.DIRECTORY_NAME + "/zookeeper__19700101090000000.csv", loadIO.filename(args)); strings = new String[]{"zookeeper1:2180,zookeeper2:2180"}; args = new StatArgs(strings); assertEquals(LoadIO.DIRECTORY_NAME + "/zookeeper1_2180_zookeeper2_2180__19700101090000000.csv", loadIO.filename(args)); }