()
| 162 | } |
| 163 | |
| 164 | @Test |
| 165 | public void simpleTest() throws Exception { |
| 166 | PrintWriter w = new PrintWriter(new FileWriter(PIG_FILE)); |
| 167 | w.println("A = load '" + INPUT_FILE + "' as (a0:int, a1:int, a2:int);"); |
| 168 | w.println("B = group A by a0;"); |
| 169 | w.println("C = foreach B generate group, COUNT(A);"); |
| 170 | w.println("store C into '" + OUTPUT_FILE + "';"); |
| 171 | w.close(); |
| 172 | |
| 173 | try { |
| 174 | String[] args = { "-Dstop.on.failure=true", "-Dopt.multiquery=false", "-Dopt.fetch=false", "-Daggregate.warning=false", "-x", execType, PIG_FILE }; |
| 175 | PigStats stats = PigRunner.run(args, new TestNotificationListener(execType)); |
| 176 | |
| 177 | assertTrue(stats.isSuccessful()); |
| 178 | |
| 179 | assertEquals(1, stats.getNumberJobs()); |
| 180 | String name = stats.getOutputNames().get(0); |
| 181 | assertEquals(OUTPUT_FILE, name); |
| 182 | assertEquals(12, stats.getBytesWritten()); |
| 183 | assertEquals(3, stats.getRecordWritten()); |
| 184 | |
| 185 | assertEquals("A,B,C", |
| 186 | ((JobStats)stats.getJobGraph().getSinks().get(0)).getAlias()); |
| 187 | |
| 188 | Configuration conf = ConfigurationUtil.toConfiguration(stats.getPigProperties()); |
| 189 | assertTrue(conf.getBoolean("stop.on.failure", false)); |
| 190 | assertTrue(!conf.getBoolean("aggregate.warning", true)); |
| 191 | assertTrue(!conf.getBoolean(PigConfiguration.PIG_OPT_MULTIQUERY, true)); |
| 192 | assertTrue(!conf.getBoolean("opt.fetch", true)); |
| 193 | } finally { |
| 194 | new File(PIG_FILE).delete(); |
| 195 | Util.deleteFile(cluster, OUTPUT_FILE); |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | @Test |
| 200 | public void simpleTest2() throws Exception { |
nothing calls this directly
no test coverage detected