use of com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult in project VideoOptimzer by attdevsupport.
the class AsyncCheckInScriptImplTest method runTest_resIsFailSync.
@Test
public void runTest_resIsFailSync() {
Mockito.when(httpRequestInfo01.getDirection()).thenReturn(HttpDirection.RESPONSE);
Mockito.when(httpRequestInfo01.getContentType()).thenReturn("abc");
Mockito.when(httpRequestInfo01.getContentLength()).thenReturn(1);
Mockito.when(httpRequestInfo02.getDirection()).thenReturn(HttpDirection.REQUEST);
Mockito.when(httpRequestInfo03.getDirection()).thenReturn(HttpDirection.RESPONSE);
Mockito.when(httpRequestInfo04.getDirection()).thenReturn(HttpDirection.RESPONSE);
Mockito.when(reqhelper.isHtml(any(String.class))).thenReturn(true);
try {
Mockito.when(reqhelper.getContentString(any(HttpRequestResponseInfo.class), any(Session.class))).thenReturn(htmlString);
} 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);
asyncCheckScriptImpl.setHttpRequestResponseHelper(reqhelper);
AbstractBestPracticeResult testResult = asyncCheckScriptImpl.runTest(tracedata);
assertEquals(BPResultType.FAIL, testResult.getResultType());
}
use of com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult in project VideoOptimzer by attdevsupport.
the class AsyncCheckInScriptImplTest method runTest_resThrowException.
@Test
public void runTest_resThrowException() throws Exception {
Mockito.when(httpRequestInfo01.getDirection()).thenReturn(HttpDirection.RESPONSE);
Mockito.when(httpRequestInfo01.getContentType()).thenReturn("abc");
Mockito.when(httpRequestInfo01.getContentLength()).thenReturn(1);
Mockito.when(httpRequestInfo02.getDirection()).thenReturn(HttpDirection.REQUEST);
Mockito.when(httpRequestInfo03.getDirection()).thenReturn(HttpDirection.RESPONSE);
Mockito.when(httpRequestInfo04.getDirection()).thenReturn(HttpDirection.RESPONSE);
Mockito.when(reqhelper.isHtml(any(String.class))).thenReturn(true);
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);
asyncCheckScriptImpl.setHttpRequestResponseHelper(reqhelper);
try {
Mockito.when(reqhelper.getContentString(any(HttpRequestResponseInfo.class), any(Session.class))).thenThrow(new Exception());
} catch (Exception e) {
e.printStackTrace();
}
asyncCheckScriptImpl.setHttpRequestResponseHelper(reqhelper);
AbstractBestPracticeResult testResult = asyncCheckScriptImpl.runTest(tracedata);
assertEquals(BPResultType.PASS, testResult.getResultType());
}
use of com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult in project VideoOptimzer by attdevsupport.
the class CombineCsJssImplTest method runTest_resIsNoErrResultTypeIsFail.
@Test
public void runTest_resIsNoErrResultTypeIsFail() {
Mockito.when(pktInfo01.getTimeStamp()).thenReturn(1.0);
Mockito.when(pktInfo02.getTimeStamp()).thenReturn(2.0);
httpRequestInfo01 = Mockito.mock(HttpRequestResponseInfo.class);
Mockito.when(httpRequestInfo01.getDirection()).thenReturn(HttpDirection.RESPONSE);
Mockito.when(httpRequestInfo01.getContentType()).thenReturn("text/css");
Mockito.when(httpRequestInfo01.getFirstDataPacket()).thenReturn(pktInfo01);
Mockito.when(httpRequestInfo01.getObjName()).thenReturn("test1.css");
httpRequestInfo02 = Mockito.mock(HttpRequestResponseInfo.class);
Mockito.when(httpRequestInfo02.getDirection()).thenReturn(HttpDirection.RESPONSE);
Mockito.when(httpRequestInfo02.getContentType()).thenReturn("text/javascript");
Mockito.when(httpRequestInfo02.getFirstDataPacket()).thenReturn(pktInfo02);
List<HttpRequestResponseInfo> value = new ArrayList<HttpRequestResponseInfo>();
value.add(httpRequestInfo01);
value.add(httpRequestInfo02);
Mockito.when(session01.getRequestResponseInfo()).thenReturn(value);
Mockito.when(session02.getRequestResponseInfo()).thenReturn(value);
List<Session> sessionList = new ArrayList<Session>();
sessionList.add(session01);
sessionList.add(session02);
Mockito.when(tracedata.getSessionlist()).thenReturn(sessionList);
csjsImpl = (CombineCsJssImpl) context.getBean("combineCsJss");
AbstractBestPracticeResult result = csjsImpl.runTest(tracedata);
assertEquals(BPResultType.FAIL, result.getResultType());
}
use of com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult in project VideoOptimzer by attdevsupport.
the class CombineCsJssImplTest method runTest_resIsNoErrResultTypeIsFailConsCssJsFirstPacket.
@Test
public void runTest_resIsNoErrResultTypeIsFailConsCssJsFirstPacket() {
Mockito.when(pktInfo01.getTimeStamp()).thenReturn(1.0);
Mockito.when(pktInfo02.getTimeStamp()).thenReturn(2.0);
httpRequestInfo01 = Mockito.mock(HttpRequestResponseInfo.class);
Mockito.when(httpRequestInfo01.getDirection()).thenReturn(HttpDirection.RESPONSE);
Mockito.when(httpRequestInfo01.getContentType()).thenReturn("text/javascript");
Mockito.when(httpRequestInfo01.getFirstDataPacket()).thenReturn(pktInfo01);
Mockito.when(httpRequestInfo01.getObjName()).thenReturn("test2.css");
httpRequestInfo02 = Mockito.mock(HttpRequestResponseInfo.class);
Mockito.when(httpRequestInfo02.getDirection()).thenReturn(HttpDirection.RESPONSE);
Mockito.when(httpRequestInfo02.getContentType()).thenReturn("application/x-javascript");
Mockito.when(httpRequestInfo02.getFirstDataPacket()).thenReturn(pktInfo02);
Mockito.when(httpRequestInfo02.getObjName()).thenReturn("test3.css");
List<HttpRequestResponseInfo> value = new ArrayList<HttpRequestResponseInfo>();
value.add(httpRequestInfo01);
value.add(httpRequestInfo02);
Mockito.when(session01.getRequestResponseInfo()).thenReturn(value);
Mockito.when(session02.getRequestResponseInfo()).thenReturn(value);
List<Session> sessionList = new ArrayList<Session>();
sessionList.add(session01);
sessionList.add(session02);
Mockito.when(tracedata.getSessionlist()).thenReturn(sessionList);
csjsImpl = (CombineCsJssImpl) context.getBean("combineCsJss");
AbstractBestPracticeResult result = csjsImpl.runTest(tracedata);
assertEquals(BPResultType.FAIL, result.getResultType());
}
use of com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult in project VideoOptimzer by attdevsupport.
the class ConnectionOpeningImplTest method runTest_resIsNoError.
@Test
public void runTest_resIsNoError() {
tracedata = Mockito.mock(PacketAnalyzerResult.class);
connOpenImpl = (ConnectionOpeningImpl) context.getBean("connectionOpening");
AbstractBestPracticeResult result = connOpenImpl.runTest(tracedata);
assertEquals(result.getResultType(), BPResultType.SELF_TEST);
}
Aggregations