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());
}
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;
}
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());
}
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);
}
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);
}
Aggregations