use of com.thinkbiganalytics.policy.rest.model.FieldValidationRule in project kylo by Teradata.
the class AvailablePoliciesTest method testAvailablePolicies.
@Test
public void testAvailablePolicies() {
List<FieldStandardizationRule> standardizationRules = AvailablePolicies.discoverStandardizationRules();
List<FieldValidationRule> validationRules = AvailablePolicies.discoverValidationRules();
log.info("Available Standardizers: {}, Validators: {} ", standardizationRules.size(), validationRules.size());
Assert.assertTrue(standardizationRules.size() > 0);
Assert.assertTrue(validationRules.size() > 0);
FieldStandardizationRule rule = standardizationRules.get(0);
log.info("First Standardizer is {}", rule);
Assert.assertNotNull(rule.getObjectClassType());
}
use of com.thinkbiganalytics.policy.rest.model.FieldValidationRule in project kylo by Teradata.
the class TestValidationTransformation method testLengthValidator.
@Test
public void testLengthValidator() {
Integer min = 10;
Integer max = 20;
LengthValidator validator = new LengthValidator(min, max);
FieldValidationRule uiModel = ValidatorAnnotationTransformer.instance().toUIModel(validator);
LengthValidator convertedValidator = fromUI(uiModel, LengthValidator.class);
Assert.assertEquals(min.intValue(), convertedValidator.getMinLength());
Assert.assertEquals(max.intValue(), convertedValidator.getMaxLength());
}
use of com.thinkbiganalytics.policy.rest.model.FieldValidationRule in project kylo by Teradata.
the class TestValidationTransformation method testUSPhoneValidator.
@Test
public void testUSPhoneValidator() {
USPhoneValidator validator = USPhoneValidator.instance();
FieldValidationRule uiModel = ValidatorAnnotationTransformer.instance().toUIModel(validator);
USPhoneValidator convertedValidator = fromUI(uiModel, USPhoneValidator.class);
Assert.assertEquals(validator, convertedValidator);
}
use of com.thinkbiganalytics.policy.rest.model.FieldValidationRule in project kylo by Teradata.
the class TestValidationTransformation method testCreditCardValidator.
@Test
public void testCreditCardValidator() {
CreditCardValidator validator = CreditCardValidator.instance();
FieldValidationRule uiModel = ValidatorAnnotationTransformer.instance().toUIModel(validator);
CreditCardValidator convertedValidator = fromUI(uiModel, CreditCardValidator.class);
Assert.assertEquals(validator, convertedValidator);
}
use of com.thinkbiganalytics.policy.rest.model.FieldValidationRule in project kylo by Teradata.
the class TestValidationTransformation method testRegexValidator.
@Test
public void testRegexValidator() {
String regex = ".";
RegexValidator validator = new RegexValidator(regex);
FieldValidationRule uiModel = ValidatorAnnotationTransformer.instance().toUIModel(validator);
RegexValidator convertedValidator = fromUI(uiModel, RegexValidator.class);
Assert.assertEquals(regex, convertedValidator.getRegexExpression());
Assert.assertEquals(regex, convertedValidator.getPattern().pattern());
}
Aggregations