Search in sources :

Example 11 with ProfileWiFi

use of com.att.aro.core.configuration.pojo.ProfileWiFi 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 12 with ProfileWiFi

use of com.att.aro.core.configuration.pojo.ProfileWiFi 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 13 with ProfileWiFi

use of com.att.aro.core.configuration.pojo.ProfileWiFi in project VideoOptimzer by attdevsupport.

the class RrcStateMachineFactoryImplTest method create_WIFIStateIsWIFI_ACTIVE.

@Test
public void create_WIFIStateIsWIFI_ACTIVE() {
    ProfileWiFi profile02 = mock(ProfileWiFi.class);
    when(profile02.getProfileType()).thenReturn(ProfileType.WIFI);
    List<PacketInfo> packetlist2 = new ArrayList<PacketInfo>();
    List<RrcStateRange> staterangelist = new ArrayList<RrcStateRange>();
    RrcStateRange rrc01 = mock(RrcStateRange.class);
    when(rrc01.getBeginTime()).thenReturn((double) date.getTime());
    when(rrc01.getEndTime()).thenReturn(date.getTime() + 2000.0);
    when(profilefactory.energyWiFi(any(double.class), any(double.class), any(RRCState.class), any(ProfileWiFi.class))).thenReturn(2.0);
    when(rrc01.getState()).thenReturn(RRCState.WIFI_ACTIVE);
    staterangelist.add(rrc01);
    when(staterange.create(any(ArrayList.class), any(Profile.class), any(double.class))).thenReturn(staterangelist);
    RrcStateMachineWiFi rrcStateMachineWifi = (RrcStateMachineWiFi) machineFactoryimpl.create(packetlist2, profile02, packetDuration, traceDuration, totalBytes, null);
    assertEquals(20.0, rrcStateMachineWifi.getJoulesPerKilobyte(), 0.0);
    assertEquals(1000.0, rrcStateMachineWifi.getPacketsDuration(), 0.0);
    assertEquals(2.0, rrcStateMachineWifi.getTotalRRCEnergy(), 0.0);
    assertEquals(2000.0, rrcStateMachineWifi.getTraceDuration(), 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 14 with ProfileWiFi

use of com.att.aro.core.configuration.pojo.ProfileWiFi 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 15 with ProfileWiFi

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

ProfileWiFi (com.att.aro.core.configuration.pojo.ProfileWiFi)15 BaseTest (com.att.aro.core.BaseTest)12 Test (org.junit.Test)12 RrcStateRange (com.att.aro.core.packetanalysis.pojo.RrcStateRange)9 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)7 ArrayList (java.util.ArrayList)7 Profile (com.att.aro.core.configuration.pojo.Profile)4 RRCState (com.att.aro.core.packetanalysis.pojo.RRCState)4 Profile3G (com.att.aro.core.configuration.pojo.Profile3G)3 RrcStateMachineWiFi (com.att.aro.core.packetanalysis.pojo.RrcStateMachineWiFi)3 AbstractRrcStateMachine (com.att.aro.core.packetanalysis.pojo.AbstractRrcStateMachine)2 Burst (com.att.aro.core.packetanalysis.pojo.Burst)1 BurstCollectionAnalysisData (com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData)1 Session (com.att.aro.core.packetanalysis.pojo.Session)1 TimeRange (com.att.aro.core.packetanalysis.pojo.TimeRange)1 DomainNameSystem (com.att.aro.core.packetreader.pojo.DomainNameSystem)1 TCPPacket (com.att.aro.core.packetreader.pojo.TCPPacket)1 UDPPacket (com.att.aro.core.packetreader.pojo.UDPPacket)1 CpuActivity (com.att.aro.core.peripheral.pojo.CpuActivity)1 UserEvent (com.att.aro.core.peripheral.pojo.UserEvent)1