Search in sources :

Example 11 with PacketInfo

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

the class RrcStateMachineFactoryImplTest method create_T3GStateIsPROMO_FACH_DCH.

@Test
public void create_T3GStateIsPROMO_FACH_DCH() {
    List<PacketInfo> packetlist1 = new ArrayList<PacketInfo>();
    when(profilefactory.energy3G(any(double.class), any(double.class), any(RRCState.class), any(Profile3G.class))).thenReturn(100.0);
    Profile3G profile15 = mock(Profile3G.class);
    when(profile15.getProfileType()).thenReturn(ProfileType.T3G);
    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.PROMO_FACH_DCH);
        when(rrcStateRangeArray[i].getBeginTime()).thenReturn((double) date.getTime() + 2 * i * 500);
        when(rrcStateRangeArray[i].getEndTime()).thenReturn((double) date.getTime() + (2 * i + 1) * 500.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);
    RrcStateMachine3G rrcStateMachine3G = (RrcStateMachine3G) machineFactoryimpl.create(packetlist1, profile15, packetDuration, traceDuration, totalBytes * 100, null);
    assertEquals(50.0, rrcStateMachine3G.getJoulesPerKilobyte(), 0.0);
    assertEquals(5, rrcStateMachine3G.getFachToDch(), 0.0);
    assertEquals(2500, rrcStateMachine3G.getFachToDchTime(), 0.0);
    assertEquals(500, rrcStateMachine3G.getFachToDchEnergy(), 0.0);
}
Also used : RrcStateMachine3G(com.att.aro.core.packetanalysis.pojo.RrcStateMachine3G) RRCState(com.att.aro.core.packetanalysis.pojo.RRCState) ArrayList(java.util.ArrayList) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) Profile3G(com.att.aro.core.configuration.pojo.Profile3G) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange) Profile(com.att.aro.core.configuration.pojo.Profile) BaseTest(com.att.aro.core.BaseTest) Test(org.junit.Test)

Example 12 with PacketInfo

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

the class RrcStateMachineFactoryImplTest method create_WIFIStateIsWIFI_IDLE.

@Test
public void create_WIFIStateIsWIFI_IDLE() {
    ProfileWiFi profile18 = mock(ProfileWiFi.class);
    when(profile18.getProfileType()).thenReturn(ProfileType.WIFI);
    when(profilefactory.energyWiFi(any(double.class), any(double.class), any(RRCState.class), any(ProfileWiFi.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.WIFI_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);
    RrcStateMachineWiFi rrcStateMachineWifi = (RrcStateMachineWiFi) machineFactoryimpl.create(packetlist1, profile18, packetDuration, traceDuration, totalBytes * 100, null);
    assertEquals(50, rrcStateMachineWifi.getJoulesPerKilobyte(), 0.0);
    assertEquals(5000, rrcStateMachineWifi.getWifiIdleTime(), 0.0);
    assertEquals(500, rrcStateMachineWifi.getWifiIdleEnergy(), 0.0);
}
Also used : RRCState(com.att.aro.core.packetanalysis.pojo.RRCState) RrcStateMachineWiFi(com.att.aro.core.packetanalysis.pojo.RrcStateMachineWiFi) 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) Profile(com.att.aro.core.configuration.pojo.Profile) BaseTest(com.att.aro.core.BaseTest) Test(org.junit.Test)

Example 13 with PacketInfo

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

the class RrcStateMachineFactoryImplTest method create_LTEStateIsLTE_DRX_LONG.

@Test
public void create_LTEStateIsLTE_DRX_LONG() {
    ProfileLTE profile08 = mock(ProfileLTE.class);
    when(profile08.getProfileType()).thenReturn(ProfileType.LTE);
    when(profilefactory.energyLTE(any(double.class), any(double.class), any(RRCState.class), any(ProfileLTE.class), any(ArrayList.class))).thenReturn(6.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_DRX_LONG);
        when(rrcStateRangeArray[i].getBeginTime()).thenReturn((double) date.getTime() + 2 * i * 500);
        when(rrcStateRangeArray[i].getEndTime()).thenReturn((double) date.getTime() + (2 * i + 1) * 500.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, profile08, packetDuration, traceDuration, totalBytes * 125, null);
    assertEquals(2.4, rrcStateMachineLTE.getJoulesPerKilobyte(), 0.0);
    assertEquals(2500, rrcStateMachineLTE.getLteDrxLongTime(), 0.0);
    assertEquals(30, rrcStateMachineLTE.getLteDrxLongEnergy(), 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)

Example 14 with PacketInfo

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

the class RrcStateMachineFactoryImplTest method create_LTEStateIsLTE_PROMOTION.

@Test
public void create_LTEStateIsLTE_PROMOTION() {
    ProfileLTE profile04 = mock(ProfileLTE.class);
    when(profile04.getProfileType()).thenReturn(ProfileType.LTE);
    when(profilefactory.energyLTE(any(double.class), any(double.class), any(RRCState.class), any(ProfileLTE.class), any(ArrayList.class))).thenReturn(5.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_PROMOTION);
        when(rrcStateRangeArray[i].getBeginTime()).thenReturn((double) date.getTime() + 2 * i * 1000);
        when(rrcStateRangeArray[i].getEndTime()).thenReturn((double) date.getTime() + (2 * i + 1) * 2000.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, profile04, packetDuration, traceDuration, totalBytes * 1000, null);
    assertEquals(0.25, rrcStateMachineLTE.getJoulesPerKilobyte(), 0.0);
    assertEquals(25, rrcStateMachineLTE.getLteIdleToCRPromotionEnergy(), 0.0);
    assertEquals(30000, rrcStateMachineLTE.getLteIdleToCRPromotionTime(), 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)

Example 15 with PacketInfo

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

the class RrcStateMachineFactoryImplTest method create_T3GStateIsSTATE_DCH.

@Test
public void create_T3GStateIsSTATE_DCH() {
    List<PacketInfo> packetlist1 = new ArrayList<PacketInfo>();
    when(profilefactory.energy3G(any(double.class), any(double.class), any(RRCState.class), any(Profile3G.class))).thenReturn(100.0);
    Profile3G profile11 = mock(Profile3G.class);
    when(profile11.getProfileType()).thenReturn(ProfileType.T3G);
    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.STATE_DCH);
        when(rrcStateRangeArray[i].getBeginTime()).thenReturn((double) date.getTime() + 2 * i * 500);
        when(rrcStateRangeArray[i].getEndTime()).thenReturn((double) date.getTime() + (2 * i + 1) * 500.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);
    RrcStateMachine3G rrcStateMachine3G = (RrcStateMachine3G) machineFactoryimpl.create(packetlist1, profile11, packetDuration, traceDuration, totalBytes * 100, null);
    assertEquals(50.0, rrcStateMachine3G.getJoulesPerKilobyte(), 0.0);
    assertEquals(2500, rrcStateMachine3G.getDchTime(), 0.0);
    assertEquals(500, rrcStateMachine3G.getDchEnergy(), 0.0);
}
Also used : RrcStateMachine3G(com.att.aro.core.packetanalysis.pojo.RrcStateMachine3G) RRCState(com.att.aro.core.packetanalysis.pojo.RRCState) ArrayList(java.util.ArrayList) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) Profile3G(com.att.aro.core.configuration.pojo.Profile3G) RrcStateRange(com.att.aro.core.packetanalysis.pojo.RrcStateRange) 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