Search in sources :

Example 36 with TraceDirectoryResult

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

the class AccessingPeripheralImplTest method runTest_resIsNoErrResultTypeIsPass.

@Test
public void runTest_resIsNoErrResultTypeIsPass() {
    Mockito.when(tracedata.getFilter()).thenReturn(analysisFilter);
    Mockito.when(traceResult.getTraceResultType()).thenReturn(TraceResultType.TRACE_FILE);
    Mockito.when((TraceDirectoryResult) tracedata.getTraceresult()).thenReturn(traceResult);
    acPrphlImpl = (AccessingPeripheralImpl) context.getBean("accessingPeripheral");
    AbstractBestPracticeResult testResult = acPrphlImpl.runTest(tracedata);
    assertEquals(BPResultType.NO_DATA, testResult.getResultType());
}
Also used : AbstractBestPracticeResult(com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Example 37 with TraceDirectoryResult

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

the class VideoSegmentAnalyzer method process.

public void process(AbstractTraceResult result, StreamingVideoData streamingVideoData) {
    if (result instanceof TraceDirectoryResult) {
        videoStreamStartupData = ((TraceDirectoryResult) result).getVideoStartupData();
        this.videoPrefs = videoUsagePrefsManager.getVideoUsagePreference();
        if (!CollectionUtils.isEmpty(streamingVideoData.getVideoStreamMap())) {
            NavigableMap<Double, VideoStream> reverseVideoStreamMap = streamingVideoData.getVideoStreamMap().descendingMap();
            for (VideoStream videoStream : reverseVideoStreamMap.values()) {
                if (!CollectionUtils.isEmpty(videoStream.getVideoEventMap())) {
                    if ((videoStreamStartup = locateStartupDelay(result, videoStream)) == null) {
                        // StartupDelay could not be set, usually an invalid Stream
                        continue;
                    }
                    double startupDelay;
                    VideoEvent chosenEvent;
                    if (videoStreamStartup != null && videoStream.getManifest().getVideoName().equals(videoStreamStartup.getManifestName())) {
                        startupDelay = videoStreamStartup.getStartupTime();
                        chosenEvent = videoStream.getVideoEventBySegment(videoStreamStartup.getFirstSegID());
                        if (videoStreamStartup.getUserEvent() != null) {
                            videoStream.setPlayRequestedTime(videoStreamStartup.getUserEvent().getPressTime());
                        }
                    } else {
                        continue;
                    }
                    duplicateHandling = videoPrefs.getDuplicateHandling();
                    LOG.debug(String.format("Stream RQ:%10.3f", videoStream.getManifest().getRequestTime()));
                    applyStartupDelayToStream(startupDelay, chosenEvent, videoStream, streamingVideoData);
                    videoStream.setDuration(videoStream.getVideoEventMap().entrySet().stream().filter(f -> f.getValue().isSelected() && f.getValue().isNormalSegment()).mapToDouble(x -> x.getValue().getDuration()).sum());
                } else {
                    videoStream.setDuration(0);
                    videoStream.setSelected(false);
                    videoStream.setValid(false);
                }
            }
        }
    }
}
Also used : VideoStreamStartup(com.att.aro.core.peripheral.pojo.VideoStreamStartup) StringUtils(org.apache.commons.lang.StringUtils) UserEvent(com.att.aro.core.peripheral.pojo.UserEvent) ValidationStartup(com.att.aro.core.peripheral.pojo.VideoStreamStartup.ValidationStartup) AbstractTraceResult(com.att.aro.core.packetanalysis.pojo.AbstractTraceResult) Autowired(org.springframework.beans.factory.annotation.Autowired) DUPLICATE_HANDLING(com.att.aro.core.videoanalysis.pojo.VideoUsagePrefs.DUPLICATE_HANDLING) ArrayList(java.util.ArrayList) Logger(org.apache.log4j.Logger) XYPair(com.att.aro.core.videoanalysis.XYPair) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) Nonnull(javax.annotation.Nonnull) VideoStall(com.att.aro.core.packetanalysis.pojo.VideoStall) VideoStreamStartupData(com.att.aro.core.peripheral.pojo.VideoStreamStartupData) VideoUsagePrefs(com.att.aro.core.videoanalysis.pojo.VideoUsagePrefs) NonNull(lombok.NonNull) NavigableMap(java.util.NavigableMap) VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) List(java.util.List) StreamingVideoData(com.att.aro.core.videoanalysis.pojo.StreamingVideoData) UserEventType(com.att.aro.core.peripheral.pojo.UserEvent.UserEventType) TreeMap(java.util.TreeMap) CollectionUtils(org.springframework.util.CollectionUtils) LogManager(org.apache.log4j.LogManager) IVideoUsagePrefsManager(com.att.aro.core.videoanalysis.IVideoUsagePrefsManager) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) Collections(java.util.Collections) SortedMap(java.util.SortedMap) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent)

Example 38 with TraceDirectoryResult

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

the class MetaDataHelper method updateMetaData.

private boolean updateMetaData(PacketAnalyzerResult packetAnalyzerResult) {
    TraceDirectoryResult result = (TraceDirectoryResult) packetAnalyzerResult.getTraceresult();
    boolean isMetaDataUpdated = false;
    if (metaData.getVideoStreams().isEmpty() || metaData.getVideoStreams().get(0).getVideoResolutionMap().isEmpty()) {
        ArrayList<MetaStream> videoStreams = new ArrayList<>();
        for (VideoStream videoStream : packetAnalyzerResult.getStreamingVideoData().getVideoStreams()) {
            MetaStream metaStream = new MetaStream();
            metaStream.setVideoDuration(videoStream.getDuration());
            metaStream.setType(videoStream.getManifest().getVideoFormat().toString());
            metaStream.setVideo(videoStream.getManifest().getVideoName());
            metaStream.setVideoOrientation(result.getCollectOptions().getOrientation());
            metaStream.setVideoDownloadtime(videoStream.getVideoActiveMap().entrySet().stream().mapToDouble(e -> e.getValue().getDLTime()).sum());
            metaStream.setAudioDownloadtime(videoStream.getAudioActiveMap().entrySet().stream().mapToDouble(e -> e.getValue().getDLTime()).sum());
            metaStream.setVideoSegmentTotal(videoStream.getVideoActiveMap().size());
            metaStream.setAudioSegmentTotal(videoStream.getAudioActiveMap().size());
            setVideoStreamTotals(metaStream, videoStream);
            videoStream.setMetaStream(metaStream);
            videoStreams.add(metaStream);
        }
        metaData.setVideoStreams(videoStreams);
        isMetaDataUpdated = true;
    }
    if (metaData.getCollectorName().isEmpty()) {
        metaData.setCollectorName(result.getCollectorName());
        isMetaDataUpdated = true;
    }
    if (metaData.getCollectorVersion().isEmpty()) {
        metaData.setCollectorVersion(result.getCollectorVersion());
        isMetaDataUpdated = true;
    }
    if (metaData.getTraceName().isEmpty()) {
        String name = result.getTraceDirectory();
        int pos = name.lastIndexOf(Util.FILE_SEPARATOR);
        if (pos > 0) {
            name = name.substring(pos + 1);
        }
        metaData.setTraceName(name);
        isMetaDataUpdated = true;
    }
    if (metaData.getDeviceScreenSize() == null) {
        metaData.setDeviceScreenSize(new Dimension(result.getDeviceScreenSizeX(), result.getDeviceScreenSizeY()));
        isMetaDataUpdated = true;
    }
    if (metaData.getPhoneMake().isEmpty()) {
        metaData.setPhoneMake(result.getDeviceMake());
        isMetaDataUpdated = true;
    }
    if (metaData.getPhoneModel().isEmpty()) {
        metaData.setPhoneModel(result.getDeviceModel());
        isMetaDataUpdated = true;
    }
    if (metaData.getOs().isEmpty()) {
        metaData.setOs(result.getOsType());
        isMetaDataUpdated = true;
    }
    if (metaData.getOsVersion().isEmpty()) {
        metaData.setOsVersion(result.getOsVersion());
        isMetaDataUpdated = true;
    }
    if (metaData.getStartUTC().isEmpty()) {
        ZonedDateTime startUTC = null;
        if (result != null && result.getTraceDateTime() != null) {
            startUTC = ZonedDateTime.ofInstant(result.getTraceDateTime().toInstant(), ZoneId.systemDefault());
            isMetaDataUpdated = true;
        }
        metaData.setStartUTC(startUTC != null ? startUTC.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME) : "");
    }
    if (metaData.getUtc() == null || metaData.getUtc() == 0L) {
        metaData.setUtc(result.getTraceDateTime().toInstant().getEpochSecond());
        isMetaDataUpdated = true;
    }
    if (metaData.getTraceDuration() == null) {
        metaData.setTraceDuration(result.getTraceDuration());
        isMetaDataUpdated = true;
    }
    if (metaData.getTraceSource().isEmpty()) {
        metaData.setTraceSource("Manual");
        isMetaDataUpdated = true;
    }
    if ((metaData.getTargetAppVer().isEmpty() || UNKNOWN.equals(metaData.getTargetAppVer())) && (!metaData.getTargetedApp().isEmpty() && !UNKNOWN.equals(metaData.getTargetedApp()))) {
        String appVersion = findAppVersion(result);
        if (!UNKNOWN.equals(appVersion)) {
            isMetaDataUpdated = true;
            metaData.setTargetAppVer(appVersion);
        }
    }
    return isMetaDataUpdated;
}
Also used : MetaStream(com.att.aro.core.tracemetadata.pojo.MetaStream) ZonedDateTime(java.time.ZonedDateTime) ArrayList(java.util.ArrayList) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) Dimension(java.awt.Dimension)

Example 39 with TraceDirectoryResult

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

the class StartupDelayDialog method loadStartupDelay.

public double loadStartupDelay() {
    Double tempStartupTime = ((TraceDirectoryResult) traceData.getAnalyzerResult().getTraceresult()).getVideoStartTime();
    if ((videoStreamStartupData = ((TraceDirectoryResult) traceData.getAnalyzerResult().getTraceresult()).getVideoStartupData()) != null) {
        if ((videoStreamStartup = videoSegmentAnalyzer.findStartupFromName(videoStreamStartupData, videoStream)) != null) {
            tempStartupTime = videoStreamStartup.getStartupTime();
        }
    } else {
        videoStreamStartupData = new VideoStreamStartupData();
    }
    if (videoStreamStartup == null) {
        videoStreamStartup = new VideoStreamStartup(videoStream.getManifest().getVideoName());
        videoStreamStartupData.getStreams().add(videoStreamStartup);
    }
    if (!allUserEventList.isEmpty() && videoStreamStartup.getUserEvent() == null) {
        UserEvent ue = findPriorUserEvent(manifestRequestTime);
        if (ue != null) {
            videoStreamStartup.setUserEvent(ue);
        }
        int lastIndex = 0;
        for (int idx = 0; idx < allUserEventList.size(); idx++) {
            if (allUserEventList.get(idx).getPressTime() > manifestRequestTime) {
                break;
            }
            lastIndex = idx;
        }
        videoStreamStartup.setUserEvent(allUserEventList.get(lastIndex));
    }
    ((TraceDirectoryResult) traceData.getAnalyzerResult().getTraceresult()).setVideoStartupData(videoStreamStartupData);
    if (tempStartupTime == 0) {
        // as in based on Manifest request timeStamp
        return getStartTime();
    }
    return tempStartupTime;
}
Also used : VideoStreamStartup(com.att.aro.core.peripheral.pojo.VideoStreamStartup) VideoStreamStartupData(com.att.aro.core.peripheral.pojo.VideoStreamStartupData) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) UserEvent(com.att.aro.core.peripheral.pojo.UserEvent)

Example 40 with TraceDirectoryResult

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

the class AlarmPlot method populate.

@Override
public void populate(XYPlot plot, AROTraceData analysis) {
    if (analysis == null) {
        LOGGER.info("analysis data is null");
    } else {
        alarmDataCollection.removeAllSeries();
        pointerAnnotation.clear();
        TraceResultType resultType = analysis.getAnalyzerResult().getTraceresult().getTraceResultType();
        if (resultType.equals(TraceResultType.TRACE_FILE)) {
            LOGGER.info("didn't get analysis trace data!");
        } else {
            // Remove old annotation from previous plots
            Iterator<XYPointerAnnotation> pointers = pointerAnnotation.iterator();
            while (pointers.hasNext()) {
                plot.removeAnnotation(pointers.next());
            }
            for (AlarmType eventType : AlarmType.values()) {
                XYIntervalSeries series = new XYIntervalSeries(eventType);
                seriesMap.put(eventType, series);
                alarmDataCollection.addSeries(series);
            }
            TraceDirectoryResult traceresult = (TraceDirectoryResult) analysis.getAnalyzerResult().getTraceresult();
            List<AlarmInfo> alarmInfos = traceresult.getAlarmInfos();
            List<ScheduledAlarmInfo> pendingAlarms = getHasFiredAlarms(traceresult.getScheduledAlarms());
            Iterator<ScheduledAlarmInfo> iterPendingAlarms = pendingAlarms.iterator();
            double firedTime = 0;
            while (iterPendingAlarms.hasNext()) {
                ScheduledAlarmInfo scheduledEvent = iterPendingAlarms.next();
                AlarmType pendingAlarmType = scheduledEvent.getAlarmType();
                if (pendingAlarmType != null) {
                    firedTime = (scheduledEvent.getTimeStamp() - scheduledEvent.getRepeatInterval()) / 1000;
                    seriesMap.get(pendingAlarmType).add(firedTime, firedTime, firedTime, 1, 0.8, 1);
                    eventMapPending.put(firedTime, scheduledEvent);
                // logger.fine("populateAlarmScheduledPlot type:\n" +
                // pendingAlarmType
                // + "\ntime " + scheduledEvent.getTimeStamp()
                // + "\nrepeating " + firedTime);
                }
            }
            Iterator<AlarmInfo> iter = alarmInfos.iterator();
            while (iter.hasNext()) {
                AlarmInfo currEvent = iter.next();
                if (currEvent != null) {
                    AlarmType alarmType = currEvent.getAlarmType();
                    if (alarmType != null) {
                        firedTime = currEvent.getTimeStamp() / 1000;
                        /*
							 * Catching any alarms align to quanta as being
							 * inexactRepeating alarms
							 */
                        if ((currEvent.getTimestampElapsed() / 1000) % 900 < 1) {
                            seriesMap.get(alarmType).add(firedTime, firedTime, firedTime, 1, 0, 0.7);
                            // Adding an arrow to mark these
                            // inexactRepeating alarms
                            XYPointerAnnotation xypointerannotation = new XYPointerAnnotation(alarmType.name(), firedTime, 0.6, 3.92699082D);
                            xypointerannotation.setBaseRadius(20D);
                            xypointerannotation.setTipRadius(1D);
                            pointerAnnotation.add(xypointerannotation);
                            plot.addAnnotation(xypointerannotation);
                        // logger.info("SetInexactRepeating alarm type: "
                        // + alarmType
                        // + " time " + firedTime
                        // + " epoch " + currEvent.getTimestampEpoch()
                        // + " elapsed:\n" +
                        // currEvent.getTimestampElapsed()/1000);
                        } else {
                            seriesMap.get(alarmType).add(firedTime, firedTime, firedTime, 1, 0, 0.5);
                        }
                        eventMap.put(firedTime, currEvent);
                    }
                }
            }
            XYItemRenderer renderer = plot.getRenderer();
            renderer.setSeriesPaint(alarmDataCollection.indexOf(AlarmType.RTC_WAKEUP), Color.red);
            renderer.setSeriesPaint(alarmDataCollection.indexOf(AlarmType.RTC), Color.pink);
            renderer.setSeriesPaint(alarmDataCollection.indexOf(AlarmType.ELAPSED_REALTIME_WAKEUP), Color.blue);
            renderer.setSeriesPaint(alarmDataCollection.indexOf(AlarmType.ELAPSED_REALTIME), Color.cyan);
            renderer.setSeriesPaint(alarmDataCollection.indexOf(AlarmType.UNKNOWN), Color.black);
            // Assign ToolTip to renderer
            renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {

                @Override
                public String generateToolTip(XYDataset dataset, int series, int item) {
                    AlarmInfo info = eventMap.get(dataset.getX(series, item));
                    Date epochTime = new Date();
                    if (info != null) {
                        epochTime.setTime((long) info.getTimestampEpoch());
                        StringBuffer displayInfo = new StringBuffer(ResourceBundleHelper.getMessageString("alarm.tooltip.prefix"));
                        displayInfo.append(MessageFormat.format(ResourceBundleHelper.getMessageString("alarm.tooltip.content"), info.getAlarmType(), info.getTimeStamp() / 1000, epochTime.toString()));
                        if ((info.getTimestampElapsed() / 1000) % 900 < 1) {
                            displayInfo.append(ResourceBundleHelper.getMessageString("alarm.tooltip.setInexactRepeating"));
                        }
                        displayInfo.append(ResourceBundleHelper.getMessageString("alarm.tooltip.suffix"));
                        return displayInfo.toString();
                    }
                    ScheduledAlarmInfo infoPending = eventMapPending.get(dataset.getX(series, item));
                    if (infoPending != null) {
                        epochTime.setTime((long) (infoPending.getTimestampEpoch() - infoPending.getRepeatInterval()));
                        StringBuffer displayInfo = new StringBuffer(ResourceBundleHelper.getMessageString("alarm.tooltip.prefix"));
                        displayInfo.append(MessageFormat.format(ResourceBundleHelper.getMessageString("alarm.tooltip.contentWithName"), infoPending.getAlarmType(), (infoPending.getTimeStamp() - infoPending.getRepeatInterval()) / 1000, epochTime.toString(), infoPending.getApplication(), infoPending.getRepeatInterval() / 1000));
                        displayInfo.append(ResourceBundleHelper.getMessageString("alarm.tooltip.suffix"));
                        return displayInfo.toString();
                    }
                    return null;
                }
            });
        }
    }
    plot.setDataset(alarmDataCollection);
// return plot;
}
Also used : AlarmType(com.att.aro.core.peripheral.pojo.AlarmInfo.AlarmType) ScheduledAlarmInfo(com.att.aro.core.packetanalysis.pojo.ScheduledAlarmInfo) TraceResultType(com.att.aro.core.packetanalysis.pojo.TraceResultType) Date(java.util.Date) XYIntervalSeries(org.jfree.data.xy.XYIntervalSeries) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) ScheduledAlarmInfo(com.att.aro.core.packetanalysis.pojo.ScheduledAlarmInfo) AlarmInfo(com.att.aro.core.peripheral.pojo.AlarmInfo) XYDataset(org.jfree.data.xy.XYDataset) XYItemRenderer(org.jfree.chart.renderer.xy.XYItemRenderer) XYToolTipGenerator(org.jfree.chart.labels.XYToolTipGenerator) XYPointerAnnotation(org.jfree.chart.annotations.XYPointerAnnotation)

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