@Test(expected = SanityCheckException.class) public void testFail_badCryptoService() { m.put(Property.INSTANCE_CRYPTO_SERVICE.getKey(), "DoesNotExistCryptoService"); ConfigSanityCheck.validate(m.entrySet()); }
public static void validate(Iterable<Entry<String,String>> entries) { String instanceZkTimeoutValue = null; for (Entry<String,String> entry : entries) { String key = entry.getKey(); String value = entry.getValue(); Property prop = Property.getPropertyByKey(entry.getKey()); if (prop == null && Property.isValidPropertyKey(key)) continue; else if (prop == null) log.warn(PREFIX + "unrecognized property key (" + key + ")"); else if (prop.getType() == PropertyType.PREFIX) fatal(PREFIX + "incomplete property key (" + key + ")"); else if (!prop.getType().isValidFormat(value)) fatal(PREFIX + "improperly formatted value for key (" + key + ", type=" + prop.getType() + ") : " + value); if (key.equals(Property.INSTANCE_ZK_TIMEOUT.getKey())) { instanceZkTimeoutValue = value; } if (key.equals(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX.getKey()) || key.equals(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey())) { long bsize = ConfigurationTypeHelper.getFixedMemoryAsBytes(value); Preconditions.checkArgument(bsize > 0 && bsize < Integer.MAX_VALUE, key + " must be greater than 0 and less than " + Integer.MAX_VALUE + " but was: " + bsize); } if (key.equals(Property.INSTANCE_CRYPTO_SERVICE.getKey())) { String cryptoStrategy = Objects.requireNonNull(value); verifyValidClassName(key, cryptoStrategy, CryptoService.class); } } if (instanceZkTimeoutValue != null) { checkTimeDuration(Property.INSTANCE_ZK_TIMEOUT, instanceZkTimeoutValue, new CheckTimeDurationBetween(1000, 300000)); } }
ConfigSanityCheck { public static void validate(Iterable<Entry<String,String>> entries) { String instanceZkTimeoutValue = null; for (Entry<String,String> entry : entries) { String key = entry.getKey(); String value = entry.getValue(); Property prop = Property.getPropertyByKey(entry.getKey()); if (prop == null && Property.isValidPropertyKey(key)) continue; else if (prop == null) log.warn(PREFIX + "unrecognized property key (" + key + ")"); else if (prop.getType() == PropertyType.PREFIX) fatal(PREFIX + "incomplete property key (" + key + ")"); else if (!prop.getType().isValidFormat(value)) fatal(PREFIX + "improperly formatted value for key (" + key + ", type=" + prop.getType() + ") : " + value); if (key.equals(Property.INSTANCE_ZK_TIMEOUT.getKey())) { instanceZkTimeoutValue = value; } if (key.equals(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX.getKey()) || key.equals(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey())) { long bsize = ConfigurationTypeHelper.getFixedMemoryAsBytes(value); Preconditions.checkArgument(bsize > 0 && bsize < Integer.MAX_VALUE, key + " must be greater than 0 and less than " + Integer.MAX_VALUE + " but was: " + bsize); } if (key.equals(Property.INSTANCE_CRYPTO_SERVICE.getKey())) { String cryptoStrategy = Objects.requireNonNull(value); verifyValidClassName(key, cryptoStrategy, CryptoService.class); } } if (instanceZkTimeoutValue != null) { checkTimeDuration(Property.INSTANCE_ZK_TIMEOUT, instanceZkTimeoutValue, new CheckTimeDurationBetween(1000, 300000)); } } }
ConfigSanityCheck { public static void validate(Iterable<Entry<String,String>> entries) { String instanceZkTimeoutValue = null; for (Entry<String,String> entry : entries) { String key = entry.getKey(); String value = entry.getValue(); Property prop = Property.getPropertyByKey(entry.getKey()); if (prop == null && Property.isValidPropertyKey(key)) continue; else if (prop == null) log.warn(PREFIX + "unrecognized property key (" + key + ")"); else if (prop.getType() == PropertyType.PREFIX) fatal(PREFIX + "incomplete property key (" + key + ")"); else if (!prop.getType().isValidFormat(value)) fatal(PREFIX + "improperly formatted value for key (" + key + ", type=" + prop.getType() + ") : " + value); if (key.equals(Property.INSTANCE_ZK_TIMEOUT.getKey())) { instanceZkTimeoutValue = value; } if (key.equals(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX.getKey()) || key.equals(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey())) { long bsize = ConfigurationTypeHelper.getFixedMemoryAsBytes(value); Preconditions.checkArgument(bsize > 0 && bsize < Integer.MAX_VALUE, key + " must be greater than 0 and less than " + Integer.MAX_VALUE + " but was: " + bsize); } if (key.equals(Property.INSTANCE_CRYPTO_SERVICE.getKey())) { String cryptoStrategy = Objects.requireNonNull(value); verifyValidClassName(key, cryptoStrategy, CryptoService.class); } } if (instanceZkTimeoutValue != null) { checkTimeDuration(Property.INSTANCE_ZK_TIMEOUT, instanceZkTimeoutValue, new CheckTimeDurationBetween(1000, 300000)); } }  }
ConfigSanityCheck { public static void validate(Iterable<Entry<String,String>> entries) { String instanceZkTimeoutValue = null; for (Entry<String,String> entry : entries) { String key = entry.getKey(); String value = entry.getValue(); Property prop = Property.getPropertyByKey(entry.getKey()); if (prop == null && Property.isValidPropertyKey(key)) continue; else if (prop == null) log.warn(PREFIX + "unrecognized property key (" + key + ")"); else if (prop.getType() == PropertyType.PREFIX) fatal(PREFIX + "incomplete property key (" + key + ")"); else if (!prop.getType().isValidFormat(value)) fatal(PREFIX + "improperly formatted value for key (" + key + ", type=" + prop.getType() + ") : " + value); if (key.equals(Property.INSTANCE_ZK_TIMEOUT.getKey())) { instanceZkTimeoutValue = value; } if (key.equals(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX.getKey()) || key.equals(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey())) { long bsize = ConfigurationTypeHelper.getFixedMemoryAsBytes(value); Preconditions.checkArgument(bsize > 0 && bsize < Integer.MAX_VALUE, key + " must be greater than 0 and less than " + Integer.MAX_VALUE + " but was: " + bsize); } if (key.equals(Property.INSTANCE_CRYPTO_SERVICE.getKey())) { String cryptoStrategy = Objects.requireNonNull(value); verifyValidClassName(key, cryptoStrategy, CryptoService.class); } } if (instanceZkTimeoutValue != null) { checkTimeDuration(Property.INSTANCE_ZK_TIMEOUT, instanceZkTimeoutValue, new CheckTimeDurationBetween(1000, 300000)); } }  static void validate(Iterable<Entry<String,String>> entries); }
ConfigSanityCheck { public static void validate(Iterable<Entry<String,String>> entries) { String instanceZkTimeoutValue = null; for (Entry<String,String> entry : entries) { String key = entry.getKey(); String value = entry.getValue(); Property prop = Property.getPropertyByKey(entry.getKey()); if (prop == null && Property.isValidPropertyKey(key)) continue; else if (prop == null) log.warn(PREFIX + "unrecognized property key (" + key + ")"); else if (prop.getType() == PropertyType.PREFIX) fatal(PREFIX + "incomplete property key (" + key + ")"); else if (!prop.getType().isValidFormat(value)) fatal(PREFIX + "improperly formatted value for key (" + key + ", type=" + prop.getType() + ") : " + value); if (key.equals(Property.INSTANCE_ZK_TIMEOUT.getKey())) { instanceZkTimeoutValue = value; } if (key.equals(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX.getKey()) || key.equals(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey())) { long bsize = ConfigurationTypeHelper.getFixedMemoryAsBytes(value); Preconditions.checkArgument(bsize > 0 && bsize < Integer.MAX_VALUE, key + " must be greater than 0 and less than " + Integer.MAX_VALUE + " but was: " + bsize); } if (key.equals(Property.INSTANCE_CRYPTO_SERVICE.getKey())) { String cryptoStrategy = Objects.requireNonNull(value); verifyValidClassName(key, cryptoStrategy, CryptoService.class); } } if (instanceZkTimeoutValue != null) { checkTimeDuration(Property.INSTANCE_ZK_TIMEOUT, instanceZkTimeoutValue, new CheckTimeDurationBetween(1000, 300000)); } }  static void validate(Iterable<Entry<String,String>> entries);  }