Search in sources :

Example 26 with TraceDirectoryResult

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

the class BatteryPlot method populate.

@Override
public void populate(XYPlot plot, AROTraceData analysis) {
    XYSeries series = new XYSeries(0);
    if (analysis == null) {
        LOGGER.info("analysis data is null");
    } else {
        TraceResultType resultType = analysis.getAnalyzerResult().getTraceresult().getTraceResultType();
        if (resultType.equals(TraceResultType.TRACE_FILE)) {
            LOGGER.info("didn't get analysis trace data!");
        } else {
            TraceDirectoryResult traceresult = (TraceDirectoryResult) analysis.getAnalyzerResult().getTraceresult();
            AnalysisFilter filter = analysis.getAnalyzerResult().getFilter();
            batteryInfos = traceresult.getBatteryInfos();
            if (batteryInfos.size() > 0 && filter.getTimeRange() != null) {
                BatteryInfo first = batteryInfos.get(0);
                series.add(filter.getTimeRange().getBeginTime().doubleValue(), first.getBatteryLevel());
            }
            for (BatteryInfo bi : batteryInfos) {
                series.add(bi.getBatteryTimeStamp(), bi.getBatteryLevel());
            }
            if (batteryInfos.size() > 0) {
                BatteryInfo last = batteryInfos.get(batteryInfos.size() - 1);
                if (filter.getTimeRange() != null) {
                    series.add(filter.getTimeRange().getEndTime().doubleValue(), last.getBatteryLevel());
                } else {
                    series.add(traceresult.getTraceDuration(), last.getBatteryLevel());
                }
            }
            XYItemRenderer renderer = plot.getRenderer();
            renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {

                @Override
                public String generateToolTip(XYDataset dataset, int series, int item) {
                    BatteryInfo bi = batteryInfos.get(Math.min(item, batteryInfos.size() - 1));
                    StringBuffer displayInfo = new StringBuffer(ResourceBundleHelper.getMessageString("battery.tooltip.prefix"));
                    displayInfo.append(MessageFormat.format(ResourceBundleHelper.getMessageString("battery.tooltip.content"), bi.getBatteryLevel(), bi.getBatteryTemp(), bi.isBatteryState() ? ResourceBundleHelper.getMessageString("battery.tooltip.connected") : ResourceBundleHelper.getMessageString("battery.tooltip.disconnected")));
                    displayInfo.append(ResourceBundleHelper.getMessageString("battery.tooltip.suffix"));
                    return displayInfo.toString();
                }
            });
        }
        plot.setDataset(new XYSeriesCollection(series));
    }
// return plot;
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) BatteryInfo(com.att.aro.core.peripheral.pojo.BatteryInfo) AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) TraceResultType(com.att.aro.core.packetanalysis.pojo.TraceResultType) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) XYDataset(org.jfree.data.xy.XYDataset) XYItemRenderer(org.jfree.chart.renderer.xy.XYItemRenderer) XYToolTipGenerator(org.jfree.chart.labels.XYToolTipGenerator) XYSeriesCollection(org.jfree.data.xy.XYSeriesCollection)

Example 27 with TraceDirectoryResult

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

the class DeviceNetworkProfilePanel method refresh.

public void refresh(AROTraceData aModel) {
    this.dateValueLabel.setText(aModel.getAnalyzerResult().getTraceresult().getTraceDateTime().toString());
    File directory = new File(aModel.getAnalyzerResult().getTraceresult().getTraceDirectory());
    this.traceValueLabel.setText(getTracePath(directory.getName()));
    this.byteCountTotalLabel.setText(Long.toString(aModel.getAnalyzerResult().getStatistic().getTotalByte()));
    this.profileValueLabel.setText(aModel.getAnalyzerResult().getProfile().getName());
    if (TraceResultType.TRACE_DIRECTORY.equals(aModel.getAnalyzerResult().getTraceresult().getTraceResultType())) {
        TraceDirectoryResult tracedirectoryResult = (TraceDirectoryResult) aModel.getAnalyzerResult().getTraceresult();
        this.networkTypeValueLabel.setText(tracedirectoryResult.getNetworkTypesList());
        CollectOptions collectOptions = tracedirectoryResult.getCollectOptions();
        if (collectOptions != null) {
            if (collectOptions.isAttnrProfile()) {
                this.downlinkLabel.setText("Attenuation Profile: ");
                this.downlinkValueLabel.setText(collectOptions.getAttnrProfileName());
                this.uplinkLabel.setVisible(false);
                this.uplinkValueLabel.setVisible(false);
            } else {
                int dsDelay = collectOptions.getDsDelay();
                int usDelay = collectOptions.getUsDelay();
                int speedThrottleDL = collectOptions.getThrottleDL();
                int speedThrottleUL = collectOptions.getThrottleUL();
                this.downlinkLabel.setText(ResourceBundleHelper.getMessageString("bestPractice.header.attenuator.downlink"));
                this.uplinkLabel.setText(ResourceBundleHelper.getMessageString("bestPractice.header.attenuator.uplink"));
                this.uplinkLabel.setVisible(true);
                this.uplinkValueLabel.setVisible(true);
                CommonHelper attenuator = new CommonHelper();
                NumberFormat numFormat = NumberFormat.getIntegerInstance();
                if (dsDelay > 0 || usDelay > 0) {
                    this.downlinkValueLabel.setText(attenuator.transferSignalSignDownload(dsDelay) + " - " + numFormat.format(dsDelay) + " ms");
                    this.uplinkValueLabel.setText(attenuator.transferSignalSignUpload(usDelay) + " - " + numFormat.format(usDelay) + " ms");
                } else {
                    // check dl and ul
                    if (speedThrottleDL < 0) {
                        this.downlinkValueLabel.setText(ResourceBundleHelper.getMessageString("waterfall.na"));
                    } else {
                        this.downlinkValueLabel.setText(attenuator.numberTransferSignalDL(speedThrottleDL) + " - " + attenuator.messageConvert(speedThrottleDL));
                    }
                    if (speedThrottleUL < 0) {
                        this.uplinkValueLabel.setText(ResourceBundleHelper.getMessageString("waterfall.na"));
                    } else {
                        this.uplinkValueLabel.setText(attenuator.numberTransferSignalUL(speedThrottleUL) + " - " + attenuator.messageConvert(speedThrottleUL));
                    }
                }
            }
        }
    } else {
        this.networkTypeValueLabel.setText("");
        this.downlinkLabel.setText(ResourceBundleHelper.getMessageString("bestPractice.header.attenuator.downlink"));
        this.uplinkLabel.setText(ResourceBundleHelper.getMessageString("bestPractice.header.attenuator.uplink"));
        this.uplinkLabel.setVisible(true);
        this.uplinkValueLabel.setVisible(true);
        this.downlinkValueLabel.setText("");
        this.uplinkValueLabel.setText("");
    }
}
Also used : CollectOptions(com.att.aro.core.peripheral.pojo.CollectOptions) CommonHelper(com.att.aro.ui.utils.CommonHelper) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) File(java.io.File) NumberFormat(java.text.NumberFormat)

Example 28 with TraceDirectoryResult

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

the class AttenuationConstantPanel method refresh.

/* (non-Javadoc)
	 * @see com.att.aro.ui.commonui.IUITabPanelLayoutUpdate#refresh(com.att.aro.core.pojo.AROTraceData)
	 */
@Override
public void refresh(AROTraceData analyzerResult) {
    TraceDirectoryResult traceResult = (TraceDirectoryResult) analyzerResult.getAnalyzerResult().getTraceresult();
    CollectOptions collectOptions = traceResult.getCollectOptions();
    refresh(collectOptions);
}
Also used : CollectOptions(com.att.aro.core.peripheral.pojo.CollectOptions) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult)

Example 29 with TraceDirectoryResult

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

the class HtmlReportImplTest method reportGenerator_retunrIsTrue.

@Test
@Ignore
public void reportGenerator_retunrIsTrue() {
    AccessingPeripheralResult access = new AccessingPeripheralResult();
    access.setResultType(BPResultType.PASS);
    CacheControlResult cache = new CacheControlResult();
    cache.setResultType(BPResultType.FAIL);
    List<AbstractBestPracticeResult> bpResults = new ArrayList<AbstractBestPracticeResult>();
    bpResults.add(access);
    bpResults.add(cache);
    File tempFile = null;
    try {
        tempFile = folder.newFile("abc.html");
    } catch (IOException e) {
        e.printStackTrace();
    }
    if (tempFile != null) {
        tempFile.deleteOnExit();
    }
    when(filereader.createFile(any(String.class))).thenReturn(tempFile);
    AROTraceData results = new AROTraceData();
    PacketAnalyzerResult analyzerResult = new PacketAnalyzerResult();
    TraceDirectoryResult tracedirresult = new TraceDirectoryResult();
    EnergyModel energyModel = new EnergyModel();
    Statistic statistic = new Statistic();
    statistic.setTotalByte(123);
    statistic.setTotalHTTPSByte(123);
    tracedirresult.setTraceDirectory("temp.txt");
    analyzerResult.setTraceresult(tracedirresult);
    analyzerResult.setEnergyModel(energyModel);
    analyzerResult.setStatistic(statistic);
    results.setAnalyzerResult(analyzerResult);
    results.setBestPracticeResults(bpResults);
    assertTrue(htmlReportImpl.reportGenerator("abc.html", results));
}
Also used : EnergyModel(com.att.aro.core.packetanalysis.pojo.EnergyModel) AbstractBestPracticeResult(com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult) ArrayList(java.util.ArrayList) IOException(java.io.IOException) AROTraceData(com.att.aro.core.pojo.AROTraceData) AccessingPeripheralResult(com.att.aro.core.bestpractice.pojo.AccessingPeripheralResult) Statistic(com.att.aro.core.packetanalysis.pojo.Statistic) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) CacheControlResult(com.att.aro.core.bestpractice.pojo.CacheControlResult) File(java.io.File) Ignore(org.junit.Ignore) BaseTest(com.att.aro.core.BaseTest) Test(org.junit.Test)

Example 30 with TraceDirectoryResult

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

the class VideoUtil method isVideoLandscape.

/**
 * the method is for check video orientation so we can display video recording with landscpae mode
 * @param traceResult
 * @return
 */
public static boolean isVideoLandscape(AbstractTraceResult traceResult) {
    String videoOrientation = "";
    if (traceResult == null) {
        return false;
    } else {
        TraceResultType resultType = traceResult.getTraceResultType();
        if (resultType.equals(TraceResultType.TRACE_FILE)) {
            return false;
        } else {
            TraceDirectoryResult traceresult = (TraceDirectoryResult) traceResult;
            videoOrientation = traceresult.getCollectOptions().getOrientation();
        }
        return TraceDataConst.UserEvent.KEY_LANDSCAPE.equalsIgnoreCase(videoOrientation);
    }
}
Also used : TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) TraceResultType(com.att.aro.core.packetanalysis.pojo.TraceResultType)

Aggregations

TraceDirectoryResult (com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult)51 ArrayList (java.util.ArrayList)16 BaseTest (com.att.aro.core.BaseTest)14 Test (org.junit.Test)14 TraceResultType (com.att.aro.core.packetanalysis.pojo.TraceResultType)13 XYToolTipGenerator (org.jfree.chart.labels.XYToolTipGenerator)10 XYItemRenderer (org.jfree.chart.renderer.xy.XYItemRenderer)10 XYDataset (org.jfree.data.xy.XYDataset)10 Session (com.att.aro.core.packetanalysis.pojo.Session)9 PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)8 CollectOptions (com.att.aro.core.peripheral.pojo.CollectOptions)7 XYIntervalSeries (org.jfree.data.xy.XYIntervalSeries)7 XYSeries (org.jfree.data.xy.XYSeries)7 AbstractTraceResult (com.att.aro.core.packetanalysis.pojo.AbstractTraceResult)5 HttpRequestResponseInfo (com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo)5 File (java.io.File)5 IHttpRequestResponseHelper (com.att.aro.core.packetanalysis.IHttpRequestResponseHelper)4 AnalysisFilter (com.att.aro.core.packetanalysis.pojo.AnalysisFilter)4 TimeRange (com.att.aro.core.packetanalysis.pojo.TimeRange)4 IOException (java.io.IOException)4