()
| 107 | } |
| 108 | |
| 109 | @Test |
| 110 | public void firstTest() throws Exception { |
| 111 | String[] script = { |
| 112 | "#!/usr/bin/python", |
| 113 | "from org.apache.pig.scripting import *", |
| 114 | "Pig.fs(\"rmr simple_out\")", |
| 115 | "input = 'simple_table'", |
| 116 | "output = 'simple_out'", |
| 117 | "P = Pig.compile(\"\"\"a = load '$input';store a into '$output';\"\"\")", |
| 118 | "Q = P.bind({'input':input, 'output':output})", |
| 119 | "stats = Q.runSingle()", |
| 120 | "if stats.isSuccessful():", |
| 121 | "\tprint 'success!'", |
| 122 | "else:", |
| 123 | "\traise 'failed'" |
| 124 | }; |
| 125 | String[] input = { |
| 126 | "1\t3", |
| 127 | "2\t4", |
| 128 | "3\t5" |
| 129 | }; |
| 130 | |
| 131 | Util.deleteFile(cluster, "simple_table"); |
| 132 | Util.createInputFile(cluster, "simple_table", input); |
| 133 | |
| 134 | PigStats stats = runSimpleScript("firstTest", script); |
| 135 | |
| 136 | assertEquals(1, stats.getNumberJobs()); |
| 137 | String name = stats.getOutputNames().get(0); |
| 138 | assertEquals("simple_out", name); |
| 139 | assertEquals(12, stats.getBytesWritten()); |
| 140 | assertEquals(3, stats.getRecordWritten()); |
| 141 | } |
| 142 | |
| 143 | @Test |
| 144 | public void secondTest() throws Exception { |
nothing calls this directly
no test coverage detected