### Question:
ShareLibService implements Service, Instrumentable { public FileSystem getFileSystem() { return fs; }  @Override void init(Services services); Map<String, List<Path>> getShareLib(); List<Path> getShareLibJars(String shareLibKey); List<Path> getSystemLibJars(String shareLibKey); @Override void destroy(); @Override Class<? extends Service> getInterface(); Map<String, String> updateShareLib(); Path getShareLibRootPath(); Path getLatestLibPath(Path rootDir, final String prefix); @Override void instrument(Instrumentation instr); FileSystem getFileSystem(); Configuration getShareLibConf(String inputKey, Path path); @VisibleForTesting Map<String, Map<Path, Configuration>> getShareLibConfigMap(); static final String LAUNCHERJAR_LIB_RETENTION; static final String SHARELIB_MAPPING_FILE; static final String SHIP_LAUNCHER_JAR; static final String PURGE_INTERVAL; static final String FAIL_FAST_ON_STARTUP; static final String LAUNCHER_LIB_PREFIX; static final String SHARE_LIB_PREFIX; static String SHARE_LIB_CONF_PREFIX; }### Answer:
@Test public void testShareLibLoadFilesFromHDFS() throws Exception { FileSystem fs = getFileSystem(); setupShareLibLoadFiles(fs, TEST_HDFS_HOME); validateShareLibLoadFiles(fs, HDFS_SCHEME_PREFIX); }
@Test public void testConfFileAddedToDistributedCache() throws Exception { try { Properties prop = new Properties(); prop.put("oozie.hive_conf", TEST_HDFS_HOME + SHARELIB_PATH + "hive-site.xml#hive-site.xml"); setupSharelibConf("hive-site.xml", "oozie.hive_conf", prop); String actionXml = "<pig>" + "<job-tracker>" + getJobTrackerUri() + "</job-tracker>" + "<name-node>" + getNameNodeUri() + "</name-node>" + "<script>test</script>" + "</pig>"; Element eActionXml = XmlUtils.parseXml(actionXml); XConfiguration protoConf = new XConfiguration(); protoConf.set(WorkflowAppService.HADOOP_USER, getTestUser()); WorkflowJobBean wfj = new WorkflowJobBean(); protoConf.setBoolean(OozieClient.USE_SYSTEM_LIBPATH, true); wfj.setProtoActionConf(XmlUtils.prettyPrint(protoConf).toString()); wfj.setConf(XmlUtils.prettyPrint(protoConf).toString()); Context context = new TestJavaActionExecutor().new Context(wfj, new WorkflowActionBean()); PigActionExecutor ae = new PigActionExecutor(); Configuration jobConf = ae.createBaseHadoopConf(context, eActionXml); jobConf.set("oozie.action.sharelib.for.pig", "hive_conf"); ae.setLibFilesArchives(context, eActionXml, new Path("hdfs: URI[] cacheFiles = DistributedCache.getCacheFiles(jobConf); String cacheFilesStr = Arrays.toString(cacheFiles); assertEquals(jobConf.get("oozie.hive_conf-sharelib-test"), null); assertTrue(URLDecoder.decode(cacheFilesStr).contains("hive-site.xml#hive-site.xml")); setupSharelibConf("hbase-site.xml", "oozie.hbase_conf"); jobConf = ae.createBaseHadoopConf(context, eActionXml); jobConf.set("oozie.action.sharelib.for.pig", "hbase_conf"); ae.setLibFilesArchives(context, eActionXml, new Path("hdfs: cacheFiles = DistributedCache.getCacheFiles(jobConf); cacheFilesStr = Arrays.toString(cacheFiles); assertTrue(cacheFilesStr.contains("hbase-site.xml")); } finally { getFileSystem().delete(new Path(SHARELIB_PATH), true); } }