Search in sources :

Example 6 with CacheEntry

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

the class BpFileDuplicateContentTablePanel method getContentTable.

/**
 * Initializes and returns the RequestResponseTable.
 */
@Override
@SuppressWarnings("unchecked")
public DataTable<CacheEntry> getContentTable() {
    if (contentTable == null) {
        contentTable = new DataTable<CacheEntry>(tableModel);
        contentTable.setName(ResourceBundleHelper.getMessageString("file.duplicate.content.tableName"));
        contentTable.setAutoCreateRowSorter(true);
        contentTable.setGridColor(Color.LIGHT_GRAY);
        contentTable.setRowHeight(ROW_HEIGHT);
        contentTable.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
        DataTablePopupMenu popupMenu = (DataTablePopupMenu) contentTable.getPopup();
        popupMenu.initialize();
    }
    return contentTable;
}
Also used : DataTablePopupMenu(com.att.aro.ui.model.DataTablePopupMenu) CacheEntry(com.att.aro.core.packetanalysis.pojo.CacheEntry)

Example 7 with CacheEntry

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

the class UsingCacheImpl method runTest.

@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
    UsingCacheResult result = new UsingCacheResult();
    if (tracedata.getCacheAnalysis() == null) {
        return null;
    }
    double cacheHeaderRatio = 0.0;
    boolean usingCache = false;
    int validCount = 0;
    int noCacheHeadersCount = 0;
    PacketInfo noCacheHeaderFirstPacket = null;
    for (CacheEntry entry : tracedata.getCacheAnalysis().getDiagnosisResults()) {
        if (entry.getDiagnosis() != Diagnosis.CACHING_DIAG_REQUEST_NOT_FOUND && entry.getDiagnosis() != Diagnosis.CACHING_DIAG_INVALID_OBJ_NAME && entry.getDiagnosis() != Diagnosis.CACHING_DIAG_INVALID_REQUEST && entry.getDiagnosis() != Diagnosis.CACHING_DIAG_INVALID_RESPONSE) {
            ++validCount;
            if (!entry.hasCacheHeaders()) {
                if (noCacheHeadersCount == 0) {
                    noCacheHeaderFirstPacket = entry.getSessionFirstPacket();
                }
                ++noCacheHeadersCount;
            }
        }
    }
    cacheHeaderRatio = validCount > 0 ? (100.0 * noCacheHeadersCount) / validCount : 0.0;
    usingCache = cacheHeaderRatio <= 10.0;
    if (usingCache) {
        result.setResultType(BPResultType.PASS);
        result.setResultText(textResultPass);
        result.setResultExcelText(BPResultType.PASS.getDescription());
    } else {
        // ref. old analyzer give warning in this best practice
        result.setResultType(BPResultType.WARNING);
        String text = MessageFormat.format(textResults, ApplicationConfig.getInstance().getAppShortName(), NumberFormat.getIntegerInstance().format(cacheHeaderRatio));
        result.setResultText(text);
        result.setResultExcelText(MessageFormat.format(textExcelResults, BPResultType.WARNING.getDescription(), NumberFormat.getIntegerInstance().format(cacheHeaderRatio)));
    }
    result.setCacheHeaderRatio(cacheHeaderRatio);
    result.setNoCacheHeaderFirstPacket(noCacheHeaderFirstPacket);
    result.setAboutText(aboutText);
    result.setDetailTitle(detailTitle);
    result.setLearnMoreUrl(learnMoreUrl);
    result.setOverviewTitle(overviewTitle);
    result.setExportAllCacheConPct(exportAllCacheConPct);
    return result;
}
Also used : PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) CacheEntry(com.att.aro.core.packetanalysis.pojo.CacheEntry) UsingCacheResult(com.att.aro.core.bestpractice.pojo.UsingCacheResult)

Example 8 with CacheEntry

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

the class DuplicateContentResult method hashCode.

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    long temp;
    temp = Double.doubleToLongBits(duplicateContentBytesRatio);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    result = prime * result + (int) duplicateContentBytes;
    result = prime * result + (int) totalContentBytes;
    result = prime * result + duplicateContentSizeOfUniqueItems;
    result = prime * result + duplicateContentsize;
    for (CacheEntry cacheEntry : duplicateContentList) {
        result = prime * result + cacheEntry.hashCode();
    }
    result = prime * result + getBestPracticeDescription().hashCode();
    result = prime * result + getBestPracticeType().hashCode();
    return result;
}
Also used : CacheEntry(com.att.aro.core.packetanalysis.pojo.CacheEntry)

Example 9 with CacheEntry

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

the class DuplicateContentImplTest method runTest_resTypeIsFail.

@Test
public void runTest_resTypeIsFail() {
    List<CacheEntry> duplicateContent = new ArrayList<CacheEntry>();
    for (int i = 0; i < 5; i++) {
        duplicateContent.add(entryArray[i]);
    }
    Mockito.when(cacheAnalysis.getDuplicateContentBytes()).thenReturn(value);
    Mockito.when(cacheAnalysis.getDuplicateContentBytesRatio()).thenReturn(1.0);
    Mockito.when(cacheAnalysis.getDuplicateContent()).thenReturn(duplicateContent);
    Mockito.when(tracedata.getCacheAnalysis()).thenReturn(cacheAnalysis);
    duplicateContentImpl = (DuplicateContentImpl) context.getBean("duplicateContent");
    AbstractBestPracticeResult testResult = duplicateContentImpl.runTest(tracedata);
    assertEquals(BPResultType.FAIL, 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 10 with CacheEntry

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

the class CacheControlImplTest method runTest_resTypeIsFail.

@Test
public void runTest_resTypeIsFail() {
    List<CacheEntry> diagnosisResults = new ArrayList<CacheEntry>();
    Mockito.when(entryArray[0].getDiagnosis()).thenReturn(Diagnosis.CACHING_DIAG_NOT_EXPIRED_DUP);
    Mockito.when(entryArray[1].getDiagnosis()).thenReturn(Diagnosis.CACHING_DIAG_NOT_EXPIRED_DUP_PARTIALHIT);
    Mockito.when(entryArray[2].getDiagnosis()).thenReturn(Diagnosis.CACHING_DIAG_OBJ_NOT_CHANGED_304);
    Mockito.when(entryArray[3].getDiagnosis()).thenReturn(Diagnosis.CACHING_DIAG_NOT_EXPIRED_DUP_PARTIALHIT);
    Mockito.when(entryArray[4].getDiagnosis()).thenReturn(Diagnosis.CACHING_DIAG_OBJ_NOT_CHANGED_304);
    for (int i = 0; i < 5; i++) {
        diagnosisResults.add(entryArray[i]);
    }
    Mockito.when(cacheAnalysis.getDiagnosisResults()).thenReturn(diagnosisResults);
    Mockito.when(tracedata.getCacheAnalysis()).thenReturn(cacheAnalysis);
    cacheControlImpl = (CacheControlImpl) context.getBean("cacheControl");
    AbstractBestPracticeResult testResult = cacheControlImpl.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