@Test public void testCustomValidate() throws InitializationException { TestRunner runner = getTestRunner(DEFAULT_TABLE_NAME, DEFAULT_COLUMN_FAMILY, "1"); getHBaseClientService(runner); runner.assertNotValid(); runner = getTestRunner(DEFAULT_TABLE_NAME, DEFAULT_COLUMN_FAMILY, "1"); getHBaseClientService(runner); runner.setProperty(PutHBaseJSON.ROW_ID, "rowId"); runner.setProperty(PutHBaseJSON.ROW_FIELD_NAME, "rowFieldName"); runner.assertNotValid(); runner = getTestRunner(DEFAULT_TABLE_NAME, DEFAULT_COLUMN_FAMILY, "1"); getHBaseClientService(runner); runner.setProperty(PutHBaseJSON.ROW_FIELD_NAME, "rowFieldName"); runner.assertValid(); runner = getTestRunner(DEFAULT_TABLE_NAME, DEFAULT_COLUMN_FAMILY, "1"); getHBaseClientService(runner); runner.setProperty(PutHBaseJSON.ROW_ID, "rowId"); runner.assertValid(); }
@Override protected Collection<ValidationResult> customValidate(ValidationContext validationContext) { final Collection<ValidationResult> results = new ArrayList<>(); final String rowId = validationContext.getProperty(ROW_ID).getValue(); final String rowFieldName = validationContext.getProperty(ROW_FIELD_NAME).getValue(); if (StringUtils.isBlank(rowId) && StringUtils.isBlank(rowFieldName)) { results.add(new ValidationResult.Builder() .subject(this.getClass().getSimpleName()) .explanation("Row Identifier or Row Identifier Field Name is required") .valid(false) .build()); } else if (!StringUtils.isBlank(rowId) && !StringUtils.isBlank(rowFieldName)) { results.add(new ValidationResult.Builder() .subject(this.getClass().getSimpleName()) .explanation("Row Identifier and Row Identifier Field Name can not be used together") .valid(false) .build()); } return results; }
PutHBaseJSON extends AbstractPutHBase { @Override protected Collection<ValidationResult> customValidate(ValidationContext validationContext) { final Collection<ValidationResult> results = new ArrayList<>(); final String rowId = validationContext.getProperty(ROW_ID).getValue(); final String rowFieldName = validationContext.getProperty(ROW_FIELD_NAME).getValue(); if (StringUtils.isBlank(rowId) && StringUtils.isBlank(rowFieldName)) { results.add(new ValidationResult.Builder() .subject(this.getClass().getSimpleName()) .explanation("Row Identifier or Row Identifier Field Name is required") .valid(false) .build()); } else if (!StringUtils.isBlank(rowId) && !StringUtils.isBlank(rowFieldName)) { results.add(new ValidationResult.Builder() .subject(this.getClass().getSimpleName()) .explanation("Row Identifier and Row Identifier Field Name can not be used together") .valid(false) .build()); } return results; } }
PutHBaseJSON extends AbstractPutHBase { @Override protected Collection<ValidationResult> customValidate(ValidationContext validationContext) { final Collection<ValidationResult> results = new ArrayList<>(); final String rowId = validationContext.getProperty(ROW_ID).getValue(); final String rowFieldName = validationContext.getProperty(ROW_FIELD_NAME).getValue(); if (StringUtils.isBlank(rowId) && StringUtils.isBlank(rowFieldName)) { results.add(new ValidationResult.Builder() .subject(this.getClass().getSimpleName()) .explanation("Row Identifier or Row Identifier Field Name is required") .valid(false) .build()); } else if (!StringUtils.isBlank(rowId) && !StringUtils.isBlank(rowFieldName)) { results.add(new ValidationResult.Builder() .subject(this.getClass().getSimpleName()) .explanation("Row Identifier and Row Identifier Field Name can not be used together") .valid(false) .build()); } return results; }  }
PutHBaseJSON extends AbstractPutHBase { @Override protected Collection<ValidationResult> customValidate(ValidationContext validationContext) { final Collection<ValidationResult> results = new ArrayList<>(); final String rowId = validationContext.getProperty(ROW_ID).getValue(); final String rowFieldName = validationContext.getProperty(ROW_FIELD_NAME).getValue(); if (StringUtils.isBlank(rowId) && StringUtils.isBlank(rowFieldName)) { results.add(new ValidationResult.Builder() .subject(this.getClass().getSimpleName()) .explanation("Row Identifier or Row Identifier Field Name is required") .valid(false) .build()); } else if (!StringUtils.isBlank(rowId) && !StringUtils.isBlank(rowFieldName)) { results.add(new ValidationResult.Builder() .subject(this.getClass().getSimpleName()) .explanation("Row Identifier and Row Identifier Field Name can not be used together") .valid(false) .build()); } return results; }  @Override final List<PropertyDescriptor> getSupportedPropertyDescriptors(); @Override Set<Relationship> getRelationships(); }
PutHBaseJSON extends AbstractPutHBase { @Override protected Collection<ValidationResult> customValidate(ValidationContext validationContext) { final Collection<ValidationResult> results = new ArrayList<>(); final String rowId = validationContext.getProperty(ROW_ID).getValue(); final String rowFieldName = validationContext.getProperty(ROW_FIELD_NAME).getValue(); if (StringUtils.isBlank(rowId) && StringUtils.isBlank(rowFieldName)) { results.add(new ValidationResult.Builder() .subject(this.getClass().getSimpleName()) .explanation("Row Identifier or Row Identifier Field Name is required") .valid(false) .build()); } else if (!StringUtils.isBlank(rowId) && !StringUtils.isBlank(rowFieldName)) { results.add(new ValidationResult.Builder() .subject(this.getClass().getSimpleName()) .explanation("Row Identifier and Row Identifier Field Name can not be used together") .valid(false) .build()); } return results; }  @Override final List<PropertyDescriptor> getSupportedPropertyDescriptors(); @Override Set<Relationship> getRelationships();  }