Search in sources :

Example 1 with CombineCsJssResult

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

the class CombineCsJssImpl method runTest.

@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
    CombineCsJssResult result = new CombineCsJssResult();
    // Changes for US432336
    List<CsJssFilesDetails> fileDetails = new ArrayList<CsJssFilesDetails>();
    int inefficientCssRequests = 0;
    PacketInfo consecutiveCssJsFirstPacket = null;
    int inefficientJsRequests = 0;
    double cssLastTimeStamp = 0.0;
    double jsLastTimeStamp = 0.0;
    String contentType = "";
    for (Session session : tracedata.getSessionlist()) {
        HttpRequestResponseInfo lastRequestObj = null;
        for (HttpRequestResponseInfo httpreq : session.getRequestResponseInfo()) {
            if (httpreq.getDirection() == HttpDirection.REQUEST) {
                lastRequestObj = httpreq;
            }
            if (httpreq.getDirection() == HttpDirection.RESPONSE && httpreq.getContentType() != null) {
                PacketInfo pktInfo = httpreq.getFirstDataPacket();
                if (pktInfo != null) {
                    contentType = httpreq.getContentType().toLowerCase().trim();
                    if (contentType.equalsIgnoreCase("text/css")) {
                        if (cssLastTimeStamp == 0.0) {
                            cssLastTimeStamp = pktInfo.getTimeStamp();
                            continue;
                        } else {
                            if ((pktInfo.getTimeStamp() - cssLastTimeStamp) <= 2.0) {
                                inefficientCssRequests++;
                                // Changes for US432336
                                CsJssFilesDetails cssFileDetails = new CsJssFilesDetails();
                                cssFileDetails.setTimeStamp(pktInfo.getTimeStamp());
                                if (httpreq.getObjName() != null) {
                                    cssFileDetails.setFileName(httpreq.getObjName());
                                } else {
                                    if (lastRequestObj != null) {
                                        cssFileDetails.setFileName(lastRequestObj.getObjName());
                                    }
                                }
                                cssFileDetails.setSize(httpreq.getContentLength());
                                fileDetails.add(cssFileDetails);
                                if (consecutiveCssJsFirstPacket == null) {
                                    consecutiveCssJsFirstPacket = pktInfo;
                                }
                            }
                            cssLastTimeStamp = pktInfo.getTimeStamp();
                        }
                    } else if (contentType.equalsIgnoreCase("text/javascript") || contentType.equalsIgnoreCase("application/x-javascript") || contentType.equalsIgnoreCase("application/javascript")) {
                        if (jsLastTimeStamp == 0.0) {
                            jsLastTimeStamp = pktInfo.getTimeStamp();
                            continue;
                        } else {
                            if ((pktInfo.getTimeStamp() - jsLastTimeStamp) < 2.0) {
                                inefficientJsRequests++;
                                // Changes for US432336
                                CsJssFilesDetails jsFileDetails = new CsJssFilesDetails();
                                jsFileDetails.setTimeStamp(pktInfo.getTimeStamp());
                                if (httpreq.getObjName() != null) {
                                    jsFileDetails.setFileName(httpreq.getObjName());
                                } else {
                                    if (lastRequestObj != null) {
                                        jsFileDetails.setFileName(lastRequestObj.getObjName());
                                    }
                                }
                                jsFileDetails.setSize(httpreq.getContentLength());
                                fileDetails.add(jsFileDetails);
                                if (consecutiveCssJsFirstPacket == null) {
                                    consecutiveCssJsFirstPacket = pktInfo;
                                }
                            }
                            jsLastTimeStamp = pktInfo.getTimeStamp();
                        }
                    }
                }
            }
        }
    }
    result.setConsecutiveCssJsFirstPacket(consecutiveCssJsFirstPacket);
    result.setInefficientCssRequests(inefficientCssRequests);
    result.setInefficientJsRequests(inefficientJsRequests);
    if (inefficientCssRequests < 1 && inefficientJsRequests < 1) {
        result.setResultType(BPResultType.PASS);
        result.setResultText(MessageFormat.format(textResultPass, ApplicationConfig.getInstance().getAppShortName()));
    } else {
        result.setResultType(BPResultType.FAIL);
        result.setResultText(textResults);
        // Changes for US432336
        result.setFilesDetails(fileDetails);
    }
    result.setResultExcelText(result.getResultType().getDescription());
    result.setAboutText(aboutText);
    result.setDetailTitle(detailTitle);
    result.setLearnMoreUrl(learnMoreUrl);
    result.setOverviewTitle(overviewTitle);
    result.setExportAllInefficientCssRequest(exportAllInefficientCssRequest);
    result.setExportAllInefficientJsRequest(exportAllInefficientJsRequest);
    return result;
}
Also used : HttpRequestResponseInfo(com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo) ArrayList(java.util.ArrayList) CombineCsJssResult(com.att.aro.core.bestpractice.pojo.CombineCsJssResult) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) CsJssFilesDetails(com.att.aro.core.bestpractice.pojo.CsJssFilesDetails) Session(com.att.aro.core.packetanalysis.pojo.Session)

Example 2 with CombineCsJssResult

use of com.att.aro.core.bestpractice.pojo.CombineCsJssResult 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)

Aggregations

CombineCsJssResult (com.att.aro.core.bestpractice.pojo.CombineCsJssResult)2 AbstractBestPracticeResult (com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult)1 ConnectionClosingResult (com.att.aro.core.bestpractice.pojo.ConnectionClosingResult)1 CsJssFilesDetails (com.att.aro.core.bestpractice.pojo.CsJssFilesDetails)1 EmptyUrlResult (com.att.aro.core.bestpractice.pojo.EmptyUrlResult)1 Http10UsageResult (com.att.aro.core.bestpractice.pojo.Http10UsageResult)1 PeriodicTransferResult (com.att.aro.core.bestpractice.pojo.PeriodicTransferResult)1 ScriptsResult (com.att.aro.core.bestpractice.pojo.ScriptsResult)1 UnnecessaryConnectionResult (com.att.aro.core.bestpractice.pojo.UnnecessaryConnectionResult)1 UsingCacheResult (com.att.aro.core.bestpractice.pojo.UsingCacheResult)1 HttpRequestResponseInfo (com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo)1 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)1 Session (com.att.aro.core.packetanalysis.pojo.Session)1 DiagnosticsTab (com.att.aro.ui.view.diagnostictab.DiagnosticsTab)1 ArrayList (java.util.ArrayList)1