Creates a temp file and populates it with the specified mock data. @param alias alias that the temp file is for @param mockData data that is being mocked for the alias @return path to the temp file
(String alias, String[] mockData)
| 308 | * @return path to the temp file |
| 309 | */ |
| 310 | private String makeMockTempFile(String alias, String[] mockData) throws IOException { |
| 311 | //The FileLocalizer uses a random variable, but that can have collisions. By using the current time, thread, |
| 312 | //and alias we should be able to guaratee a unique file |
| 313 | String uniqueSuffix = alias + "." + System.currentTimeMillis() + "." + Thread.currentThread().getId(); |
| 314 | //PigServer/Cluster is not initialized yet. Let's initialize it. |
| 315 | if (getPigServer() == null) { |
| 316 | getCluster(); |
| 317 | } |
| 318 | String path = FileLocalizer.getTemporaryPath(getPigServer().getPigContext(), uniqueSuffix).toString(); |
| 319 | getCluster().copyFromLocalFile(mockData, path, true); |
| 320 | return path; |
| 321 | } |
| 322 | |
| 323 | private String getActualResults(String alias, boolean ignoreOrder) throws IOException, ParseException { |
| 324 | //Tuples are sortable, but we should sort it as Strings for convenience when comparing to expected data |
no test coverage detected