use of com.att.aro.core.packetanalysis.pojo.CacheEntry in project VideoOptimzer by attdevsupport.
the class CacheControlImplTest method runTest_resTypeIsPass.
@Test
public void runTest_resTypeIsPass() {
List<CacheEntry> diagnosisResults = new ArrayList<CacheEntry>();
Mockito.when(entryArray[0].getDiagnosis()).thenReturn(Diagnosis.CACHING_DIAG_CACHE_MISSED);
diagnosisResults.add(entryArray[0]);
Mockito.when(cacheAnalysis.getDiagnosisResults()).thenReturn(diagnosisResults);
Mockito.when(tracedata.getCacheAnalysis()).thenReturn(cacheAnalysis);
cacheControlImpl = (CacheControlImpl) context.getBean("cacheControl");
AbstractBestPracticeResult testResult = cacheControlImpl.runTest(tracedata);
assertEquals(BPResultType.PASS, testResult.getResultType());
}
use of com.att.aro.core.packetanalysis.pojo.CacheEntry in project VideoOptimzer by attdevsupport.
the class DuplicateContentTablePanel method getJDuplicateContentTable.
/**
* Initializes and returns the RequestResponseTable.
*/
public DataTable<CacheEntry> getJDuplicateContentTable() {
if (duplicateContentTable == null) {
duplicateContentTable = new DataTable<CacheEntry>(duplicateContentTableModel);
duplicateContentTable.setName(ResourceBundleHelper.getMessageString("overview.duplicate.content.tableName"));
duplicateContentTable.setAutoCreateRowSorter(true);
duplicateContentTable.setGridColor(Color.LIGHT_GRAY);
duplicateContentTable.addMouseListener(this);
duplicateContentTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent listEvent) {
CacheEntry entry = duplicateContentTable.getSelectedItem();
HttpRequestResponseInfo rrInfo = entry != null ? entry.getResponse() : null;
boolean enabled = rrInfo != null && rrInfo.getContentLength() > 0 && rrInfo.getDirection() == HttpDirection.RESPONSE && entry != null && entry.getSession() != null;
boolean isContentTypeVideo = (rrInfo != null && rrInfo.getContentType() != null) ? rrInfo.getContentType().contains("video/") : false;
boolean bVideo = enabled ? isContentTypeVideo : false;
getViewBtn().setEnabled((bVideo) ? false : enabled);
getSaveBtn().setEnabled(enabled);
}
});
DataTablePopupMenu popupMenu = (DataTablePopupMenu) duplicateContentTable.getPopup();
popupMenu.initialize();
}
DataTablePopupMenu popupMenu = (DataTablePopupMenu) duplicateContentTable.getPopup();
popupMenu.initialize();
return duplicateContentTable;
}
use of com.att.aro.core.packetanalysis.pojo.CacheEntry in project VideoOptimzer by attdevsupport.
the class DuplicateContentTablePanel method getSaveBtn.
/**
* Returns the save button.
*/
private JButton getSaveBtn() {
if (saveBtn == null) {
saveBtn = new JButton(ResourceBundleHelper.getMessageString("button.Save"));
saveBtn.setEnabled(false);
saveBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
CacheEntry entry = duplicateContentTable.getSelectedItem();
if (entry != null) {
ContentViewer.getInstance().saveContent(DuplicateContentTablePanel.this.getTopLevelAncestor(), entry.getSession(), entry.getResponse());
}
}
});
}
return saveBtn;
}
use of com.att.aro.core.packetanalysis.pojo.CacheEntry in project VideoOptimzer by attdevsupport.
the class DuplicateContentTablePanel method getViewBtn.
/**
* Returns the view button.
*/
private JButton getViewBtn() {
if (viewBtn == null) {
viewBtn = new JButton(ResourceBundleHelper.getMessageString("button.View"));
viewBtn.setEnabled(false);
viewBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
try {
CacheEntry cEntry = duplicateContentTable.getSelectedItem();
if (cEntry != null) {
if (!cEntry.getResponse().getContentType().contains("video")) {
if (cEntry.getResponse().getRawSize() < 5242880) {
ContentViewer.getInstance().viewContent(getSession(cEntry), cEntry.getResponse());
} else {
MessageDialogFactory.getInstance().showErrorDialog(new Window(new Frame()), ResourceBundleHelper.getMessageString("Error.fileSize"));
}
}
}
} catch (Exception ioExp) {
MessageDialogFactory.showMessageDialog(DuplicateContentTablePanel.this.getTopLevelAncestor(), ioExp);
}
}
private Session getSession(CacheEntry cEntry) {
Session session = cEntry.getRequest().getSession();
if (session == null) {
session = cEntry.getSession();
}
return session;
}
});
}
return viewBtn;
}
use of com.att.aro.core.packetanalysis.pojo.CacheEntry in project VideoOptimzer by attdevsupport.
the class DuplicateContentTablePanel method mousePressed.
@Override
public void mousePressed(MouseEvent event) {
if (event.getClickCount() == 2) {
if (event.getSource() instanceof JTable) {
int selectionIndex = ((JTable) event.getSource()).getSelectedRow();
int original = ((JTable) event.getSource()).convertRowIndexToModel(selectionIndex);
logger.info("selectionIndex: " + selectionIndex);
if (selectionIndex != -1) {
CacheEntry cacheEntry = duplicateContentTableModel.getValueAt(original);
overviewTab.updateDiagnosticsTab(cacheEntry);
}
}
}
}
Aggregations