use of com.att.aro.core.bestpractice.pojo.BestPracticeType in project VideoOptimzer by attdevsupport.
the class AROServiceImpl method createEmptyResults.
private List<AbstractBestPracticeResult> createEmptyResults() {
List<BestPracticeType> allBP = Arrays.asList(BestPracticeType.values());
List<BestPracticeType> selected = SettingsUtil.retrieveBestPractices();
Function<? super BestPracticeType, ? extends AbstractBestPracticeResult> resMapper = (bp) -> {
AbstractBestPracticeResult res = new AbstractBestPracticeResult() {
@Override
public BestPracticeType getBestPracticeType() {
return bp;
}
};
res.setResultType(BPResultType.NONE);
res.setDetailTitle(res.getBestPracticeType().getDescription());
res.setOverviewTitle(res.getBestPracticeType().getDescription());
return res;
};
List<AbstractBestPracticeResult> results = allBP.stream().filter((bp) -> bp.getCategory() != Category.PRE_PROCESS && !selected.contains(bp)).map(resMapper).collect(Collectors.toList());
return results;
}
use of com.att.aro.core.bestpractice.pojo.BestPracticeType in project VideoOptimzer by attdevsupport.
the class AROServiceImpl method analyze.
/**
* Performs BestPractice tests identified in the requests
* List<BestPracticeType> requests.<br>
* Test results are added to a resultList, ArrayList<IBestPractice>
*
* @param result
* a PacketAnalyzerResult object
* @param requests
* a List of BestPracticeType
* @return ArrayList<IBestPractice> or null if result was null
*/
@Override
public List<AbstractBestPracticeResult> analyze(PacketAnalyzerResult result, List<BestPracticeType> requests) {
if (result == null) {
return null;
}
List<AbstractBestPracticeResult> resultlist = new ArrayList<AbstractBestPracticeResult>();
IBestPractice worker = null;
if (requests.contains(BestPracticeType.USING_CACHE) || requests.contains(BestPracticeType.CACHE_CONTROL) || requests.contains(BestPracticeType.DUPLICATE_CONTENT)) {
this.createCacheAnalysis(result);
}
for (BestPracticeType type : requests) {
worker = getBPWorker(type);
if (worker != null) {
try {
long bpStartTime = System.currentTimeMillis();
resultlist.add(worker.runTest(result));
GoogleAnalyticsUtil.getGoogleAnalyticsInstance().sendAnalyticsTimings(type.getDescription(), System.currentTimeMillis() - bpStartTime, bpTimingsTitle);
} catch (Exception | Error ex) {
LOGGER.error("Error running best practice " + type.getDescription() + " : ", ex);
new Thread(() -> sendExceptiontoGA(type)).start();
}
}
}
for (AbstractBestPracticeResult testresult : resultlist) {
sendGABPResult(testresult);
}
return resultlist;
}
use of com.att.aro.core.bestpractice.pojo.BestPracticeType in project VideoOptimzer by attdevsupport.
the class VideoResultSummary method populateSummary.
private void populateSummary(AROTraceData trace) {
for (AbstractBestPracticeResult bpResult : trace.getBestPracticeResults()) {
if (bpResult.getClass().getName().contains("AROServiceImpl")) {
continue;
}
BestPracticeType bpType = bpResult.getBestPracticeType();
switch(bpType) {
case VIDEO_STALL:
VideoStallResult result = (VideoStallResult) bpResult;
stalls = result.getStallResult();
break;
case NETWORK_COMPARISON:
VideoNetworkComparisonResult ntkResult = (VideoNetworkComparisonResult) bpResult;
ntkComparison = ntkResult.getAvgKbps();
break;
case TCP_CONNECTION:
VideoTcpConnectionResult tcpResult = (VideoTcpConnectionResult) bpResult;
tcpConnection = tcpResult.getTcpConnections();
break;
case BUFFER_OCCUPANCY:
BufferOccupancyResult bufferResult = (BufferOccupancyResult) bpResult;
bufferOccupancy = bufferResult.getMaxBuffer();
populateBufferResult(bufferResult);
break;
case CHUNK_SIZE:
VideoChunkSizeResult segmentSizeResult = (VideoChunkSizeResult) bpResult;
segmentSize = segmentSizeResult.getSegmentSize();
segmentCount = segmentSizeResult.getSegmentCount();
break;
case CHUNK_PACING:
VideoChunkPacingResult segmentPacingResult = (VideoChunkPacingResult) bpResult;
segmentPacing = segmentPacingResult.getChunkPacing();
break;
case VIDEO_REDUNDANCY:
VideoRedundancyResult redundancyResult = (VideoRedundancyResult) bpResult;
duplicate = redundancyResult.getCountDuplicate();
redundancy = redundancyResult.getRedundantPercentage();
break;
case STARTUP_DELAY:
VideoStartUpDelayResult startupDelayResult = (VideoStartUpDelayResult) bpResult;
startUpDelay = startupDelayResult.getStartUpDelay();
break;
case VIDEO_CONCURRENT_SESSION:
VideoConcurrentSessionResult concurrentSessionResult = (VideoConcurrentSessionResult) bpResult;
concurrentSessions = concurrentSessionResult.getMaxConcurrentSessionCount();
break;
default:
break;
}
}
List<Session> allSessions = trace.getAnalyzerResult().getSessionlist();
Map<InetAddress, List<Session>> ipSessionsMap = new HashMap<InetAddress, List<Session>>();
for (Session session : allSessions) {
InetAddress ipAddress = session.getRemoteIP();
if (ipSessionsMap.containsKey(ipAddress)) {
ipSessionsMap.get(ipAddress).add(session);
} else {
List<Session> sess = new ArrayList<Session>();
sess.add(session);
ipSessionsMap.put(ipAddress, sess);
}
}
ipAddress = ipSessionsMap.keySet().size();
ipSessions = allSessions.size();
StreamingVideoData streamingVideoData;
if ((streamingVideoData = trace.getAnalyzerResult().getStreamingVideoData()) == null) {
return;
}
Collection<VideoStream> selectedVideoStreams = streamingVideoData.getVideoStreams();
movieMBytes = calculateMBytes(selectedVideoStreams, false);
totalMBytes = calculateMBytes(selectedVideoStreams, true);
if (trace.getAnalyzerResult().getStreamingVideoData().getStreamingVideoCompiled().getChunkPlayTimeList().isEmpty()) {
startupDelayStatus = false;
} else {
startupDelayStatus = true;
}
}
use of com.att.aro.core.bestpractice.pojo.BestPracticeType in project VideoOptimzer by attdevsupport.
the class AROServiceImplTest method analyzeFileNullTest.
@Test
public void analyzeFileNullTest() 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)));
analyze.setTraceresult(traceresult);
List<BestPracticeType> req = new ArrayList<BestPracticeType>();
req.add(BestPracticeType.UNNECESSARY_CONNECTIONS);
AROTraceData testResult = aro.analyzeFile(req, "traffic.cap");
assertEquals(null, testResult.getBestPracticeResults());
}
use of com.att.aro.core.bestpractice.pojo.BestPracticeType in project VideoOptimzer by attdevsupport.
the class BpDetailItem method refresh.
@Override
public void refresh(AROTraceData model) {
List<AbstractBestPracticeResult> bpResults = model.getBestPracticeResults();
for (AbstractBestPracticeResult bpr : bpResults) {
if (bpr.getBestPracticeType().equals(this.bpType)) {
resultsTextLabel.setText(bpr.getResultText());
imageLabel.setIcon(loadImageIcon(bpr));
if (bpr.getResultType().equals(BPResultType.CONFIG_REQUIRED)) {
addConfigIconActions();
} else {
imageLabel.setToolTipText("");
if (imageLabel.getMouseListeners() != null && imageLabel.getMouseListeners().length > 1) {
imageLabel.setCursor(Cursor.getDefaultCursor());
}
}
BestPracticeType resultType = bpr.getBestPracticeType();
switch(resultType) {
case FILE_COMPRESSION:
if (bpr.getResultType() == BPResultType.NONE)
((BpFileCompressionTablePanel) resultsTablePanel).setData(Collections.emptyList());
else
((BpFileCompressionTablePanel) resultsTablePanel).setData(((FileCompressionResult) bpr).getResults());
return;
case DUPLICATE_CONTENT:
if (bpr.getResultType() == BPResultType.NONE)
((BpFileDuplicateContentTablePanel) resultsTablePanel).setData(Collections.emptyList());
else
((BpFileDuplicateContentTablePanel) resultsTablePanel).setData(((DuplicateContentResult) bpr).getDuplicateContentList());
return;
case IMAGE_SIZE:
if (bpr.getResultType() == BPResultType.NONE || bpr.getResultType() == BPResultType.NO_DATA)
((BpFileImageSizeTablePanel) resultsTablePanel).setData(Collections.emptyList());
else
((BpFileImageSizeTablePanel) resultsTablePanel).setData(((ImageSizeResult) bpr).getResults());
return;
case IMAGE_MDATA:
if (bpr.getResultType() == BPResultType.NONE || bpr.getResultType() == BPResultType.NO_DATA)
((BpFileImageMDataTablePanel) imgMdataResultsTablePanel).setData(Collections.emptyList());
else
((BpFileImageMDataTablePanel) imgMdataResultsTablePanel).setData(((ImageMdtaResult) bpr).getResults());
return;
case IMAGE_CMPRS:
if (bpr.getResultType() == BPResultType.NONE || bpr.getResultType() == BPResultType.NO_DATA)
((BpFileImageCompressionTablePanel) imageCompressionResultsTablePanel).setData(Collections.emptyList());
else
((BpFileImageCompressionTablePanel) imageCompressionResultsTablePanel).setData(((ImageCompressionResult) bpr).getResults());
return;
case IMAGE_FORMAT:
if (bpr.getResultType() == BPResultType.NONE || bpr.getResultType() == BPResultType.NO_DATA)
((BpFileImageFormatTablePanel) imageFormatResultsTablePanel).setData(Collections.emptyList());
else
((BpFileImageFormatTablePanel) imageFormatResultsTablePanel).setData(((ImageFormatResult) bpr).getResults());
return;
case IMAGE_COMPARE:
if (bpr.getResultType() == BPResultType.NONE || bpr.getResultType() == BPResultType.NO_DATA) {
((BpFileImageComparisionTablePanel) imageComparisonResultsTablePanel).setData(Collections.emptyList());
} else {
((BpFileImageComparisionTablePanel) imageComparisonResultsTablePanel).setData(((ImageComparatorResult) bpr).getResults());
}
return;
case MINIFICATION:
if (bpr.getResultType() == BPResultType.NONE)
((BpFileMinificationTablePanel) resultsTablePanel).setData(Collections.emptyList());
else
((BpFileMinificationTablePanel) resultsTablePanel).setData(((MinificationResult) bpr).getMinificationEntryList());
return;
case SPRITEIMAGE:
if (bpr.getResultType() == BPResultType.NONE)
((BpFileSpriteImagesTablePanel) resultsTablePanel).setData(Collections.emptyList());
else
((BpFileSpriteImagesTablePanel) resultsTablePanel).setData(((SpriteImageResult) bpr).getAnalysisResults());
return;
case HTTP_4XX_5XX:
if (bpr.getResultType() == BPResultType.NONE)
((BpConnectionsHttp4xx5xxTablePanel) resultsTablePanel).setData(Collections.emptyList());
else
((BpConnectionsHttp4xx5xxTablePanel) resultsTablePanel).setData(((Http4xx5xxResult) bpr).getHttpResCodelist());
return;
case HTTP_3XX_CODE:
if (bpr.getResultType() == BPResultType.NONE)
((BpConnectionsHttp3xxTablePanel) resultsTablePanel).setData(Collections.emptyList());
else
((BpConnectionsHttp3xxTablePanel) resultsTablePanel).setData(((Http3xxCodeResult) bpr).getHttp3xxResCode());
return;
case ASYNC_CHECK:
if (bpr.getResultType() == BPResultType.NONE)
((BpHtmlAsyncLoadTablePanel) resultsTablePanel).setData(Collections.emptyList());
else {
List<AsyncCheckEntry> res = ((AsyncCheckInScriptResult) bpr).getResults();
((BpHtmlAsyncLoadTablePanel) resultsTablePanel).setData(res);
}
return;
case FILE_ORDER:
if (bpr.getResultType() == BPResultType.NONE)
((BpHtmlFileOrderTablePanel) resultsTablePanel).setData(Collections.emptyList());
else
((BpHtmlFileOrderTablePanel) resultsTablePanel).setData(((FileOrderResult) bpr).getResults());
return;
case DISPLAY_NONE_IN_CSS:
if (bpr.getResultType() == BPResultType.NONE)
((BpHtmlDisplayNoneInCSSTablePanel) resultsTablePanel).setData(Collections.emptyList());
else
((BpHtmlDisplayNoneInCSSTablePanel) resultsTablePanel).setData(((DisplayNoneInCSSResult) bpr).getResults());
return;
case UNNECESSARY_CONNECTIONS:
if (bpr.getResultType() == BPResultType.NONE)
((BpConnectionsUnnecessaryTablePanel) resultsTablePanel).setData(Collections.emptyList());
else
((BpConnectionsUnnecessaryTablePanel) resultsTablePanel).setData(((UnnecessaryConnectionResult) bpr).getTightlyCoupledBurstsDetails());
return;
case HTTPS_USAGE:
if (bpr.getResultType() == BPResultType.NONE)
((BpSecurityHttpsUsageTablePanel) resultsTablePanel).setData(Collections.emptyList());
else
((BpSecurityHttpsUsageTablePanel) resultsTablePanel).setData(((HttpsUsageResult) bpr).getResults());
return;
case TRANSMISSION_PRIVATE_DATA:
if (bpr.getResultType() == BPResultType.NONE) {
((BpSecurityTransmissionPrivateDataTablePanel) resultsTablePanel).setData(Collections.emptyList());
buttonPrivateData.setEnabled(false);
} else {
((BpSecurityTransmissionPrivateDataTablePanel) resultsTablePanel).setData(((TransmissionPrivateDataResult) bpr).getResults());
buttonPrivateData.setEnabled(true);
}
return;
case UNSECURE_SSL_VERSION:
if (bpr.getResultType() == BPResultType.NONE)
((BpSecurityUnsecureSSLVersionTablePanel) resultsTablePanel).setData(Collections.emptyList());
else
((BpSecurityUnsecureSSLVersionTablePanel) resultsTablePanel).setData(((UnsecureSSLVersionResult) bpr).getResults());
return;
case FORWARD_SECRECY:
if (bpr.getResultType() == BPResultType.NONE)
((BpSecurityForwardSecrecyTablePanel) resultsTablePanel).setData(Collections.emptyList());
else
((BpSecurityForwardSecrecyTablePanel) resultsTablePanel).setData(((ForwardSecrecyResult) bpr).getResults());
return;
case SIMUL_CONN:
if (bpr.getResultType() == BPResultType.NONE)
((BPConnectionsSimultnsTablePanel) resultsTablePanel).setData(Collections.emptyList());
else
((BPConnectionsSimultnsTablePanel) resultsTablePanel).setData(((SimultnsConnectionResult) bpr).getResults());
return;
case MULTI_SIMULCONN:
if (bpr.getResultType() == BPResultType.NONE)
((BPConnectionsSimultnsTablePanel) resultsTablePanel).setData(Collections.emptyList());
else
((BPConnectionsSimultnsTablePanel) resultsTablePanel).setData(((MultiSimultnsConnectionResult) bpr).getResults());
return;
case VIDEO_STALL:
if (bpr.getResultType() == BPResultType.NONE || bpr.getResultType() == BPResultType.NO_DATA) {
((BPVideoStallTablePanel) resultsTablePanel).setData(Collections.emptyList());
} else {
((BPVideoStallTablePanel) resultsTablePanel).setData(((VideoStallResult) bpr).getResults());
}
return;
case STARTUP_DELAY:
StartupDelayComparisonPanel startupDelayPanel = (StartupDelayComparisonPanel) resultsChartPanel;
List<VideoStartup> results = Collections.emptyList();
if (bpr.getResultType() != BPResultType.NONE) {
results = ((VideoStartUpDelayResult) bpr).getResults();
}
startupDelayPanel.setData(results);
return;
case VIDEO_ABR_LADDER:
VideoAdaptiveBitrateLadderPanel adaptiveBitrateLadderPanel = (VideoAdaptiveBitrateLadderPanel) resultsChartPanel;
if (bpr.getResultType() == BPResultType.NONE || bpr.getResultType() == BPResultType.NO_DATA) {
adaptiveBitrateLadderPanel.setData(Collections.emptyList());
((BPAdaptiveBitrateTablePanel) resultsTablePanel).setData(Collections.emptyList());
} else {
adaptiveBitrateLadderPanel.setData(((VideoAdaptiveBitrateLadderResult) bpr).getResults());
((BPAdaptiveBitrateTablePanel) resultsTablePanel).setData(((VideoAdaptiveBitrateLadderResult) bpr).getResults());
}
return;
case VIDEO_CONCURRENT_SESSION:
if (bpr.getResultType() == BPResultType.NONE || bpr.getResultType() == BPResultType.NO_DATA) {
((BPVideoConcurrentSessionTablePanel) resultsTablePanel).setData(Collections.emptyList());
} else {
((BPVideoConcurrentSessionTablePanel) resultsTablePanel).setData(((VideoConcurrentSessionResult) bpr).getResults());
}
return;
case NETWORK_COMPARISON:
if (bpr.getResultType() == BPResultType.NONE || bpr.getResultType() == BPResultType.NO_DATA) {
((BPNetworkComparisonTablePanel) resultsTablePanel).setData(Collections.emptyList());
} else {
((BPNetworkComparisonTablePanel) resultsTablePanel).setData(((VideoNetworkComparisonResult) bpr).getResults());
}
return;
default:
return;
}
}
}
}
Aggregations