use of com.att.aro.core.searching.pojo.SearchingPatternBuilder in project VideoOptimzer by attdevsupport.
the class KeywordSearchingHandlerTest method testMultiSearchingPattern.
@Test
public void testMultiSearchingPattern() {
SearchingPatternBuilder patternBuilder = new SearchingPatternBuilder();
patternBuilder.add("abc", PrivateDataType.regex_credit_card_number.name()).add("bcd", PrivateDataType.regex_credit_card_number.name()).add("def", PrivateDataType.regex_credit_card_number.name());
SearchingContent content = new SearchingContent("abcde");
SearchingResult result = searchingHandler.search(patternBuilder.build(), content);
assertNotNull(result);
assertEquals(2, result.getWords().size());
}
use of com.att.aro.core.searching.pojo.SearchingPatternBuilder in project VideoOptimzer by attdevsupport.
the class KeywordSearchingHandlerTest method testSingleSearchingPattern.
@Test
public void testSingleSearchingPattern() {
SearchingPatternBuilder patternBuilder = new SearchingPatternBuilder();
patternBuilder.add("abc", PrivateDataType.regex_credit_card_number.name());
SearchingContent content = new SearchingContent("abcde");
SearchingResult result = searchingHandler.search(patternBuilder.build(), content);
assertNotNull(result);
assertEquals("abc", result.getWords().get(0));
}
use of com.att.aro.core.searching.pojo.SearchingPatternBuilder in project VideoOptimzer by attdevsupport.
the class PatternSearchingHandlerTest method testEmptyContent.
@Test
public void testEmptyContent() {
SearchingPatternBuilder pattenBuilder = new SearchingPatternBuilder();
pattenBuilder.add("\\d{3}[-\\.\\s]\\d{3}[-\\.\\s]\\d{4},-,3,8,-,7,4", PrivateDataType.regex_phone_number.name());
SearchingContent content = new SearchingContent(null);
SearchingResult result = searchingHandler.search(pattenBuilder.build(), content);
assertNotNull(result);
assertEquals(0, result.getWords().size());
}
use of com.att.aro.core.searching.pojo.SearchingPatternBuilder in project VideoOptimzer by attdevsupport.
the class PatternSearchingHandlerTest method testResultNotFound.
@Test
public void testResultNotFound() {
SearchingPatternBuilder pattenBuilder = new SearchingPatternBuilder();
pattenBuilder.add("\\d{3}[-\\.\\s]\\d{3}[-\\.\\s]\\d{4},-,3,8,-,7,4", PrivateDataType.regex_phone_number.name());
String text = "https://www.google.com/login/username=fakeName&password=1234&id=423456-7865";
SearchingContent content = new SearchingContent(text);
SearchingResult result = searchingHandler.search(pattenBuilder.build(), content);
assertNotNull(result);
assertEquals(0, result.getWords().size());
}
use of com.att.aro.core.searching.pojo.SearchingPatternBuilder in project VideoOptimzer by attdevsupport.
the class TransmissionPrivateDataImpl method getRegexPattern.
/**
* get regular expression defined by ARO, such as SSN, Phone Number and Date of Birth
* PLUS
* user defined expression from user setting
*
* @return
*/
private SearchingPattern getRegexPattern(Map<String, String> expressions) {
SearchingPatternBuilder patternBuilder = new SearchingPatternBuilder();
// ARO defined expression (default)
// addRegex(patternBuilder, phoneNumberRegex, PrivateDataType.regex_phone_number.toString());
// addRegex(patternBuilder, dateBirthRegex, PrivateDataType.regex_date_birth.toString());
addRegex(patternBuilder, creditCardAmericanExpress, PrivateDataType.regex_credit_card_number.toString());
addRegex(patternBuilder, creditCardMasterCard, PrivateDataType.regex_credit_card_number.toString());
addRegex(patternBuilder, creditCardDiscover, PrivateDataType.regex_credit_card_number.toString());
addRegex(patternBuilder, creditCardVisa, PrivateDataType.regex_credit_card_number.toString());
if (expressions == null || expressions.isEmpty()) {
return patternBuilder.build();
}
// user defined expression (not implemented yet)
Set<String> keySet = expressions.keySet();
for (String expression : keySet) {
patternBuilder.add(expression, expressions.get(expression));
}
return patternBuilder.build();
}
Aggregations