Search in sources :

Example 11 with CacheEntry

use of com.att.aro.core.packetanalysis.pojo.CacheEntry in project VideoOptimzer by attdevsupport.

the class DataTable method selectItem.

/**
 * Marks the specified item in the table as selected, if it exists.If the
 * item exists in the table and is already marked as selected, the the
 * selection is cleared.
 *
 * @param item
 *            The item in the table to mark as selected.
 * @return A boolean value that is true if the specified item was found and
 *         marked as selected.
 */
public boolean selectItem(T item) {
    int index;
    if (getDataTableModel().getClass() != DuplicateContentTableModel.class) {
        if (item != null && (index = getDataTableModel().indexOf(item)) >= 0) {
            return isSelected(index);
        } else {
            clearSelection();
        }
    } else {
        if (item != null) {
            CacheEntry cacheEntry;
            CacheEntry cacheItem = (CacheEntry) item;
            for (int rowIndex = 0; rowIndex < getDataTableModel().getRowCount(); rowIndex++) {
                cacheEntry = ((CacheEntry) getDataTableModel().getValueAt(rowIndex));
                if (cacheEntry.getDiagnosis().toString().equalsIgnoreCase(Diagnosis.CACHING_DIAG_CACHE_MISSED.toString())) {
                    if (cacheItem.getHttpObjectName().equalsIgnoreCase(cacheEntry.getHttpObjectName()) && cacheItem.getContentLength() == cacheEntry.getContentLength()) {
                        return isSelected(rowIndex);
                    }
                }
            }
        }
        clearSelection();
    }
    return false;
}
Also used : CacheEntry(com.att.aro.core.packetanalysis.pojo.CacheEntry)

Example 12 with CacheEntry

use of com.att.aro.core.packetanalysis.pojo.CacheEntry in project VideoOptimzer by attdevsupport.

the class ARODiagnosticsOverviewRouteImpl method updateDiagnosticsTab.

@Override
public void updateDiagnosticsTab(Object routeInfo) {
    int oldPanelIndex = jtabbedPane.getSelectedIndex();
    jtabbedPane.setSelectedIndex(DIAGNOSTIC_INDEX);
    DiagnosticsTab diagnosticsTab = (DiagnosticsTab) jtabbedPane.getSelectedComponent();
    if (routeInfo == null) {
        jtabbedPane.setSelectedIndex(oldPanelIndex);
        LOG.error("Diagnostics Tab needs a type for updating");
        return;
    }
    LOG.debug("Type used to route to Diagnostics Tab: " + routeInfo.getClass().getSimpleName());
    if (routeInfo instanceof CacheEntry) {
        diagnosticsTab.setHighlightedTCP(((CacheEntry) routeInfo).getHttpRequestResponse());
    } else if (routeInfo instanceof Session) {
        diagnosticsTab.setHighlightedTCP(((Session) routeInfo));
    } else if (routeInfo instanceof HttpRequestResponseInfo) {
        diagnosticsTab.setHighlightedTCP((HttpRequestResponseInfo) routeInfo);
    } else if (routeInfo instanceof HttpEntry) {
        diagnosticsTab.setHighlightedTCP(((HttpEntry) routeInfo).getHttpRequestResponse());
    } else if (routeInfo instanceof DisplayNoneInCSSEntry) {
        diagnosticsTab.setHighlightedTCP(((DisplayNoneInCSSEntry) routeInfo).getHttpRequestResponse());
    } else if (routeInfo instanceof ImageMdataEntry) {
        diagnosticsTab.setHighlightedTCP(((ImageMdataEntry) routeInfo).getHttpRequestResponse());
    } else if (routeInfo instanceof ImageCompressionEntry) {
        diagnosticsTab.setHighlightedTCP(((ImageCompressionEntry) routeInfo).getHttpRequestResponse());
    } else if (routeInfo instanceof MultipleConnectionsEntry) {
        if (((MultipleConnectionsEntry) routeInfo).isMultiple()) {
            jtabbedPane.setSelectedIndex(WATERFALL_INDEX);
            WaterfallTab waterfallTab = (WaterfallTab) jtabbedPane.getSelectedComponent();
            waterfallTab.updateGraph(((MultipleConnectionsEntry) routeInfo).getHttpReqRespInfo());
        } else {
            if (((MultipleConnectionsEntry) routeInfo).getHttpReqRespInfo().getSession() != null) {
                diagnosticsTab.setHighlightedSessionTCP(((MultipleConnectionsEntry) routeInfo).getHttpReqRespInfo());
            } else {
                diagnosticsTab.setHighlightedTCP(((MultipleConnectionsEntry) routeInfo).getHttpReqRespInfo());
            }
        }
    } else if (routeInfo instanceof SpriteImageEntry) {
        diagnosticsTab.setHighlightedTCP(((SpriteImageEntry) routeInfo).getHttpRequestResponse());
    } else if (routeInfo instanceof UnnecessaryConnectionEntry) {
        UnnecessaryConnectionEntry unConnectionEntry = (UnnecessaryConnectionEntry) routeInfo;
        diagnosticsTab.setHighlightedTCP(unConnectionEntry.getLowTime());
    } else if (routeInfo instanceof TransmissionPrivateDataEntry || routeInfo instanceof UnsecureSSLVersionEntry || routeInfo instanceof ForwardSecrecyEntry) {
        diagnosticsTab.setHighlightedTCP(routeInfo);
    } else if (routeInfo instanceof VideoStall) {
        double timestamp = ((VideoStall) routeInfo).getSegmentTryingToPlay().getStartTS();
        diagnosticsTab.getGraphPanel().setGraphView(timestamp, true);
        diagnosticsTab.getVideoPlayer().setMediaTime(timestamp);
    } else {
        jtabbedPane.setSelectedIndex(oldPanelIndex);
        LOG.error("Diagnostics Tab cannot handle a type of " + routeInfo.getClass().getSimpleName() + " for updating");
    }
}
Also used : ImageMdataEntry(com.att.aro.core.bestpractice.pojo.ImageMdataEntry) TransmissionPrivateDataEntry(com.att.aro.core.bestpractice.pojo.TransmissionPrivateDataEntry) MultipleConnectionsEntry(com.att.aro.core.bestpractice.pojo.MultipleConnectionsEntry) HttpRequestResponseInfo(com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo) DisplayNoneInCSSEntry(com.att.aro.core.bestpractice.pojo.DisplayNoneInCSSEntry) DiagnosticsTab(com.att.aro.ui.view.diagnostictab.DiagnosticsTab) CacheEntry(com.att.aro.core.packetanalysis.pojo.CacheEntry) UnnecessaryConnectionEntry(com.att.aro.core.bestpractice.pojo.UnnecessaryConnectionEntry) ForwardSecrecyEntry(com.att.aro.core.bestpractice.pojo.ForwardSecrecyEntry) HttpEntry(com.att.aro.core.bestpractice.pojo.HttpEntry) ImageCompressionEntry(com.att.aro.core.bestpractice.pojo.ImageCompressionEntry) UnsecureSSLVersionEntry(com.att.aro.core.bestpractice.pojo.UnsecureSSLVersionEntry) WaterfallTab(com.att.aro.ui.view.waterfalltab.WaterfallTab) SpriteImageEntry(com.att.aro.core.bestpractice.pojo.SpriteImageEntry) Session(com.att.aro.core.packetanalysis.pojo.Session) VideoStall(com.att.aro.core.packetanalysis.pojo.VideoStall)

Example 13 with CacheEntry

use of com.att.aro.core.packetanalysis.pojo.CacheEntry in project VideoOptimzer by attdevsupport.

the class CacheAnalysisDerived method getResponseBytesCounts.

/**
 * This gets all the counts we need in a single pass through the diagnostic results
 *
 * @param diagnosticResults
 * @param diagnosis The list of diagnostic count buckets that are part of the return map
 * @return A map of the counts associated with a diagnosis attributes in diagnosis
 */
private Map<Diagnosis, DiagnosisCounts> getResponseBytesCounts(List<CacheEntry> diagnosticResults, Diagnosis[] diagnosis) {
    Map<Diagnosis, DiagnosisCounts> diagnosisPercentsMap = new HashMap<Diagnosis, DiagnosisCounts>();
    DiagnosisCounts totalBucket = new DiagnosisCounts();
    diagnosisPercentsMap.put(repurposedTotalBucket, totalBucket);
    // Create the count buckets for matched and unmatched attributes
    Set<Diagnosis> duplicateCheck = new HashSet<Diagnosis>();
    for (Diagnosis currentDiagnosis : diagnosis) {
        if (duplicateCheck.contains(currentDiagnosis)) {
            throw new AROUIPanelException("Cannot have duplicate diagnosis (" + currentDiagnosis.name() + ")");
        }
        diagnosisPercentsMap.put(currentDiagnosis, new DiagnosisCounts());
        duplicateCheck.add(currentDiagnosis);
    }
    duplicateCheck.clear();
    duplicateCheck = null;
    // Now go through the diagnosis results, updating counts as necessary
    for (CacheEntry diagnosticResult : diagnosticResults) {
        Diagnosis currentResultDiagnosis = diagnosticResult.getDiagnosis();
        // Only look if basic validity passed
        if (isValidResult(currentResultDiagnosis)) {
            for (Diagnosis currentDiagnosis : diagnosis) {
                if (currentResultDiagnosis == currentDiagnosis) {
                    diagnosisPercentsMap.get(currentDiagnosis).incrementMatchedResponsesBytes(diagnosticResult);
                } else {
                    diagnosisPercentsMap.get(currentDiagnosis).incrementUnmatchedResponsesBytes(diagnosticResult);
                }
            }
            totalBucket.incrementMatchedResponsesBytes(diagnosticResult);
        }
    }
    return diagnosisPercentsMap;
}
Also used : HashMap(java.util.HashMap) AROUIPanelException(com.att.aro.ui.exception.AROUIPanelException) Diagnosis(com.att.aro.core.packetanalysis.pojo.Diagnosis) CacheEntry(com.att.aro.core.packetanalysis.pojo.CacheEntry) HashSet(java.util.HashSet)

Example 14 with CacheEntry

use of com.att.aro.core.packetanalysis.pojo.CacheEntry in project VideoOptimzer by attdevsupport.

the class DuplicateContentImplTest method runTest_resTypeIsPass.

@Test
public void runTest_resTypeIsPass() {
    List<CacheEntry> duplicateContent = new ArrayList<CacheEntry>();
    for (int i = 0; i < 2; i++) {
        duplicateContent.add(entryArray[i]);
    }
    Mockito.when(cacheAnalysis.getDuplicateContentBytes()).thenReturn(value);
    Mockito.when(cacheAnalysis.getDuplicateContentBytesRatio()).thenReturn(0.1);
    Mockito.when(cacheAnalysis.getTotalBytesDownloaded()).thenReturn(value);
    Mockito.when(cacheAnalysis.getDuplicateContent()).thenReturn(duplicateContent);
    Mockito.when(tracedata.getCacheAnalysis()).thenReturn(cacheAnalysis);
    duplicateContentImpl = (DuplicateContentImpl) context.getBean("duplicateContent");
    AbstractBestPracticeResult testResult = duplicateContentImpl.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 15 with CacheEntry

use of com.att.aro.core.packetanalysis.pojo.CacheEntry in project VideoOptimzer by attdevsupport.

the class UsingCacheImplTest method runTest_Fail.

@Test
public void runTest_Fail() {
    List<CacheEntry> diagnosisResults = new ArrayList<CacheEntry>();
    Mockito.when(entryArray[0].getDiagnosis()).thenReturn(Diagnosis.CACHING_DIAG_NOT_CACHABLE);
    Mockito.when(entryArray[0].hasCacheHeaders()).thenReturn(true);
    Mockito.when(entryArray[1].getDiagnosis()).thenReturn(Diagnosis.CACHING_DIAG_CACHE_MISSED);
    Mockito.when(entryArray[1].hasCacheHeaders()).thenReturn(false);
    Mockito.when(entryArray[1].getSessionFirstPacket()).thenReturn(pktInfo01);
    Mockito.when(entryArray[2].getDiagnosis()).thenReturn(Diagnosis.CACHING_DIAG_NOT_EXPIRED_DUP_PARTIALHIT);
    Mockito.when(entryArray[2].hasCacheHeaders()).thenReturn(true);
    Mockito.when(entryArray[3].getDiagnosis()).thenReturn(Diagnosis.CACHING_DIAG_NOT_EXPIRED_DUP);
    Mockito.when(entryArray[3].hasCacheHeaders()).thenReturn(true);
    Mockito.when(entryArray[4].getDiagnosis()).thenReturn(Diagnosis.CACHING_DIAG_OBJ_NOT_CHANGED_304);
    Mockito.when(entryArray[4].hasCacheHeaders()).thenReturn(false);
    for (int i = 0; i < 5; i++) {
        diagnosisResults.add(entryArray[i]);
    }
    Mockito.when(cacheAnalysis.getDiagnosisResults()).thenReturn(diagnosisResults);
    Mockito.when(tracedata.getCacheAnalysis()).thenReturn(cacheAnalysis);
    AbstractBestPracticeResult testResult = usingCacheImpl.runTest(tracedata);
    assertEquals(BPResultType.WARNING, 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)

Aggregations

CacheEntry (com.att.aro.core.packetanalysis.pojo.CacheEntry)23 ArrayList (java.util.ArrayList)7 BaseTest (com.att.aro.core.BaseTest)6 AbstractBestPracticeResult (com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult)6 Test (org.junit.Test)6 HttpRequestResponseInfo (com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo)4 DuplicateEntry (com.att.aro.core.packetanalysis.pojo.DuplicateEntry)3 Session (com.att.aro.core.packetanalysis.pojo.Session)3 CacheAnalysis (com.att.aro.core.packetanalysis.pojo.CacheAnalysis)2 Diagnosis (com.att.aro.core.packetanalysis.pojo.Diagnosis)2 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)2 DataTablePopupMenu (com.att.aro.ui.model.DataTablePopupMenu)2 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 JButton (javax.swing.JButton)2 CacheControlResult (com.att.aro.core.bestpractice.pojo.CacheControlResult)1 DisplayNoneInCSSEntry (com.att.aro.core.bestpractice.pojo.DisplayNoneInCSSEntry)1 DuplicateContentResult (com.att.aro.core.bestpractice.pojo.DuplicateContentResult)1