@Test public void testTimezoneValidatedExceptionMessage() { properties.put(PartitionerConfig.TIMEZONE_CONFIG, "LLL"); String expectedError = String.format("Invalid value LLL for configuration %s: " + "The datetime zone id 'LLL' is not recognised", PartitionerConfig.TIMEZONE_CONFIG); try { new PartitionerConfig(PartitionerConfig.newConfigDef(new GenericRecommender()), properties); } catch (ConfigException e){ assertEquals(expectedError, e.getMessage()); } }
public static ConfigDef newConfigDef(ConfigDef.Recommender partitionerClassRecommender) { ConfigDef configDef = new ConfigDef(); { final String group = "Partitioner"; int orderInGroup = 0; configDef.define(PARTITIONER_CLASS_CONFIG, Type.CLASS, PARTITIONER_CLASS_DEFAULT, Importance.HIGH, PARTITIONER_CLASS_DOC, group, ++orderInGroup, Width.LONG, PARTITIONER_CLASS_DISPLAY, Arrays.asList( PARTITION_FIELD_NAME_CONFIG, PARTITION_DURATION_MS_CONFIG, PATH_FORMAT_CONFIG, LOCALE_CONFIG, TIMEZONE_CONFIG ), partitionerClassRecommender); configDef.define(PARTITION_FIELD_NAME_CONFIG, Type.LIST, PARTITION_FIELD_NAME_DEFAULT, Importance.MEDIUM, PARTITION_FIELD_NAME_DOC, group, ++orderInGroup, Width.NONE, PARTITION_FIELD_NAME_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(PARTITION_DURATION_MS_CONFIG, Type.LONG, PARTITION_DURATION_MS_DEFAULT, Importance.MEDIUM, PARTITION_DURATION_MS_DOC, group, ++orderInGroup, Width.LONG, PARTITION_DURATION_MS_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(PATH_FORMAT_CONFIG, Type.STRING, PATH_FORMAT_DEFAULT, Importance.MEDIUM, PATH_FORMAT_DOC, group, ++orderInGroup, Width.LONG, PATH_FORMAT_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(LOCALE_CONFIG, Type.STRING, LOCALE_DEFAULT, Importance.MEDIUM, LOCALE_DOC, group, ++orderInGroup, Width.LONG, LOCALE_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(TIMEZONE_CONFIG, Type.STRING, TIMEZONE_DEFAULT, new TimezoneValidator(), Importance.MEDIUM, TIMEZONE_DOC, group, ++orderInGroup, Width.LONG, TIMEZONE_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(TIMESTAMP_EXTRACTOR_CLASS_CONFIG, Type.STRING, TIMESTAMP_EXTRACTOR_CLASS_DEFAULT, Importance.MEDIUM, TIMESTAMP_EXTRACTOR_CLASS_DOC, group, ++orderInGroup, Width.LONG, TIMESTAMP_EXTRACTOR_CLASS_DISPLAY); configDef.define(TIMESTAMP_FIELD_NAME_CONFIG, Type.STRING, TIMESTAMP_FIELD_NAME_DEFAULT, Importance.MEDIUM, TIMESTAMP_FIELD_NAME_DOC, group, ++orderInGroup, Width.LONG, TIMESTAMP_FIELD_NAME_DISPLAY); } return configDef; }
PartitionerConfig extends AbstractConfig implements ComposableConfig { public static ConfigDef newConfigDef(ConfigDef.Recommender partitionerClassRecommender) { ConfigDef configDef = new ConfigDef(); { final String group = "Partitioner"; int orderInGroup = 0; configDef.define(PARTITIONER_CLASS_CONFIG, Type.CLASS, PARTITIONER_CLASS_DEFAULT, Importance.HIGH, PARTITIONER_CLASS_DOC, group, ++orderInGroup, Width.LONG, PARTITIONER_CLASS_DISPLAY, Arrays.asList( PARTITION_FIELD_NAME_CONFIG, PARTITION_DURATION_MS_CONFIG, PATH_FORMAT_CONFIG, LOCALE_CONFIG, TIMEZONE_CONFIG ), partitionerClassRecommender); configDef.define(PARTITION_FIELD_NAME_CONFIG, Type.LIST, PARTITION_FIELD_NAME_DEFAULT, Importance.MEDIUM, PARTITION_FIELD_NAME_DOC, group, ++orderInGroup, Width.NONE, PARTITION_FIELD_NAME_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(PARTITION_DURATION_MS_CONFIG, Type.LONG, PARTITION_DURATION_MS_DEFAULT, Importance.MEDIUM, PARTITION_DURATION_MS_DOC, group, ++orderInGroup, Width.LONG, PARTITION_DURATION_MS_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(PATH_FORMAT_CONFIG, Type.STRING, PATH_FORMAT_DEFAULT, Importance.MEDIUM, PATH_FORMAT_DOC, group, ++orderInGroup, Width.LONG, PATH_FORMAT_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(LOCALE_CONFIG, Type.STRING, LOCALE_DEFAULT, Importance.MEDIUM, LOCALE_DOC, group, ++orderInGroup, Width.LONG, LOCALE_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(TIMEZONE_CONFIG, Type.STRING, TIMEZONE_DEFAULT, new TimezoneValidator(), Importance.MEDIUM, TIMEZONE_DOC, group, ++orderInGroup, Width.LONG, TIMEZONE_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(TIMESTAMP_EXTRACTOR_CLASS_CONFIG, Type.STRING, TIMESTAMP_EXTRACTOR_CLASS_DEFAULT, Importance.MEDIUM, TIMESTAMP_EXTRACTOR_CLASS_DOC, group, ++orderInGroup, Width.LONG, TIMESTAMP_EXTRACTOR_CLASS_DISPLAY); configDef.define(TIMESTAMP_FIELD_NAME_CONFIG, Type.STRING, TIMESTAMP_FIELD_NAME_DEFAULT, Importance.MEDIUM, TIMESTAMP_FIELD_NAME_DOC, group, ++orderInGroup, Width.LONG, TIMESTAMP_FIELD_NAME_DISPLAY); } return configDef; } }
PartitionerConfig extends AbstractConfig implements ComposableConfig { public static ConfigDef newConfigDef(ConfigDef.Recommender partitionerClassRecommender) { ConfigDef configDef = new ConfigDef(); { final String group = "Partitioner"; int orderInGroup = 0; configDef.define(PARTITIONER_CLASS_CONFIG, Type.CLASS, PARTITIONER_CLASS_DEFAULT, Importance.HIGH, PARTITIONER_CLASS_DOC, group, ++orderInGroup, Width.LONG, PARTITIONER_CLASS_DISPLAY, Arrays.asList( PARTITION_FIELD_NAME_CONFIG, PARTITION_DURATION_MS_CONFIG, PATH_FORMAT_CONFIG, LOCALE_CONFIG, TIMEZONE_CONFIG ), partitionerClassRecommender); configDef.define(PARTITION_FIELD_NAME_CONFIG, Type.LIST, PARTITION_FIELD_NAME_DEFAULT, Importance.MEDIUM, PARTITION_FIELD_NAME_DOC, group, ++orderInGroup, Width.NONE, PARTITION_FIELD_NAME_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(PARTITION_DURATION_MS_CONFIG, Type.LONG, PARTITION_DURATION_MS_DEFAULT, Importance.MEDIUM, PARTITION_DURATION_MS_DOC, group, ++orderInGroup, Width.LONG, PARTITION_DURATION_MS_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(PATH_FORMAT_CONFIG, Type.STRING, PATH_FORMAT_DEFAULT, Importance.MEDIUM, PATH_FORMAT_DOC, group, ++orderInGroup, Width.LONG, PATH_FORMAT_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(LOCALE_CONFIG, Type.STRING, LOCALE_DEFAULT, Importance.MEDIUM, LOCALE_DOC, group, ++orderInGroup, Width.LONG, LOCALE_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(TIMEZONE_CONFIG, Type.STRING, TIMEZONE_DEFAULT, new TimezoneValidator(), Importance.MEDIUM, TIMEZONE_DOC, group, ++orderInGroup, Width.LONG, TIMEZONE_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(TIMESTAMP_EXTRACTOR_CLASS_CONFIG, Type.STRING, TIMESTAMP_EXTRACTOR_CLASS_DEFAULT, Importance.MEDIUM, TIMESTAMP_EXTRACTOR_CLASS_DOC, group, ++orderInGroup, Width.LONG, TIMESTAMP_EXTRACTOR_CLASS_DISPLAY); configDef.define(TIMESTAMP_FIELD_NAME_CONFIG, Type.STRING, TIMESTAMP_FIELD_NAME_DEFAULT, Importance.MEDIUM, TIMESTAMP_FIELD_NAME_DOC, group, ++orderInGroup, Width.LONG, TIMESTAMP_FIELD_NAME_DISPLAY); } return configDef; } PartitionerConfig(ConfigDef configDef, Map<String, String> props); }
PartitionerConfig extends AbstractConfig implements ComposableConfig { public static ConfigDef newConfigDef(ConfigDef.Recommender partitionerClassRecommender) { ConfigDef configDef = new ConfigDef(); { final String group = "Partitioner"; int orderInGroup = 0; configDef.define(PARTITIONER_CLASS_CONFIG, Type.CLASS, PARTITIONER_CLASS_DEFAULT, Importance.HIGH, PARTITIONER_CLASS_DOC, group, ++orderInGroup, Width.LONG, PARTITIONER_CLASS_DISPLAY, Arrays.asList( PARTITION_FIELD_NAME_CONFIG, PARTITION_DURATION_MS_CONFIG, PATH_FORMAT_CONFIG, LOCALE_CONFIG, TIMEZONE_CONFIG ), partitionerClassRecommender); configDef.define(PARTITION_FIELD_NAME_CONFIG, Type.LIST, PARTITION_FIELD_NAME_DEFAULT, Importance.MEDIUM, PARTITION_FIELD_NAME_DOC, group, ++orderInGroup, Width.NONE, PARTITION_FIELD_NAME_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(PARTITION_DURATION_MS_CONFIG, Type.LONG, PARTITION_DURATION_MS_DEFAULT, Importance.MEDIUM, PARTITION_DURATION_MS_DOC, group, ++orderInGroup, Width.LONG, PARTITION_DURATION_MS_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(PATH_FORMAT_CONFIG, Type.STRING, PATH_FORMAT_DEFAULT, Importance.MEDIUM, PATH_FORMAT_DOC, group, ++orderInGroup, Width.LONG, PATH_FORMAT_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(LOCALE_CONFIG, Type.STRING, LOCALE_DEFAULT, Importance.MEDIUM, LOCALE_DOC, group, ++orderInGroup, Width.LONG, LOCALE_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(TIMEZONE_CONFIG, Type.STRING, TIMEZONE_DEFAULT, new TimezoneValidator(), Importance.MEDIUM, TIMEZONE_DOC, group, ++orderInGroup, Width.LONG, TIMEZONE_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(TIMESTAMP_EXTRACTOR_CLASS_CONFIG, Type.STRING, TIMESTAMP_EXTRACTOR_CLASS_DEFAULT, Importance.MEDIUM, TIMESTAMP_EXTRACTOR_CLASS_DOC, group, ++orderInGroup, Width.LONG, TIMESTAMP_EXTRACTOR_CLASS_DISPLAY); configDef.define(TIMESTAMP_FIELD_NAME_CONFIG, Type.STRING, TIMESTAMP_FIELD_NAME_DEFAULT, Importance.MEDIUM, TIMESTAMP_FIELD_NAME_DOC, group, ++orderInGroup, Width.LONG, TIMESTAMP_FIELD_NAME_DISPLAY); } return configDef; } PartitionerConfig(ConfigDef configDef, Map<String, String> props); static ConfigDef newConfigDef(ConfigDef.Recommender partitionerClassRecommender); @Override Object get(String key); }
PartitionerConfig extends AbstractConfig implements ComposableConfig { public static ConfigDef newConfigDef(ConfigDef.Recommender partitionerClassRecommender) { ConfigDef configDef = new ConfigDef(); { final String group = "Partitioner"; int orderInGroup = 0; configDef.define(PARTITIONER_CLASS_CONFIG, Type.CLASS, PARTITIONER_CLASS_DEFAULT, Importance.HIGH, PARTITIONER_CLASS_DOC, group, ++orderInGroup, Width.LONG, PARTITIONER_CLASS_DISPLAY, Arrays.asList( PARTITION_FIELD_NAME_CONFIG, PARTITION_DURATION_MS_CONFIG, PATH_FORMAT_CONFIG, LOCALE_CONFIG, TIMEZONE_CONFIG ), partitionerClassRecommender); configDef.define(PARTITION_FIELD_NAME_CONFIG, Type.LIST, PARTITION_FIELD_NAME_DEFAULT, Importance.MEDIUM, PARTITION_FIELD_NAME_DOC, group, ++orderInGroup, Width.NONE, PARTITION_FIELD_NAME_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(PARTITION_DURATION_MS_CONFIG, Type.LONG, PARTITION_DURATION_MS_DEFAULT, Importance.MEDIUM, PARTITION_DURATION_MS_DOC, group, ++orderInGroup, Width.LONG, PARTITION_DURATION_MS_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(PATH_FORMAT_CONFIG, Type.STRING, PATH_FORMAT_DEFAULT, Importance.MEDIUM, PATH_FORMAT_DOC, group, ++orderInGroup, Width.LONG, PATH_FORMAT_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(LOCALE_CONFIG, Type.STRING, LOCALE_DEFAULT, Importance.MEDIUM, LOCALE_DOC, group, ++orderInGroup, Width.LONG, LOCALE_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(TIMEZONE_CONFIG, Type.STRING, TIMEZONE_DEFAULT, new TimezoneValidator(), Importance.MEDIUM, TIMEZONE_DOC, group, ++orderInGroup, Width.LONG, TIMEZONE_DISPLAY, new PartitionerClassDependentsRecommender()); configDef.define(TIMESTAMP_EXTRACTOR_CLASS_CONFIG, Type.STRING, TIMESTAMP_EXTRACTOR_CLASS_DEFAULT, Importance.MEDIUM, TIMESTAMP_EXTRACTOR_CLASS_DOC, group, ++orderInGroup, Width.LONG, TIMESTAMP_EXTRACTOR_CLASS_DISPLAY); configDef.define(TIMESTAMP_FIELD_NAME_CONFIG, Type.STRING, TIMESTAMP_FIELD_NAME_DEFAULT, Importance.MEDIUM, TIMESTAMP_FIELD_NAME_DOC, group, ++orderInGroup, Width.LONG, TIMESTAMP_FIELD_NAME_DISPLAY); } return configDef; } PartitionerConfig(ConfigDef configDef, Map<String, String> props); static ConfigDef newConfigDef(ConfigDef.Recommender partitionerClassRecommender); @Override Object get(String key); static final String PARTITIONER_CLASS_CONFIG; static final String PARTITIONER_CLASS_DOC; static final Class<?> PARTITIONER_CLASS_DEFAULT; static final String PARTITIONER_CLASS_DISPLAY; static final String PARTITION_FIELD_NAME_CONFIG; static final String PARTITION_FIELD_NAME_DOC; static final String PARTITION_FIELD_NAME_DEFAULT; static final String PARTITION_FIELD_NAME_DISPLAY; static final String PARTITION_DURATION_MS_CONFIG; static final String PARTITION_DURATION_MS_DOC; static final long PARTITION_DURATION_MS_DEFAULT; static final String PARTITION_DURATION_MS_DISPLAY; static final String PATH_FORMAT_CONFIG; static final String PATH_FORMAT_DOC; static final String PATH_FORMAT_DEFAULT; static final String PATH_FORMAT_DISPLAY; static final String LOCALE_CONFIG; static final String LOCALE_DOC; static final String LOCALE_DEFAULT; static final String LOCALE_DISPLAY; static final String TIMEZONE_CONFIG; static final String TIMEZONE_DOC; static final String TIMEZONE_DEFAULT; static final String TIMEZONE_DISPLAY; static final String TIMESTAMP_EXTRACTOR_CLASS_CONFIG; static final String TIMESTAMP_EXTRACTOR_CLASS_DOC; static final String TIMESTAMP_EXTRACTOR_CLASS_DEFAULT; static final String TIMESTAMP_EXTRACTOR_CLASS_DISPLAY; static final String TIMESTAMP_FIELD_NAME_CONFIG; static final String TIMESTAMP_FIELD_NAME_DOC; static final String TIMESTAMP_FIELD_NAME_DEFAULT; static final String TIMESTAMP_FIELD_NAME_DISPLAY; }