use of com.att.aro.core.searching.pojo.SearchingContent 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.SearchingContent in project VideoOptimzer by attdevsupport.
the class TransmissionPrivateDataImpl method getContent.
/**
* get content string from given session
* @param session
* @return
*/
private SearchingContent getContent(Session session) {
String str = "";
ByteArrayOutputStream data = new ByteArrayOutputStream();
BufferedOutputStream dataWrapper = new BufferedOutputStream(data);
try {
for (HttpRequestResponseInfo rrInfo : session.getRequestResponseInfo()) {
if (rrInfo.getDirection() == HttpDirection.REQUEST) {
dataWrapper.write(rrInfo.getPayloadData().toByteArray());
}
}
dataWrapper.flush();
} catch (IOException e) {
LOGGER.error("Error extracting content from Session: " + session.getSessionKey());
}
str = Util.byteArrayToString(data.toByteArray());
return new SearchingContent(str);
}
use of com.att.aro.core.searching.pojo.SearchingContent in project VideoOptimzer by attdevsupport.
the class PatternSearchingHandlerTest method testResultFound.
@Test
public void testResultFound() {
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&phone=443-237-7431";
SearchingContent content = new SearchingContent(text);
SearchingResult result = searchingHandler.search(pattenBuilder.build(), content);
assertNotNull(result);
assertEquals(1, result.getWords().size());
assertEquals("443-237-7431", result.getWords().get(0));
}
use of com.att.aro.core.searching.pojo.SearchingContent in project VideoOptimzer by attdevsupport.
the class SearchingStrategyTest method testSinglePatternMatchFound.
@Test
public void testSinglePatternMatchFound() {
SearchingContent content = new SearchingContent("abcabeabd");
SearchingPatternBuilder patternBuilder = new SearchingPatternBuilder();
patternBuilder.add("abe", PrivateDataType.regex_credit_card_number.name());
SearchingResult result = searchStrategy.applySearch(patternBuilder.build(), content);
assertNotNull(result);
assertEquals(1, result.getWords().size());
assertEquals("abe", result.getWords().get(0));
}
use of com.att.aro.core.searching.pojo.SearchingContent in project VideoOptimzer by attdevsupport.
the class SearchingStrategyTest method testEmptyContent.
@Test
public void testEmptyContent() {
SearchingContent content = new SearchingContent("");
SearchingPatternBuilder patternBuilder = new SearchingPatternBuilder();
patternBuilder.add("abc", PrivateDataType.regex_credit_card_number.name());
SearchingResult result = searchStrategy.applySearch(patternBuilder.build(), content);
assertNotNull(result);
assertEquals(0, result.getWords().size());
}
Aggregations