assertTrue(caught);
}
@Test
public void testStopOnFailure() throws Throwable {
PigServer server = new PigServer(ExecType.MAPREDUCE, cluster.getProperties());
PigContext context = server.getPigContext();
context.getProperties().setProperty("stop.on.failure", ""+true);
String strCmd =
"rmf bar;\n"
+"rmf foo;\n"
+"rmf baz;\n"
+"copyFromLocal test/org/apache/pig/test/data/passwd pre;\n"
+"A = load '"
+ Util.generateURI("file:test/org/apache/pig/test/data/passwd", context) + "';\n"
+"B = stream A through `false`;\n"
+"store B into 'bar' using BinStorage();\n"
+"A = load 'bar';\n"
+"store A into 'foo';\n"
+"cp pre done;\n";
ByteArrayInputStream cmd = new ByteArrayInputStream(strCmd.getBytes());
InputStreamReader reader = new InputStreamReader(cmd);
Grunt grunt = new Grunt(new BufferedReader(reader), context);
boolean caught = false;
try {
grunt.exec();
} catch (PigException e) {
caught = true;
assertTrue(e.getErrorCode() == 6017);
}
assertFalse(server.existsFile("done"));
assertTrue(caught);
}