use of com.att.aro.core.bestpractice.pojo.BestPracticeType in project VideoOptimzer by attdevsupport.
the class BpDetailItem method layoutPanel.
public JPanel layoutPanel(String name) {
JScrollPane scroll;
if (dataPanel == null) {
dataPanel = new JPanel(new GridBagLayout());
dataPanel.setBackground(UIManager.getColor(AROUIManager.PAGE_BACKGROUND_KEY));
Insets insets = new Insets(2, 2, 2, 2);
int idx = 0;
//
nameLabel.setText(ResourceBundleHelper.getMessageString("bestPractices.test"));
nameTextLabel.setText(ResourceBundleHelper.getMessageString(name + ".detailedTitle"));
aboutLabel.setText(ResourceBundleHelper.getMessageString("bestPractices.About"));
aboutTextLabel = createJTextArea(ResourceBundleHelper.getMessageString(name + ".desc"), getLearnMoreURI());
resultsLabel.setText(ResourceBundleHelper.getMessageString("bestPractices.results"));
resultsTextLabel = createJTextPane("");
setwidth(aboutTextLabel, TEXT_WIDTH);
resultsTextLabel.setPreferredSize(null);
resultsTextLabel.setSize(TEXT_WIDTH, 9999);
Dimension labelDim = resultsTextLabel.getPreferredSize();
labelDim.width = TEXT_WIDTH;
labelDim.height = 60;
resultsTextLabel.setPreferredSize(labelDim);
resultsTextLabel.setMinimumSize(labelDim);
resultsTextLabel.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
if (e.getDescription().equalsIgnoreCase("preferences")) {
openVideoPreferencesDialog();
} else if (e.getDescription().equalsIgnoreCase("selectStream")) {
openVideoTab();
} else {
routeHyperlink();
}
}
}
});
// Icon
dataPanel.add(imageLabel, new GridBagConstraints(0, idx, 1, 4, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, imageInsets, 0, 0));
// Text:
dataPanel.add(nameLabel, new GridBagConstraints(1, idx, 1, 1, 0.0, 0.0, GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, startInsets, 0, 0));
// about: detailedTitle - desc
nameLabel.setFont(new Font("TimesRoman", Font.PLAIN, 16));
nameTextLabel.setFont(new Font("TimesRoman", Font.PLAIN, 16));
scroll = new JScrollPane(nameTextLabel);
scroll.setBorder(BorderFactory.createEmptyBorder());
removeMouseWheelListeners(scroll);
dataPanel.add(scroll, new GridBagConstraints(2, idx, 1, 1, 1.0, 1.0, GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, insets, 0, 0));
dataPanel.add(aboutLabel, new GridBagConstraints(1, ++idx, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, insets, 0, 0));
scroll = new JScrollPane(aboutTextLabel);
scroll.setBorder(BorderFactory.createEmptyBorder());
removeMouseWheelListeners(scroll);
dataPanel.add(scroll, new GridBagConstraints(2, idx, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, insets, 0, 0));
// Results
dataPanel.add(resultsLabel, new GridBagConstraints(1, ++idx, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, insets, 0, 0));
scroll = new JScrollPane(resultsTextLabel);
scroll.setBorder(BorderFactory.createEmptyBorder());
removeMouseWheelListeners(scroll);
dataPanel.add(scroll, new GridBagConstraints(2, idx, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, insets, 0, 0));
// PrivateData Button
if (name.equalsIgnoreCase("security.transmissionPrivateData")) {
buttonPrivateData.setText("Add Private Data Tracking");
buttonPrivateData.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
openPrivateDataDialog();
}
});
buttonPrivateData.setEnabled(false);
for (BestPracticeType bptype : BPSelectionPanel.getInstance().getCheckedBP()) {
if (bptype.name().equalsIgnoreCase("TRANSMISSION_PRIVATE_DATA")) {
buttonPrivateData.setEnabled(true);
}
}
scroll = new JScrollPane(buttonPrivateData);
scroll.setBorder(BorderFactory.createEmptyBorder());
removeMouseWheelListeners(scroll);
dataPanel.add(scroll, new GridBagConstraints(2, ++idx, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NORTHWEST, insets, 0, 0));
}
// Table
if (resultsTablePanel != null) {
dataPanel.add(resultsTablePanel, new GridBagConstraints(2, ++idx, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, insets, 0, 0));
} else if (imgMdataResultsTablePanel != null) {
dataPanel.add(imgMdataResultsTablePanel, new GridBagConstraints(2, ++idx, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, insets, 0, 0));
} else if (imageCompressionResultsTablePanel != null) {
dataPanel.add(imageCompressionResultsTablePanel, new GridBagConstraints(2, ++idx, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, insets, 0, 0));
} else if (imageFormatResultsTablePanel != null) {
dataPanel.add(imageFormatResultsTablePanel, new GridBagConstraints(2, ++idx, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, insets, 0, 0));
} else if (imageComparisonResultsTablePanel != null) {
dataPanel.add(imageComparisonResultsTablePanel, new GridBagConstraints(2, ++idx, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, insets, 0, 0));
}
// Chart
if (resultsChartPanel != null) {
dataPanel.add(resultsChartPanel, new GridBagConstraints(2, ++idx, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, insets, 0, 0));
}
}
return dataPanel;
}
use of com.att.aro.core.bestpractice.pojo.BestPracticeType in project VideoOptimzer by attdevsupport.
the class BPSelectionPanel method setSelectedBoxes.
private void setSelectedBoxes() {
List<BestPracticeType> bpList = retrieveBestPractices();
for (JCheckBox val : map.values()) {
val.setSelected(false);
}
setSelectedBoxes(bpList, true);
}
use of com.att.aro.core.bestpractice.pojo.BestPracticeType in project VideoOptimzer by attdevsupport.
the class AROServiceImplTest method analyzeDirectoryTest_resultIsNull.
@Test
public void analyzeDirectoryTest_resultIsNull() throws IOException {
List<BestPracticeType> req = new ArrayList<BestPracticeType>();
when(packetanalyzer.analyzeTraceDirectory(any(String.class), any(Profile.class), any(AnalysisFilter.class))).thenReturn(null);
AROTraceData testResult = aro.analyzeDirectory(req, Util.getCurrentRunningDir());
assertEquals(108, testResult.getError().getCode());
assertFalse(testResult.isSuccess());
}
use of com.att.aro.core.bestpractice.pojo.BestPracticeType in project VideoOptimzer by attdevsupport.
the class AROServiceImplTest method analyzeFileTest_resultIsNull.
@Test
public void analyzeFileTest_resultIsNull() throws IOException {
when(packetanalyzer.analyzeTraceFile(any(String.class), any(Profile.class), any(AnalysisFilter.class))).thenReturn(null);
List<BestPracticeType> req = new ArrayList<BestPracticeType>();
AROTraceData testResult = aro.analyzeFile(req, "traffic.cap");
assertEquals(104, testResult.getError().getCode());
assertFalse(testResult.isSuccess());
}
use of com.att.aro.core.bestpractice.pojo.BestPracticeType in project VideoOptimzer by attdevsupport.
the class AROServiceImplTest method analyzeFileTest.
@Test
public void analyzeFileTest() throws IOException {
PacketAnalyzerResult analyze = new PacketAnalyzerResult();
TraceFileResult traceresult = new TraceFileResult();
List<PacketInfo> allpackets = new ArrayList<PacketInfo>();
allpackets.add(new PacketInfo(new Packet(0, 0, 0, 0, null)));
traceresult.setAllpackets(allpackets);
analyze.setTraceresult(traceresult);
PeriodicTransferResult periodicTransferResult = new PeriodicTransferResult();
List<BestPracticeType> req = new ArrayList<BestPracticeType>();
req.add(BestPracticeType.UNNECESSARY_CONNECTIONS);
req.add(BestPracticeType.CONNECTION_CLOSING);
req.add(BestPracticeType.CONNECTION_OPENING);
req.add(BestPracticeType.PERIODIC_TRANSFER);
req.add(BestPracticeType.SCREEN_ROTATION);
req.add(BestPracticeType.ACCESSING_PERIPHERALS);
req.add(BestPracticeType.COMBINE_CS_JSS);
req.add(BestPracticeType.HTTP_1_0_USAGE);
req.add(BestPracticeType.CACHE_CONTROL);
req.add(BestPracticeType.USING_CACHE);
req.add(BestPracticeType.DUPLICATE_CONTENT);
req.add(BestPracticeType.HTTP_4XX_5XX);
req.add(BestPracticeType.HTTP_3XX_CODE);
req.add(BestPracticeType.FILE_COMPRESSION);
req.add(BestPracticeType.IMAGE_SIZE);
req.add(BestPracticeType.MINIFICATION);
req.add(BestPracticeType.EMPTY_URL);
req.add(BestPracticeType.SPRITEIMAGE);
req.add(BestPracticeType.SCRIPTS_URL);
req.add(BestPracticeType.ASYNC_CHECK);
req.add(BestPracticeType.DISPLAY_NONE_IN_CSS);
req.add(BestPracticeType.FILE_ORDER);
req.add(BestPracticeType.MULTI_SIMULCONN);
req.add(BestPracticeType.VIDEO_STALL);
req.add(BestPracticeType.STARTUP_DELAY);
req.add(BestPracticeType.BUFFER_OCCUPANCY);
req.add(BestPracticeType.NETWORK_COMPARISON);
req.add(BestPracticeType.TCP_CONNECTION);
req.add(BestPracticeType.CHUNK_SIZE);
req.add(BestPracticeType.CHUNK_PACING);
req.add(BestPracticeType.VIDEO_REDUNDANCY);
req.add(BestPracticeType.VIDEO_CONCURRENT_SESSION);
req.add(BestPracticeType.VIDEO_VARIABLE_BITRATE);
req.add(BestPracticeType.HTTPS_USAGE);
req.add(BestPracticeType.TRANSMISSION_PRIVATE_DATA);
req.add(BestPracticeType.DISPLAY_NONE_IN_CSS);
packetanalyzer = Mockito.mock(IPacketAnalyzer.class);
aro.setPacketAnalyzer(packetanalyzer);
when(packetanalyzer.analyzeTraceFile(any(String.class), any(Profile.class), any(AnalysisFilter.class))).thenReturn(analyze);
when(worker.runTest(any(PacketAnalyzerResult.class))).thenReturn(periodicTransferResult);
List<BestPracticeType> list = SettingsUtil.retrieveBestPractices();
SettingsUtil.saveBestPractices(req);
try {
AROTraceData testResult = aro.analyzeFile(req, "traffic.cap");
assertEquals(TOTAL_BPTESTS, testResult.getBestPracticeResults().size());
} finally {
SettingsUtil.saveBestPractices(list);
}
}
Aggregations