Search in sources :

Example 11 with SearchingResult

use of com.att.aro.core.searching.pojo.SearchingResult in project VideoOptimzer by attdevsupport.

the class SearchingStrategyTest method testEmptyPattern.

@Test
public void testEmptyPattern() {
    SearchingContent content = new SearchingContent("abcabeabd");
    SearchingPatternBuilder patternBuilder = new SearchingPatternBuilder();
    patternBuilder.add("", null);
    SearchingResult result = searchStrategy.applySearch(patternBuilder.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 12 with SearchingResult

use of com.att.aro.core.searching.pojo.SearchingResult in project VideoOptimzer by attdevsupport.

the class SearchingStrategyTest method testMultiPatternMatchFound.

@Test
public void testMultiPatternMatchFound() {
    SearchingContent content = new SearchingContent("abcde");
    SearchingPatternBuilder patternBuilder = new SearchingPatternBuilder();
    patternBuilder.add("abf", PrivateDataType.regex_credit_card_number.name()).add("bcd", PrivateDataType.regex_credit_card_number.name()).add("def", PrivateDataType.regex_credit_card_number.name());
    SearchingResult result = searchStrategy.applySearch(patternBuilder.build(), content);
    assertNotNull(result);
    assertEquals(1, 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 13 with SearchingResult

use of com.att.aro.core.searching.pojo.SearchingResult in project VideoOptimzer by attdevsupport.

the class SearchingStrategyTest method testMultiPatternMatchNotFound.

@Test
public void testMultiPatternMatchNotFound() {
    SearchingContent content = new SearchingContent("abcde");
    SearchingPatternBuilder patternBuilder = new SearchingPatternBuilder();
    patternBuilder.add("abe", PrivateDataType.regex_credit_card_number.name()).add("bca", PrivateDataType.regex_credit_card_number.name()).add("def", PrivateDataType.regex_credit_card_number.name());
    SearchingResult result = searchStrategy.applySearch(patternBuilder.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 14 with SearchingResult

use of com.att.aro.core.searching.pojo.SearchingResult in project VideoOptimzer by attdevsupport.

the class TransmissionPrivateDataImpl method search.

/**
 * searching method depends on the type of searching handler (exact keyword searching or pattern searching)
 * @param sessions
 * @param handler
 * @param privateDataSet
 * @return
 */
private List<TransmissionPrivateDataEntry> search(List<Session> sessions, ISearchingHandler handler, Map<String, String> privateDataSet) {
    List<TransmissionPrivateDataEntry> entries = new LinkedList<>();
    SearchingPattern pattern = getSearchingPattern(handler, privateDataSet);
    if (pattern.isEmpty()) {
        return entries;
    }
    for (Session session : sessions) {
        SearchingContent content = getContent(session);
        SearchingResult result = handler.search(pattern, content);
        List<String> wordsFound = result.getWords();
        List<String> types = result.getTypes();
        for (int i = 0; i < wordsFound.size(); i++) {
            entries.add(populateEntry(session, wordsFound.get(i), types.get(i)));
        }
    }
    return entries;
}
Also used : TransmissionPrivateDataEntry(com.att.aro.core.bestpractice.pojo.TransmissionPrivateDataEntry) SearchingResult(com.att.aro.core.searching.pojo.SearchingResult) SearchingContent(com.att.aro.core.searching.pojo.SearchingContent) SearchingPattern(com.att.aro.core.searching.pojo.SearchingPattern) LinkedList(java.util.LinkedList) Session(com.att.aro.core.packetanalysis.pojo.Session)

Aggregations

SearchingContent (com.att.aro.core.searching.pojo.SearchingContent)14 SearchingResult (com.att.aro.core.searching.pojo.SearchingResult)14 BaseTest (com.att.aro.core.BaseTest)13 Test (org.junit.Test)13 SearchingPatternBuilder (com.att.aro.core.searching.pojo.SearchingPatternBuilder)11 SearchingPattern (com.att.aro.core.searching.pojo.SearchingPattern)3 TransmissionPrivateDataEntry (com.att.aro.core.bestpractice.pojo.TransmissionPrivateDataEntry)1 Session (com.att.aro.core.packetanalysis.pojo.Session)1 LinkedList (java.util.LinkedList)1