use of com.att.aro.core.packetanalysis.pojo.Session in project VideoOptimzer by attdevsupport.
the class EmptyUrlImplTest method runTest_resIsFail.
@Test
public void runTest_resIsFail() {
Mockito.when(httpRequestInfo01.getDirection()).thenReturn(HttpDirection.RESPONSE);
Mockito.when(httpRequestInfo01.getContentType()).thenReturn("html");
Mockito.when(httpRequestInfo01.getContentLength()).thenReturn(1);
Mockito.when(httpRequestInfo02.getDirection()).thenReturn(HttpDirection.REQUEST);
Mockito.when(httpRequestInfo02.getContentType()).thenReturn(null);
Mockito.when(httpRequestInfo02.getContentLength()).thenReturn(0);
Mockito.when(httpRequestInfo03.getDirection()).thenReturn(HttpDirection.RESPONSE);
Mockito.when(httpRequestInfo03.getContentType()).thenReturn("html");
Mockito.when(httpRequestInfo03.getContentLength()).thenReturn(2);
Mockito.when(httpRequestInfo04.getDirection()).thenReturn(HttpDirection.RESPONSE);
Mockito.when(httpRequestInfo04.getContentType()).thenReturn("html");
Mockito.when(httpRequestInfo04.getContentLength()).thenReturn(3);
Mockito.when(reqhelper.isHtml(any(String.class))).thenReturn(true);
try {
Mockito.when(reqhelper.getContentString(any(HttpRequestResponseInfo.class), any(Session.class))).thenReturn(htmlString2);
} catch (Exception e) {
e.printStackTrace();
}
List<HttpRequestResponseInfo> value = new ArrayList<HttpRequestResponseInfo>();
value.add(httpRequestInfo01);
value.add(httpRequestInfo02);
value.add(httpRequestInfo03);
value.add(httpRequestInfo04);
Mockito.when(session01.getRequestResponseInfo()).thenReturn(value);
List<Session> sessionList = new ArrayList<Session>();
Mockito.when(session01.getDomainName()).thenReturn("www.google.com");
sessionList.add(session01);
Mockito.when(tracedata.getSessionlist()).thenReturn(sessionList);
emptyUrlImpl.setHttpReqResHelper(reqhelper);
AbstractBestPracticeResult testResult = emptyUrlImpl.runTest(tracedata);
assertEquals(BPResultType.FAIL, testResult.getResultType());
}
use of com.att.aro.core.packetanalysis.pojo.Session in project VideoOptimzer by attdevsupport.
the class FileOrderImplTest method runTest_resultIsFail.
@Test
public void runTest_resultIsFail() {
fileOrderImpl.setHttpRequestResponseHelper(reqhelper);
when(httpRequestResponseInfo01.getDirection()).thenReturn(HttpDirection.RESPONSE);
when(httpRequestResponseInfo01.getContentType()).thenReturn("text/css");
when(httpRequestResponseInfo01.getContentLength()).thenReturn(1);
when(httpRequestResponseInfo01.getObjName()).thenReturn(htmlString2);
when(httpRequestResponseInfo02.getDirection()).thenReturn(HttpDirection.REQUEST);
when(httpRequestResponseInfo02.getContentType()).thenReturn("script");
when(httpRequestResponseInfo02.getContentLength()).thenReturn(2);
when(httpRequestResponseInfo02.getObjName()).thenReturn(htmlString2);
when(httpRequestResponseInfo03.getDirection()).thenReturn(HttpDirection.RESPONSE);
when(httpRequestResponseInfo03.getContentType()).thenReturn("text/css");
when(httpRequestResponseInfo03.getContentLength()).thenReturn(1);
when(httpRequestResponseInfo03.getObjName()).thenReturn(htmlString2);
when(httpRequestResponseInfo04.getDirection()).thenReturn(HttpDirection.RESPONSE);
when(httpRequestResponseInfo04.getContentType()).thenReturn("text/css");
when(httpRequestResponseInfo04.getContentLength()).thenReturn(2);
when(httpRequestResponseInfo04.getObjName()).thenReturn(htmlString);
when(httpRequestResponseInfo05.getDirection()).thenReturn(HttpDirection.RESPONSE);
when(httpRequestResponseInfo05.getContentType()).thenReturn("text/css");
when(httpRequestResponseInfo05.getContentLength()).thenReturn(2);
when(httpRequestResponseInfo05.getObjName()).thenReturn(htmlString);
when(httpRequestResponseInfo06.getDirection()).thenReturn(HttpDirection.RESPONSE);
when(httpRequestResponseInfo06.getContentType()).thenReturn("script");
when(httpRequestResponseInfo06.getContentLength()).thenReturn(4);
when(httpRequestResponseInfo06.getObjName()).thenReturn(htmlString2);
try {
when(reqhelper.isHtml(any(String.class))).thenReturn(true);
when(reqhelper.getContentString(any(HttpRequestResponseInfo.class), any(Session.class))).thenReturn(htmlString2);
} catch (Exception e) {
e.printStackTrace();
}
List<HttpRequestResponseInfo> value = new ArrayList<HttpRequestResponseInfo>();
value.add(httpRequestResponseInfo01);
value.add(httpRequestResponseInfo02);
value.add(httpRequestResponseInfo03);
value.add(httpRequestResponseInfo04);
value.add(httpRequestResponseInfo05);
Mockito.when(session01.getRequestResponseInfo()).thenReturn(value);
List<Session> sessionList = new ArrayList<Session>();
Mockito.when(session01.getDomainName()).thenReturn("www.google.com");
sessionList.add(session01);
Mockito.when(tracedata.getSessionlist()).thenReturn(sessionList);
AbstractBestPracticeResult testResult = fileOrderImpl.runTest(tracedata);
assertEquals(BPResultType.FAIL, testResult.getResultType());
}
use of com.att.aro.core.packetanalysis.pojo.Session in project VideoOptimzer by attdevsupport.
the class FileOrderImplTest method runTest_resultIsPass.
@Test
public void runTest_resultIsPass() {
fileOrderImpl.setHttpRequestResponseHelper(reqhelper);
when(httpRequestResponseInfo01.getDirection()).thenReturn(HttpDirection.RESPONSE);
when(httpRequestResponseInfo01.getContentType()).thenReturn("text/css");
when(httpRequestResponseInfo01.getContentLength()).thenReturn(1);
when(httpRequestResponseInfo02.getDirection()).thenReturn(HttpDirection.REQUEST);
when(httpRequestResponseInfo02.getContentType()).thenReturn("script");
when(httpRequestResponseInfo02.getContentLength()).thenReturn(2);
try {
when(reqhelper.isHtml(any(String.class))).thenReturn(true);
when(reqhelper.getContentString(any(HttpRequestResponseInfo.class), any(Session.class))).thenReturn(htmlString);
} catch (Exception e) {
e.printStackTrace();
}
List<HttpRequestResponseInfo> value = new ArrayList<HttpRequestResponseInfo>();
value.add(httpRequestResponseInfo01);
value.add(httpRequestResponseInfo02);
Mockito.when(session01.getRequestResponseInfo()).thenReturn(value);
List<Session> sessionList = new ArrayList<Session>();
Mockito.when(session01.getDomainName()).thenReturn("www.google.com");
sessionList.add(session01);
Mockito.when(tracedata.getSessionlist()).thenReturn(sessionList);
AbstractBestPracticeResult testResult = fileOrderImpl.runTest(tracedata);
assertEquals(BPResultType.PASS, testResult.getResultType());
}
use of com.att.aro.core.packetanalysis.pojo.Session in project VideoOptimzer by attdevsupport.
the class Http10UsageImplTest method runTest_resTypeIsPass.
@Test
public void runTest_resTypeIsPass() {
Mockito.when(httpRequestInfo01.getVersion()).thenReturn(HttpRequestResponseInfo.HTTP11);
List<HttpRequestResponseInfo> value = new ArrayList<HttpRequestResponseInfo>();
value.add(httpRequestInfo01);
Mockito.when(session01.getRequestResponseInfo()).thenReturn(value);
List<Session> sessionList = new ArrayList<Session>();
sessionList.add(session01);
Mockito.when(tracedata.getSessionlist()).thenReturn(sessionList);
httpUsageImpl = (Http10UsageImpl) context.getBean("http10Usage");
AbstractBestPracticeResult result = httpUsageImpl.runTest(tracedata);
assertEquals(BPResultType.PASS, result.getResultType());
}
use of com.att.aro.core.packetanalysis.pojo.Session in project VideoOptimzer by attdevsupport.
the class Http4xx5xxImplTest method runTest_resTypeIsPass.
@Test
public void runTest_resTypeIsPass() {
Mockito.when(httpRequestInfo01.getDirection()).thenReturn(HttpDirection.RESPONSE);
Mockito.when(httpRequestInfo01.getScheme()).thenReturn(HttpRequestResponseInfo.HTTP_SCHEME);
Mockito.when(httpRequestInfo01.getStatusCode()).thenReturn(200);
Mockito.when(httpRequestInfo02.getDirection()).thenReturn(HttpDirection.REQUEST);
List<HttpRequestResponseInfo> value = new ArrayList<HttpRequestResponseInfo>();
value.add(httpRequestInfo01);
value.add(httpRequestInfo02);
Mockito.when(session01.getRequestResponseInfo()).thenReturn(value);
Mockito.when(session01.getDomainName()).thenReturn("www.google.com");
List<Session> sessionList = new ArrayList<Session>();
sessionList.add(session01);
Mockito.when(tracedata.getSessionlist()).thenReturn(sessionList);
http4xx5xxImpl = (Http4xx5xxImpl) context.getBean("http4xx5xx");
AbstractBestPracticeResult result = http4xx5xxImpl.runTest(tracedata);
assertEquals(BPResultType.PASS, result.getResultType());
}
Aggregations