@Override public void processTuple(T tuple) { HTable table = store.getTable(); Put put = operationPut(tuple); try { table.put(put); } catch (RetriesExhaustedWithDetailsException e) { logger.error("Could not output tuple", e); DTThrowable.rethrow(e); } catch (InterruptedIOException e) { logger.error("Could not output tuple", e); DTThrowable.rethrow(e); } }
private void populateFile(String fileName, String contents) { File testFile = new File(testMeta.getDir() + "/" + fileName); try { testFile.createNewFile(); } catch (IOException ex) { DTThrowable.rethrow(ex); } FileWriter fileWriter; try { fileWriter = new FileWriter(testFile); fileWriter.write(contents); fileWriter.close(); } catch (IOException ex) { DTThrowable.rethrow(ex); } }
@SuppressWarnings("deprecation") public static void checkOutput(int fileCount, String baseFilePath, String expectedOutput) { if (fileCount >= 0) { baseFilePath += "." + fileCount; } File file = new File(baseFilePath); String fileContents = null; try { fileContents = FileUtils.readFileToString(file); } catch (IOException ex) { DTThrowable.rethrow(ex); } Assert.assertEquals( "Single file " + fileCount + " output contents", expectedOutput, fileContents); }