use of com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo in project VideoOptimzer by attdevsupport.
the class Http3xxCodeImplTest method runTest_resTypeIsFail.
@Test
public void runTest_resTypeIsFail() {
Mockito.when(httpRequestInfo01.getDirection()).thenReturn(HttpDirection.RESPONSE);
Mockito.when(httpRequestInfo01.getScheme()).thenReturn(HttpRequestResponseInfo.HTTP_SCHEME);
Mockito.when(httpRequestInfo01.getStatusCode()).thenReturn(304);
Mockito.when(httpRequestInfo01.getObjName()).thenReturn("");
Mockito.when(httpRequestInfo02.getDirection()).thenReturn(HttpDirection.REQUEST);
Mockito.when(httpRequestInfo02.getObjName()).thenReturn("");
Mockito.when(httpRequestInfo03.getDirection()).thenReturn(HttpDirection.RESPONSE);
Mockito.when(httpRequestInfo03.getScheme()).thenReturn(HttpRequestResponseInfo.HTTP_SCHEME);
Mockito.when(httpRequestInfo03.getStatusCode()).thenReturn(304);
Mockito.when(httpRequestInfo03.getObjName()).thenReturn("");
Mockito.when(httpRequestInfo04.getDirection()).thenReturn(HttpDirection.REQUEST);
Mockito.when(httpRequestInfo04.getObjName()).thenReturn("");
List<HttpRequestResponseInfo> value = new ArrayList<HttpRequestResponseInfo>();
value.add(httpRequestInfo01);
value.add(httpRequestInfo02);
value.add(httpRequestInfo03);
value.add(httpRequestInfo04);
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);
http3xxCodeImpl = (Http3xxCodeImpl) context.getBean("http3xx");
AbstractBestPracticeResult result = http3xxCodeImpl.runTest(tracedata);
assertEquals(BPResultType.FAIL, result.getResultType());
}
use of com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo in project VideoOptimzer by attdevsupport.
the class EmptyUrlImplTest method getContentStringIsNullThrowException.
@Test
public void getContentStringIsNullThrowException() throws Exception {
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);
Mockito.when(reqhelper.getContentString(any(HttpRequestResponseInfo.class), any(Session.class))).thenThrow(new Exception());
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.PASS, testResult.getResultType());
}
use of com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo 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.HttpRequestResponseInfo 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.HttpRequestResponseInfo 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());
}
Aggregations