Search in sources :

Example 86 with PacketInfo

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

the class RrcStateRangeFactoryImplTest method create_WIFIIsIdleTrace.

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

Example 87 with PacketInfo

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

the class RrcStateRangeFactoryImplTest method create_ProfileIsWifi.

@Test
public void create_ProfileIsWifi() {
    ProfileWiFi profile03 = mock(ProfileWiFi.class);
    when(profile03.getProfileType()).thenReturn(ProfileType.WIFI);
    List<PacketInfo> packetlist = new ArrayList<PacketInfo>();
    double traceDuration = 1000.0;
    when(profile03.getWifiTailTime()).thenReturn(1500.0);
    when(pktInfoArray[0].getTimeStamp()).thenReturn(date.getTime() - 1500.0);
    when(pktInfoArray[1].getTimeStamp()).thenReturn(date.getTime() - 500.0);
    when(pktInfoArray[2].getTimeStamp()).thenReturn(date.getTime() + 500.0);
    when(pktInfoArray[3].getTimeStamp()).thenReturn(date.getTime() + 1500.0);
    when(pktInfoArray[4].getTimeStamp()).thenReturn(date.getTime() + 2505.0);
    when(pktInfoArray[5].getTimeStamp()).thenReturn(date.getTime() + 3500.0);
    when(pktInfoArray[6].getTimeStamp()).thenReturn(date.getTime() + 4501.0);
    when(pktInfoArray[7].getTimeStamp()).thenReturn(date.getTime() + 5001.0);
    when(pktInfoArray[8].getTimeStamp()).thenReturn(date.getTime() + 6001.0);
    when(pktInfoArray[9].getTimeStamp()).thenReturn(date.getTime() + 6501.0);
    when(pktInfoArray[10].getTimeStamp()).thenReturn(date.getTime() + 7001.0);
    when(pktInfoArray[11].getTimeStamp()).thenReturn(date.getTime() + 9000.0);
    when(pktInfoArray[12].getTimeStamp()).thenReturn(date.getTime() + 9900.0);
    when(pktInfoArray[13].getTimeStamp()).thenReturn(date.getTime() + 15500.0);
    when(pktInfoArray[14].getTimeStamp()).thenReturn(date.getTime() + 25005.0);
    when(pktInfoArray[15].getTimeStamp()).thenReturn(date.getTime() + 36500.0);
    when(pktInfoArray[16].getTimeStamp()).thenReturn(date.getTime() + 47501.0);
    when(pktInfoArray[17].getTimeStamp()).thenReturn(date.getTime() + 57601.0);
    when(pktInfoArray[18].getTimeStamp()).thenReturn(date.getTime() + 107001.0);
    when(pktInfoArray[19].getTimeStamp()).thenReturn(date.getTime() + 216001.0);
    for (int i = 0; i < 20; i++) {
        packetlist.add(pktInfoArray[i]);
    }
    List<RrcStateRange> testList = rrcStateRangeFactory.create(packetlist, profile03, traceDuration);
    assertEquals(26, testList.size());
}
Also used : ArrayList(java.util.ArrayList) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange) ProfileWiFi(com.att.aro.core.configuration.pojo.ProfileWiFi) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Example 88 with PacketInfo

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

the class RrcStateRangeFactoryImplTest method create3G_test3.

@Test
public void create3G_test3() {
    Profile3G profile3g = mock(Profile3G.class);
    when(profile3g.getProfileType()).thenReturn(ProfileType.T3G);
    when(profile3g.getIdleDchPromoAvg()).thenReturn(1000.0);
    when(profile3g.getIdleDchPromoMin()).thenReturn((double) date.getTime());
    when(profile3g.getIdleDchPromoMax()).thenReturn(1500.0);
    when(profile3g.getFachDchPromoAvg()).thenReturn(1000.0);
    when(profile3g.getFachDchPromoMin()).thenReturn(1000.0);
    when(profile3g.getFachDchPromoMax()).thenReturn(1000.0);
    when(profile3g.getDchFachTimer()).thenReturn(1000.0);
    when(profile3g.getFachIdleTimer()).thenReturn(1000.0);
    double traceDuration = 2000.0;
    List<PacketInfo> packetlist = new ArrayList<PacketInfo>();
    when(pktInfoArray[0].getTimeStamp()).thenReturn(date.getTime() - 1500.0);
    when(pktInfoArray[0].getDir()).thenReturn(PacketDirection.DOWNLINK);
    when(pktInfoArray[0].getLen()).thenReturn(1000);
    when(pktInfoArray[0].getStateMachine()).thenReturn(RRCState.PROMO_IDLE_DCH);
    packetlist.add(pktInfoArray[0]);
    when(pktInfoArray[1].getTimeStamp()).thenReturn(date.getTime() + 100.0);
    when(pktInfoArray[1].getDir()).thenReturn(PacketDirection.UPLINK);
    when(pktInfoArray[1].getLen()).thenReturn(1000);
    when(pktInfoArray[1].getStateMachine()).thenReturn(RRCState.PROMO_IDLE_DCH);
    packetlist.add(pktInfoArray[1]);
    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 89 with PacketInfo

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

the class AROServiceImplTest method analyzeFileTest.

@Test
public void analyzeFileTest() throws IOException {
    PacketAnalyzerResult analyze = new PacketAnalyzerResult();
    TraceFileResult traceresult = new TraceFileResult();
    List<PacketInfo> allpackets = new ArrayList<PacketInfo>();
    allpackets.add(new PacketInfo(new Packet(0, 0, 0, 0, null)));
    traceresult.setAllpackets(allpackets);
    analyze.setTraceresult(traceresult);
    PeriodicTransferResult periodicTransferResult = new PeriodicTransferResult();
    List<BestPracticeType> req = new ArrayList<BestPracticeType>();
    req.add(BestPracticeType.UNNECESSARY_CONNECTIONS);
    req.add(BestPracticeType.CONNECTION_CLOSING);
    req.add(BestPracticeType.CONNECTION_OPENING);
    req.add(BestPracticeType.PERIODIC_TRANSFER);
    req.add(BestPracticeType.SCREEN_ROTATION);
    req.add(BestPracticeType.ACCESSING_PERIPHERALS);
    req.add(BestPracticeType.COMBINE_CS_JSS);
    req.add(BestPracticeType.HTTP_1_0_USAGE);
    req.add(BestPracticeType.CACHE_CONTROL);
    req.add(BestPracticeType.USING_CACHE);
    req.add(BestPracticeType.DUPLICATE_CONTENT);
    req.add(BestPracticeType.HTTP_4XX_5XX);
    req.add(BestPracticeType.HTTP_3XX_CODE);
    req.add(BestPracticeType.FILE_COMPRESSION);
    req.add(BestPracticeType.IMAGE_SIZE);
    req.add(BestPracticeType.MINIFICATION);
    req.add(BestPracticeType.EMPTY_URL);
    req.add(BestPracticeType.SPRITEIMAGE);
    req.add(BestPracticeType.SCRIPTS_URL);
    req.add(BestPracticeType.ASYNC_CHECK);
    req.add(BestPracticeType.DISPLAY_NONE_IN_CSS);
    req.add(BestPracticeType.FILE_ORDER);
    req.add(BestPracticeType.MULTI_SIMULCONN);
    req.add(BestPracticeType.VIDEO_STALL);
    req.add(BestPracticeType.STARTUP_DELAY);
    req.add(BestPracticeType.BUFFER_OCCUPANCY);
    req.add(BestPracticeType.NETWORK_COMPARISON);
    req.add(BestPracticeType.TCP_CONNECTION);
    req.add(BestPracticeType.CHUNK_SIZE);
    req.add(BestPracticeType.CHUNK_PACING);
    req.add(BestPracticeType.VIDEO_REDUNDANCY);
    req.add(BestPracticeType.VIDEO_CONCURRENT_SESSION);
    req.add(BestPracticeType.VIDEO_VARIABLE_BITRATE);
    req.add(BestPracticeType.HTTPS_USAGE);
    req.add(BestPracticeType.TRANSMISSION_PRIVATE_DATA);
    req.add(BestPracticeType.DISPLAY_NONE_IN_CSS);
    packetanalyzer = Mockito.mock(IPacketAnalyzer.class);
    aro.setPacketAnalyzer(packetanalyzer);
    when(packetanalyzer.analyzeTraceFile(any(String.class), any(Profile.class), any(AnalysisFilter.class))).thenReturn(analyze);
    when(worker.runTest(any(PacketAnalyzerResult.class))).thenReturn(periodicTransferResult);
    List<BestPracticeType> list = SettingsUtil.retrieveBestPractices();
    SettingsUtil.saveBestPractices(req);
    try {
        AROTraceData testResult = aro.analyzeFile(req, "traffic.cap");
        assertEquals(TOTAL_BPTESTS, testResult.getBestPracticeResults().size());
    } finally {
        SettingsUtil.saveBestPractices(list);
    }
}
Also used : Packet(com.att.aro.core.packetreader.pojo.Packet) IPacketAnalyzer(com.att.aro.core.packetanalysis.IPacketAnalyzer) PeriodicTransferResult(com.att.aro.core.bestpractice.pojo.PeriodicTransferResult) AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) ArrayList(java.util.ArrayList) BestPracticeType(com.att.aro.core.bestpractice.pojo.BestPracticeType) AROTraceData(com.att.aro.core.pojo.AROTraceData) Profile(com.att.aro.core.configuration.pojo.Profile) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) TraceFileResult(com.att.aro.core.packetanalysis.pojo.TraceFileResult) BaseTest(com.att.aro.core.BaseTest) Test(org.junit.Test)

Example 90 with PacketInfo

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

the class AROServiceImplTest method analyzeDirectoryTest.

@Test
public void analyzeDirectoryTest() throws IOException {
    TraceDirectoryResult traceresult = new TraceDirectoryResult();
    List<PacketInfo> allpackets = new ArrayList<PacketInfo>();
    allpackets.add(new PacketInfo(new Packet(0, 0, 0, 0, null)));
    traceresult.setAllpackets(allpackets);
    PacketAnalyzerResult analyze = new PacketAnalyzerResult();
    analyze.setTraceresult(traceresult);
    CacheAnalysis cacheAnalysis = new CacheAnalysis();
    PeriodicTransferResult periodicTransferResult = new PeriodicTransferResult();
    List<BestPracticeType> req = new ArrayList<BestPracticeType>();
    req.add(BestPracticeType.UNNECESSARY_CONNECTIONS);
    req.add(BestPracticeType.CONNECTION_CLOSING);
    req.add(BestPracticeType.CONNECTION_OPENING);
    req.add(BestPracticeType.PERIODIC_TRANSFER);
    req.add(BestPracticeType.SCREEN_ROTATION);
    req.add(BestPracticeType.ACCESSING_PERIPHERALS);
    req.add(BestPracticeType.COMBINE_CS_JSS);
    req.add(BestPracticeType.HTTP_1_0_USAGE);
    req.add(BestPracticeType.CACHE_CONTROL);
    req.add(BestPracticeType.USING_CACHE);
    req.add(BestPracticeType.DUPLICATE_CONTENT);
    req.add(BestPracticeType.HTTP_4XX_5XX);
    req.add(BestPracticeType.HTTP_3XX_CODE);
    req.add(BestPracticeType.FILE_COMPRESSION);
    req.add(BestPracticeType.IMAGE_SIZE);
    req.add(BestPracticeType.MINIFICATION);
    req.add(BestPracticeType.EMPTY_URL);
    req.add(BestPracticeType.SPRITEIMAGE);
    req.add(BestPracticeType.SCRIPTS_URL);
    req.add(BestPracticeType.ASYNC_CHECK);
    req.add(BestPracticeType.DISPLAY_NONE_IN_CSS);
    req.add(BestPracticeType.FILE_ORDER);
    req.add(BestPracticeType.VIDEO_STALL);
    req.add(BestPracticeType.STARTUP_DELAY);
    req.add(BestPracticeType.BUFFER_OCCUPANCY);
    req.add(BestPracticeType.NETWORK_COMPARISON);
    req.add(BestPracticeType.TCP_CONNECTION);
    req.add(BestPracticeType.CHUNK_SIZE);
    req.add(BestPracticeType.CHUNK_PACING);
    req.add(BestPracticeType.VIDEO_REDUNDANCY);
    req.add(BestPracticeType.VIDEO_VARIABLE_BITRATE);
    req.add(BestPracticeType.HTTPS_USAGE);
    req.add(BestPracticeType.TRANSMISSION_PRIVATE_DATA);
    req.add(BestPracticeType.DISPLAY_NONE_IN_CSS);
    req.add(BestPracticeType.VIDEO_CONCURRENT_SESSION);
    req.add(BestPracticeType.AUDIO_STREAM);
    req.add(BestPracticeType.MULTI_SIMULCONN);
    List<BestPracticeType> list = SettingsUtil.retrieveBestPractices();
    SettingsUtil.saveBestPractices(req);
    when(packetanalyzer.analyzeTraceDirectory(any(String.class), any(Profile.class), any(AnalysisFilter.class))).thenReturn(analyze);
    when(worker.runTest(any(PacketAnalyzerResult.class))).thenReturn(periodicTransferResult);
    when(cacheAnalyzer.analyze(anyListOf(Session.class))).thenReturn(cacheAnalysis);
    try {
        AROTraceData testResult = aro.analyzeDirectory(req, Util.getCurrentRunningDir());
        assertEquals(null, testResult.getBestPracticeResults());
    } finally {
        SettingsUtil.saveBestPractices(list);
    }
}
Also used : Packet(com.att.aro.core.packetreader.pojo.Packet) PeriodicTransferResult(com.att.aro.core.bestpractice.pojo.PeriodicTransferResult) AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) ArrayList(java.util.ArrayList) BestPracticeType(com.att.aro.core.bestpractice.pojo.BestPracticeType) AROTraceData(com.att.aro.core.pojo.AROTraceData) Profile(com.att.aro.core.configuration.pojo.Profile) CacheAnalysis(com.att.aro.core.packetanalysis.pojo.CacheAnalysis) ICacheAnalysis(com.att.aro.core.packetanalysis.ICacheAnalysis) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) Session(com.att.aro.core.packetanalysis.pojo.Session) 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