Search in sources :

Example 46 with RrcStateRange

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

the class RrcStateMachineFactoryImplTest method create_3GStateRrcStateRangeListIsEmpty.

@Test
public void create_3GStateRrcStateRangeListIsEmpty() {
    Profile3G profile16 = mock(Profile3G.class);
    when(profile16.getProfileType()).thenReturn(ProfileType.T3G);
    List<PacketInfo> packetlist1 = new ArrayList<PacketInfo>();
    List<RrcStateRange> staterangelist = new ArrayList<RrcStateRange>();
    when(staterange.create(any(ArrayList.class), any(Profile.class), any(double.class))).thenReturn(staterangelist);
    RrcStateMachine3G rrcStateMachine3G = (RrcStateMachine3G) machineFactoryimpl.create(packetlist1, profile16, packetDuration, traceDuration, 0 * totalBytes, null);
    assertEquals(0.0, rrcStateMachine3G.getJoulesPerKilobyte(), 0.0);
    assertEquals(1000, rrcStateMachine3G.getPacketsDuration(), 0.0);
    assertEquals(2000, rrcStateMachine3G.getTraceDuration(), 0.0);
}
Also used : RrcStateMachine3G(com.att.aro.core.packetanalysis.pojo.RrcStateMachine3G) 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) Profile(com.att.aro.core.configuration.pojo.Profile) BaseTest(com.att.aro.core.BaseTest) Test(org.junit.Test)

Example 47 with RrcStateRange

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

the class RrcStateMachineFactoryImplTest method create_LTEStateIsLTE_DRX_SHORT.

@Test
public void create_LTEStateIsLTE_DRX_SHORT() {
    ProfileLTE profile07 = mock(ProfileLTE.class);
    when(profile07.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_SHORT);
        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, profile07, packetDuration, traceDuration, totalBytes * 125, null);
    assertEquals(2.4, rrcStateMachineLTE.getJoulesPerKilobyte(), 0.0);
    assertEquals(2500, rrcStateMachineLTE.getLteDrxShortTime(), 0.0);
    assertEquals(30, rrcStateMachineLTE.getLteDrxShortEnergy(), 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 48 with RrcStateRange

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

the class RrcStateMachineFactoryImplTest method create_WIFIStateIsWIFI_TAIL.

@Test
public void create_WIFIStateIsWIFI_TAIL() {
    ProfileWiFi profile17 = mock(ProfileWiFi.class);
    when(profile17.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_TAIL);
        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, profile17, packetDuration, traceDuration, totalBytes * 100, null);
    assertEquals(50, rrcStateMachineWifi.getJoulesPerKilobyte(), 0.0);
    assertEquals(500, rrcStateMachineWifi.getWifiTailEnergy(), 0.0);
    assertEquals(5000, rrcStateMachineWifi.getWifiTailTime(), 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 49 with RrcStateRange

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

the class RrcStateMachineFactoryImplTest method create_LTEStateIsLTE_CONTINUOUS.

@Test
public void create_LTEStateIsLTE_CONTINUOUS() {
    ProfileLTE profile05 = mock(ProfileLTE.class);
    when(profile05.getProfileType()).thenReturn(ProfileType.LTE);
    when(profilefactory.energyLTE(any(double.class), any(double.class), any(RRCState.class), any(ProfileLTE.class), any(ArrayList.class))).thenReturn(4.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_CONTINUOUS);
        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, profile05, packetDuration, traceDuration, totalBytes * 100, null);
    assertEquals(2, rrcStateMachineLTE.getJoulesPerKilobyte(), 0.0);
    assertEquals(20, rrcStateMachineLTE.getLteCrEnergy(), 0.0);
    assertEquals(5000, rrcStateMachineLTE.getLteCrTime(), 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 50 with RrcStateRange

use of com.att.aro.core.packetanalysis.pojo.RrcStateRange 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

RrcStateRange (com.att.aro.core.packetanalysis.pojo.RrcStateRange)59 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)48 ArrayList (java.util.ArrayList)47 BaseTest (com.att.aro.core.BaseTest)42 Test (org.junit.Test)42 Profile3G (com.att.aro.core.configuration.pojo.Profile3G)27 Profile (com.att.aro.core.configuration.pojo.Profile)23 RRCState (com.att.aro.core.packetanalysis.pojo.RRCState)22 ProfileLTE (com.att.aro.core.configuration.pojo.ProfileLTE)12 ProfileWiFi (com.att.aro.core.configuration.pojo.ProfileWiFi)9 RrcStateMachine3G (com.att.aro.core.packetanalysis.pojo.RrcStateMachine3G)9 RrcStateMachineLTE (com.att.aro.core.packetanalysis.pojo.RrcStateMachineLTE)9 TCPPacket (com.att.aro.core.packetreader.pojo.TCPPacket)5 UDPPacket (com.att.aro.core.packetreader.pojo.UDPPacket)5 BurstCollectionAnalysisData (com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData)4 RrcStateMachineWiFi (com.att.aro.core.packetanalysis.pojo.RrcStateMachineWiFi)4 DomainNameSystem (com.att.aro.core.packetreader.pojo.DomainNameSystem)4 CpuActivity (com.att.aro.core.peripheral.pojo.CpuActivity)4 InetAddress (java.net.InetAddress)4 HashSet (java.util.HashSet)4