use of com.att.aro.core.bestpractice.pojo.PeriodicTransferResult in project VideoOptimzer by attdevsupport.
the class ARODiagnosticsOverviewRouteImpl method routeHyperlink.
@Override
public void routeHyperlink(BestPracticeType bpType) {
if (bpType.equals(BestPracticeType.DUPLICATE_CONTENT)) {
jtabbedPane.setSelectedIndex(OVERVIEW_INDEX);
} else {
jtabbedPane.setSelectedIndex(DIAGNOSTIC_INDEX);
DiagnosticsTab diagnosticsTab = (DiagnosticsTab) jtabbedPane.getSelectedComponent();
switch(bpType) {
case FILE_COMPRESSION:
{
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof FileCompressionResult) {
// diagnosticsTab.setHighlightedTCP(((FileCompressionResult)result).getConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
// break;
case USING_CACHE:
{
// done
for (AbstractBestPracticeResult result : diagnosticsTab.getAnalyzerResult().getBestPracticeResults()) {
if (result instanceof UsingCacheResult) {
diagnosticsTab.setHighlightedTCP(((UsingCacheResult) result).getNoCacheHeaderFirstPacket().getTimeStamp());
break;
}
}
}
break;
case CACHE_CONTROL:
{
// cant not find cache control start time in
// CacheControlResult
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof CacheControlResult) {
// diagnosticsTab.setHighlightedTCP(((CacheControlResult)result).getConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
case COMBINE_CS_JSS:
{
// done
for (AbstractBestPracticeResult result : diagnosticsTab.getAnalyzerResult().getBestPracticeResults()) {
if (result instanceof CombineCsJssResult) {
diagnosticsTab.setHighlightedTCP(((CombineCsJssResult) result).getConsecutiveCssJsFirstPacket().getTimeStamp());
break;
}
}
}
break;
case IMAGE_SIZE:
{
}
break;
case IMAGE_MDATA:
{
}
break;
case IMAGE_CMPRS:
{
}
break;
case IMAGE_FORMAT:
{
}
break;
case IMAGE_COMPARE:
{
}
break;
case MINIFICATION:
{
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof CombineCsJssResult) {
// diagnosticsTab.setHighlightedTCP(((MinificationResult)result).getConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
case SPRITEIMAGE:
{
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof SpriteImageResult) {
// diagnosticsTab.setHighlightedTCP(((SpriteImageResult)result).getConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
case UNNECESSARY_CONNECTIONS:
{
// to test
for (AbstractBestPracticeResult result : diagnosticsTab.getAnalyzerResult().getBestPracticeResults()) {
if (result instanceof UnnecessaryConnectionResult) {
diagnosticsTab.setHighlightedTCP(((UnnecessaryConnectionResult) result).getTightlyCoupledBurstTime());
break;
}
}
}
break;
case SCRIPTS_URL:
{
// done
for (AbstractBestPracticeResult result : diagnosticsTab.getAnalyzerResult().getBestPracticeResults()) {
if (result instanceof ScriptsResult) {
diagnosticsTab.setHighlightedTCP(((ScriptsResult) result).getFirstFailedHtml());
break;
}
}
}
break;
case SCREEN_ROTATION:
{
}
break;
case SIMUL_CONN:
{
}
break;
case MULTI_SIMULCONN:
{
}
break;
case PERIODIC_TRANSFER:
{
// done
for (AbstractBestPracticeResult result : diagnosticsTab.getAnalyzerResult().getBestPracticeResults()) {
if (result instanceof PeriodicTransferResult) {
diagnosticsTab.setHighlightedTCP(((PeriodicTransferResult) result).getMinimumPeriodicRepeatTime());
break;
}
}
}
break;
case HTTP_4XX_5XX:
{
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof Http4xx5xxResult) {
// diagnosticsTab.setHighlightedTCP(((Http4xx5xxResult)result).getHttpResCodelist()ConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
case HTTP_3XX_CODE:
{
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof Http3xxCodeResult) {
// diagnosticsTab.setHighlightedTCP(((Http3xxCodeResult)result).getFirstResMap()ConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
case HTTP_1_0_USAGE:
{
// done
for (AbstractBestPracticeResult result : diagnosticsTab.getAnalyzerResult().getBestPracticeResults()) {
if (result instanceof Http10UsageResult) {
diagnosticsTab.setHighlightedTCP(((Http10UsageResult) result).getHttp10Session());
break;
}
}
}
break;
case FILE_ORDER:
{
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof FileOrderResult) {
// diagnosticsTab.setHighlightedTCP(((FileOrderResult)result).getConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
case EMPTY_URL:
{
// done
for (AbstractBestPracticeResult result : diagnosticsTab.getAnalyzerResult().getBestPracticeResults()) {
if (result instanceof EmptyUrlResult) {
diagnosticsTab.setHighlightedTCP(((EmptyUrlResult) result).getFirstFailedHtml());
break;
}
}
}
break;
case DISPLAY_NONE_IN_CSS:
{
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof DisplayNoneInCSSResult) {
// diagnosticsTab.setHighlightedTCP(((DisplayNoneInCSSResult)result).getConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
case CONNECTION_OPENING:
{
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof ConnectionOpeningResult) {
// diagnosticsTab.setHighlightedTCP(((ConnectionOpeningResult)result).getConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
case CONNECTION_CLOSING:
{
// done
for (AbstractBestPracticeResult result : diagnosticsTab.getAnalyzerResult().getBestPracticeResults()) {
if (result instanceof ConnectionClosingResult) {
diagnosticsTab.setHighlightedTCP(((ConnectionClosingResult) result).getLargestEnergyTime());
break;
}
}
}
break;
case ASYNC_CHECK:
{
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof AsyncCheckInScriptResult) {
// diagnosticsTab.setHighlightedTCP(((AsyncCheckInScriptResult)result).getConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
case ACCESSING_PERIPHERALS:
{
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof AccessingPeripheralResult) {
// diagnosticsTab.setHighlightedTCP(((AccessingPeripheralResult)result).getConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
default:
break;
}
// switch
}
}
use of com.att.aro.core.bestpractice.pojo.PeriodicTransferResult 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);
}
use of com.att.aro.core.bestpractice.pojo.PeriodicTransferResult in project VideoOptimzer by attdevsupport.
the class PeriodicTransferImpl method runTest.
@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
// logger.info("PeriodicTransferImpl start");
periodicCount = 0;
diffPeriodicCount = 0;
minimumPeriodicRepeatTime = 0.0;
PeriodicTransferResult result = new PeriodicTransferResult();
// logger.info("run diagnosisPeriodicRequest");
diagnosisPeriodicRequest(tracedata.getSessionlist(), tracedata.getBurstCollectionAnalysisData().getBurstCollection(), tracedata.getProfile());
// logger.info("run calculatePeriodicRequestTime");
calculatePeriodicRepeatTime(tracedata.getBurstCollectionAnalysisData().getBurstCollection());
if (this.minimumPeriodicRepeatTime == 0.0) {
result.setResultType(BPResultType.PASS);
result.setResultText(textResultPass);
result.setResultExcelText(BPResultType.PASS.getDescription());
} else {
result.setResultType(BPResultType.FAIL);
String text = MessageFormat.format(diffPeriodicCount > 1 ? this.textResults : this.textResult, this.diffPeriodicCount, this.periodicCount, this.minimumPeriodicRepeatTime);
result.setResultText(text);
// TODO: Fix verbiage
result.setResultExcelText(MessageFormat.format(textExcelResults, BPResultType.FAIL.getDescription(), diffPeriodicCount, periodicCount, minimumPeriodicRepeatTime));
}
result.setDiffPeriodicCount(diffPeriodicCount);
result.setPeriodicCount(periodicCount);
result.setMinimumPeriodicRepeatTime(minimumPeriodicRepeatTime);
result.setAboutText(aboutText);
result.setDetailTitle(detailTitle);
result.setLearnMoreUrl(learnMoreUrl);
result.setOverviewTitle(overviewTitle);
result.setSelfTest(false);
result.setExportAllIneffConnDesc(exportAllIneffConnDesc);
result.setExportAllIneffConnRptDesc(exportAllIneffConnRptDesc);
result.setExportAllIneffConnTimeDesc(exportAllIneffConnTimeDesc);
return result;
}
use of com.att.aro.core.bestpractice.pojo.PeriodicTransferResult in project VideoOptimzer by attdevsupport.
the class AROServiceImplTest method analyzeFileTest.
@Test
public void analyzeFileTest() throws IOException {
PacketAnalyzerResult analyze = new PacketAnalyzerResult();
TraceFileResult traceresult = new TraceFileResult();
List<PacketInfo> allpackets = new ArrayList<PacketInfo>();
allpackets.add(new PacketInfo(new Packet(0, 0, 0, 0, null)));
traceresult.setAllpackets(allpackets);
analyze.setTraceresult(traceresult);
PeriodicTransferResult periodicTransferResult = new PeriodicTransferResult();
List<BestPracticeType> req = new ArrayList<BestPracticeType>();
req.add(BestPracticeType.UNNECESSARY_CONNECTIONS);
req.add(BestPracticeType.CONNECTION_CLOSING);
req.add(BestPracticeType.CONNECTION_OPENING);
req.add(BestPracticeType.PERIODIC_TRANSFER);
req.add(BestPracticeType.SCREEN_ROTATION);
req.add(BestPracticeType.ACCESSING_PERIPHERALS);
req.add(BestPracticeType.COMBINE_CS_JSS);
req.add(BestPracticeType.HTTP_1_0_USAGE);
req.add(BestPracticeType.CACHE_CONTROL);
req.add(BestPracticeType.USING_CACHE);
req.add(BestPracticeType.DUPLICATE_CONTENT);
req.add(BestPracticeType.HTTP_4XX_5XX);
req.add(BestPracticeType.HTTP_3XX_CODE);
req.add(BestPracticeType.FILE_COMPRESSION);
req.add(BestPracticeType.IMAGE_SIZE);
req.add(BestPracticeType.MINIFICATION);
req.add(BestPracticeType.EMPTY_URL);
req.add(BestPracticeType.SPRITEIMAGE);
req.add(BestPracticeType.SCRIPTS_URL);
req.add(BestPracticeType.ASYNC_CHECK);
req.add(BestPracticeType.DISPLAY_NONE_IN_CSS);
req.add(BestPracticeType.FILE_ORDER);
req.add(BestPracticeType.MULTI_SIMULCONN);
req.add(BestPracticeType.VIDEO_STALL);
req.add(BestPracticeType.STARTUP_DELAY);
req.add(BestPracticeType.BUFFER_OCCUPANCY);
req.add(BestPracticeType.NETWORK_COMPARISON);
req.add(BestPracticeType.TCP_CONNECTION);
req.add(BestPracticeType.CHUNK_SIZE);
req.add(BestPracticeType.CHUNK_PACING);
req.add(BestPracticeType.VIDEO_REDUNDANCY);
req.add(BestPracticeType.VIDEO_CONCURRENT_SESSION);
req.add(BestPracticeType.VIDEO_VARIABLE_BITRATE);
req.add(BestPracticeType.HTTPS_USAGE);
req.add(BestPracticeType.TRANSMISSION_PRIVATE_DATA);
req.add(BestPracticeType.DISPLAY_NONE_IN_CSS);
packetanalyzer = Mockito.mock(IPacketAnalyzer.class);
aro.setPacketAnalyzer(packetanalyzer);
when(packetanalyzer.analyzeTraceFile(any(String.class), any(Profile.class), any(AnalysisFilter.class))).thenReturn(analyze);
when(worker.runTest(any(PacketAnalyzerResult.class))).thenReturn(periodicTransferResult);
List<BestPracticeType> list = SettingsUtil.retrieveBestPractices();
SettingsUtil.saveBestPractices(req);
try {
AROTraceData testResult = aro.analyzeFile(req, "traffic.cap");
assertEquals(TOTAL_BPTESTS, testResult.getBestPracticeResults().size());
} finally {
SettingsUtil.saveBestPractices(list);
}
}
use of com.att.aro.core.bestpractice.pojo.PeriodicTransferResult in project VideoOptimzer by attdevsupport.
the class AROServiceImplTest method analyzeDirectoryTest.
@Test
public void analyzeDirectoryTest() throws IOException {
TraceDirectoryResult traceresult = new TraceDirectoryResult();
List<PacketInfo> allpackets = new ArrayList<PacketInfo>();
allpackets.add(new PacketInfo(new Packet(0, 0, 0, 0, null)));
traceresult.setAllpackets(allpackets);
PacketAnalyzerResult analyze = new PacketAnalyzerResult();
analyze.setTraceresult(traceresult);
CacheAnalysis cacheAnalysis = new CacheAnalysis();
PeriodicTransferResult periodicTransferResult = new PeriodicTransferResult();
List<BestPracticeType> req = new ArrayList<BestPracticeType>();
req.add(BestPracticeType.UNNECESSARY_CONNECTIONS);
req.add(BestPracticeType.CONNECTION_CLOSING);
req.add(BestPracticeType.CONNECTION_OPENING);
req.add(BestPracticeType.PERIODIC_TRANSFER);
req.add(BestPracticeType.SCREEN_ROTATION);
req.add(BestPracticeType.ACCESSING_PERIPHERALS);
req.add(BestPracticeType.COMBINE_CS_JSS);
req.add(BestPracticeType.HTTP_1_0_USAGE);
req.add(BestPracticeType.CACHE_CONTROL);
req.add(BestPracticeType.USING_CACHE);
req.add(BestPracticeType.DUPLICATE_CONTENT);
req.add(BestPracticeType.HTTP_4XX_5XX);
req.add(BestPracticeType.HTTP_3XX_CODE);
req.add(BestPracticeType.FILE_COMPRESSION);
req.add(BestPracticeType.IMAGE_SIZE);
req.add(BestPracticeType.MINIFICATION);
req.add(BestPracticeType.EMPTY_URL);
req.add(BestPracticeType.SPRITEIMAGE);
req.add(BestPracticeType.SCRIPTS_URL);
req.add(BestPracticeType.ASYNC_CHECK);
req.add(BestPracticeType.DISPLAY_NONE_IN_CSS);
req.add(BestPracticeType.FILE_ORDER);
req.add(BestPracticeType.VIDEO_STALL);
req.add(BestPracticeType.STARTUP_DELAY);
req.add(BestPracticeType.BUFFER_OCCUPANCY);
req.add(BestPracticeType.NETWORK_COMPARISON);
req.add(BestPracticeType.TCP_CONNECTION);
req.add(BestPracticeType.CHUNK_SIZE);
req.add(BestPracticeType.CHUNK_PACING);
req.add(BestPracticeType.VIDEO_REDUNDANCY);
req.add(BestPracticeType.VIDEO_VARIABLE_BITRATE);
req.add(BestPracticeType.HTTPS_USAGE);
req.add(BestPracticeType.TRANSMISSION_PRIVATE_DATA);
req.add(BestPracticeType.DISPLAY_NONE_IN_CSS);
req.add(BestPracticeType.VIDEO_CONCURRENT_SESSION);
req.add(BestPracticeType.AUDIO_STREAM);
req.add(BestPracticeType.MULTI_SIMULCONN);
List<BestPracticeType> list = SettingsUtil.retrieveBestPractices();
SettingsUtil.saveBestPractices(req);
when(packetanalyzer.analyzeTraceDirectory(any(String.class), any(Profile.class), any(AnalysisFilter.class))).thenReturn(analyze);
when(worker.runTest(any(PacketAnalyzerResult.class))).thenReturn(periodicTransferResult);
when(cacheAnalyzer.analyze(anyListOf(Session.class))).thenReturn(cacheAnalysis);
try {
AROTraceData testResult = aro.analyzeDirectory(req, Util.getCurrentRunningDir());
assertEquals(null, testResult.getBestPracticeResults());
} finally {
SettingsUtil.saveBestPractices(list);
}
}
Aggregations