Search in sources :

Example 6 with RrcStateMachineWiFi

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

Aggregations

RrcStateMachineWiFi (com.att.aro.core.packetanalysis.pojo.RrcStateMachineWiFi)6 RrcStateRange (com.att.aro.core.packetanalysis.pojo.RrcStateRange)4 BaseTest (com.att.aro.core.BaseTest)3 Profile (com.att.aro.core.configuration.pojo.Profile)3 ProfileWiFi (com.att.aro.core.configuration.pojo.ProfileWiFi)3 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)3 RRCState (com.att.aro.core.packetanalysis.pojo.RRCState)3 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)3 RrcStateMachine3G (com.att.aro.core.packetanalysis.pojo.RrcStateMachine3G)1 RrcStateMachineLTE (com.att.aro.core.packetanalysis.pojo.RrcStateMachineLTE)1 TraceBenchmarkInfo (com.att.aro.ui.model.overview.TraceBenchmarkInfo)1