use of com.att.aro.core.bestpractice.pojo.CacheControlResult in project VideoOptimzer by attdevsupport.
the class CacheControlImpl method runTest.
@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
CacheControlResult result = new CacheControlResult();
if (tracedata.getCacheAnalysis() == null) {
return null;
}
int hitNotExpiredDup = 0;
int hitExpired304 = 0;
for (CacheEntry entry : tracedata.getCacheAnalysis().getDiagnosisResults()) {
if (entry.getDiagnosis() == Diagnosis.CACHING_DIAG_NOT_EXPIRED_DUP || entry.getDiagnosis() == Diagnosis.CACHING_DIAG_NOT_EXPIRED_DUP_PARTIALHIT) {
hitNotExpiredDup++;
} else if (entry.getDiagnosis() == Diagnosis.CACHING_DIAG_OBJ_NOT_CHANGED_304) {
hitExpired304++;
}
}
boolean cacheControl = (hitNotExpiredDup > hitExpired304 ? false : true);
if (cacheControl) {
result.setResultType(BPResultType.PASS);
result.setResultText(textResultPass);
result.setResultExcelText(BPResultType.PASS.getDescription());
} else {
// ref. old analyzer give warning in this best practice
result.setResultType(BPResultType.WARNING);
String text = MessageFormat.format(textResults, hitNotExpiredDup, hitExpired304);
result.setResultText(text);
result.setResultExcelText(MessageFormat.format(textExcelResults, BPResultType.WARNING.getDescription(), hitNotExpiredDup, hitExpired304));
}
result.setHitExpired304Count(hitExpired304);
result.setHitNotExpiredDupCount(hitNotExpiredDup);
result.setAboutText(aboutText);
result.setDetailTitle(detailTitle);
result.setLearnMoreUrl(learnMoreUrl);
result.setOverviewTitle(overviewTitle);
result.setExportAllCacheCon304Desc(exportAllCacheCon304Desc);
result.setExportAllCacheConNExpDesc(exportAllCacheConNExpDesc);
return result;
}
use of com.att.aro.core.bestpractice.pojo.CacheControlResult 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));
}
use of com.att.aro.core.bestpractice.pojo.CacheControlResult in project VideoOptimzer by attdevsupport.
the class ApplicationScoreDerived method processDerivedAttributes.
private void processDerivedAttributes(AROTraceData model, ApplicationSampling applicationSampling) {
int topScore = 100;
PacketAnalyzerResult analyzerResults = model.getAnalyzerResult();
List<AbstractBestPracticeResult> bpResults = model.getBestPracticeResults();
List<BurstAnalysisInfo> burstInfo = analyzerResults.getBurstCollectionAnalysisData().getBurstAnalysisInfo();
AbstractRrcStateMachine rrcStateMachine = analyzerResults.getStatemachine();
Statistic statistics = analyzerResults.getStatistic();
int burstInfoSize = burstInfo.size();
// TODO: CONNECTION_CLOSING and USING_CACHE enum types are reversed in model. FIX!
for (AbstractBestPracticeResult result : bpResults) {
if (result instanceof UsingCacheResult) {
UsingCacheResult bpuscaResult = (UsingCacheResult) result;
bpuscaResult.getCacheHeaderRatio();
cacheHeaderControlScore = (int) ((isUsingCache(bpuscaResult) ? topScore : getIndividualScore(bpuscaResult.getCacheHeaderRatio(), 10, 25, 65)) * .75);
} else if (result instanceof ConnectionClosingResult) {
ConnectionClosingResult bpcoclResult = (ConnectionClosingResult) result;
connectionClosingScore = (int) ((bpcoclResult.isConClosingProb() ? topScore : getIndividualScore(bpcoclResult.getTcpControlEnergyRatio() * 100, 5, 20, 50)) * .75);
} else if (result instanceof UnnecessaryConnectionResult) {
UnnecessaryConnectionResult bpunco = (UnnecessaryConnectionResult) result;
bpunco.getTightlyCoupledBurstCount();
int tightlyGroupedBursts = (int) (burstInfoSize > 0 ? 100.0 * bpunco.getTightlyCoupledBurstCount() / burstInfoSize : 0.0);
tightlyGroupedConnectionScore = (int) (tightlyGroupedBursts * 1.50);
} else if (result instanceof PeriodicTransferResult) {
PeriodicTransferResult periodicTransferResult = (PeriodicTransferResult) result;
periodicTransferScore = (int) ((isPeriodicCount(periodicTransferResult) ? topScore : getPeriodicTransferScoreCalculation(periodicTransferResult, burstInfo)) * 1.50);
} else if (result instanceof CacheControlResult) {
CacheControlResult cacheControlResultResult = (CacheControlResult) result;
connectionExpirationScore = (int) ((isCacheControl(cacheControlResultResult) ? topScore : getConnectionExpirationScoreCalculation(cacheControlResultResult)) * .50);
} else if (result instanceof DuplicateContentResult) {
DuplicateContentResult duplicateContentResult = (DuplicateContentResult) result;
duplicateContentScore = (int) ((isDuplicateContent(duplicateContentResult) ? topScore : getDuplicateContentScoreCalculation(duplicateContentResult)) * 1.25);
}
}
double promotionRatio;
double joulesPerKilobyte;
switch(rrcStateMachine.getType()) {
case LTE:
promotionRatio = ((RrcStateMachineLTE) rrcStateMachine).getCRPromotionRatio();
joulesPerKilobyte = ((RrcStateMachineLTE) rrcStateMachine).getJoulesPerKilobyte();
break;
case Type3G:
promotionRatio = ((RrcStateMachine3G) rrcStateMachine).getPromotionRatio();
joulesPerKilobyte = ((RrcStateMachine3G) rrcStateMachine).getJoulesPerKilobyte();
break;
case WiFi:
promotionRatio = 0.0;
joulesPerKilobyte = 0.0;
break;
default:
throw new AROUIPanelException("Undhandled state machine type " + rrcStateMachine.getType().name());
}
signalingOverheadScore = (int) (applicationSampling.getPromoRatioPercentile(promotionRatio) * 1.25);
averageRateScore = (int) (applicationSampling.getThroughputPercentile(statistics.getAverageKbps()) * .625);
energyEfficiencyScore = (int) (ApplicationSampling.getInstance().getJpkbPercentile(joulesPerKilobyte) * 1.875);
}
Aggregations