private static FileSystem setupMockFileSystem(Configuration conf, URI uri) throws Exception { String scheme = uri.getScheme(); conf.set("fs." + scheme + ".impl", MockFileSystem.class.getName()); FileSystem fs = FileSystem.get(uri, conf); ConfigUtil.addLink(conf, "/mounts/" + scheme, uri); return ((MockFileSystem)fs).getRawFileSystem(); }