()
| 215 | |
| 216 | // See PIG-1824 |
| 217 | @SuppressWarnings("deprecation") |
| 218 | @Test |
| 219 | public void testScriptFiles() throws Exception { |
| 220 | PigContext pc = new PigContext(Util.getLocalTestMode(), getProperties()); |
| 221 | final int n = pc.scriptFiles.size(); |
| 222 | pc.addScriptFile("test/path-1824"); |
| 223 | assertEquals("test" + File.separator + "path-1824", pc.getScriptFiles().get("test/path-1824").toString()); |
| 224 | assertEquals("script files should not be populated", n, pc.scriptFiles.size()); |
| 225 | |
| 226 | pc.addScriptFile("path-1824", "test/path-1824"); |
| 227 | assertEquals("test" + File.separator + "path-1824", pc.getScriptFiles().get("path-1824").toString()); |
| 228 | assertEquals("script files should not be populated", n, pc.scriptFiles.size()); |
| 229 | |
| 230 | // last add wins when using an alias |
| 231 | pc.addScriptFile("path-1824", "test/some/other/path-1824"); |
| 232 | assertEquals("test" + File.separator + "some" + File.separator + "other" |
| 233 | + File.separator + "path-1824", pc.getScriptFiles().get("path-1824").toString()); |
| 234 | assertEquals("script files should not be populated", n, pc.scriptFiles.size()); |
| 235 | |
| 236 | // clean up |
| 237 | pc.getScriptFiles().remove("path-1824"); |
| 238 | pc.getScriptFiles().remove("test/path-1824"); |
| 239 | } |
| 240 | |
| 241 | private static Properties getProperties() { |
| 242 | Properties props = new Properties(); |
nothing calls this directly
no test coverage detected