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