Search in sources :

Example 21 with TraceDirectoryResult

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

the class GpsPlot method populate.

@Override
public void populate(XYPlot plot, AROTraceData analysis) {
    if (analysis == null) {
        LOGGER.info("analysis data is null");
        return;
    }
    gpsData.removeAllSeries();
    locationData.removeAllSeries();
    TraceResultType resultType = analysis.getAnalyzerResult().getTraceresult().getTraceResultType();
    if (resultType.equals(TraceResultType.TRACE_FILE)) {
        LOGGER.info("didn't get analysis trace data!");
    } else {
        try {
            image = ImageIO.read(GpsPlot.class.getResourceAsStream("/images/location.png"));
            image = ImageHelper.resize(image, 12, 12);
        } catch (IOException e) {
            e.printStackTrace();
        }
        // create the GPS dataset...
        Map<GpsState, XYIntervalSeries> seriesMap = new EnumMap<GpsState, XYIntervalSeries>(GpsState.class);
        for (GpsState eventType : GpsState.values()) {
            XYIntervalSeries series = new XYIntervalSeries(eventType);
            seriesMap.put(eventType, series);
            gpsData.addSeries(series);
        }
        series = new XYSeries("location");
        TraceDirectoryResult traceresult = (TraceDirectoryResult) analysis.getAnalyzerResult().getTraceresult();
        listLocationEvent = (ArrayList<LocationEvent>) traceresult.getLocationEventInfos();
        for (int idx = 0; idx < listLocationEvent.size(); idx++) {
            series.add(listLocationEvent.get(idx).getTimeRecorded(), 0.5);
        }
        locationData.addSeries(series);
        Iterator<GpsInfo> iter = analysis.getAnalyzerResult().getTraceresult().getGpsInfos().iterator();
        if (iter.hasNext()) {
            while (iter.hasNext()) {
                GpsInfo gpsEvent = iter.next();
                if (gpsEvent.getGpsState() != GpsState.GPS_DISABLED) {
                    seriesMap.get(gpsEvent.getGpsState()).add(gpsEvent.getBeginTimeStamp(), gpsEvent.getBeginTimeStamp(), gpsEvent.getEndTimeStamp(), 0.5, 0, 1);
                }
            }
        }
        XYItemRenderer renderer = plot.getRenderer(0);
        // Looks like renderer is using the index descending order, so setting the index of the GPS background as 2 & location information index as 1.
        if (renderer == null) {
            renderer = plot.getRenderer(2);
        }
        renderer.setSeriesPaint(gpsData.indexOf(GpsState.GPS_STANDBY), Color.YELLOW);
        renderer.setSeriesPaint(gpsData.indexOf(GpsState.GPS_ACTIVE), new Color(34, 177, 76));
        // Assign ToolTip to renderer
        renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {

            @Override
            public String generateToolTip(XYDataset dataset, int series, int item) {
                GpsState eventType = (GpsState) gpsData.getSeries(series).getKey();
                return MessageFormat.format(ResourceBundleHelper.getMessageString("gps.tooltip"), dataset.getX(series, item), ResourceBundleHelper.getEnumString(eventType));
            }
        });
        plot.setRenderer(2, renderer);
        // Assign ToolTip to renderer
        LocationImageRenderer renderer_loc = new LocationImageRenderer();
        plot.setRenderer(1, renderer_loc);
        renderer_loc.setBaseToolTipGenerator(new XYToolTipGenerator() {

            @Override
            public String generateToolTip(XYDataset dataset, int series, int item) {
                // Update tooltip of location data
                LocationEvent event = listLocationEvent.get(item);
                StringBuffer displayInfo = new StringBuffer(ResourceBundleHelper.getMessageString("location.tooltip.prefix"));
                displayInfo.append(MessageFormat.format(ResourceBundleHelper.getMessageString("location.tooltip.content"), event.getTimeRecorded(), event.getLatitude(), event.getLongitude(), event.getProvider(), event.getLocality()));
                displayInfo.append(ResourceBundleHelper.getMessageString("location.tooltip.suffix"));
                return displayInfo.toString();
            }
        });
    }
    plot.setDataset(2, gpsData);
    plot.setDataset(1, locationData);
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) Color(java.awt.Color) GpsInfo(com.att.aro.core.peripheral.pojo.GpsInfo) IOException(java.io.IOException) TraceResultType(com.att.aro.core.packetanalysis.pojo.TraceResultType) GpsState(com.att.aro.core.peripheral.pojo.GpsInfo.GpsState) XYIntervalSeries(org.jfree.data.xy.XYIntervalSeries) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) XYDataset(org.jfree.data.xy.XYDataset) StandardXYItemRenderer(org.jfree.chart.renderer.xy.StandardXYItemRenderer) XYItemRenderer(org.jfree.chart.renderer.xy.XYItemRenderer) XYToolTipGenerator(org.jfree.chart.labels.XYToolTipGenerator) EnumMap(java.util.EnumMap) LocationEvent(com.att.aro.core.peripheral.pojo.LocationEvent)

Example 22 with TraceDirectoryResult

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

the class SpeedThrottlePlot method populate.

@Override
public void populate(XYPlot plot, AROTraceData analysis) {
    serCollection.removeAllSeries();
    if (analysis == null) {
        LOGGER.info("There is no trace data in the pojo!");
    } else {
        TraceResultType resultType = analysis.getAnalyzerResult().getTraceresult().getTraceResultType();
        if (resultType.equals(TraceResultType.TRACE_FILE)) {
            LOGGER.info("This is trace file pojo so there is no speed throttle info involved here.");
        } else {
            XYSeries seriesDL = new XYSeries(0);
            XYSeries seriesUP = new XYSeries(1);
            TraceDirectoryResult traceresult = (TraceDirectoryResult) analysis.getAnalyzerResult().getTraceresult();
            List<SpeedThrottleEvent> speedThrottleInfos = traceresult.getSpeedThrottleEvent();
            calculateNode(seriesDL, seriesUP, speedThrottleInfos);
            setDataPlot(plot, seriesDL, seriesUP);
        }
    }
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) SpeedThrottleEvent(com.att.aro.core.peripheral.pojo.SpeedThrottleEvent) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) TraceResultType(com.att.aro.core.packetanalysis.pojo.TraceResultType)

Example 23 with TraceDirectoryResult

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

the class NetworkTypePlot method populate.

@Override
public void populate(XYPlot plot, AROTraceData analysis) {
    plot.setDataset(new XYIntervalSeriesCollection());
    if (analysis == null) {
        LOGGER.info("no trace data here");
    } else {
        if (analysis.getAnalyzerResult().getTraceresult().getTraceResultType() == TraceResultType.TRACE_FILE) {
            LOGGER.info("no trace folder data here");
        } else {
            TraceDirectoryResult traceresult = (TraceDirectoryResult) analysis.getAnalyzerResult().getTraceresult();
            final XYIntervalSeriesCollection networkDataSeries = new XYIntervalSeriesCollection();
            final Map<NetworkType, XYIntervalSeries> seriesMap = new EnumMap<NetworkType, XYIntervalSeries>(NetworkType.class);
            createDataSeriesForAllNetworkTypes(seriesMap, networkDataSeries);
            Iterator<NetworkBearerTypeInfo> iter = traceresult.getNetworkTypeInfos().iterator();
            if (iter.hasNext()) {
                while (iter.hasNext()) {
                    NetworkBearerTypeInfo networkInfo = iter.next();
                    if (networkInfo.getNetworkType() != NetworkType.UNKNOWN) {
                        if (NetworkType.LTE == networkInfo.getNetworkType() && (NetworkType.OVERRIDE_NETWORK_TYPE_NR_NSA == networkInfo.getOverrideNetworkType() || NetworkType.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE == networkInfo.getOverrideNetworkType() || NetworkType.OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO == networkInfo.getOverrideNetworkType())) {
                            seriesMap.get(networkInfo.getOverrideNetworkType()).add(networkInfo.getBeginTimestamp(), networkInfo.getBeginTimestamp(), networkInfo.getEndTimestamp(), 0.5, 0, 1);
                        } else {
                            seriesMap.get(networkInfo.getNetworkType()).add(networkInfo.getBeginTimestamp(), networkInfo.getBeginTimestamp(), networkInfo.getEndTimestamp(), 0.5, 0, 1);
                        }
                    }
                }
            } else {
                NetworkType nt = traceresult.getNetworkType();
                if (nt != null && nt != NetworkType.UNKNOWN) {
                    seriesMap.get(nt).add(0, 0, traceresult.getTraceDuration(), 0.5, 0, 1);
                }
            }
            XYItemRenderer renderer = plot.getRenderer();
            setRenderingColorForDataSeries(renderer, networkDataSeries);
            // Assign ToolTip to renderer
            renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {

                @Override
                public String generateToolTip(XYDataset dataset, int series, int item) {
                    NetworkType networkType = (NetworkType) networkDataSeries.getSeries(series).getKey();
                    return MessageFormat.format(ResourceBundleHelper.getMessageString("network.tooltip"), dataset.getX(series, item), ResourceBundleHelper.getEnumString(networkType));
                }
            });
            plot.setDataset(networkDataSeries);
        }
    }
}
Also used : XYIntervalSeriesCollection(org.jfree.data.xy.XYIntervalSeriesCollection) NetworkType(com.att.aro.core.peripheral.pojo.NetworkType) XYIntervalSeries(org.jfree.data.xy.XYIntervalSeries) 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) EnumMap(java.util.EnumMap) NetworkBearerTypeInfo(com.att.aro.core.packetanalysis.pojo.NetworkBearerTypeInfo)

Example 24 with TraceDirectoryResult

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

the class RadioPlot method populate.

@Override
public void populate(XYPlot plot, AROTraceData analysis) {
    XYSeries series = new XYSeries(0);
    if (analysis == null) {
        LOGGER.info("no trace data here");
    } else {
        TraceResultType resultType = analysis.getAnalyzerResult().getTraceresult().getTraceResultType();
        if (resultType.equals(TraceResultType.TRACE_FILE)) {
            LOGGER.info("no trace folder data here");
        } else {
            TraceDirectoryResult traceResult = (TraceDirectoryResult) analysis.getAnalyzerResult().getTraceresult();
            radioInfos = traceResult.getRadioInfos();
            if (radioInfos.size() > 0 && analysis.getAnalyzerResult().getFilter().getTimeRange() != null) {
                RadioInfo first = radioInfos.get(0);
                series.add(analysis.getAnalyzerResult().getFilter().getTimeRange().getBeginTime().doubleValue(), first.getSignalStrength() < 0 ? first.getSignalStrength() : MIN_SIGNAL);
            }
            for (RadioInfo ri : radioInfos) {
                series.add(ri.getTimeStamp(), ri.getSignalStrength() < 0 ? ri.getSignalStrength() : MIN_SIGNAL);
            }
            if (radioInfos.size() > 0) {
                RadioInfo last = radioInfos.get(radioInfos.size() - 1);
                if (analysis.getAnalyzerResult().getFilter().getTimeRange() != null) {
                    series.add(analysis.getAnalyzerResult().getFilter().getTimeRange().getEndTime().doubleValue(), last.getSignalStrength() < 0 ? last.getSignalStrength() : MIN_SIGNAL);
                } else {
                    series.add(traceResult.getTraceDuration(), last.getSignalStrength() < 0 ? last.getSignalStrength() : MIN_SIGNAL);
                }
            }
            // Assign ToolTip to renderer
            XYItemRenderer renderer = plot.getRenderer();
            renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {

                @Override
                public String generateToolTip(XYDataset dataset, int series, int item) {
                    RadioInfo ri = radioInfos.get(Math.min(item, radioInfos.size() - 1));
                    if (ri.getSignalStrength() < 0) {
                        if (ri.isLte()) {
                            return MessageFormat.format(ResourceBundleHelper.getMessageString("radio.tooltip.lte"), ri.getLteRsrp(), ri.getLteRsrq());
                        } else {
                            return MessageFormat.format(ResourceBundleHelper.getMessageString("radio.tooltip"), ri.getSignalStrength());
                        }
                    } else {
                        return ResourceBundleHelper.getMessageString("radio.noSignal");
                    }
                }
            });
        }
    }
    plot.setDataset(new XYSeriesCollection(series));
// return plot;
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) RadioInfo(com.att.aro.core.peripheral.pojo.RadioInfo) 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) TraceResultType(com.att.aro.core.packetanalysis.pojo.TraceResultType) XYSeriesCollection(org.jfree.data.xy.XYSeriesCollection)

Example 25 with TraceDirectoryResult

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

the class AttenuatorPlot method populate.

@Override
public void populate(XYPlot plot, AROTraceData analysis) {
    if (analysis == null) {
        LOGGER.info("didn't get analysis trace data!");
    } else {
        TraceResultType resultType = analysis.getAnalyzerResult().getTraceresult().getTraceResultType();
        if (resultType.equals(TraceResultType.TRACE_FILE)) {
            LOGGER.info("didn't get analysis trace folder!");
        } else {
            XYSeries seriesDL = new XYSeries(0);
            XYSeries seriesUP = new XYSeries(1);
            TraceDirectoryResult traceresult = (TraceDirectoryResult) analysis.getAnalyzerResult().getTraceresult();
            List<AttenuatorEvent> attnrInfos = traceresult.getAttenautionEvent();
            calculateNode(seriesDL, seriesUP, attnrInfos);
            setDataPlot(plot, seriesDL, seriesUP);
        }
    }
}
Also used : XYSeries(org.jfree.data.xy.XYSeries) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) TraceResultType(com.att.aro.core.packetanalysis.pojo.TraceResultType) AttenuatorEvent(com.att.aro.core.peripheral.pojo.AttenuatorEvent)

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