Search in sources :

Example 11 with AbstractTraceResult

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

the class MissingTraceFiles method retrieveMissingFiles.

public Set<File> retrieveMissingFiles() {
    Set<File> missingFiles = new LinkedHashSet<File>();
    addMissingFileMaybe(TraceDataConst.FileName.APPNAME_FILE, missingFiles);
    addMissingFileMaybe(TraceDataConst.FileName.DEVICEINFO_FILE, missingFiles);
    addMissingFileMaybe(TraceDataConst.FileName.DEVICEDETAILS_FILE, missingFiles);
    // addMissingFileMaybe(TraceDataConst.FileName.NETWORKINFO_FILE, missingFiles);
    addMissingFileMaybe(TraceDataConst.FileName.CPU_FILE, missingFiles);
    addMissingFileMaybe(TraceDataConst.FileName.GPS_FILE, missingFiles);
    addMissingFileMaybe(TraceDataConst.FileName.BLUETOOTH_FILE, missingFiles);
    addMissingFileMaybe(TraceDataConst.FileName.WIFI_FILE, missingFiles);
    addMissingFileMaybe(TraceDataConst.FileName.CAMERA_FILE, missingFiles);
    addMissingFileMaybe(TraceDataConst.FileName.SCREEN_STATE_FILE, missingFiles);
    addMissingFileMaybe(TraceDataConst.FileName.USER_EVENTS_FILE, missingFiles);
    // addMissingFileMaybe(TraceDataConst.FileName.SCREEN_ROTATIONS_FILE, missingFiles);
    addMissingFileMaybe(TraceDataConst.FileName.ALARM_END_FILE, missingFiles);
    addMissingFileMaybe(TraceDataConst.FileName.ALARM_START_FILE, missingFiles);
    addMissingFileMaybe(TraceDataConst.FileName.KERNEL_LOG_FILE, missingFiles);
    addMissingFileMaybe(TraceDataConst.FileName.BATTERY_FILE, missingFiles);
    addMissingFileMaybe(TraceDataConst.FileName.BATTERYINFO_FILE, missingFiles);
    addMissingFileMaybe(TraceDataConst.FileName.TEMPERATURE_FILE, missingFiles);
    addMissingFileMaybe(TraceDataConst.FileName.LOCATION_FILE, missingFiles);
    addMissingFileMaybe(TraceDataConst.FileName.RADIO_EVENTS_FILE, missingFiles);
    if (isFilePresent(ResourceBundleHelper.getMessageString("video.videoDisplayFile")) || isFilePresent(ResourceBundleHelper.getMessageString("video.videoFileOnDevice"))) {
        addMissingFileMaybe(TraceDataConst.FileName.VIDEO_TIME_FILE, missingFiles);
    }
    if (isFilePresent(ResourceBundleHelper.getMessageString("video.exVideoDisplayFile")) || isExternalVideoSourceFilePresent("video.mp4", "video.mov")) {
        addMissingFileMaybe(TraceDataConst.FileName.EXVIDEO_TIME_FILE, missingFiles);
    }
    // UI shoule not be doing this!!!
    if (model != null) {
        AbstractTraceResult traceResult = model.getAnalyzerResult().getTraceresult();
        if (traceResult instanceof TraceDirectoryResult) {
            ((TraceDirectoryResult) traceResult).setMissingFiles(getModelMissingFiles(missingFiles));
        }
    }
    return missingFiles;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) AbstractTraceResult(com.att.aro.core.packetanalysis.pojo.AbstractTraceResult) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) File(java.io.File)

Example 12 with AbstractTraceResult

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

the class AccessingPeripheralImpl method runTest.

@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
    AccessingPeripheralResult result = new AccessingPeripheralResult();
    AbstractTraceResult traceResult = tracedata.getTraceresult();
    TraceDirectoryResult trresult = null;
    if (traceResult != null && traceResult instanceof TraceDirectoryResult) {
        trresult = (TraceDirectoryResult) traceResult;
    }
    if (trresult != null && isPeripheralDataAvailable(trresult)) {
        double activeGPSRatio = 0.0;
        double activeBluetoothRatio = 0.0;
        double activeCameraRatio = 0.0;
        double gpsActiveDuration = 0.0;
        double bluetoothActiveDuration = 0.0;
        double cameraActiveDuration = 0.0;
        double duration = 0.0;
        boolean accessingPeripherals = true;
        TimeRange timeRange = null;
        if (tracedata.getFilter() != null) {
            timeRange = tracedata.getFilter().getTimeRange();
        }
        if (tracedata.getTraceresult().getTraceResultType() == TraceResultType.TRACE_DIRECTORY) {
            gpsActiveDuration = trresult.getGpsActiveDuration();
            bluetoothActiveDuration = trresult.getBluetoothActiveDuration();
            cameraActiveDuration = trresult.getCameraActiveDuration();
        }
        if (timeRange != null) {
            duration = timeRange.getEndTime() - timeRange.getBeginTime();
        } else {
            duration = tracedata.getTraceresult().getTraceDuration();
        }
        activeGPSRatio = (gpsActiveDuration * 100) / duration;
        activeBluetoothRatio = (bluetoothActiveDuration * 100) / duration;
        activeCameraRatio = (cameraActiveDuration * 100) / duration;
        result.setActiveBluetoothRatio(activeBluetoothRatio);
        result.setActiveCameraRatio(activeCameraRatio);
        result.setActiveGPSRatio(activeGPSRatio);
        result.setActiveBluetoothDuration(bluetoothActiveDuration);
        result.setActiveCameraDuration(cameraActiveDuration);
        result.setActiveGPSDuration(gpsActiveDuration);
        if (activeGPSRatio > PERIPHERAL_ACTIVE_LIMIT || activeBluetoothRatio > PERIPHERAL_ACTIVE_LIMIT || activeCameraRatio > PERIPHERAL_ACTIVE_LIMIT) {
            accessingPeripherals = false;
        }
        String cameraPer = "0";
        NumberFormat nfor = NumberFormat.getIntegerInstance();
        if (cameraActiveDuration != 0.0) {
            if (activeCameraRatio < 1.0) {
                cameraPer = Util.percentageFormat(activeCameraRatio);
            } else {
                cameraPer = nfor.format(activeCameraRatio);
            }
        }
        String key = "";
        if (accessingPeripherals) {
            result.setResultType(BPResultType.PASS);
            key = this.textResultPass;
        } else {
            // ref. old analyzer give warning in this best practice
            result.setResultType(BPResultType.WARNING);
            key = this.textResults;
        }
        String text = MessageFormat.format(key, activeGPSRatio, activeBluetoothRatio, cameraPer);
        result.setResultText(text);
        result.setResultExcelText(MessageFormat.format(textExcelResults, result.getResultType().getDescription(), activeGPSRatio, activeBluetoothRatio, cameraPer));
    } else {
        result.setResultText(noData);
        result.setResultType(BPResultType.NO_DATA);
        result.setResultExcelText(BPResultType.NO_DATA.getDescription());
    }
    result.setAboutText(aboutText);
    result.setDetailTitle(detailTitle);
    result.setLearnMoreUrl(learnMoreUrl);
    result.setOverviewTitle(overviewTitle);
    result.setExportAllBTDesc(exportAllBTDesc);
    result.setExportAllCamDesc(exportAllCamDesc);
    result.setExportAllGPSDesc(exportAllGPSDesc);
    return result;
}
Also used : TimeRange(com.att.aro.core.packetanalysis.pojo.TimeRange) AccessingPeripheralResult(com.att.aro.core.bestpractice.pojo.AccessingPeripheralResult) AbstractTraceResult(com.att.aro.core.packetanalysis.pojo.AbstractTraceResult) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) NumberFormat(java.text.NumberFormat)

Aggregations

AbstractTraceResult (com.att.aro.core.packetanalysis.pojo.AbstractTraceResult)12 TraceDirectoryResult (com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult)5 PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)3 File (java.io.File)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 StreamingVideoData (com.att.aro.core.videoanalysis.pojo.StreamingVideoData)2 VideoEvent (com.att.aro.core.videoanalysis.pojo.VideoEvent)2 VideoStream (com.att.aro.core.videoanalysis.pojo.VideoStream)2 Collections (java.util.Collections)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 TreeMap (java.util.TreeMap)2 StringUtils (org.apache.commons.lang.StringUtils)2 LogManager (org.apache.log4j.LogManager)2 Logger (org.apache.log4j.Logger)2 Autowired (org.springframework.beans.factory.annotation.Autowired)2 AccessingPeripheralResult (com.att.aro.core.bestpractice.pojo.AccessingPeripheralResult)1 IFileManager (com.att.aro.core.fileio.IFileManager)1 HttpDirection (com.att.aro.core.packetanalysis.pojo.HttpDirection)1