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());
}
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);
}
}
}
}
}
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;
}
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;
}
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;
}
Aggregations