Search in sources :

Example 11 with FieldValidationRule

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());
}
Also used : FieldValidationRule(com.thinkbiganalytics.policy.rest.model.FieldValidationRule) FieldStandardizationRule(com.thinkbiganalytics.policy.rest.model.FieldStandardizationRule) Test(org.junit.Test)

Example 12 with FieldValidationRule

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());
}
Also used : LengthValidator(com.thinkbiganalytics.policy.validation.LengthValidator) FieldValidationRule(com.thinkbiganalytics.policy.rest.model.FieldValidationRule) Test(org.junit.Test)

Example 13 with FieldValidationRule

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);
}
Also used : FieldValidationRule(com.thinkbiganalytics.policy.rest.model.FieldValidationRule) USPhoneValidator(com.thinkbiganalytics.policy.validation.USPhoneValidator) Test(org.junit.Test)

Example 14 with FieldValidationRule

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);
}
Also used : CreditCardValidator(com.thinkbiganalytics.policy.validation.CreditCardValidator) FieldValidationRule(com.thinkbiganalytics.policy.rest.model.FieldValidationRule) Test(org.junit.Test)

Example 15 with FieldValidationRule

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());
}
Also used : RegexValidator(com.thinkbiganalytics.policy.validation.RegexValidator) FieldValidationRule(com.thinkbiganalytics.policy.rest.model.FieldValidationRule) Test(org.junit.Test)

Aggregations

FieldValidationRule (com.thinkbiganalytics.policy.rest.model.FieldValidationRule)17 Test (org.junit.Test)14 FieldStandardizationRule (com.thinkbiganalytics.policy.rest.model.FieldStandardizationRule)4 ArrayList (java.util.ArrayList)4 FieldRuleProperty (com.thinkbiganalytics.policy.rest.model.FieldRuleProperty)2 RangeValidator (com.thinkbiganalytics.policy.validation.RangeValidator)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 DefaultTag (com.thinkbiganalytics.discovery.model.DefaultTag)1 EntityDifference (com.thinkbiganalytics.feedmgr.rest.model.EntityDifference)1 EntityVersion (com.thinkbiganalytics.feedmgr.rest.model.EntityVersion)1 EntityVersionDifference (com.thinkbiganalytics.feedmgr.rest.model.EntityVersionDifference)1 FeedCategory (com.thinkbiganalytics.feedmgr.rest.model.FeedCategory)1 FeedMetadata (com.thinkbiganalytics.feedmgr.rest.model.FeedMetadata)1 FeedVersions (com.thinkbiganalytics.feedmgr.rest.model.FeedVersions)1 ImportTemplate (com.thinkbiganalytics.feedmgr.service.template.importing.model.ImportTemplate)1 Diff (com.thinkbiganalytics.integration.Diff)1 NifiProperty (com.thinkbiganalytics.nifi.rest.model.NifiProperty)1 BaseUiPolicyRule (com.thinkbiganalytics.policy.rest.model.BaseUiPolicyRule)1