Search in sources :

Example 1 with AbstractRrcStateMachine

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

the class PacketAnalyzerImpl method finalResult.

protected PacketAnalyzerResult finalResult(AbstractTraceResult result, Profile profile, AnalysisFilter filter) {
    PacketAnalyzerResult data = new PacketAnalyzerResult();
    if (filter == null) {
        double endTime = result.getAllpackets().size() > 0 ? Math.max(result.getAllpackets().get(result.getAllpackets().size() - 1).getTimeStamp(), result.getTraceDuration()) : 0.0;
        result.setTimeRange(new TimeRange("Full", TimeRange.TimeRangeType.FULL, 0.0, endTime));
    } else {
        result.setTimeRange(filter.getTimeRange());
    }
    // List of packets included in analysis (application filtered)
    List<PacketInfo> filteredPackets;
    Profile aProfile = profile;
    if (aProfile == null) {
        // if the user doesn't load any profile.....
        aProfile = profilefactory.createLTEdefault();
        aProfile.setName("AT&T LTE");
    }
    // for the situation, filter out all no-ip packets and caused the allpackets is empty, need to refactor
    if (result != null && result.getAllpackets() != null && result.getAllpackets().size() == 0) {
        data.setTraceresult(result);
        return data;
    }
    /* Purpose of this code block is to finish building out the filter, if needed, for TimeRange analysis
		 * 
		 * This code block is excuted when:
		 *  1: time-range.json exists in trace folder
		 *  	a: and the json contains an entry with RangeType.AUTO
		 *  2: A TimeRange object was created and launched in TimeRangeEditorDialog
		 *  
		 *  AroController will have created an AnalysisFilter and so filter will not be null
		 *  
		 */
    try {
        if ((filter != null && filter.getTimeRange() != null && filter.getTimeRange().getPath() != null) || result.getAllAppNames().size() == 1) {
            String app = TraceDataReaderImpl.UNKNOWN_APPNAME;
            if (filter != null && filter.getAppSelections() != null && filter.getAppSelections().containsKey(app) && filter.getAppSelections().get(app).getIPAddressSelections().isEmpty()) {
                LOGGER.debug("AUTO Time Range analysis: add all found appIps to " + app + ", then store in the filter");
                ApplicationSelection appSelection = new ApplicationSelection(app, result.getAppIps().get(app));
                filter.getAppSelections().put(app, appSelection);
            }
        }
    } catch (Exception e) {
        LOGGER.error("Error handling TimeRange JSON data", e);
    }
    TimeRange timeRange = null;
    boolean isCSI = false;
    filteredPackets = new ArrayList<PacketInfo>();
    if (filter == null) {
        if (result != null) {
            filteredPackets = result.getAllpackets();
        }
    } else {
        // do the filter
        if (filter.isCSI() && filter.getManifestFilePath() != null) {
            isCSI = true;
        }
        timeRange = filter.getTimeRange();
        if (result != null) {
            filteredPackets = filterPackets(filter, result.getAllpackets());
        }
    }
    // Fix for Sev 2 Time Range Analysis Issue - DE187848
    if (result != null) {
        result.setAllpackets(filteredPackets);
        SessionManagerImpl sessionMangerImpl = (SessionManagerImpl) sessionmanager;
        sessionMangerImpl.setPcapTimeOffset(result.getPcapTimeOffset());
        // for iOS trace
        sessionmanager.setiOSSecureTracePath(result.getTraceDirectory());
        // Check if secure trace path exists
        if (result instanceof TraceDirectoryResult) {
            File file = new File(((SessionManagerImpl) sessionmanager).getTracePath());
            if (file.exists()) {
                ((TraceDirectoryResult) result).setSecureTrace(true);
            }
        }
    }
    Statistic stat = this.getStatistic(filteredPackets);
    List<Session> sessionList = sessionmanager.processPacketsAndAssembleSessions(filteredPackets);
    generateGetRequestMapAndPopulateLatencyStat(sessionList, stat);
    if (result != null && stat.getAppName() != null && stat.getAppName().size() == 1 && stat.getAppName().contains(TraceDataReaderImpl.UNKNOWN_APPNAME)) {
        stat.setAppName(new HashSet<String>(result.getAppInfos()));
    }
    // get Unanalyzed HTTPS bytes
    boolean isSecureTrace = result instanceof TraceDirectoryResult ? ((TraceDirectoryResult) result).isSecureTrace() : false;
    if (isSecureTrace) {
        stat.setTotalHTTPSBytesNotAnalyzed(getHttpsBytesNotAnalyzed(sessionList));
    } else {
        stat.setTotalHTTPSBytesNotAnalyzed(stat.getTotalHTTPSByte());
    }
    // stat is used to get some info for RrcStateMachine etc
    if (result != null) {
        LOGGER.debug("Starting pre processing in PAI");
        AbstractRrcStateMachine statemachine = statemachinefactory.create(filteredPackets, aProfile, stat.getPacketDuration(), result.getTraceDuration(), stat.getTotalByte(), timeRange);
        EnergyModel energymodel = energymodelfactory.create(aProfile, statemachine.getTotalRRCEnergy(), result.getGpsInfos(), result.getCameraInfos(), result.getBluetoothInfos(), result.getScreenStateInfos());
        BurstCollectionAnalysisData burstcollectiondata = burstcollectionanalyzer.analyze(filteredPackets, aProfile, stat.getPacketSizeToCountMap(), statemachine.getStaterangelist(), result.getUserEvents(), result.getCpuActivityList().getCpuActivities(), sessionList);
        data.clearBPResults();
        try {
            List<BestPracticeType> videoBPList = BestPracticeType.getByCategory(BestPracticeType.Category.VIDEO);
            data.setStreamingVideoData(videoTrafficCollector.clearData());
            if (CollectionUtils.containsAny(SettingsUtil.retrieveBestPractices(), videoBPList)) {
                if (isCSI || csiDataHelper.doesCSIFileExist(result.getTraceDirectory())) {
                    data.setStreamingVideoData(videoTrafficInferencer.inferVideoData(result, sessionList, (filter != null && filter.getManifestFilePath() != null) ? filter.getManifestFilePath() : result.getTraceDirectory()));
                } else {
                    data.setStreamingVideoData(videoTrafficCollector.collect(result, sessionList, requestMap));
                }
            }
        } catch (Exception ex) {
            LOGGER.error("Error in Video usage analysis :", ex);
            // Guarantee that StreamingVideoData is empty
            data.setStreamingVideoData(videoTrafficCollector.clearData());
            data.getStreamingVideoData().setFinished(true);
        }
        try {
            List<BestPracticeType> imageBPList = new ArrayList<>();
            imageBPList.add(BestPracticeType.IMAGE_MDATA);
            imageBPList.add(BestPracticeType.IMAGE_CMPRS);
            imageBPList.add(BestPracticeType.IMAGE_FORMAT);
            imageBPList.add(BestPracticeType.IMAGE_COMPARE);
            if (CollectionUtils.containsAny(SettingsUtil.retrieveBestPractices(), imageBPList)) {
                imageExtractor.execute(result, sessionList, requestMap);
            }
        } catch (Exception ex) {
            LOGGER.error("Error in Image extraction:" + ex.getMessage(), ex);
        }
        htmlExtractor.execute(result, sessionList, requestMap);
        // Calculate time range analysis
        double beginTime = 0.0d;
        double endTime = 0.0d;
        if (filter != null && filter.getTimeRange() != null) {
            beginTime = filter.getTimeRange().getBeginTime();
            endTime = filter.getTimeRange().getEndTime();
        } else {
            endTime = result.getTraceDuration();
        }
        data.setBurstCollectionAnalysisData(burstcollectiondata);
        data.setEnergyModel(energymodel);
        data.setSessionlist(sessionList);
        data.setStatemachine(statemachine);
        data.setStatistic(stat);
        data.setTraceresult(result);
        data.setProfile(aProfile);
        data.setFilter(filter);
        data.setDeviceKeywords(result.getDeviceKeywordInfos());
        data.setTimeRangeAnalysis(new TimeRangeAnalysis(beginTime, endTime, data));
    }
    return data;
}
Also used : ApplicationSelection(com.att.aro.core.packetanalysis.pojo.ApplicationSelection) ArrayList(java.util.ArrayList) BestPracticeType(com.att.aro.core.bestpractice.pojo.BestPracticeType) Profile(com.att.aro.core.configuration.pojo.Profile) Statistic(com.att.aro.core.packetanalysis.pojo.Statistic) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) AbstractRrcStateMachine(com.att.aro.core.packetanalysis.pojo.AbstractRrcStateMachine) EnergyModel(com.att.aro.core.packetanalysis.pojo.EnergyModel) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) TimeRange(com.att.aro.core.packetanalysis.pojo.TimeRange) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) BurstCollectionAnalysisData(com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) File(java.io.File) Session(com.att.aro.core.packetanalysis.pojo.Session)

Example 2 with AbstractRrcStateMachine

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

the class ApplicationScoreDerived method processDerivedAttributes.

private void processDerivedAttributes(AROTraceData model, ApplicationSampling applicationSampling) {
    int topScore = 100;
    PacketAnalyzerResult analyzerResults = model.getAnalyzerResult();
    List<AbstractBestPracticeResult> bpResults = model.getBestPracticeResults();
    List<BurstAnalysisInfo> burstInfo = analyzerResults.getBurstCollectionAnalysisData().getBurstAnalysisInfo();
    AbstractRrcStateMachine rrcStateMachine = analyzerResults.getStatemachine();
    Statistic statistics = analyzerResults.getStatistic();
    int burstInfoSize = burstInfo.size();
    // TODO:  CONNECTION_CLOSING and USING_CACHE enum types are reversed in model.  FIX!
    for (AbstractBestPracticeResult result : bpResults) {
        if (result instanceof UsingCacheResult) {
            UsingCacheResult bpuscaResult = (UsingCacheResult) result;
            bpuscaResult.getCacheHeaderRatio();
            cacheHeaderControlScore = (int) ((isUsingCache(bpuscaResult) ? topScore : getIndividualScore(bpuscaResult.getCacheHeaderRatio(), 10, 25, 65)) * .75);
        } else if (result instanceof ConnectionClosingResult) {
            ConnectionClosingResult bpcoclResult = (ConnectionClosingResult) result;
            connectionClosingScore = (int) ((bpcoclResult.isConClosingProb() ? topScore : getIndividualScore(bpcoclResult.getTcpControlEnergyRatio() * 100, 5, 20, 50)) * .75);
        } else if (result instanceof UnnecessaryConnectionResult) {
            UnnecessaryConnectionResult bpunco = (UnnecessaryConnectionResult) result;
            bpunco.getTightlyCoupledBurstCount();
            int tightlyGroupedBursts = (int) (burstInfoSize > 0 ? 100.0 * bpunco.getTightlyCoupledBurstCount() / burstInfoSize : 0.0);
            tightlyGroupedConnectionScore = (int) (tightlyGroupedBursts * 1.50);
        } else if (result instanceof PeriodicTransferResult) {
            PeriodicTransferResult periodicTransferResult = (PeriodicTransferResult) result;
            periodicTransferScore = (int) ((isPeriodicCount(periodicTransferResult) ? topScore : getPeriodicTransferScoreCalculation(periodicTransferResult, burstInfo)) * 1.50);
        } else if (result instanceof CacheControlResult) {
            CacheControlResult cacheControlResultResult = (CacheControlResult) result;
            connectionExpirationScore = (int) ((isCacheControl(cacheControlResultResult) ? topScore : getConnectionExpirationScoreCalculation(cacheControlResultResult)) * .50);
        } else if (result instanceof DuplicateContentResult) {
            DuplicateContentResult duplicateContentResult = (DuplicateContentResult) result;
            duplicateContentScore = (int) ((isDuplicateContent(duplicateContentResult) ? topScore : getDuplicateContentScoreCalculation(duplicateContentResult)) * 1.25);
        }
    }
    double promotionRatio;
    double joulesPerKilobyte;
    switch(rrcStateMachine.getType()) {
        case LTE:
            promotionRatio = ((RrcStateMachineLTE) rrcStateMachine).getCRPromotionRatio();
            joulesPerKilobyte = ((RrcStateMachineLTE) rrcStateMachine).getJoulesPerKilobyte();
            break;
        case Type3G:
            promotionRatio = ((RrcStateMachine3G) rrcStateMachine).getPromotionRatio();
            joulesPerKilobyte = ((RrcStateMachine3G) rrcStateMachine).getJoulesPerKilobyte();
            break;
        case WiFi:
            promotionRatio = 0.0;
            joulesPerKilobyte = 0.0;
            break;
        default:
            throw new AROUIPanelException("Undhandled state machine type " + rrcStateMachine.getType().name());
    }
    signalingOverheadScore = (int) (applicationSampling.getPromoRatioPercentile(promotionRatio) * 1.25);
    averageRateScore = (int) (applicationSampling.getThroughputPercentile(statistics.getAverageKbps()) * .625);
    energyEfficiencyScore = (int) (ApplicationSampling.getInstance().getJpkbPercentile(joulesPerKilobyte) * 1.875);
}
Also used : PeriodicTransferResult(com.att.aro.core.bestpractice.pojo.PeriodicTransferResult) AbstractBestPracticeResult(com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult) UnnecessaryConnectionResult(com.att.aro.core.bestpractice.pojo.UnnecessaryConnectionResult) ConnectionClosingResult(com.att.aro.core.bestpractice.pojo.ConnectionClosingResult) DuplicateContentResult(com.att.aro.core.bestpractice.pojo.DuplicateContentResult) Statistic(com.att.aro.core.packetanalysis.pojo.Statistic) BurstAnalysisInfo(com.att.aro.core.packetanalysis.pojo.BurstAnalysisInfo) AROUIPanelException(com.att.aro.ui.exception.AROUIPanelException) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) AbstractRrcStateMachine(com.att.aro.core.packetanalysis.pojo.AbstractRrcStateMachine) CacheControlResult(com.att.aro.core.bestpractice.pojo.CacheControlResult) UsingCacheResult(com.att.aro.core.bestpractice.pojo.UsingCacheResult)

Example 3 with AbstractRrcStateMachine

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

the class GraphPanel method filterFlowTable.

// In 4.1.1, the method called refreshGraph()
public void filterFlowTable() {
    AROTraceData filteredSessionTraceData = getTraceData();
    double filteredStartTime = 0.0;
    double filteredEndTime = 0.0;
    double filteredDuration = filteredSessionTraceData.getAnalyzerResult().getTraceresult().getTraceDuration();
    List<Session> tcpsessionsList = new ArrayList<Session>();
    if (getTraceData() == null) {
        return;
    } else {
        TCPUDPFlowsTableModel model = (TCPUDPFlowsTableModel) parent.getJTCPFlowsTable().getModel();
        Map<String, Session> subSessionMap = model.getSessionMap();
        Map<String, Boolean> subcheckboxMap = model.getCheckboxMap();
        for (Map.Entry<String, Boolean> entry : subcheckboxMap.entrySet()) {
            if (entry.getValue()) {
                tcpsessionsList.add(subSessionMap.get(entry.getKey()));
            }
        }
        filteredSessionTraceData.getAnalyzerResult().setSessionlist(tcpsessionsList);
    }
    List<PacketInfo> packetsForSelectedSession = new ArrayList<PacketInfo>();
    for (Session tcpSession : tcpsessionsList) {
        if (tcpSession.getTcpPackets() != null) {
            packetsForSelectedSession.addAll(tcpSession.getTcpPackets());
        }
    }
    // when generating graph, make sure session is ordered by time stamp
    Collections.sort(packetsForSelectedSession, new Comparator<PacketInfo>() {

        @Override
        public int compare(PacketInfo p1, PacketInfo p2) {
            return (int) (p1.getTimeStamp() * 1000 - p2.getTimeStamp() * 1000);
        }
    });
    boolean selectedAllPackets = false;
    // Adding the TCP packets to the trace for getting redoing the analysis
    if (packetsForSelectedSession.size() > 0) {
        if (tcpsessionsList.size() == getAllTcpSessions()) {
            // For select all use all exiting packets
            filteredSessionTraceData.getAnalyzerResult().getTraceresult().setAllpackets(getAllPackets());
            selectedAllPackets = true;
        } else {
            // Collections.sort(packetsForSelectedSession);//?
            filteredSessionTraceData.getAnalyzerResult().getTraceresult().setAllpackets(packetsForSelectedSession);
        }
    }
    if (selectedAllPackets) {
        filteredStartTime = -0.01;
        filteredEndTime = filteredDuration;
    } else {
        int index = 0;
        for (Session tcpSession : tcpsessionsList) {
            if (tcpSession.getTcpPackets().size() != 0) {
                if (index == 0) {
                    filteredStartTime = tcpSession.getTcpPackets().get(0).getTimeStamp();
                    filteredEndTime = tcpSession.getTcpPackets().get(0).getTimeStamp();
                }
                if (filteredStartTime > tcpSession.getTcpPackets().get(0).getTimeStamp()) {
                    filteredStartTime = tcpSession.getTcpPackets().get(0).getTimeStamp();
                }
                if (filteredEndTime < tcpSession.getTcpPackets().get(0).getTimeStamp()) {
                    filteredEndTime = tcpSession.getTcpPackets().get(0).getTimeStamp();
                }
                index++;
            }
        }
        if (index == 0) {
            filteredStartTime = 0.0;
            filteredEndTime = 0.0;
        }
    }
    // for Analysis data particular time of the graph, some number is not clear..
    if (filteredStartTime > 0) {
        // adjust the time line axis number
        filteredStartTime = filteredStartTime - 2;
        if (filteredStartTime < 0) {
            filteredStartTime = -0.01;
        }
    }
    if (filteredStartTime < 0) {
        filteredStartTime = -0.01;
    }
    if (!selectedAllPackets) {
        if (filteredEndTime > 0) {
            // adjust the time line axis number
            filteredEndTime = filteredEndTime + 15;
        }
        if (filteredEndTime > filteredDuration) {
            filteredEndTime = filteredDuration;
        }
    }
    this.startTime = filteredStartTime;
    this.endTime = filteredEndTime;
    if (getTraceData() != null) {
        TimeRange timeRange = new TimeRange(filteredStartTime, filteredEndTime);
        AnalysisFilter filter = filteredSessionTraceData.getAnalyzerResult().getFilter();
        filter.setTimeRange(timeRange);
        filteredSessionTraceData.getAnalyzerResult().setFilter(filter);
        Statistic stat = ContextAware.getAROConfigContext().getBean(IPacketAnalyzer.class).getStatistic(packetsForSelectedSession);
        long totaltemp = 0;
        for (Session byteCountSession : tcpsessionsList) {
            totaltemp += byteCountSession.getBytesTransferred();
        }
        stat.setTotalByte(totaltemp);
        AbstractRrcStateMachine statemachine = ContextAware.getAROConfigContext().getBean(IRrcStateMachineFactory.class).create(packetsForSelectedSession, filteredSessionTraceData.getAnalyzerResult().getProfile(), stat.getPacketDuration(), filteredDuration, stat.getTotalByte(), timeRange);
        BurstCollectionAnalysisData burstcollectiondata = new BurstCollectionAnalysisData();
        if (stat.getTotalByte() > 0) {
            burstcollectiondata = ContextAware.getAROConfigContext().getBean(IBurstCollectionAnalysis.class).analyze(packetsForSelectedSession, filteredSessionTraceData.getAnalyzerResult().getProfile(), stat.getPacketSizeToCountMap(), statemachine.getStaterangelist(), filteredSessionTraceData.getAnalyzerResult().getTraceresult().getUserEvents(), filteredSessionTraceData.getAnalyzerResult().getTraceresult().getCpuActivityList().getCpuActivities(), tcpsessionsList);
        }
        filteredSessionTraceData.getAnalyzerResult().getStatistic().setTotalByte(stat.getTotalByte());
        filteredSessionTraceData.getAnalyzerResult().setStatemachine(statemachine);
        filteredSessionTraceData.getAnalyzerResult().setBurstCollectionAnalysisData(burstcollectiondata);
        refresh(filteredSessionTraceData);
    }
}
Also used : TCPUDPFlowsTableModel(com.att.aro.ui.model.diagnostic.TCPUDPFlowsTableModel) AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) ArrayList(java.util.ArrayList) Statistic(com.att.aro.core.packetanalysis.pojo.Statistic) AbstractRrcStateMachine(com.att.aro.core.packetanalysis.pojo.AbstractRrcStateMachine) IPacketAnalyzer(com.att.aro.core.packetanalysis.IPacketAnalyzer) AROTraceData(com.att.aro.core.pojo.AROTraceData) Point(java.awt.Point) TimeRange(com.att.aro.core.packetanalysis.pojo.TimeRange) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) BurstCollectionAnalysisData(com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData) Map(java.util.Map) EnumMap(java.util.EnumMap) TreeMap(java.util.TreeMap) IRrcStateMachineFactory(com.att.aro.core.packetanalysis.IRrcStateMachineFactory) Session(com.att.aro.core.packetanalysis.pojo.Session)

Example 4 with AbstractRrcStateMachine

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

the class RrcStateMachineFactoryImpl method create.

@Override
public AbstractRrcStateMachine create(List<PacketInfo> packetlist, Profile profile, double packetDuration, double traceDuration, double totalBytes, TimeRange timerange) {
    List<RrcStateRange> staterangelist = staterange.create(packetlist, profile, traceDuration);
    if (timerange != null) {
        staterangelist = this.getRRCStatesForTheTimeRange(staterangelist, timerange.getBeginTime(), timerange.getEndTime());
    }
    AbstractRrcStateMachine data = null;
    if (profile.getProfileType() == ProfileType.T3G) {
        data = run3GRRcStatistics(staterangelist, (Profile3G) profile, totalBytes, packetDuration, traceDuration);
    } else if (profile.getProfileType() == ProfileType.LTE) {
        data = runLTERRcStatistics(staterangelist, (ProfileLTE) profile, packetlist, totalBytes, packetDuration, traceDuration);
    } else if (profile.getProfileType() == ProfileType.WIFI) {
        data = runWiFiRRcStatistics(staterangelist, (ProfileWiFi) profile, totalBytes, packetDuration, traceDuration);
    }
    if (data != null) {
        data.setStaterangelist(staterangelist);
    }
    return data;
}
Also used : RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange) Profile3G(com.att.aro.core.configuration.pojo.Profile3G) AbstractRrcStateMachine(com.att.aro.core.packetanalysis.pojo.AbstractRrcStateMachine) ProfileWiFi(com.att.aro.core.configuration.pojo.ProfileWiFi)

Example 5 with AbstractRrcStateMachine

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

the class RrcStateMachineFactoryImplTest method create_TimeRangeIsNotNull.

@Test
public void create_TimeRangeIsNotNull() {
    ProfileWiFi profile01 = mock(ProfileWiFi.class);
    when(profile01.getProfileType()).thenReturn(ProfileType.WIFI);
    List<PacketInfo> packetlist1 = new ArrayList<PacketInfo>();
    TimeRange timeRange = mock(TimeRange.class);
    when(timeRange.getBeginTime()).thenReturn((double) date.getTime() - 3000.0);
    when(timeRange.getEndTime()).thenReturn((double) date.getTime() + 1000.0);
    List<RrcStateRange> staterangelist = new ArrayList<RrcStateRange>();
    RrcStateRange rrc01 = mock(RrcStateRange.class);
    RrcStateRange rrc02 = mock(RrcStateRange.class);
    RrcStateRange rrc03 = mock(RrcStateRange.class);
    when(rrc01.getBeginTime()).thenReturn((double) date.getTime() - 3000.0);
    when(rrc01.getEndTime()).thenReturn((double) date.getTime() - 2000.0);
    when(rrc02.getBeginTime()).thenReturn((double) date.getTime() - 1000.0);
    when(rrc02.getEndTime()).thenReturn((double) date.getTime());
    when(rrc03.getBeginTime()).thenReturn((double) date.getTime() + 1000.0);
    when(rrc03.getEndTime()).thenReturn((double) date.getTime() + 2000.0);
    when(profilefactory.energy3G(any(double.class), any(double.class), any(RRCState.class), any(Profile3G.class))).thenReturn(2.0);
    when(rrc01.getState()).thenReturn(RRCState.TAIL_FACH);
    when(rrc02.getState()).thenReturn(RRCState.TAIL_FACH);
    when(rrc03.getState()).thenReturn(RRCState.TAIL_FACH);
    staterangelist.add(rrc01);
    staterangelist.add(rrc02);
    staterangelist.add(rrc03);
    when(staterange.create(any(ArrayList.class), any(Profile.class), any(double.class))).thenReturn(staterangelist);
    AbstractRrcStateMachine rrcStateMachinewifi = machineFactoryimpl.create(packetlist1, profile01, packetDuration, traceDuration, 0.0, timeRange);
    assertEquals(0.0, rrcStateMachinewifi.getJoulesPerKilobyte(), 0.0);
}
Also used : TimeRange(com.att.aro.core.packetanalysis.pojo.TimeRange) RRCState(com.att.aro.core.packetanalysis.pojo.RRCState) ArrayList(java.util.ArrayList) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange) Profile3G(com.att.aro.core.configuration.pojo.Profile3G) AbstractRrcStateMachine(com.att.aro.core.packetanalysis.pojo.AbstractRrcStateMachine) ProfileWiFi(com.att.aro.core.configuration.pojo.ProfileWiFi) Profile(com.att.aro.core.configuration.pojo.Profile) BaseTest(com.att.aro.core.BaseTest) Test(org.junit.Test)

Aggregations

AbstractRrcStateMachine (com.att.aro.core.packetanalysis.pojo.AbstractRrcStateMachine)5 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)3 Statistic (com.att.aro.core.packetanalysis.pojo.Statistic)3 TimeRange (com.att.aro.core.packetanalysis.pojo.TimeRange)3 ArrayList (java.util.ArrayList)3 Profile (com.att.aro.core.configuration.pojo.Profile)2 Profile3G (com.att.aro.core.configuration.pojo.Profile3G)2 ProfileWiFi (com.att.aro.core.configuration.pojo.ProfileWiFi)2 BurstCollectionAnalysisData (com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData)2 PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)2 RrcStateRange (com.att.aro.core.packetanalysis.pojo.RrcStateRange)2 Session (com.att.aro.core.packetanalysis.pojo.Session)2 BaseTest (com.att.aro.core.BaseTest)1 AbstractBestPracticeResult (com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult)1 BestPracticeType (com.att.aro.core.bestpractice.pojo.BestPracticeType)1 CacheControlResult (com.att.aro.core.bestpractice.pojo.CacheControlResult)1 ConnectionClosingResult (com.att.aro.core.bestpractice.pojo.ConnectionClosingResult)1 DuplicateContentResult (com.att.aro.core.bestpractice.pojo.DuplicateContentResult)1 PeriodicTransferResult (com.att.aro.core.bestpractice.pojo.PeriodicTransferResult)1 UnnecessaryConnectionResult (com.att.aro.core.bestpractice.pojo.UnnecessaryConnectionResult)1