Search in sources :

Example 6 with PacketInfo

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

the class CacheAnalysisImpl method analyze.

@Override
public CacheAnalysis analyze(List<Session> sessionlist) {
    long analysisStartTime = System.currentTimeMillis();
    CacheAnalysis result = new CacheAnalysis();
    long totalRequestResponseBytes = 0;
    long totalRequestResponseDupBytes = 0;
    double duplicateContentBytesRatio = 0.0;
    Map<String, CacheEntry> cacheEntries = new HashMap<String, CacheEntry>();
    Map<String, CacheEntry> dupEntries = new HashMap<String, CacheEntry>();
    Map<String, SortedSet<Range>> rangeEntries = new HashMap<String, SortedSet<Range>>();
    List<CacheEntry> diagnosisResults = new ArrayList<CacheEntry>();
    List<CacheEntry> duplicateContent = new ArrayList<CacheEntry>();
    List<CacheEntry> duplicateContentWithOriginals = new ArrayList<CacheEntry>();
    Map<CacheExpiration, List<CacheEntry>> cacheExpirationResponses = result.getCacheExpirationResponses();
    duplicateEntries = new ArrayList<DuplicateEntry>();
    // Initialize cache expiration lists
    for (CacheExpiration expiration : CacheExpiration.values()) {
        cacheExpirationResponses.put(expiration, new ArrayList<CacheEntry>());
    }
    // Build a sorted list of all of the HTTP request/response in the trace
    List<HttpRequestResponseInfoWithSession> rrInfo = new ArrayList<HttpRequestResponseInfoWithSession>();
    for (Session session : sessionlist) {
        if (!session.isUdpOnly()) {
            // rrInfo.addAll(session.getRequestResponseInfo());
            for (HttpRequestResponseInfo item : session.getRequestResponseInfo()) {
                HttpRequestResponseInfoWithSession itemsession = new HttpRequestResponseInfoWithSession();
                itemsession.setInfo(item);
                itemsession.setSession(session);
                rrInfo.add(itemsession);
            }
        }
    }
    Collections.sort(rrInfo);
    // Iterate through responses looking for duplicates
    for (HttpRequestResponseInfoWithSession httpreqres : rrInfo) {
        HttpRequestResponseInfo response = httpreqres.getInfo();
        Session session = httpreqres.getSession();
        PacketInfo firstPacket = session.getTcpPackets().get(0);
        if (response.getDirection() == HttpDirection.REQUEST) {
            // We only want to process responses
            continue;
        }
        // Check whether response is valid
        int statusCode = response.getStatusCode();
        if (statusCode == 0) {
            diagnosisResults.add(new CacheEntry(null, response, Diagnosis.CACHING_DIAG_INVALID_RESPONSE, 0, firstPacket));
            continue;
        }
        if (statusCode != 200 && statusCode != 206) {
            diagnosisResults.add(new CacheEntry(null, response, Diagnosis.CACHING_DIAG_INVALID_REQUEST, 0, firstPacket));
            continue;
        }
        // [A] Find corresponding request
        HttpRequestResponseInfo request = response.getAssocReqResp();
        if (request == null) {
            diagnosisResults.add(new CacheEntry(request, response, Diagnosis.CACHING_DIAG_REQUEST_NOT_FOUND, 0, firstPacket));
            continue;
        }
        totalRequestResponseBytes += response.getContentLength();
        // Request must by GET, POST, or PUT
        String requestType = request.getRequestType();
        if (!HttpRequestResponseInfo.HTTP_GET.equals(requestType) && !HttpRequestResponseInfo.HTTP_PUT.equals(requestType) && !HttpRequestResponseInfo.HTTP_POST.equals(requestType)) {
            diagnosisResults.add(new CacheEntry(request, response, Diagnosis.CACHING_DIAG_INVALID_REQUEST, 0, firstPacket));
            continue;
        }
        // Check for valid object name and host name
        if (request.getHostName() == null || request.getObjName() == null) {
            diagnosisResults.add(new CacheEntry(request, response, Diagnosis.CACHING_DIAG_INVALID_OBJ_NAME, 0, firstPacket));
            continue;
        }
        // [B] Object cacheable?
        if (response.isNoStore() || request.isNoStore() || HttpRequestResponseInfo.HTTP_POST.equals(requestType) || HttpRequestResponseInfo.HTTP_PUT.equals(requestType)) {
            cacheEntries.remove(getObjFullName(request, response));
            dupEntries.remove(getObjDuplicateName(request, response));
            diagnosisResults.add(new CacheEntry(request, response, Diagnosis.CACHING_DIAG_NOT_CACHABLE, 0, firstPacket));
            continue;
        }
        // [C] Does it hit the cache?
        CacheEntry cacheEntry = cacheEntries.get(getObjFullName(request, response));
        CacheEntry cacheDuplicateEntry = dupEntries.get(getObjDuplicateName(request, response));
        CacheEntry newCacheEntry;
        if (cacheEntry == null) {
            Diagnosis diagnosis = Diagnosis.CACHING_DIAG_CACHE_MISSED;
            newCacheEntry = new CacheEntry(request, response, diagnosis, firstPacket);
            newCacheEntry.setSession(session);
            addToCache(newCacheEntry, rangeEntries, cacheEntries, dupEntries, session);
            newCacheEntry.setCacheCount(1);
            diagnosisResults.add(newCacheEntry);
            if (cacheDuplicateEntry != null) {
                diagnosis = Diagnosis.CACHING_DIAG_ETAG_DUPLICATE;
            }
            duplicateEntries.add(new DuplicateEntry(request, response, diagnosis, firstPacket, session, getContent(response, session)));
            continue;
        } else {
            int oldCount = cacheEntry.getCacheCount();
            cacheEntry.setCacheCount(oldCount + 1);
        }
        CacheExpiration expStatus = cacheExpired(cacheEntry, request.getAbsTimeStamp());
        SortedSet<Range> ranges = rangeEntries.get(getObjFullName(cacheEntry.getRequest(), cacheEntry.getResponse()));
        boolean isfullcachehit = isFullCacheHit(response, ranges);
        if (isfullcachehit) {
            // [D] Is it expired?
            switch(expStatus) {
                case CACHE_EXPIRED:
                case CACHE_EXPIRED_HEURISTIC:
                    newCacheEntry = handleCacheExpired(session, response, request, firstPacket, cacheEntry);
                    diagnosisResults.add(newCacheEntry);
                    break;
                case CACHE_NOT_EXPIRED:
                case CACHE_NOT_EXPIRED_HEURISTIC:
                    newCacheEntry = new CacheEntry(request, response, Diagnosis.CACHING_DIAG_NOT_EXPIRED_DUP, firstPacket);
                    duplicateEntries.add(new DuplicateEntry(request, response, Diagnosis.CACHING_DIAG_NOT_EXPIRED_DUP, firstPacket, session, getContent(response, session)));
                    diagnosisResults.add(newCacheEntry);
                    break;
                default:
                    // Should not occur
                    newCacheEntry = null;
            }
        } else {
            long bytesInCache = getBytesInCache(response, ranges);
            // [D] Is it expired?
            switch(expStatus) {
                case CACHE_EXPIRED:
                case CACHE_EXPIRED_HEURISTIC:
                    newCacheEntry = handleCacheExpiredWithByteInCache(session, response, request, firstPacket, cacheEntry, bytesInCache);
                    diagnosisResults.add(newCacheEntry);
                    break;
                case CACHE_NOT_EXPIRED:
                case CACHE_NOT_EXPIRED_HEURISTIC:
                    newCacheEntry = new CacheEntry(request, response, Diagnosis.CACHING_DIAG_NOT_EXPIRED_DUP_PARTIALHIT, bytesInCache, firstPacket);
                    duplicateEntries.add(new DuplicateEntry(request, response, Diagnosis.CACHING_DIAG_NOT_EXPIRED_DUP, firstPacket, session, getContent(response, session)));
                    diagnosisResults.add(newCacheEntry);
                    break;
                default:
                    // Should not occur
                    newCacheEntry = null;
            }
        }
        cacheExpirationResponses.get(expStatus).add(newCacheEntry);
        if (newCacheEntry != null) {
            newCacheEntry.setCacheHit(cacheEntry);
        }
    // addToCache(newCacheEntry);
    }
    // END: Iterate through responses looking for duplicates
    // Get cache problems
    Set<CacheEntry> dupsWithOrig = new HashSet<CacheEntry>();
    Map<String, DuplicateEntry> duplicateEntriesMap = new HashMap<String, DuplicateEntry>();
    CacheEntry cache;
    for (DuplicateEntry dupEntry : duplicateEntries) {
        if (dupEntry.getContentLength() > 0) {
            String key = dupEntry.getRequest().getHostName() + dupEntry.getHttpObjectName() + dupEntry.getContentLength();
            if (dupEntry.getHttpObjectName() != null) {
                if (!duplicateEntriesMap.containsKey(key)) {
                    dupEntry.setCount(1);
                    duplicateEntriesMap.put(key, dupEntry);
                } else {
                    if (Arrays.equals(duplicateEntriesMap.get(key).getContent(), dupEntry.getContent())) {
                        int count = duplicateEntriesMap.get(key).getCount();
                        if (count == 1) {
                            cache = new CacheEntry(duplicateEntriesMap.get(key).getRequest(), duplicateEntriesMap.get(key).getResponse(), duplicateEntriesMap.get(key).getDiagnosis(), duplicateEntriesMap.get(key).getSessionFirstPacket());
                            cache.setSession(dupEntry.getSession());
                            dupsWithOrig.add(cache);
                        }
                        cache = new CacheEntry(dupEntry.getRequest(), dupEntry.getResponse(), dupEntry.getDiagnosis(), dupEntry.getSessionFirstPacket());
                        dupsWithOrig.add(cache);
                        dupEntry = new DuplicateEntry(dupEntry.getRequest(), dupEntry.getResponse(), dupEntry.getDiagnosis(), dupEntry.getSessionFirstPacket(), dupEntry.getSession(), dupEntry.getContent());
                        dupEntry.setCount(count + 1);
                        duplicateEntriesMap.replace(key, dupEntry);
                    }
                }
            }
        }
    }
    for (Entry<String, DuplicateEntry> cacheEntry2 : duplicateEntriesMap.entrySet()) {
        if (cacheEntry2.getValue().getCount() > 1) {
            int count = cacheEntry2.getValue().getCount();
            cache = new CacheEntry(cacheEntry2.getValue().getRequest(), cacheEntry2.getValue().getResponse(), cacheEntry2.getValue().getDiagnosis(), cacheEntry2.getValue().getSessionFirstPacket());
            cache.setHitCount(count);
            if (count > 2) {
                totalRequestResponseDupBytes += (cacheEntry2.getValue().getHttpRequestResponse().getContentLength() * (count - 1));
            } else {
                totalRequestResponseDupBytes += cacheEntry2.getValue().getHttpRequestResponse().getContentLength();
            }
            duplicateContent.add(cache);
        }
    }
    duplicateContentWithOriginals.addAll(dupsWithOrig);
    Collections.sort(duplicateContentWithOriginals);
    duplicateContentBytesRatio = totalRequestResponseBytes != 0 ? (double) totalRequestResponseDupBytes / totalRequestResponseBytes : 0.0;
    result.setCacheExpirationResponses(cacheExpirationResponses);
    result.setDiagnosisResults(diagnosisResults);
    result.setDuplicateContent(duplicateContent);
    result.setDuplicateContentBytesRatio(duplicateContentBytesRatio);
    result.setDuplicateContentWithOriginals(duplicateContentWithOriginals);
    result.setTotalRequestResponseBytes(totalRequestResponseBytes);
    result.setTotalRequestResponseDupBytes(totalRequestResponseDupBytes);
    GoogleAnalyticsUtil.getGoogleAnalyticsInstance().sendAnalyticsTimings(cacheAnalysisTitle, System.currentTimeMillis() - analysisStartTime, analysisCategory);
    return result;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) SortedSet(java.util.SortedSet) DuplicateEntry(com.att.aro.core.packetanalysis.pojo.DuplicateEntry) ArrayList(java.util.ArrayList) List(java.util.List) Diagnosis(com.att.aro.core.packetanalysis.pojo.Diagnosis) CacheExpiration(com.att.aro.core.packetanalysis.pojo.CacheExpiration) HashSet(java.util.HashSet) HttpRequestResponseInfoWithSession(com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfoWithSession) HttpRequestResponseInfo(com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo) CacheEntry(com.att.aro.core.packetanalysis.pojo.CacheEntry) Range(com.att.aro.core.packetanalysis.pojo.Range) CacheAnalysis(com.att.aro.core.packetanalysis.pojo.CacheAnalysis) ICacheAnalysis(com.att.aro.core.packetanalysis.ICacheAnalysis) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) HttpRequestResponseInfoWithSession(com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfoWithSession) Session(com.att.aro.core.packetanalysis.pojo.Session)

Example 7 with PacketInfo

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

the class PacketAnalyzerImplTest method test_getStatisticResult.

@Test
public void test_getStatisticResult() throws UnknownHostException {
    InetAddress iAdr = Mockito.mock(InetAddress.class);
    InetAddress iAdr1 = Mockito.mock(InetAddress.class);
    Mockito.when(iAdr.getAddress()).thenReturn(new byte[] { 89, 10, 1, 1 });
    Mockito.when(iAdr1.getAddress()).thenReturn(new byte[] { 72, 12, 13, 1 });
    Set<InetAddress> inetSet = new HashSet<InetAddress>();
    inetSet.add(iAdr);
    inetSet.add(iAdr1);
    DomainNameSystem dns = Mockito.mock(DomainNameSystem.class);
    Mockito.when(dns.getIpAddresses()).thenReturn(inetSet);
    Mockito.when(dns.getDomainName()).thenReturn("www.att.com");
    UDPPacket udpPacket = Mockito.mock(UDPPacket.class);
    Mockito.when(udpPacket.isDNSPacket()).thenReturn(true);
    Mockito.when(udpPacket.getDns()).thenReturn(dns);
    Mockito.when(udpPacket.getSourcePort()).thenReturn(83);
    Mockito.when(udpPacket.getDestinationPort()).thenReturn(84);
    Mockito.when(udpPacket.getDestinationIPAddress()).thenReturn(iAdr);
    PacketInfo packetInfo1 = Mockito.mock(PacketInfo.class);
    Mockito.when(packetInfo1.getPacket()).thenReturn(udpPacket);
    Mockito.when(packetInfo1.getDir()).thenReturn(PacketDirection.UPLINK);
    Mockito.when(packetInfo1.getPayloadLen()).thenReturn(0);
    Mockito.when(packetInfo1.getLen()).thenReturn(10);
    Mockito.when(packetInfo1.getAppName()).thenReturn("Test1");
    Mockito.when(packetInfo1.getTcpFlagString()).thenReturn("TestString");
    Mockito.when(packetInfo1.getTimeStamp()).thenReturn(500d);
    InetAddress iAdr2 = Mockito.mock(InetAddress.class);
    Mockito.when(iAdr2.getAddress()).thenReturn(new byte[] { 95, 10, 1, 1 });
    TCPPacket tcpPacket = Mockito.mock(TCPPacket.class);
    Mockito.when(tcpPacket.getSourcePort()).thenReturn(81);
    Mockito.when(tcpPacket.getDestinationPort()).thenReturn(82);
    Mockito.when(tcpPacket.getDestinationIPAddress()).thenReturn(iAdr2);
    Mockito.when(tcpPacket.isSYN()).thenReturn(true);
    Mockito.when(tcpPacket.isFIN()).thenReturn(true);
    Mockito.when(tcpPacket.isRST()).thenReturn(true);
    Mockito.when(tcpPacket.getTimeStamp()).thenReturn(1000d);
    PacketInfo packetInfo2 = Mockito.mock(PacketInfo.class);
    Mockito.when(packetInfo2.getPacket()).thenReturn(tcpPacket);
    Mockito.when(packetInfo2.getDir()).thenReturn(PacketDirection.UPLINK);
    Mockito.when(packetInfo2.getTcpInfo()).thenReturn(TcpInfo.TCP_ESTABLISH);
    Mockito.when(packetInfo2.getPayloadLen()).thenReturn(0);
    Mockito.when(packetInfo2.getLen()).thenReturn(15);
    Mockito.when(packetInfo2.getAppName()).thenReturn("Test2");
    Mockito.when(packetInfo2.getTcpFlagString()).thenReturn("Test2String");
    Mockito.when(packetInfo2.getTimeStamp()).thenReturn(10d);
    TCPPacket tcpPacket2 = Mockito.mock(TCPPacket.class);
    Mockito.when(tcpPacket2.getSourcePort()).thenReturn(95);
    Mockito.when(tcpPacket2.getDestinationPort()).thenReturn(99);
    Mockito.when(tcpPacket2.getDestinationIPAddress()).thenReturn(iAdr2);
    Mockito.when(tcpPacket2.isSYN()).thenReturn(true);
    Mockito.when(tcpPacket2.isFIN()).thenReturn(true);
    Mockito.when(tcpPacket2.isRST()).thenReturn(false);
    Mockito.when(tcpPacket2.getTimeStamp()).thenReturn(50d);
    Inet4Address address = (Inet4Address) InetAddress.getByName("192.168.1.4");
    PacketInfo packetInfo3 = Mockito.mock(PacketInfo.class);
    Mockito.when(packetInfo3.getPacket()).thenReturn(tcpPacket2);
    Mockito.when(packetInfo3.getDir()).thenReturn(PacketDirection.UPLINK);
    Mockito.when(packetInfo3.getTcpInfo()).thenReturn(TcpInfo.TCP_ESTABLISH);
    Mockito.when(packetInfo3.getPayloadLen()).thenReturn(0);
    Mockito.when(packetInfo3.getLen()).thenReturn(15);
    Mockito.when(packetInfo3.getAppName()).thenReturn("Test2");
    Mockito.when(packetInfo3.getTcpFlagString()).thenReturn("Test2String");
    Mockito.when(packetInfo3.getTimeStamp()).thenReturn(10d);
    Mockito.when(packetInfo3.getRemoteIPAddress()).thenReturn(address);
    List<PacketInfo> packetsList = new ArrayList<PacketInfo>();
    // Adding UDP Packet to the list
    packetsList.add(packetInfo1);
    packetsList.add(packetInfo2);
    packetsList.add(packetInfo3);
    Statistic testResult = iPacketAnalyzer.getStatistic(packetsList);
    assertEquals(3, testResult.getTotalPackets());
}
Also used : Inet4Address(java.net.Inet4Address) DomainNameSystem(com.att.aro.core.packetreader.pojo.DomainNameSystem) Statistic(com.att.aro.core.packetanalysis.pojo.Statistic) TCPPacket(com.att.aro.core.packetreader.pojo.TCPPacket) ArrayList(java.util.ArrayList) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) InetAddress(java.net.InetAddress) UDPPacket(com.att.aro.core.packetreader.pojo.UDPPacket) HashSet(java.util.HashSet) BaseTest(com.att.aro.core.BaseTest) Test(org.junit.Test)

Example 8 with PacketInfo

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

the class RrcStateRangeFactoryImplTest method Create3G_test8.

@Test
public void Create3G_test8() {
    Profile3G profile3g = mock(Profile3G.class);
    when(profile3g.getProfileType()).thenReturn(ProfileType.T3G);
    when(profile3g.getIdleDchPromoAvg()).thenReturn(12000.0);
    when(profile3g.getIdleDchPromoMin()).thenReturn(1000.0);
    when(profile3g.getIdleDchPromoMax()).thenReturn(20000.0);
    when(profile3g.getFachDchPromoAvg()).thenReturn(1000.0);
    when(profile3g.getFachDchPromoMin()).thenReturn(2500.0);
    when(profile3g.getFachDchPromoMax()).thenReturn(6000.0);
    when(profile3g.getDchFachTimer()).thenReturn(5000.0);
    when(profile3g.getFachIdleTimer()).thenReturn(10000.0);
    double traceDuration = 2000.0;
    List<PacketInfo> packetlist = new ArrayList<PacketInfo>();
    when(pktInfoArray[0].getTimeStamp()).thenReturn(date.getTime() - 7500.0);
    when(pktInfoArray[0].getDir()).thenReturn(PacketDirection.DOWNLINK);
    when(pktInfoArray[0].getLen()).thenReturn(1000);
    when(pktInfoArray[0].getStateMachine()).thenReturn(RRCState.PROMO_FACH_DCH);
    packetlist.add(pktInfoArray[0]);
    when(pktInfoArray[1].getTimeStamp()).thenReturn(date.getTime() + 10000.0);
    when(pktInfoArray[1].getDir()).thenReturn(PacketDirection.DOWNLINK);
    when(pktInfoArray[1].getLen()).thenReturn(1000);
    when(pktInfoArray[1].getStateMachine()).thenReturn(RRCState.PROMO_IDLE_DCH);
    packetlist.add(pktInfoArray[1]);
    when(pktInfoArray[2].getTimeStamp()).thenReturn(date.getTime() + 15000.0);
    when(pktInfoArray[2].getDir()).thenReturn(PacketDirection.DOWNLINK);
    when(pktInfoArray[2].getLen()).thenReturn(1000);
    when(pktInfoArray[2].getStateMachine()).thenReturn(RRCState.PROMO_IDLE_DCH);
    packetlist.add(pktInfoArray[2]);
    List<RrcStateRange> testList = rrcStateRangeFactory.create(packetlist, profile3g, traceDuration);
    assertEquals(1, testList.size());
}
Also used : ArrayList(java.util.ArrayList) Profile3G(com.att.aro.core.configuration.pojo.Profile3G) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Example 9 with PacketInfo

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

the class RrcStateRangeFactoryImplTest method create_LTEIsIdle.

@Test
public void create_LTEIsIdle() {
    ProfileLTE profile02 = mock(ProfileLTE.class);
    when(profile02.getProfileType()).thenReturn(ProfileType.LTE);
    List<PacketInfo> packetlist1 = new ArrayList<PacketInfo>();
    double traceDuration = 2000.0;
    List<RrcStateRange> testResult = rrcStateRangeFactory.create(packetlist1, profile02, traceDuration);
    assertEquals(1, testResult.size());
}
Also used : ArrayList(java.util.ArrayList) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange) ProfileLTE(com.att.aro.core.configuration.pojo.ProfileLTE) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Example 10 with PacketInfo

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

the class RrcStateMachineFactoryImplTest method create_LTEStateIsLTE_IDLE.

@Test
public void create_LTEStateIsLTE_IDLE() {
    ProfileLTE profile03 = mock(ProfileLTE.class);
    when(profile03.getProfileType()).thenReturn(ProfileType.LTE);
    when(profilefactory.energyLTE(any(double.class), any(double.class), any(RRCState.class), any(ProfileLTE.class), any(ArrayList.class))).thenReturn(100.0);
    List<PacketInfo> packetlist1 = new ArrayList<PacketInfo>();
    List<RrcStateRange> staterangelist = new ArrayList<RrcStateRange>();
    RrcStateRange[] rrcStateRangeArray = new RrcStateRange[5];
    for (int i = 0; i < 5; i++) {
        rrcStateRangeArray[i] = mock(RrcStateRange.class);
        when(rrcStateRangeArray[i].getState()).thenReturn(RRCState.LTE_IDLE);
        when(rrcStateRangeArray[i].getBeginTime()).thenReturn((double) date.getTime() + 2 * i * 1000);
        when(rrcStateRangeArray[i].getEndTime()).thenReturn((double) date.getTime() + (2 * i + 1) * 1000.0);
    }
    for (int i = 0; i < 5; i++) {
        staterangelist.add(rrcStateRangeArray[i]);
    }
    when(staterange.create(any(ArrayList.class), any(Profile.class), any(double.class))).thenReturn(staterangelist);
    RrcStateMachineLTE rrcStateMachineLTE = (RrcStateMachineLTE) machineFactoryimpl.create(packetlist1, profile03, packetDuration, traceDuration, totalBytes * 100, null);
    assertEquals(50, rrcStateMachineLTE.getJoulesPerKilobyte(), 0.0);
    assertEquals(500, rrcStateMachineLTE.getTotalRRCEnergy(), 0.0);
    assertEquals(5000, rrcStateMachineLTE.getLteIdleTime(), 0.0);
}
Also used : RrcStateMachineLTE(com.att.aro.core.packetanalysis.pojo.RrcStateMachineLTE) 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) ProfileLTE(com.att.aro.core.configuration.pojo.ProfileLTE) Profile(com.att.aro.core.configuration.pojo.Profile) BaseTest(com.att.aro.core.BaseTest) Test(org.junit.Test)

Aggregations

PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)119 ArrayList (java.util.ArrayList)92 BaseTest (com.att.aro.core.BaseTest)63 Test (org.junit.Test)63 RrcStateRange (com.att.aro.core.packetanalysis.pojo.RrcStateRange)48 Session (com.att.aro.core.packetanalysis.pojo.Session)33 TCPPacket (com.att.aro.core.packetreader.pojo.TCPPacket)30 Profile3G (com.att.aro.core.configuration.pojo.Profile3G)26 Profile (com.att.aro.core.configuration.pojo.Profile)25 InetAddress (java.net.InetAddress)25 RRCState (com.att.aro.core.packetanalysis.pojo.RRCState)21 ProfileLTE (com.att.aro.core.configuration.pojo.ProfileLTE)18 HashSet (java.util.HashSet)16 HttpRequestResponseInfo (com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo)14 UDPPacket (com.att.aro.core.packetreader.pojo.UDPPacket)14 Packet (com.att.aro.core.packetreader.pojo.Packet)11 HashMap (java.util.HashMap)11 BurstCollectionAnalysisData (com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData)9 DomainNameSystem (com.att.aro.core.packetreader.pojo.DomainNameSystem)9 IPPacket (com.att.aro.core.packetreader.pojo.IPPacket)9