Search in sources :

Example 11 with BestPracticeType

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;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) HyperlinkEvent(javax.swing.event.HyperlinkEvent) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) BestPracticeType(com.att.aro.core.bestpractice.pojo.BestPracticeType) Dimension(java.awt.Dimension) Font(java.awt.Font) ActionListener(java.awt.event.ActionListener) HyperlinkListener(javax.swing.event.HyperlinkListener)

Example 12 with BestPracticeType

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);
}
Also used : JCheckBox(javax.swing.JCheckBox) BestPracticeType(com.att.aro.core.bestpractice.pojo.BestPracticeType)

Example 13 with BestPracticeType

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());
}
Also used : AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) ArrayList(java.util.ArrayList) BestPracticeType(com.att.aro.core.bestpractice.pojo.BestPracticeType) AROTraceData(com.att.aro.core.pojo.AROTraceData) Profile(com.att.aro.core.configuration.pojo.Profile) BaseTest(com.att.aro.core.BaseTest) Test(org.junit.Test)

Example 14 with BestPracticeType

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());
}
Also used : AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) ArrayList(java.util.ArrayList) BestPracticeType(com.att.aro.core.bestpractice.pojo.BestPracticeType) AROTraceData(com.att.aro.core.pojo.AROTraceData) Profile(com.att.aro.core.configuration.pojo.Profile) BaseTest(com.att.aro.core.BaseTest) Test(org.junit.Test)

Example 15 with BestPracticeType

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);
    }
}
Also used : Packet(com.att.aro.core.packetreader.pojo.Packet) IPacketAnalyzer(com.att.aro.core.packetanalysis.IPacketAnalyzer) PeriodicTransferResult(com.att.aro.core.bestpractice.pojo.PeriodicTransferResult) AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) ArrayList(java.util.ArrayList) BestPracticeType(com.att.aro.core.bestpractice.pojo.BestPracticeType) AROTraceData(com.att.aro.core.pojo.AROTraceData) Profile(com.att.aro.core.configuration.pojo.Profile) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) TraceFileResult(com.att.aro.core.packetanalysis.pojo.TraceFileResult) BaseTest(com.att.aro.core.BaseTest) Test(org.junit.Test)

Aggregations

BestPracticeType (com.att.aro.core.bestpractice.pojo.BestPracticeType)16 ArrayList (java.util.ArrayList)10 AbstractBestPracticeResult (com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult)6 Profile (com.att.aro.core.configuration.pojo.Profile)6 PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)6 AROTraceData (com.att.aro.core.pojo.AROTraceData)6 BaseTest (com.att.aro.core.BaseTest)5 AnalysisFilter (com.att.aro.core.packetanalysis.pojo.AnalysisFilter)4 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)4 Test (org.junit.Test)4 Session (com.att.aro.core.packetanalysis.pojo.Session)3 FileNotFoundException (java.io.FileNotFoundException)3 IOException (java.io.IOException)3 IBestPractice (com.att.aro.core.bestpractice.IBestPractice)2 BufferOccupancyResult (com.att.aro.core.bestpractice.pojo.BufferOccupancyResult)2 PeriodicTransferResult (com.att.aro.core.bestpractice.pojo.PeriodicTransferResult)2 VideoChunkPacingResult (com.att.aro.core.bestpractice.pojo.VideoChunkPacingResult)2 VideoChunkSizeResult (com.att.aro.core.bestpractice.pojo.VideoChunkSizeResult)2 TsharkException (com.att.aro.core.exception.TsharkException)2 Packet (com.att.aro.core.packetreader.pojo.Packet)2