@Test public void testGetOwnConfig() { Config config1 = this.store.getOwnConfig(this.rootPath, this.version); Assert.assertEquals(config1.getString("gobblin.property.test1"), "prop1"); Assert.assertEquals(config1.getString("gobblin.property.test2"), "prop2"); Config config2 = this.store.getOwnConfig(this.testPath, this.version); Assert.assertEquals(config2.getString("gobblin.test.property"), "string1"); Config config3 = this.store.getOwnConfig(this.child1Path, this.version); Assert.assertEquals(config3.getString("gobblin.test.property"), "string2"); Config config4 = this.store.getOwnConfig(this.child2Path, this.version); Assert.assertEquals(config4.getString("gobblin.test.property"), "string3"); }
@Override public Config getOwnConfig(ConfigKeyPath configKey, String version) throws VersionDoesNotExistException { Preconditions.checkNotNull(configKey, "configKey cannot be null!"); Preconditions.checkArgument(version.equals(getCurrentVersion())); Path datasetDir = getDatasetDirForKey(configKey); Path mainConfFile = this.fs.getPath(datasetDir.toString(), SimpleHadoopFilesystemConfigStore.MAIN_CONF_FILE_NAME); try { if (!Files.exists(mainConfFile)) { return ConfigFactory.empty(); } if (!Files.isDirectory(mainConfFile)) { try (InputStream mainConfInputStream = Files.newInputStream(mainConfFile)) { return ConfigFactory.parseReader(new InputStreamReader(mainConfInputStream, Charsets.UTF_8)); } } return ConfigFactory.empty(); } catch (IOException e) { throw new RuntimeException(String.format("Error while getting config for configKey: \"%s\"", configKey), e); } }
ZipFileConfigStore implements ConfigStore { @Override public Config getOwnConfig(ConfigKeyPath configKey, String version) throws VersionDoesNotExistException { Preconditions.checkNotNull(configKey, "configKey cannot be null!"); Preconditions.checkArgument(version.equals(getCurrentVersion())); Path datasetDir = getDatasetDirForKey(configKey); Path mainConfFile = this.fs.getPath(datasetDir.toString(), SimpleHadoopFilesystemConfigStore.MAIN_CONF_FILE_NAME); try { if (!Files.exists(mainConfFile)) { return ConfigFactory.empty(); } if (!Files.isDirectory(mainConfFile)) { try (InputStream mainConfInputStream = Files.newInputStream(mainConfFile)) { return ConfigFactory.parseReader(new InputStreamReader(mainConfInputStream, Charsets.UTF_8)); } } return ConfigFactory.empty(); } catch (IOException e) { throw new RuntimeException(String.format("Error while getting config for configKey: \"%s\"", configKey), e); } } }
ZipFileConfigStore implements ConfigStore { @Override public Config getOwnConfig(ConfigKeyPath configKey, String version) throws VersionDoesNotExistException { Preconditions.checkNotNull(configKey, "configKey cannot be null!"); Preconditions.checkArgument(version.equals(getCurrentVersion())); Path datasetDir = getDatasetDirForKey(configKey); Path mainConfFile = this.fs.getPath(datasetDir.toString(), SimpleHadoopFilesystemConfigStore.MAIN_CONF_FILE_NAME); try { if (!Files.exists(mainConfFile)) { return ConfigFactory.empty(); } if (!Files.isDirectory(mainConfFile)) { try (InputStream mainConfInputStream = Files.newInputStream(mainConfFile)) { return ConfigFactory.parseReader(new InputStreamReader(mainConfInputStream, Charsets.UTF_8)); } } return ConfigFactory.empty(); } catch (IOException e) { throw new RuntimeException(String.format("Error while getting config for configKey: \"%s\"", configKey), e); } } ZipFileConfigStore(ZipFileSystem fs, URI logicalStoreRoot, String version, String storePrefix); }
ZipFileConfigStore implements ConfigStore { @Override public Config getOwnConfig(ConfigKeyPath configKey, String version) throws VersionDoesNotExistException { Preconditions.checkNotNull(configKey, "configKey cannot be null!"); Preconditions.checkArgument(version.equals(getCurrentVersion())); Path datasetDir = getDatasetDirForKey(configKey); Path mainConfFile = this.fs.getPath(datasetDir.toString(), SimpleHadoopFilesystemConfigStore.MAIN_CONF_FILE_NAME); try { if (!Files.exists(mainConfFile)) { return ConfigFactory.empty(); } if (!Files.isDirectory(mainConfFile)) { try (InputStream mainConfInputStream = Files.newInputStream(mainConfFile)) { return ConfigFactory.parseReader(new InputStreamReader(mainConfInputStream, Charsets.UTF_8)); } } return ConfigFactory.empty(); } catch (IOException e) { throw new RuntimeException(String.format("Error while getting config for configKey: \"%s\"", configKey), e); } } ZipFileConfigStore(ZipFileSystem fs, URI logicalStoreRoot, String version, String storePrefix); @Override String getCurrentVersion(); @Override URI getStoreURI(); @Override Collection<ConfigKeyPath> getChildren(ConfigKeyPath configKey, String version); @Override List<ConfigKeyPath> getOwnImports(ConfigKeyPath configKey, String version); List<ConfigKeyPath> getOwnImports(ConfigKeyPath configKey, String version, Optional<Config> runtimeConfig); @Override Config getOwnConfig(ConfigKeyPath configKey, String version); }
ZipFileConfigStore implements ConfigStore { @Override public Config getOwnConfig(ConfigKeyPath configKey, String version) throws VersionDoesNotExistException { Preconditions.checkNotNull(configKey, "configKey cannot be null!"); Preconditions.checkArgument(version.equals(getCurrentVersion())); Path datasetDir = getDatasetDirForKey(configKey); Path mainConfFile = this.fs.getPath(datasetDir.toString(), SimpleHadoopFilesystemConfigStore.MAIN_CONF_FILE_NAME); try { if (!Files.exists(mainConfFile)) { return ConfigFactory.empty(); } if (!Files.isDirectory(mainConfFile)) { try (InputStream mainConfInputStream = Files.newInputStream(mainConfFile)) { return ConfigFactory.parseReader(new InputStreamReader(mainConfInputStream, Charsets.UTF_8)); } } return ConfigFactory.empty(); } catch (IOException e) { throw new RuntimeException(String.format("Error while getting config for configKey: \"%s\"", configKey), e); } } ZipFileConfigStore(ZipFileSystem fs, URI logicalStoreRoot, String version, String storePrefix); @Override String getCurrentVersion(); @Override URI getStoreURI(); @Override Collection<ConfigKeyPath> getChildren(ConfigKeyPath configKey, String version); @Override List<ConfigKeyPath> getOwnImports(ConfigKeyPath configKey, String version); List<ConfigKeyPath> getOwnImports(ConfigKeyPath configKey, String version, Optional<Config> runtimeConfig); @Override Config getOwnConfig(ConfigKeyPath configKey, String version);  }