Search in sources :

Example 1 with SearchingPatternBuilder

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());
}
Also used : SearchingResult(com.att.aro.core.searching.pojo.SearchingResult) SearchingContent(com.att.aro.core.searching.pojo.SearchingContent) SearchingPatternBuilder(com.att.aro.core.searching.pojo.SearchingPatternBuilder) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Example 2 with SearchingPatternBuilder

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));
}
Also used : SearchingResult(com.att.aro.core.searching.pojo.SearchingResult) SearchingContent(com.att.aro.core.searching.pojo.SearchingContent) SearchingPatternBuilder(com.att.aro.core.searching.pojo.SearchingPatternBuilder) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Example 3 with SearchingPatternBuilder

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());
}
Also used : SearchingResult(com.att.aro.core.searching.pojo.SearchingResult) SearchingContent(com.att.aro.core.searching.pojo.SearchingContent) SearchingPatternBuilder(com.att.aro.core.searching.pojo.SearchingPatternBuilder) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Example 4 with SearchingPatternBuilder

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());
}
Also used : SearchingResult(com.att.aro.core.searching.pojo.SearchingResult) SearchingContent(com.att.aro.core.searching.pojo.SearchingContent) SearchingPatternBuilder(com.att.aro.core.searching.pojo.SearchingPatternBuilder) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Example 5 with SearchingPatternBuilder

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();
}
Also used : SearchingPatternBuilder(com.att.aro.core.searching.pojo.SearchingPatternBuilder)

Aggregations

SearchingPatternBuilder (com.att.aro.core.searching.pojo.SearchingPatternBuilder)13 BaseTest (com.att.aro.core.BaseTest)11 SearchingContent (com.att.aro.core.searching.pojo.SearchingContent)11 SearchingResult (com.att.aro.core.searching.pojo.SearchingResult)11 Test (org.junit.Test)11