()
| 113 | } |
| 114 | |
| 115 | @Test |
| 116 | public void testCleanupOnFailure() throws Exception { |
| 117 | String cleanupSuccessFile = outputFileName + "_cleanupOnFailure_succeeded"; |
| 118 | String cleanupFailFile = outputFileName + "_cleanupOnFailure_failed"; |
| 119 | String[] inputData = new String[]{"hello\tworld", "bye\tworld"}; |
| 120 | |
| 121 | String script = "a = load '"+ inputFileName + "';" + |
| 122 | "store a into '" + outputFileName + "' using " + |
| 123 | DUMMY_STORE_CLASS_NAME + "('true');"; |
| 124 | |
| 125 | Util.deleteFile(ps.getPigContext(), TESTDIR); |
| 126 | ps.setBatchOn(); |
| 127 | Util.createInputFile(ps.getPigContext(), |
| 128 | inputFileName, inputData); |
| 129 | Util.registerMultiLineQuery(ps, script); |
| 130 | ps.executeBatch(); |
| 131 | assertEquals( |
| 132 | "Checking if file indicating that cleanupOnFailure failed " + |
| 133 | " does not exists in " + mode + " mode", false, |
| 134 | Util.exists(ps.getPigContext(), cleanupFailFile)); |
| 135 | assertEquals( |
| 136 | "Checking if file indicating that cleanupOnFailure was " + |
| 137 | "successfully called exists in " + mode + " mode", true, |
| 138 | Util.exists(ps.getPigContext(), cleanupSuccessFile)); |
| 139 | } |
| 140 | |
| 141 | @Test |
| 142 | public void testCleanupOnFailureMultiStore() throws Exception { |
nothing calls this directly
no test coverage detected