()
| 156 | |
| 157 | |
| 158 | @Test |
| 159 | public void testParseInputScript() throws Exception { |
| 160 | File input = Util.createInputFile("tmp", "", |
| 161 | new String[]{"{(1,1.0)}\ttestinputstring1", |
| 162 | "{(2,2.0)}\ttestinputstring1", |
| 163 | "{(3,3.0)}\ttestinputstring1", |
| 164 | "{(4,4.0)}\ttestinputstring1"} |
| 165 | ); |
| 166 | File out = new File(System.getProperty("java.io.tmpdir")+"/testParseInputScriptOut"); |
| 167 | File scriptFile = Util.createInputFile("pigScript", "", |
| 168 | new String[]{"A = load '"+input.getAbsolutePath()+"' as (a:{(x:chararray, y:float)}, b:chararray);", |
| 169 | "B = foreach A generate\n" + |
| 170 | " b,\n" + |
| 171 | " (bag{tuple(long)}) a.x as ax:{(x:long)};", |
| 172 | "store B into '"+out.getAbsolutePath()+"';"} |
| 173 | ); |
| 174 | |
| 175 | Main.run(new String[]{"-x", "local", scriptFile.getAbsolutePath()}, null); |
| 176 | BufferedReader file = new BufferedReader(new FileReader(new File(out.getAbsolutePath()+"/part-m-00000"))); |
| 177 | String line; |
| 178 | int count = 0; |
| 179 | while(( line = file.readLine()) != null) { |
| 180 | count++; |
| 181 | } |
| 182 | assertEquals(4,count); |
| 183 | Util.deleteDirectory(new File(out.getAbsolutePath())); |
| 184 | assertTrue(!new File(out.getAbsolutePath()).exists()); |
| 185 | } |
| 186 | |
| 187 | public static class TestNotificationListener2 extends TestNotificationListener { |
| 188 | protected boolean hadArgs = false; |
nothing calls this directly
no test coverage detected