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;
}
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");
}
}
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;
}
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());
}
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());
}
Aggregations