private void mockupConfigValueForKey(ConfigKeyPath configKey){ final String generalKey = "generalKey"; Map<String, String> valueMap = new HashMap<>(); // key in all the nodes valueMap.put(generalKey, "valueOf_" +generalKey +"_"+configKey.getOwnPathName() ); // key in self node valueMap.put("keyOf_" + configKey.getOwnPathName(), "valueOf_" + configKey.getOwnPathName()); when(mockConfigStore.getOwnConfig(configKey, version)).thenReturn(ConfigFactory.parseMap(valueMap)); }
@Test public void testGetChildren() throws IOException, URISyntaxException, ConfigStoreCreationException { String datasetName = "dataset-test-get-children"; String childDatasetName = "childDataset"; Path datasetPath = new Path(CONFIG_DIR_PATH, datasetName); try { this.fs.mkdirs(new Path(datasetPath, childDatasetName)); ConfigKeyPath datasetConfigKey = SingleLinkedListConfigKeyPath.ROOT.createChild(datasetName); Collection<ConfigKeyPath> children = this._simpleHadoopFilesystemConfigStore.getChildren(datasetConfigKey, VERSION); Assert.assertEquals(children.size(), 1); Assert.assertEquals(children.iterator().next().getOwnPathName(), childDatasetName); } finally { if (this.fs.exists(datasetPath)) { this.fs.delete(datasetPath, true); } } }