This is an automated email from the ASF dual-hosted git repository. mmiller pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push: new 0357c9b Rename config check classes (#2314) 0357c9b is described below commit 0357c9b66e0fcd49cc8778c3e51d91a60b494e38 Author: Mike Miller <mmil...@apache.org> AuthorDate: Wed Oct 13 08:26:57 2021 -0400 Rename config check classes (#2314) * Rename classes that check configuration to more specific names * Rename ConfigSanityCheck to CheckServerConfig to match keyword --- ...ConfigSanityCheck.java => ConfigCheckUtil.java} | 14 ++++++------ .../accumulo/core/conf/SiteConfiguration.java | 2 +- ...nityCheckTest.java => ConfigCheckUtilTest.java} | 26 +++++++++++----------- .../core/conf/DefaultConfigurationTest.java | 2 +- ...nfigSanityCheck.java => CheckServerConfig.java} | 2 +- .../server/conf/ServerConfigurationFactory.java | 8 +++---- .../conf/ServerConfigurationFactoryTest.java | 2 +- .../apache/accumulo/test/start/KeywordStartIT.java | 4 ++-- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/core/src/main/java/org/apache/accumulo/core/conf/ConfigSanityCheck.java b/core/src/main/java/org/apache/accumulo/core/conf/ConfigCheckUtil.java similarity index 94% rename from core/src/main/java/org/apache/accumulo/core/conf/ConfigSanityCheck.java rename to core/src/main/java/org/apache/accumulo/core/conf/ConfigCheckUtil.java index fada2ba..b0bc099 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/ConfigSanityCheck.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/ConfigCheckUtil.java @@ -31,9 +31,9 @@ import com.google.common.base.Preconditions; /** * A utility class for validating {@link AccumuloConfiguration} instances. */ -public class ConfigSanityCheck { +public class ConfigCheckUtil { - private static final Logger log = LoggerFactory.getLogger(ConfigSanityCheck.class); + private static final Logger log = LoggerFactory.getLogger(ConfigCheckUtil.class); private static final String PREFIX = "BAD CONFIG "; /** @@ -44,7 +44,7 @@ public class ConfigSanityCheck { * * @param entries * iterable through configuration keys and values - * @throws SanityCheckException + * @throws ConfigCheckException * if a fatal configuration error is found */ public static void validate(Iterable<Entry<String,String>> entries) { @@ -126,15 +126,15 @@ public class ConfigSanityCheck { } /** - * The exception thrown when {@link ConfigSanityCheck#validate(Iterable)} fails. + * The exception thrown when {@link ConfigCheckUtil#validate(Iterable)} fails. */ - public static class SanityCheckException extends RuntimeException { + public static class ConfigCheckException extends RuntimeException { private static final long serialVersionUID = 1L; /** * Creates a new exception with the given message. */ - public SanityCheckException(String msg) { + public ConfigCheckException(String msg) { super(msg); } } @@ -143,7 +143,7 @@ public class ConfigSanityCheck { // ACCUMULO-3651 Level changed from fatal to error and FATAL added to message for slf4j // compatibility log.error("FATAL: {}", msg); - throw new SanityCheckException(msg); + throw new ConfigCheckException(msg); } /** diff --git a/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java b/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java index 35bda16..63c5c28 100644 --- a/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java +++ b/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java @@ -206,7 +206,7 @@ public class SiteConfiguration extends AccumuloConfiguration { private final Map<String,String> config; private SiteConfiguration(Map<String,String> config) { - ConfigSanityCheck.validate(config.entrySet()); + ConfigCheckUtil.validate(config.entrySet()); this.config = config; } diff --git a/core/src/test/java/org/apache/accumulo/core/conf/ConfigSanityCheckTest.java b/core/src/test/java/org/apache/accumulo/core/conf/ConfigCheckUtilTest.java similarity index 78% rename from core/src/test/java/org/apache/accumulo/core/conf/ConfigSanityCheckTest.java rename to core/src/test/java/org/apache/accumulo/core/conf/ConfigCheckUtilTest.java index 30f99dd..9574e15 100644 --- a/core/src/test/java/org/apache/accumulo/core/conf/ConfigSanityCheckTest.java +++ b/core/src/test/java/org/apache/accumulo/core/conf/ConfigCheckUtilTest.java @@ -20,11 +20,11 @@ package org.apache.accumulo.core.conf; import java.util.Map; -import org.apache.accumulo.core.conf.ConfigSanityCheck.SanityCheckException; +import org.apache.accumulo.core.conf.ConfigCheckUtil.ConfigCheckException; import org.junit.Before; import org.junit.Test; -public class ConfigSanityCheckTest { +public class ConfigCheckUtilTest { private Map<String,String> m; @Before @@ -38,51 +38,51 @@ public class ConfigSanityCheckTest { m.put(Property.MANAGER_TABLET_BALANCER.getKey(), "org.apache.accumulo.server.manager.balancer.TableLoadBalancer"); m.put(Property.MANAGER_BULK_RETRIES.getKey(), "3"); - ConfigSanityCheck.validate(m.entrySet()); + ConfigCheckUtil.validate(m.entrySet()); } @Test public void testPass_Empty() { - ConfigSanityCheck.validate(m.entrySet()); + ConfigCheckUtil.validate(m.entrySet()); } @Test public void testPass_UnrecognizedValidProperty() { m.put(Property.MANAGER_CLIENTPORT.getKey(), "9999"); m.put(Property.MANAGER_PREFIX.getKey() + "something", "abcdefg"); - ConfigSanityCheck.validate(m.entrySet()); + ConfigCheckUtil.validate(m.entrySet()); } @Test public void testPass_UnrecognizedProperty() { m.put(Property.MANAGER_CLIENTPORT.getKey(), "9999"); m.put("invalid.prefix.value", "abcdefg"); - ConfigSanityCheck.validate(m.entrySet()); + ConfigCheckUtil.validate(m.entrySet()); } - @Test(expected = SanityCheckException.class) + @Test(expected = ConfigCheckException.class) public void testFail_Prefix() { m.put(Property.MANAGER_CLIENTPORT.getKey(), "9999"); m.put(Property.MANAGER_PREFIX.getKey(), "oops"); - ConfigSanityCheck.validate(m.entrySet()); + ConfigCheckUtil.validate(m.entrySet()); } - @Test(expected = SanityCheckException.class) + @Test(expected = ConfigCheckException.class) public void testFail_InstanceZkTimeoutOutOfRange() { m.put(Property.INSTANCE_ZK_TIMEOUT.getKey(), "10ms"); - ConfigSanityCheck.validate(m.entrySet()); + ConfigCheckUtil.validate(m.entrySet()); } - @Test(expected = SanityCheckException.class) + @Test(expected = ConfigCheckException.class) public void testFail_badCryptoService() { m.put(Property.INSTANCE_CRYPTO_SERVICE.getKey(), "DoesNotExistCryptoService"); - ConfigSanityCheck.validate(m.entrySet()); + ConfigCheckUtil.validate(m.entrySet()); } @Test public void testPass_defaultCryptoService() { m.put(Property.INSTANCE_CRYPTO_SERVICE.getKey(), Property.INSTANCE_CRYPTO_SERVICE.getDefaultValue()); - ConfigSanityCheck.validate(m.entrySet()); + ConfigCheckUtil.validate(m.entrySet()); } } diff --git a/core/src/test/java/org/apache/accumulo/core/conf/DefaultConfigurationTest.java b/core/src/test/java/org/apache/accumulo/core/conf/DefaultConfigurationTest.java index 457fd2c..f8dd452 100644 --- a/core/src/test/java/org/apache/accumulo/core/conf/DefaultConfigurationTest.java +++ b/core/src/test/java/org/apache/accumulo/core/conf/DefaultConfigurationTest.java @@ -52,6 +52,6 @@ public class DefaultConfigurationTest { @Test public void testSanityCheck() { - ConfigSanityCheck.validate(c); + ConfigCheckUtil.validate(c); } } diff --git a/server/base/src/main/java/org/apache/accumulo/server/conf/ConfigSanityCheck.java b/server/base/src/main/java/org/apache/accumulo/server/conf/CheckServerConfig.java similarity index 96% rename from server/base/src/main/java/org/apache/accumulo/server/conf/ConfigSanityCheck.java rename to server/base/src/main/java/org/apache/accumulo/server/conf/CheckServerConfig.java index b31a4c2..9f7ebf4 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/conf/ConfigSanityCheck.java +++ b/server/base/src/main/java/org/apache/accumulo/server/conf/CheckServerConfig.java @@ -25,7 +25,7 @@ import org.apache.accumulo.start.spi.KeywordExecutable; import com.google.auto.service.AutoService; @AutoService(KeywordExecutable.class) -public class ConfigSanityCheck implements KeywordExecutable { +public class CheckServerConfig implements KeywordExecutable { public static void main(String[] args) { try (var context = new ServerContext(SiteConfiguration.auto())) { diff --git a/server/base/src/main/java/org/apache/accumulo/server/conf/ServerConfigurationFactory.java b/server/base/src/main/java/org/apache/accumulo/server/conf/ServerConfigurationFactory.java index f9b8743..9fde55c 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/conf/ServerConfigurationFactory.java +++ b/server/base/src/main/java/org/apache/accumulo/server/conf/ServerConfigurationFactory.java @@ -24,7 +24,7 @@ import java.util.Map; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.clientImpl.Tables; import org.apache.accumulo.core.conf.AccumuloConfiguration; -import org.apache.accumulo.core.conf.ConfigSanityCheck; +import org.apache.accumulo.core.conf.ConfigCheckUtil; import org.apache.accumulo.core.conf.DefaultConfiguration; import org.apache.accumulo.core.conf.SiteConfiguration; import org.apache.accumulo.core.data.NamespaceId; @@ -129,7 +129,7 @@ public class ServerConfigurationFactory extends ServerConfiguration { // default visibility labels will never be updated in a Tablet until it is reloaded. if (conf == null && Tables.exists(context, tableId)) { conf = new TableConfiguration(context, tableId, getNamespaceConfigurationForTable(tableId)); - ConfigSanityCheck.validate(conf); + ConfigCheckUtil.validate(conf); synchronized (tableConfigs) { Map<TableId,TableConfiguration> configs = tableConfigs.get(instanceID); TableConfiguration existingConf = configs.get(tableId); @@ -160,7 +160,7 @@ public class ServerConfigurationFactory extends ServerConfiguration { throw new RuntimeException(e); } conf = new NamespaceConfiguration(namespaceId, context, getSystemConfiguration()); - ConfigSanityCheck.validate(conf); + ConfigCheckUtil.validate(conf); synchronized (tableParentConfigs) { tableParentConfigs.get(instanceID).put(tableId, conf); } @@ -180,7 +180,7 @@ public class ServerConfigurationFactory extends ServerConfiguration { // changed - include instance in constructor call conf = new NamespaceConfiguration(namespaceId, context, getSystemConfiguration()); conf.setZooCacheFactory(zcf); - ConfigSanityCheck.validate(conf); + ConfigCheckUtil.validate(conf); synchronized (namespaceConfigs) { namespaceConfigs.get(instanceID).put(namespaceId, conf); } diff --git a/server/base/src/test/java/org/apache/accumulo/server/conf/ServerConfigurationFactoryTest.java b/server/base/src/test/java/org/apache/accumulo/server/conf/ServerConfigurationFactoryTest.java index 67c22ed..9fe2d97 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/conf/ServerConfigurationFactoryTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/conf/ServerConfigurationFactoryTest.java @@ -66,7 +66,7 @@ public class ServerConfigurationFactoryTest { expect(zc.getChildren(anyObject(String.class))).andReturn(null); expectLastCall().anyTimes(); - // ConfigSanityCheck looks at timeout + // CheckServerConfig looks at timeout expect(zc.get(endsWith("timeout"))).andReturn(("" + ZK_TIMEOUT + "ms").getBytes(UTF_8)); replay(zc); } diff --git a/test/src/main/java/org/apache/accumulo/test/start/KeywordStartIT.java b/test/src/main/java/org/apache/accumulo/test/start/KeywordStartIT.java index 48c4d35..ff05a9b 100644 --- a/test/src/main/java/org/apache/accumulo/test/start/KeywordStartIT.java +++ b/test/src/main/java/org/apache/accumulo/test/start/KeywordStartIT.java @@ -47,7 +47,7 @@ import org.apache.accumulo.minicluster.MiniAccumuloRunner; import org.apache.accumulo.miniclusterImpl.MiniClusterExecutable; import org.apache.accumulo.monitor.Monitor; import org.apache.accumulo.monitor.MonitorExecutable; -import org.apache.accumulo.server.conf.ConfigSanityCheck; +import org.apache.accumulo.server.conf.CheckServerConfig; import org.apache.accumulo.server.init.Initialize; import org.apache.accumulo.server.util.Admin; import org.apache.accumulo.server.util.ConvertConfig; @@ -105,7 +105,7 @@ public class KeywordStartIT { assumeTrue(new File(System.getProperty("user.dir") + "/src").exists()); TreeMap<String,Class<? extends KeywordExecutable>> expectSet = new TreeMap<>(); expectSet.put("admin", Admin.class); - expectSet.put("check-server-config", ConfigSanityCheck.class); + expectSet.put("check-server-config", CheckServerConfig.class); expectSet.put("compaction-coordinator", CoordinatorExecutable.class); expectSet.put("compactor", CompactorExecutable.class); expectSet.put("convert-config", ConvertConfig.class);