(String[] inputFileNames,
String loadLocationString)
| 260 | } |
| 261 | |
| 262 | @SuppressWarnings("unchecked") |
| 263 | private void testLoadingMultipleFiles(String[] inputFileNames, |
| 264 | String loadLocationString) throws IOException, ParserException { |
| 265 | |
| 266 | String[][] inputStrings = new String[][] { |
| 267 | new String[] { "hello\tworld"}, |
| 268 | new String[] { "bye\tnow"}, |
| 269 | new String[] { "all\tgood"} |
| 270 | }; |
| 271 | List<Tuple> expected = Arrays.asList(new Tuple[] { |
| 272 | (Tuple) Util.getPigConstant("('hello', 'world')"), |
| 273 | (Tuple) Util.getPigConstant("('bye', 'now')"), |
| 274 | (Tuple) Util.getPigConstant("('all', 'good')")}); |
| 275 | |
| 276 | List<Tuple> expectedBasedOnNumberOfInputs = new ArrayList<Tuple>(); |
| 277 | for(int i = 0; i < inputFileNames.length; i++) { |
| 278 | Util.createInputFile(pc, inputFileNames[i], inputStrings[i]); |
| 279 | expectedBasedOnNumberOfInputs.add(expected.get(i)); |
| 280 | } |
| 281 | try { |
| 282 | servers[0].registerQuery(" a = load '" + loadLocationString + "' as " + |
| 283 | "(s1:chararray, s2:chararray);"); |
| 284 | Iterator<Tuple> it = servers[0].openIterator("a"); |
| 285 | |
| 286 | List<Tuple> actual = new ArrayList<Tuple>(); |
| 287 | while(it.hasNext()) { |
| 288 | actual.add(it.next()); |
| 289 | } |
| 290 | Collections.sort(expectedBasedOnNumberOfInputs); |
| 291 | Collections.sort(actual); |
| 292 | assertEquals(expectedBasedOnNumberOfInputs, actual); |
| 293 | } finally { |
| 294 | for(int i = 0; i < inputFileNames.length; i++) { |
| 295 | Util.deleteFile(pc, inputFileNames[i]); |
| 296 | } |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | private void checkLoadPath(String orig, String expected) throws Exception { |
| 301 | checkLoadPath(orig, expected, false); |
no test coverage detected