Search in sources :

Example 6 with Throughput

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

the class ThroughputCalculatorImplTest method calculateThroughput_a.

@Test
public void calculateThroughput_a() {
    Date date = new Date();
    List<Throughput> testResult = new ArrayList<Throughput>();
    List<PacketInfo> packets = new ArrayList<PacketInfo>();
    PacketInfo pktInfo01 = Mockito.mock(PacketInfo.class);
    Mockito.when(pktInfo01.getDir()).thenReturn(PacketDirection.UPLINK);
    Mockito.when(pktInfo01.getTimeStamp()).thenReturn(date.getTime() + 5000.0);
    packets.add(pktInfo01);
    PacketInfo pktInfo02 = Mockito.mock(PacketInfo.class);
    Mockito.when(pktInfo02.getDir()).thenReturn(PacketDirection.DOWNLINK);
    Mockito.when(pktInfo02.getTimeStamp()).thenReturn(date.getTime() + 8000.0);
    packets.add(pktInfo02);
    PacketInfo pktInfo03 = Mockito.mock(PacketInfo.class);
    Mockito.when(pktInfo03.getDir()).thenReturn(PacketDirection.UPLINK);
    Mockito.when(pktInfo03.getTimeStamp()).thenReturn(date.getTime() + 22000.0);
    packets.add(pktInfo03);
    PacketInfo pktInfo04 = Mockito.mock(PacketInfo.class);
    Mockito.when(pktInfo04.getDir()).thenReturn(PacketDirection.UPLINK);
    Mockito.when(pktInfo04.getTimeStamp()).thenReturn(date.getTime() + 23000.0);
    packets.add(pktInfo04);
    PacketInfo pktInfo05 = Mockito.mock(PacketInfo.class);
    Mockito.when(pktInfo05.getDir()).thenReturn(PacketDirection.UPLINK);
    Mockito.when(pktInfo05.getTimeStamp()).thenReturn(date.getTime() + 70000.0);
    packets.add(pktInfo05);
    PacketInfo pktInfo06 = Mockito.mock(PacketInfo.class);
    Mockito.when(pktInfo06.getDir()).thenReturn(PacketDirection.UPLINK);
    Mockito.when(pktInfo06.getTimeStamp()).thenReturn(date.getTime() + 72000.0);
    packets.add(pktInfo06);
    testResult = throughputCalculator.calculateThroughput(date.getTime() + 0.0, date.getTime() + 100000.0, 15000.0, packets);
    assertEquals(7, testResult.size());
}
Also used : ArrayList(java.util.ArrayList) Throughput(com.att.aro.core.packetanalysis.pojo.Throughput) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) Date(java.util.Date) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Aggregations

Throughput (com.att.aro.core.packetanalysis.pojo.Throughput)6 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)5 ArrayList (java.util.ArrayList)4 BaseTest (com.att.aro.core.BaseTest)2 Date (java.util.Date)2 Test (org.junit.Test)2 XYToolTipGenerator (org.jfree.chart.labels.XYToolTipGenerator)1 XYDataset (org.jfree.data.xy.XYDataset)1 XYSeries (org.jfree.data.xy.XYSeries)1 XYSeriesCollection (org.jfree.data.xy.XYSeriesCollection)1