@Test public void testCustomValidate() throws Exception { testRunner.setProperty(AbstractCassandraProcessor.CONTACT_POINTS, ""); testRunner.assertNotValid(); testRunner.setProperty(AbstractCassandraProcessor.CONTACT_POINTS, "localhost"); testRunner.assertNotValid(); testRunner.setProperty(AbstractCassandraProcessor.CONTACT_POINTS, "localhost:9042"); testRunner.assertValid(); testRunner.setProperty(AbstractCassandraProcessor.CONTACT_POINTS, "localhost:9042, node2: 4399"); testRunner.assertValid(); testRunner.setProperty(AbstractCassandraProcessor.CONTACT_POINTS, " localhost : 9042, node2: 4399"); testRunner.assertValid(); testRunner.setProperty(AbstractCassandraProcessor.CONTACT_POINTS, "localhost:9042, node2"); testRunner.assertNotValid(); testRunner.setProperty(AbstractCassandraProcessor.CONTACT_POINTS, "localhost:65536"); testRunner.assertNotValid(); testRunner.setProperty(AbstractCassandraProcessor.CONTACT_POINTS, "localhost:9042"); testRunner.setProperty(AbstractCassandraProcessor.USERNAME, "user"); testRunner.assertNotValid(); testRunner.setProperty(AbstractCassandraProcessor.PASSWORD, "password"); testRunner.assertValid(); }
@Override protected Collection<ValidationResult> customValidate(ValidationContext validationContext) { Set<ValidationResult> results = new HashSet<>(); Map<PropertyDescriptor, String> propertyMap = validationContext.getProperties(); if (StringUtils.isEmpty(propertyMap.get(USERNAME)) != StringUtils.isEmpty(propertyMap.get(PASSWORD))) { results.add(new ValidationResult.Builder().valid(false).explanation( "If username or password is specified, then the other must be specified as well").build()); } return results; }
AbstractCassandraProcessor extends AbstractProcessor { @Override protected Collection<ValidationResult> customValidate(ValidationContext validationContext) { Set<ValidationResult> results = new HashSet<>(); Map<PropertyDescriptor, String> propertyMap = validationContext.getProperties(); if (StringUtils.isEmpty(propertyMap.get(USERNAME)) != StringUtils.isEmpty(propertyMap.get(PASSWORD))) { results.add(new ValidationResult.Builder().valid(false).explanation( "If username or password is specified, then the other must be specified as well").build()); } return results; } }
AbstractCassandraProcessor extends AbstractProcessor { @Override protected Collection<ValidationResult> customValidate(ValidationContext validationContext) { Set<ValidationResult> results = new HashSet<>(); Map<PropertyDescriptor, String> propertyMap = validationContext.getProperties(); if (StringUtils.isEmpty(propertyMap.get(USERNAME)) != StringUtils.isEmpty(propertyMap.get(PASSWORD))) { results.add(new ValidationResult.Builder().valid(false).explanation( "If username or password is specified, then the other must be specified as well").build()); } return results; }  }
AbstractCassandraProcessor extends AbstractProcessor { @Override protected Collection<ValidationResult> customValidate(ValidationContext validationContext) { Set<ValidationResult> results = new HashSet<>(); Map<PropertyDescriptor, String> propertyMap = validationContext.getProperties(); if (StringUtils.isEmpty(propertyMap.get(USERNAME)) != StringUtils.isEmpty(propertyMap.get(PASSWORD))) { results.add(new ValidationResult.Builder().valid(false).explanation( "If username or password is specified, then the other must be specified as well").build()); } return results; }  void stop(); static Schema getUnionFieldType(String dataType); static Schema getSchemaForType(String dataType); static String getPrimitiveAvroTypeFromCassandraType(DataType dataType); static DataType getPrimitiveDataTypeFromString(String dataTypeName); List<InetSocketAddress> getContactPoints(String contactPointList); }
AbstractCassandraProcessor extends AbstractProcessor { @Override protected Collection<ValidationResult> customValidate(ValidationContext validationContext) { Set<ValidationResult> results = new HashSet<>(); Map<PropertyDescriptor, String> propertyMap = validationContext.getProperties(); if (StringUtils.isEmpty(propertyMap.get(USERNAME)) != StringUtils.isEmpty(propertyMap.get(PASSWORD))) { results.add(new ValidationResult.Builder().valid(false).explanation( "If username or password is specified, then the other must be specified as well").build()); } return results; }  void stop(); static Schema getUnionFieldType(String dataType); static Schema getSchemaForType(String dataType); static String getPrimitiveAvroTypeFromCassandraType(DataType dataType); static DataType getPrimitiveDataTypeFromString(String dataTypeName); List<InetSocketAddress> getContactPoints(String contactPointList); static final int DEFAULT_CASSANDRA_PORT; static final PropertyDescriptor CONTACT_POINTS; static final PropertyDescriptor KEYSPACE; static final PropertyDescriptor PROP_SSL_CONTEXT_SERVICE; static final PropertyDescriptor CLIENT_AUTH; static final PropertyDescriptor USERNAME; static final PropertyDescriptor PASSWORD; static final PropertyDescriptor CONSISTENCY_LEVEL; static final PropertyDescriptor CHARSET; }