()
| 147 | } |
| 148 | |
| 149 | @Test |
| 150 | public void testValidationFailure() throws Exception{ |
| 151 | String input[] = new String[] { "some data" }; |
| 152 | String outputFileName = "test-output.txt"; |
| 153 | boolean sawException = false; |
| 154 | try { |
| 155 | Util.createInputFile(ps.getPigContext(),outputFileName, input); |
| 156 | String query = "a = load '" + inputFileName + "' as (c:chararray, " + |
| 157 | "i:int,d:double);" + |
| 158 | "store a into '" + outputFileName + "' using PigStorage();"; |
| 159 | Util.buildLp( ps, query ); |
| 160 | } catch (InvocationTargetException e){ |
| 161 | FrontendException pve = (FrontendException)e.getCause(); |
| 162 | pve.printStackTrace(); |
| 163 | // Since output file is present, validation should fail |
| 164 | // and throw this exception |
| 165 | assertEquals(6000,pve.getErrorCode()); |
| 166 | assertEquals(PigException.REMOTE_ENVIRONMENT, pve.getErrorSource()); |
| 167 | assertTrue(pve.getCause() instanceof IOException); |
| 168 | sawException = true; |
| 169 | } finally { |
| 170 | assertTrue(sawException); |
| 171 | Util.deleteFile(ps.getPigContext(), outputFileName); |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | @Test |
| 176 | public void testStore() throws Exception { |
nothing calls this directly
no test coverage detected