MCPcopy Create free account
hub / github.com/apache/pig / testValidationFailure

Method testValidationFailure

test/org/apache/pig/test/TestStore.java:149–173  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 8

createInputFileMethod · 0.95
buildLpMethod · 0.95
deleteFileMethod · 0.95
getPigContextMethod · 0.45
getCauseMethod · 0.45
assertEqualsMethod · 0.45
getErrorCodeMethod · 0.45
getErrorSourceMethod · 0.45

Tested by

no test coverage detected