Search in sources :

Example 6 with FieldStandardizationRule

use of com.thinkbiganalytics.policy.rest.model.FieldStandardizationRule in project kylo by Teradata.

the class TestStandardizationTransform method testSimpleRegexReplacer.

@Test
public void testSimpleRegexReplacer() throws IOException {
    String regex = "\\p{Cc}";
    String replace = "REPLACE";
    SimpleRegexReplacer standardizer = new SimpleRegexReplacer(regex, replace);
    FieldStandardizationRule uiModel = StandardizationAnnotationTransformer.instance().toUIModel(standardizer);
    SimpleRegexReplacer convertedPolicy = fromUI(uiModel, SimpleRegexReplacer.class);
    Assert.assertEquals(regex, convertedPolicy.getPattern().pattern());
    Assert.assertEquals(replace, convertedPolicy.getReplacement());
    Assert.assertEquals(true, convertedPolicy.isValid());
}
Also used : SimpleRegexReplacer(com.thinkbiganalytics.policy.standardization.SimpleRegexReplacer) FieldStandardizationRule(com.thinkbiganalytics.policy.rest.model.FieldStandardizationRule) Test(org.junit.Test)

Example 7 with FieldStandardizationRule

use of com.thinkbiganalytics.policy.rest.model.FieldStandardizationRule in project kylo by Teradata.

the class AvailablePolicies method discoverStandardizationRules.

public static List<FieldStandardizationRule> discoverStandardizationRules() {
    List<FieldStandardizationRule> rules = new ArrayList<>();
    Set<Class<?>> standardizers = ReflectionPolicyAnnotationDiscoverer.getTypesAnnotatedWith(Standardizer.class);
    for (Class c : standardizers) {
        Standardizer standardizer = (Standardizer) c.getAnnotation(Standardizer.class);
        List<FieldRuleProperty> properties = StandardizationAnnotationTransformer.instance().getUiProperties(c);
        rules.add(new FieldStandardizationRuleBuilder(standardizer.name()).description(standardizer.description()).addProperties(properties).objectClassType(c).build());
    }
    return rules;
}
Also used : FieldStandardizationRuleBuilder(com.thinkbiganalytics.policy.rest.model.FieldStandardizationRuleBuilder) ArrayList(java.util.ArrayList) Standardizer(com.thinkbiganalytics.policy.standardization.Standardizer) FieldRuleProperty(com.thinkbiganalytics.policy.rest.model.FieldRuleProperty) FieldStandardizationRule(com.thinkbiganalytics.policy.rest.model.FieldStandardizationRule)

Example 8 with FieldStandardizationRule

use of com.thinkbiganalytics.policy.rest.model.FieldStandardizationRule 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 9 with FieldStandardizationRule

use of com.thinkbiganalytics.policy.rest.model.FieldStandardizationRule in project kylo by Teradata.

the class TestStandardizationTransform method testStripNonNumeric.

@Test
public void testStripNonNumeric() throws IOException {
    StripNonNumeric standardizer = StripNonNumeric.instance();
    FieldStandardizationRule uiModel = StandardizationAnnotationTransformer.instance().toUIModel(standardizer);
    StripNonNumeric convertedPolicy = fromUI(uiModel, StripNonNumeric.class);
    Assert.assertEquals(standardizer, convertedPolicy);
}
Also used : StripNonNumeric(com.thinkbiganalytics.policy.standardization.StripNonNumeric) FieldStandardizationRule(com.thinkbiganalytics.policy.rest.model.FieldStandardizationRule) Test(org.junit.Test)

Example 10 with FieldStandardizationRule

use of com.thinkbiganalytics.policy.rest.model.FieldStandardizationRule in project kylo by Teradata.

the class TestStandardizationTransform method testRemoveControlCharsStandardizer.

@Test
public void testRemoveControlCharsStandardizer() throws IOException {
    RemoveControlCharsStandardizer standardizer = RemoveControlCharsStandardizer.instance();
    FieldStandardizationRule uiModel = StandardizationAnnotationTransformer.instance().toUIModel(standardizer);
    RemoveControlCharsStandardizer convertedPolicy = fromUI(uiModel, RemoveControlCharsStandardizer.class);
    Assert.assertEquals(standardizer, convertedPolicy);
}
Also used : RemoveControlCharsStandardizer(com.thinkbiganalytics.policy.standardization.RemoveControlCharsStandardizer) FieldStandardizationRule(com.thinkbiganalytics.policy.rest.model.FieldStandardizationRule) Test(org.junit.Test)

Aggregations

FieldStandardizationRule (com.thinkbiganalytics.policy.rest.model.FieldStandardizationRule)14 Test (org.junit.Test)11 FieldValidationRule (com.thinkbiganalytics.policy.rest.model.FieldValidationRule)4 DefaultValueStandardizer (com.thinkbiganalytics.policy.standardization.DefaultValueStandardizer)3 ArrayList (java.util.ArrayList)3 DateTimeStandardizer (com.thinkbiganalytics.policy.standardization.DateTimeStandardizer)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 PredicateImpl (com.thinkbiganalytics.guava.PredicateImpl)1 Diff (com.thinkbiganalytics.integration.Diff)1 NifiProperty (com.thinkbiganalytics.nifi.rest.model.NifiProperty)1