CliRunSupport extends CliSupport { protected Group createSourceGroup() { GroupBuilder group = newGroupBuilder().withName(getMessage(SOURCE_GROUP_NAME)).withRequired(true) .withMinimum(1); OptionFormat optionFormat = new OptionFormat(getOptionFormat()); optionFormat.setValuesSeparator(null); Option driver = newBasicOptionBuilder().withName(SOURCE_DRIVER) .withDescription(getMessage(SOURCE_DRIVER_OPTION_DESCRIPTION)).withRequired(true) .withArgument(newArgumentBuilder().withName(getMessage(SOURCE_DRIVER_ARGUMENT_NAME)).withRequired(true) .withMinimum(1).withOptionFormat(optionFormat).build()) .build(); group.withOption(driver); Option url = newBasicOptionBuilder().withName(SOURCE_URL) .withDescription(getMessage(SOURCE_URL_OPTION_DESCRIPTION)).withRequired(true) .withArgument(newArgumentBuilder().withName(getMessage(SOURCE_URL_ARGUMENT_NAME)).withRequired(true) .withMinimum(1).withOptionFormat(optionFormat).build()) .build(); group.withOption(url); Option username = newBasicOptionBuilder().withName(SOURCE_USERNAME) .withDescription(getMessage(SOURCE_USERNAME_OPTION_DESCRIPTION)).withArgument(newArgumentBuilder() .withName(getMessage(SOURCE_USERNAME_ARGUMENT_NAME)).withOptionFormat(optionFormat).build()) .build(); group.withOption(username); Option password = newBasicOptionBuilder().withName(SOURCE_PASSWORD) .withDescription(getMessage(SOURCE_PASSWORD_OPTION_DESCRIPTION)) .withRequired(false) .withArgument(newArgumentBuilder() .withName(getMessage(SOURCE_PASSWORD_ARGUMENT_NAME)).withOptionFormat(optionFormat).build()) .withOptionProcessor(sourcePasswordOptionProcessor) .build(); group.withOption(password); Option properties = newBasicOptionBuilder().withName(SOURCE_PROPERTIES) .withDescription(getMessage(SOURCE_PROPERTIES_OPTION_DESCRIPTION)) .withArgument(newArgumentBuilder().withName(getMessage(SOURCE_PROPERTIES_ARGUMENT_NAME)).build()) .build(); group.withOption(properties); Option catalog = newBasicOptionBuilder().withName(SOURCE_CATALOG) .withDescription(getMessage(SOURCE_CATALOG_OPTION_DESCRIPTION)).withArgument(newArgumentBuilder() .withName(getMessage(SOURCE_CATALOG_ARGUMENT_NAME)).withOptionFormat(optionFormat).build()) .build(); group.withOption(catalog); Option schema = newBasicOptionBuilder().withName(SOURCE_SCHEMA) .withDescription(getMessage(SOURCE_SCHEMA_OPTION_DESCRIPTION)).withArgument(newArgumentBuilder() .withName(getMessage(SOURCE_SCHEMA_ARGUMENT_NAME)).withOptionFormat(optionFormat).build()) .build(); group.withOption(schema); Option autoCommit = newBasicOptionBuilder().withName(SOURCE_AUTO_COMMIT) .withDescription(getMessage(SOURCE_AUTO_COMMIT_OPTION_DESCRIPTION)).withArgument(newArgumentBuilder() .withName(getMessage(SOURCE_AUTO_COMMIT_ARGUMENT_NAME)).withOptionFormat(optionFormat).build()) .build(); group.withOption(autoCommit); Option transactionIsolation = newBasicOptionBuilder().withName(SOURCE_TRANSACTION_ISOLATION) .withDescription(getMessage(SOURCE_TRANSACTION_ISOLATION_OPTION_DESCRIPTION)) .withArgument(newArgumentBuilder().withName(getMessage(SOURCE_TRANSACTION_ISOLATION_ARGUMENT_NAME)) .withOptionFormat(optionFormat).build()) .build(); group.withOption(transactionIsolation); addConnectionGroupValidators(group, new ConnectionGroupInfo(SOURCE_DRIVER, SOURCE_URL, SOURCE_USERNAME, SOURCE_PASSWORD, SOURCE_CATALOG, SOURCE_SCHEMA, SOURCE_PROPERTIES, SOURCE_TRANSACTION_ISOLATION)); return group.build(); }  TimeZone getDefaultTimeZone(); void setDefaultTimeZone(TimeZone defaultTimeZone); static final TimeZone DEFAULT_TIME_ZONE; }
@Test(dataProvider = "sourceGroupValidation", expectedExceptions = OptionException.class) public void testSourceGroupValidation(String[] arguments, String exception) { Group group = cliRunSupport.createSourceGroup(); parser.parse(arguments, group); fail(exception); }