Search in sources :

Example 11 with AbstractBestPracticeResult

use of com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult in project VideoOptimzer by attdevsupport.

the class UsingCacheImplTest method runTest_.

@Test
public void runTest_() {
    List<CacheEntry> diagnosisResults = new ArrayList<CacheEntry>();
    Mockito.when(entryArray[0].getDiagnosis()).thenReturn(Diagnosis.CACHING_DIAG_REQUEST_NOT_FOUND);
    Mockito.when(entryArray[1].getDiagnosis()).thenReturn(Diagnosis.CACHING_DIAG_INVALID_OBJ_NAME);
    Mockito.when(entryArray[2].getDiagnosis()).thenReturn(Diagnosis.CACHING_DIAG_INVALID_REQUEST);
    Mockito.when(entryArray[3].getDiagnosis()).thenReturn(Diagnosis.CACHING_DIAG_INVALID_RESPONSE);
    for (int i = 0; i < 4; i++) {
        diagnosisResults.add(entryArray[i]);
    }
    Mockito.when(cacheAnalysis.getDiagnosisResults()).thenReturn(diagnosisResults);
    Mockito.when(tracedata.getCacheAnalysis()).thenReturn(cacheAnalysis);
    AbstractBestPracticeResult testResult = usingCacheImpl.runTest(tracedata);
    assertEquals(BPResultType.PASS, testResult.getResultType());
}
Also used : ArrayList(java.util.ArrayList) AbstractBestPracticeResult(com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult) CacheEntry(com.att.aro.core.packetanalysis.pojo.CacheEntry) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Example 12 with AbstractBestPracticeResult

use of com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult 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
    }
}
Also used : UnnecessaryConnectionResult(com.att.aro.core.bestpractice.pojo.UnnecessaryConnectionResult) ConnectionClosingResult(com.att.aro.core.bestpractice.pojo.ConnectionClosingResult) Http10UsageResult(com.att.aro.core.bestpractice.pojo.Http10UsageResult) PeriodicTransferResult(com.att.aro.core.bestpractice.pojo.PeriodicTransferResult) AbstractBestPracticeResult(com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult) ScriptsResult(com.att.aro.core.bestpractice.pojo.ScriptsResult) CombineCsJssResult(com.att.aro.core.bestpractice.pojo.CombineCsJssResult) DiagnosticsTab(com.att.aro.ui.view.diagnostictab.DiagnosticsTab) EmptyUrlResult(com.att.aro.core.bestpractice.pojo.EmptyUrlResult) UsingCacheResult(com.att.aro.core.bestpractice.pojo.UsingCacheResult)

Example 13 with AbstractBestPracticeResult

use of com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult 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;
            }
        }
    }
}
Also used : AsyncCheckEntry(com.att.aro.core.bestpractice.pojo.AsyncCheckEntry) UnsecureSSLVersionResult(com.att.aro.core.bestpractice.pojo.UnsecureSSLVersionResult) ImageFormatResult(com.att.aro.core.bestpractice.pojo.ImageFormatResult) AbstractBestPracticeResult(com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult) BestPracticeType(com.att.aro.core.bestpractice.pojo.BestPracticeType) ImageSizeResult(com.att.aro.core.bestpractice.pojo.ImageSizeResult) DisplayNoneInCSSResult(com.att.aro.core.bestpractice.pojo.DisplayNoneInCSSResult) UnnecessaryConnectionResult(com.att.aro.core.bestpractice.pojo.UnnecessaryConnectionResult) MultiSimultnsConnectionResult(com.att.aro.core.bestpractice.pojo.MultiSimultnsConnectionResult) SimultnsConnectionResult(com.att.aro.core.bestpractice.pojo.SimultnsConnectionResult) VideoStartup(com.att.aro.core.videoanalysis.pojo.VideoStartup) Http3xxCodeResult(com.att.aro.core.bestpractice.pojo.Http3xxCodeResult) HttpsUsageResult(com.att.aro.core.bestpractice.pojo.HttpsUsageResult) MinificationResult(com.att.aro.core.bestpractice.pojo.MinificationResult) SpriteImageResult(com.att.aro.core.bestpractice.pojo.SpriteImageResult) ForwardSecrecyResult(com.att.aro.core.bestpractice.pojo.ForwardSecrecyResult) FileOrderResult(com.att.aro.core.bestpractice.pojo.FileOrderResult) AsyncCheckInScriptResult(com.att.aro.core.bestpractice.pojo.AsyncCheckInScriptResult) FileCompressionResult(com.att.aro.core.bestpractice.pojo.FileCompressionResult) DuplicateContentResult(com.att.aro.core.bestpractice.pojo.DuplicateContentResult) Http4xx5xxResult(com.att.aro.core.bestpractice.pojo.Http4xx5xxResult) MultiSimultnsConnectionResult(com.att.aro.core.bestpractice.pojo.MultiSimultnsConnectionResult) ImageCompressionResult(com.att.aro.core.bestpractice.pojo.ImageCompressionResult) ImageMdtaResult(com.att.aro.core.bestpractice.pojo.ImageMdtaResult)

Example 14 with AbstractBestPracticeResult

use of com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult in project VideoOptimzer by attdevsupport.

the class MultipleSimultnsConnImpl method runTest.

@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult traceData) {
    traceDataResult = traceData;
    MultiSimultnsConnectionResult result = new MultiSimultnsConnectionResult();
    simultnsConnectionAllServersEntryList = new ArrayList<MultipleConnectionsEntry>();
    simultnsConnectionAllServersEntryMap = new TreeMap<Double, MultipleConnectionsEntry>();
    populateAllSimultConnList();
    for (Map.Entry<Double, MultipleConnectionsEntry> simultnsConnAllServersEntryMap : simultnsConnectionAllServersEntryMap.entrySet()) {
        if (simultnsConnAllServersEntryMap.getValue() != null) {
            simultnsConnectionAllServersEntryList.add(simultnsConnAllServersEntryMap.getValue());
        }
    }
    result.setResults(simultnsConnectionAllServersEntryList);
    String text = "";
    if (simultnsConnectionAllServersEntryList.isEmpty()) {
        result.setResultType(BPResultType.PASS);
        text = MessageFormat.format(textResultPass, simultnsConnectionAllServersEntryList.size());
        result.setResultText(text);
        result.setResultExcelText(BPResultType.PASS.getDescription());
    } else {
        result.setResultType(BPResultType.FAIL);
        result.setResultText(textResults);
        // TODO: Validate conditional statement
        result.setResultExcelText(MessageFormat.format(textExcelResults, BPResultType.FAIL.getDescription(), simultnsConnectionAllServersEntryList.parallelStream().mapToInt(x -> x.getConcurrentSessions()).sum(), (simultnsConnectionAllServersEntryList.size() > 1 ? "s" : "")));
    }
    result.setAboutText(aboutText);
    result.setDetailTitle(detailTitle);
    result.setLearnMoreUrl(learnMoreUrl);
    result.setOverviewTitle(overviewTitle);
    return result;
}
Also used : BPResultType(com.att.aro.core.bestpractice.pojo.BPResultType) MultiSimultnsConnectionResult(com.att.aro.core.bestpractice.pojo.MultiSimultnsConnectionResult) Session(com.att.aro.core.packetanalysis.pojo.Session) SessionValues(com.att.aro.core.packetanalysis.pojo.SessionValues) MessageFormat(java.text.MessageFormat) ArrayList(java.util.ArrayList) Value(org.springframework.beans.factory.annotation.Value) AbstractBestPracticeResult(com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult) List(java.util.List) TreeMap(java.util.TreeMap) SimultnsUtil(com.att.aro.core.bestpractice.pojo.SimultnsUtil) IBestPractice(com.att.aro.core.bestpractice.IBestPractice) MultipleConnectionsEntry(com.att.aro.core.bestpractice.pojo.MultipleConnectionsEntry) Map(java.util.Map) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) Collections(java.util.Collections) SortedMap(java.util.SortedMap) MultipleConnectionsEntry(com.att.aro.core.bestpractice.pojo.MultipleConnectionsEntry) MultiSimultnsConnectionResult(com.att.aro.core.bestpractice.pojo.MultiSimultnsConnectionResult) TreeMap(java.util.TreeMap) Map(java.util.Map) SortedMap(java.util.SortedMap)

Example 15 with AbstractBestPracticeResult

use of com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult in project VideoOptimzer by attdevsupport.

the class VideoBufferOccupancyImpl method runTest.

@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
    result = new BufferOccupancyResult();
    init(result);
    if ((streamingVideoData = tracedata.getStreamingVideoData()) != null && (videoStreamCollection = streamingVideoData.getVideoStreamMap()) != null && MapUtils.isNotEmpty(videoStreamCollection)) {
        bpResultType = BPResultType.CONFIG_REQUIRED;
        result.setResultExcelText(bpResultType.getDescription());
        selectedManifestCount = streamingVideoData.getSelectedManifestCount();
        hasSelectedManifest = (selectedManifestCount > 0);
        invalidCount = streamingVideoData.getInvalidManifestCount();
        if (selectedManifestCount == 0) {
            if (invalidCount == videoStreamCollection.size()) {
                result.setResultText(invalidManifestsFound);
            } else if (invalidCount > 0) {
                result.setResultText(noManifestsSelectedMixed);
            } else {
                result.setResultText(noManifestsSelected);
            }
        } else if (selectedManifestCount > 1) {
            result.setResultText(multipleManifestsSelected);
        } else if (hasSelectedManifest) {
            BufferOccupancyBPResult bufferBPResult = tracedata.getBufferOccupancyResult();
            BufferTimeBPResult bufferTimeBPResult = tracedata.getBufferTimeResult();
            double maxBufferInMB = 0;
            if (bufferBPResult != null && bufferBPResult.getBufferByteDataSet().size() > 0) {
                double megabyteDivisor = 1000 * 1000;
                // getMaxBuffer() returns in bytes
                maxBufferInMB = bufferBPResult.getMaxBuffer() / megabyteDivisor;
                List<Double> bufferDataSet = bufferBPResult.getBufferByteDataSet();
                // In MB
                result.setMinBufferByte(bufferDataSet.get(0) / megabyteDivisor);
                double bufferSum = bufferDataSet.stream().reduce((a, b) -> a + b).get();
                result.setAvgBufferByte((bufferSum / bufferDataSet.size()) / megabyteDivisor);
            } else {
                maxBufferInMB = 0;
            }
            if (bufferTimeBPResult != null && bufferTimeBPResult.getBufferTimeDataSet().size() > 0) {
                List<Double> bufferTimeDataSet = bufferTimeBPResult.getBufferTimeDataSet();
                result.setMinBufferTime(bufferTimeDataSet.get(0));
                result.setMaxBufferTime(bufferTimeDataSet.get(bufferTimeDataSet.size() - 1));
                double sum = bufferTimeDataSet.stream().reduce((a, b) -> a + b).get();
                result.setAvgBufferTime(sum / bufferTimeDataSet.size());
            }
            result.setSelfTest(true);
            result.setMaxBuffer(maxBufferInMB);
            double percentage = 0;
            double maxBufferSet = getVideoPrefMaxBuffer();
            if (maxBufferSet != 0) {
                percentage = (maxBufferInMB / maxBufferSet) * 100;
            }
            if (MapUtils.isEmpty(streamingVideoData.getStreamingVideoCompiled().getChunkPlayTimeList())) {
                result.setResultText(startUpDelayNotSet);
                bpResultType = BPResultType.CONFIG_REQUIRED;
            } else {
                if (percentage > 100) {
                    bpResultType = BPResultType.WARNING;
                }
                bpResultType = BPResultType.PASS;
                result.setResultText(MessageFormat.format(this.textResults, String.format("%.2f", percentage), String.format("%.2f", maxBufferInMB), String.format("%.2f", maxBufferSet)));
                result.setResultExcelText(MessageFormat.format(textExcelResults, bpResultType.getDescription(), String.format("%.2f", percentage), String.format("%.2f", maxBufferInMB)));
            }
        }
    } else {
        result.setSelfTest(false);
        result.setResultText(noData);
        bpResultType = BPResultType.NO_DATA;
        result.setResultExcelText(bpResultType.getDescription());
    }
    result.setResultType(bpResultType);
    return result;
}
Also used : BPResultType(com.att.aro.core.bestpractice.pojo.BPResultType) Setter(lombok.Setter) BufferOccupancyResult(com.att.aro.core.bestpractice.pojo.BufferOccupancyResult) Getter(lombok.Getter) MapUtils(org.apache.commons.collections.MapUtils) BufferOccupancyBPResult(com.att.aro.core.packetanalysis.pojo.BufferOccupancyBPResult) NonNull(lombok.NonNull) Autowired(org.springframework.beans.factory.annotation.Autowired) BufferTimeBPResult(com.att.aro.core.packetanalysis.pojo.BufferTimeBPResult) MessageFormat(java.text.MessageFormat) Value(org.springframework.beans.factory.annotation.Value) AbstractBestPracticeResult(com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) List(java.util.List) StreamingVideoData(com.att.aro.core.videoanalysis.pojo.StreamingVideoData) AccessLevel(lombok.AccessLevel) TreeMap(java.util.TreeMap) IBestPractice(com.att.aro.core.bestpractice.IBestPractice) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) IVideoUsagePrefsManager(com.att.aro.core.videoanalysis.IVideoUsagePrefsManager) Nonnull(javax.annotation.Nonnull) SortedMap(java.util.SortedMap) BufferOccupancyBPResult(com.att.aro.core.packetanalysis.pojo.BufferOccupancyBPResult) BufferOccupancyResult(com.att.aro.core.bestpractice.pojo.BufferOccupancyResult) BufferTimeBPResult(com.att.aro.core.packetanalysis.pojo.BufferTimeBPResult)

Aggregations

AbstractBestPracticeResult (com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult)66 BaseTest (com.att.aro.core.BaseTest)47 ArrayList (java.util.ArrayList)47 Test (org.junit.Test)47 Session (com.att.aro.core.packetanalysis.pojo.Session)33 HttpRequestResponseInfo (com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo)29 PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)17 Burst (com.att.aro.core.packetanalysis.pojo.Burst)8 BestPracticeType (com.att.aro.core.bestpractice.pojo.BestPracticeType)6 CacheEntry (com.att.aro.core.packetanalysis.pojo.CacheEntry)6 List (java.util.List)6 IBestPractice (com.att.aro.core.bestpractice.IBestPractice)5 BPResultType (com.att.aro.core.bestpractice.pojo.BPResultType)4 UnnecessaryConnectionResult (com.att.aro.core.bestpractice.pojo.UnnecessaryConnectionResult)4 BufferOccupancyResult (com.att.aro.core.bestpractice.pojo.BufferOccupancyResult)3 TsharkException (com.att.aro.core.exception.TsharkException)3 BurstCollectionAnalysisData (com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData)3 TraceDirectoryResult (com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult)3 AROTraceData (com.att.aro.core.pojo.AROTraceData)3 IOException (java.io.IOException)3