use of com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult in project VideoOptimzer by attdevsupport.
the class DisplayNoneInCSSImplTest method runTest_ResultIsFail.
@Test
public void runTest_ResultIsFail() {
Mockito.when(httpRequestInfo01.getDirection()).thenReturn(HttpDirection.RESPONSE);
Mockito.when(httpRequestInfo01.getContentType()).thenReturn("text/html");
Mockito.when(httpRequestInfo01.getContentLength()).thenReturn(1);
Mockito.when(httpRequestInfo01.getAssocReqResp()).thenReturn(httpRequestInfo01);
Mockito.when(httpRequestInfo01.getObjName()).thenReturn(htmlString);
Mockito.when(httpRequestInfo02.getDirection()).thenReturn(HttpDirection.REQUEST);
Mockito.when(httpRequestInfo02.getContentType()).thenReturn("");
Mockito.when(httpRequestInfo02.getContentLength()).thenReturn(2);
Mockito.when(httpRequestInfo02.getObjName()).thenReturn(htmlString);
Mockito.when(httpRequestInfo02.getAssocReqResp()).thenReturn(httpRequestInfo02);
Mockito.when(httpRequestInfo03.getDirection()).thenReturn(HttpDirection.RESPONSE);
Mockito.when(httpRequestInfo03.getContentType()).thenReturn("text/html");
Mockito.when(httpRequestInfo03.getContentLength()).thenReturn(1);
Mockito.when(httpRequestInfo03.getObjName()).thenReturn(htmlString);
Mockito.when(httpRequestInfo03.getAssocReqResp()).thenReturn(httpRequestInfo03);
Mockito.when(httpRequestInfo04.getDirection()).thenReturn(HttpDirection.RESPONSE);
Mockito.when(httpRequestInfo04.getContentType()).thenReturn("text/html");
Mockito.when(httpRequestInfo04.getContentLength()).thenReturn(2);
Mockito.when(httpRequestInfo04.getObjName()).thenReturn(htmlString);
Mockito.when(httpRequestInfo04.getAssocReqResp()).thenReturn(httpRequestInfo04);
Mockito.when(httpRequestInfo05.getDirection()).thenReturn(HttpDirection.RESPONSE);
Mockito.when(httpRequestInfo05.getContentType()).thenReturn("text/css");
Mockito.when(httpRequestInfo05.getContentLength()).thenReturn(2);
Mockito.when(httpRequestInfo05.getObjName()).thenReturn(htmlString);
Mockito.when(httpRequestInfo05.getAssocReqResp()).thenReturn(httpRequestInfo04);
displayNoneInCSSImpl.setHttpRequestResponseHelper(reqhelper);
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);
value.add(httpRequestInfo05);
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 = displayNoneInCSSImpl.runTest(tracedata);
assertEquals(BPResultType.FAIL, testResult.getResultType());
}
use of com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult in project VideoOptimzer by attdevsupport.
the class DisplayNoneInCSSImplTest method runTest_ResultIsPass.
@Test
public void runTest_ResultIsPass() {
Mockito.when(httpRequestInfo06.getDirection()).thenReturn(HttpDirection.RESPONSE);
Mockito.when(httpRequestInfo06.getContentType()).thenReturn("text/html");
Mockito.when(httpRequestInfo06.getContentLength()).thenReturn(1);
Mockito.when(httpRequestInfo06.getAssocReqResp()).thenReturn(httpRequestInfo01);
Mockito.when(httpRequestInfo06.getObjName()).thenReturn(htmlString);
displayNoneInCSSImpl.setHttpRequestResponseHelper(reqhelper);
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(httpRequestInfo06);
Mockito.when(session03.getRequestResponseInfo()).thenReturn(value);
List<Session> sessionList = new ArrayList<Session>();
Mockito.when(session03.getDomainName()).thenReturn("www.google.com");
sessionList.add(session03);
Mockito.when(tracedata.getSessionlist()).thenReturn(sessionList);
AbstractBestPracticeResult testResult = displayNoneInCSSImpl.runTest(tracedata);
assertEquals(BPResultType.PASS, testResult.getResultType());
}
use of com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult in project VideoOptimzer by attdevsupport.
the class VideoChunksPlot method refreshBPVideoResults.
private AROTraceData refreshBPVideoResults(AROTraceData model, AbstractBestPracticeResult bpResult, AbstractBestPracticeResult stallBPResult, AbstractBestPracticeResult bufferOccupancyBPResult) {
removeList.clear();
AROTraceData trace = model;
for (AbstractBestPracticeResult bp : model.getBestPracticeResults()) {
if (bp.getBestPracticeType() == BestPracticeType.STARTUP_DELAY) {
updateAbstractBestPracticeParameters(bp, bpResult, model.getBestPracticeResults().indexOf(bp));
} else if (stallBPResult != null && bp.getBestPracticeType() == BestPracticeType.VIDEO_STALL) {
updateAbstractBestPracticeParameters(bp, stallBPResult, model.getBestPracticeResults().indexOf(bp));
} else if (bufferOccupancyBPResult != null && bp.getBestPracticeType() == BestPracticeType.BUFFER_OCCUPANCY) {
updateAbstractBestPracticeParameters(bp, bufferOccupancyBPResult, model.getBestPracticeResults().indexOf(bp));
}
}
if (!removeList.isEmpty()) {
for (int index : removeList.keySet()) {
AbstractBestPracticeResult bp = removeList.get(index);
trace.getBestPracticeResults().remove(bp);
AbstractBestPracticeResult result = null;
if (bp.getBestPracticeType() == BestPracticeType.STARTUP_DELAY) {
result = bpResult;
} else if (bp.getBestPracticeType() == BestPracticeType.VIDEO_STALL) {
result = stallBPResult;
} else if (bp.getBestPracticeType() == BestPracticeType.BUFFER_OCCUPANCY) {
result = bufferOccupancyBPResult;
}
trace.getBestPracticeResults().add(index, result);
}
}
return trace;
}
use of com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult in project VideoOptimzer by attdevsupport.
the class ConnectionStatisticsChartPanel method generateDataForChart.
private ConnectionStatisticsInfo generateDataForChart() {
ConnectionStatisticsInfo connectionStatisticsPojo = new ConnectionStatisticsInfo();
double sessionTermPct = 0.0;
int longBurstCount = 0;
if (traceDataModel != null && traceDataModel.getAnalyzerResult() != null) {
int termSessions = 0;
int properTermSessions = 0;
for (Session tcpSession : traceDataModel.getAnalyzerResult().getSessionlist()) {
if (!tcpSession.isUdpOnly()) {
Termination termination = tcpSession.getSessionTermination();
if (termination != null) {
++termSessions;
if (termination.getSessionTerminationDelay() <= SESSION_TERMINATION_THRESHOLD) {
++properTermSessions;
}
}
}
}
if (termSessions > 0) {
sessionTermPct = 100.0 * properTermSessions / termSessions;
}
longBurstCount = traceDataModel.getAnalyzerResult().getBurstCollectionAnalysisData().getLongBurstCount();
}
connectionStatisticsPojo.setSessionTermPct(sessionTermPct);
double tightlyCoupledTCPPct = 0.0;
if (traceDataModel != null && traceDataModel.getAnalyzerResult() != null) {
int burstSize = traceDataModel.getAnalyzerResult().getBurstCollectionAnalysisData().getBurstCollection().size();
int periodicBurstCount = 0;
for (Burst burstInfo : traceDataModel.getAnalyzerResult().getBurstCollectionAnalysisData().getBurstCollection()) {
BurstCategory bCategory = burstInfo.getBurstCategory();
if (bCategory == BurstCategory.PERIODICAL) {
periodicBurstCount += 1;
}
}
double nonPeriodicBurstPct = 100 - 100.0 * periodicBurstCount / burstSize;
connectionStatisticsPojo.setNonPeriodicBurstPct(nonPeriodicBurstPct);
int tightlyCoupledBurstCount = 0;
for (AbstractBestPracticeResult abstractResult : traceDataModel.getBestPracticeResults()) {
if (abstractResult.getBestPracticeType().equals(BestPracticeType.UNNECESSARY_CONNECTIONS) && abstractResult.getResultType() != BPResultType.NONE) {
UnnecessaryConnectionResult unnecessaryConnt = (UnnecessaryConnectionResult) abstractResult;
tightlyCoupledBurstCount = unnecessaryConnt.getTightlyCoupledBurstCount();
}
}
tightlyCoupledTCPPct = 100.0 * tightlyCoupledBurstCount / burstSize;
connectionStatisticsPojo.setTightlyCoupledTCPPct(tightlyCoupledTCPPct);
double longBurstPct = 0.0;
longBurstPct = 100.0 * longBurstCount / burstSize;
connectionStatisticsPojo.setLongBurstPct(longBurstPct);
}
return connectionStatisticsPojo;
}
use of com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult in project VideoOptimzer by attdevsupport.
the class HtmlReportImplTest method reportGenerator_retunrIsTrue.
@Test
@Ignore
public void reportGenerator_retunrIsTrue() {
AccessingPeripheralResult access = new AccessingPeripheralResult();
access.setResultType(BPResultType.PASS);
CacheControlResult cache = new CacheControlResult();
cache.setResultType(BPResultType.FAIL);
List<AbstractBestPracticeResult> bpResults = new ArrayList<AbstractBestPracticeResult>();
bpResults.add(access);
bpResults.add(cache);
File tempFile = null;
try {
tempFile = folder.newFile("abc.html");
} catch (IOException e) {
e.printStackTrace();
}
if (tempFile != null) {
tempFile.deleteOnExit();
}
when(filereader.createFile(any(String.class))).thenReturn(tempFile);
AROTraceData results = new AROTraceData();
PacketAnalyzerResult analyzerResult = new PacketAnalyzerResult();
TraceDirectoryResult tracedirresult = new TraceDirectoryResult();
EnergyModel energyModel = new EnergyModel();
Statistic statistic = new Statistic();
statistic.setTotalByte(123);
statistic.setTotalHTTPSByte(123);
tracedirresult.setTraceDirectory("temp.txt");
analyzerResult.setTraceresult(tracedirresult);
analyzerResult.setEnergyModel(energyModel);
analyzerResult.setStatistic(statistic);
results.setAnalyzerResult(analyzerResult);
results.setBestPracticeResults(bpResults);
assertTrue(htmlReportImpl.reportGenerator("abc.html", results));
}
Aggregations