Search in sources :

Example 26 with AbstractBestPracticeResult

use of com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult in project VideoOptimzer by attdevsupport.

the class FileOrderImplTest method runTest_resultIsFail.

@Test
public void runTest_resultIsFail() {
    fileOrderImpl.setHttpRequestResponseHelper(reqhelper);
    when(httpRequestResponseInfo01.getDirection()).thenReturn(HttpDirection.RESPONSE);
    when(httpRequestResponseInfo01.getContentType()).thenReturn("text/css");
    when(httpRequestResponseInfo01.getContentLength()).thenReturn(1);
    when(httpRequestResponseInfo01.getObjName()).thenReturn(htmlString2);
    when(httpRequestResponseInfo02.getDirection()).thenReturn(HttpDirection.REQUEST);
    when(httpRequestResponseInfo02.getContentType()).thenReturn("script");
    when(httpRequestResponseInfo02.getContentLength()).thenReturn(2);
    when(httpRequestResponseInfo02.getObjName()).thenReturn(htmlString2);
    when(httpRequestResponseInfo03.getDirection()).thenReturn(HttpDirection.RESPONSE);
    when(httpRequestResponseInfo03.getContentType()).thenReturn("text/css");
    when(httpRequestResponseInfo03.getContentLength()).thenReturn(1);
    when(httpRequestResponseInfo03.getObjName()).thenReturn(htmlString2);
    when(httpRequestResponseInfo04.getDirection()).thenReturn(HttpDirection.RESPONSE);
    when(httpRequestResponseInfo04.getContentType()).thenReturn("text/css");
    when(httpRequestResponseInfo04.getContentLength()).thenReturn(2);
    when(httpRequestResponseInfo04.getObjName()).thenReturn(htmlString);
    when(httpRequestResponseInfo05.getDirection()).thenReturn(HttpDirection.RESPONSE);
    when(httpRequestResponseInfo05.getContentType()).thenReturn("text/css");
    when(httpRequestResponseInfo05.getContentLength()).thenReturn(2);
    when(httpRequestResponseInfo05.getObjName()).thenReturn(htmlString);
    when(httpRequestResponseInfo06.getDirection()).thenReturn(HttpDirection.RESPONSE);
    when(httpRequestResponseInfo06.getContentType()).thenReturn("script");
    when(httpRequestResponseInfo06.getContentLength()).thenReturn(4);
    when(httpRequestResponseInfo06.getObjName()).thenReturn(htmlString2);
    try {
        when(reqhelper.isHtml(any(String.class))).thenReturn(true);
        when(reqhelper.getContentString(any(HttpRequestResponseInfo.class), any(Session.class))).thenReturn(htmlString2);
    } catch (Exception e) {
        e.printStackTrace();
    }
    List<HttpRequestResponseInfo> value = new ArrayList<HttpRequestResponseInfo>();
    value.add(httpRequestResponseInfo01);
    value.add(httpRequestResponseInfo02);
    value.add(httpRequestResponseInfo03);
    value.add(httpRequestResponseInfo04);
    value.add(httpRequestResponseInfo05);
    Mockito.when(session01.getRequestResponseInfo()).thenReturn(value);
    List<Session> sessionList = new ArrayList<Session>();
    Mockito.when(session01.getDomainName()).thenReturn("www.google.com");
    sessionList.add(session01);
    Mockito.when(tracedata.getSessionlist()).thenReturn(sessionList);
    AbstractBestPracticeResult testResult = fileOrderImpl.runTest(tracedata);
    assertEquals(BPResultType.FAIL, testResult.getResultType());
}
Also used : HttpRequestResponseInfo(com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo) ArrayList(java.util.ArrayList) AbstractBestPracticeResult(com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult) Session(com.att.aro.core.packetanalysis.pojo.Session) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Example 27 with AbstractBestPracticeResult

use of com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult in project VideoOptimzer by attdevsupport.

the class FileOrderImplTest method runTest_resultIsPass.

@Test
public void runTest_resultIsPass() {
    fileOrderImpl.setHttpRequestResponseHelper(reqhelper);
    when(httpRequestResponseInfo01.getDirection()).thenReturn(HttpDirection.RESPONSE);
    when(httpRequestResponseInfo01.getContentType()).thenReturn("text/css");
    when(httpRequestResponseInfo01.getContentLength()).thenReturn(1);
    when(httpRequestResponseInfo02.getDirection()).thenReturn(HttpDirection.REQUEST);
    when(httpRequestResponseInfo02.getContentType()).thenReturn("script");
    when(httpRequestResponseInfo02.getContentLength()).thenReturn(2);
    try {
        when(reqhelper.isHtml(any(String.class))).thenReturn(true);
        when(reqhelper.getContentString(any(HttpRequestResponseInfo.class), any(Session.class))).thenReturn(htmlString);
    } catch (Exception e) {
        e.printStackTrace();
    }
    List<HttpRequestResponseInfo> value = new ArrayList<HttpRequestResponseInfo>();
    value.add(httpRequestResponseInfo01);
    value.add(httpRequestResponseInfo02);
    Mockito.when(session01.getRequestResponseInfo()).thenReturn(value);
    List<Session> sessionList = new ArrayList<Session>();
    Mockito.when(session01.getDomainName()).thenReturn("www.google.com");
    sessionList.add(session01);
    Mockito.when(tracedata.getSessionlist()).thenReturn(sessionList);
    AbstractBestPracticeResult testResult = fileOrderImpl.runTest(tracedata);
    assertEquals(BPResultType.PASS, testResult.getResultType());
}
Also used : HttpRequestResponseInfo(com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo) ArrayList(java.util.ArrayList) AbstractBestPracticeResult(com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult) Session(com.att.aro.core.packetanalysis.pojo.Session) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Example 28 with AbstractBestPracticeResult

use of com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult in project VideoOptimzer by attdevsupport.

the class Http10UsageImplTest method runTest_resTypeIsPass.

@Test
public void runTest_resTypeIsPass() {
    Mockito.when(httpRequestInfo01.getVersion()).thenReturn(HttpRequestResponseInfo.HTTP11);
    List<HttpRequestResponseInfo> value = new ArrayList<HttpRequestResponseInfo>();
    value.add(httpRequestInfo01);
    Mockito.when(session01.getRequestResponseInfo()).thenReturn(value);
    List<Session> sessionList = new ArrayList<Session>();
    sessionList.add(session01);
    Mockito.when(tracedata.getSessionlist()).thenReturn(sessionList);
    httpUsageImpl = (Http10UsageImpl) context.getBean("http10Usage");
    AbstractBestPracticeResult result = httpUsageImpl.runTest(tracedata);
    assertEquals(BPResultType.PASS, result.getResultType());
}
Also used : HttpRequestResponseInfo(com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo) ArrayList(java.util.ArrayList) AbstractBestPracticeResult(com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult) Session(com.att.aro.core.packetanalysis.pojo.Session) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Example 29 with AbstractBestPracticeResult

use of com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult in project VideoOptimzer by attdevsupport.

the class Http4xx5xxImplTest method runTest_resTypeIsPass.

@Test
public void runTest_resTypeIsPass() {
    Mockito.when(httpRequestInfo01.getDirection()).thenReturn(HttpDirection.RESPONSE);
    Mockito.when(httpRequestInfo01.getScheme()).thenReturn(HttpRequestResponseInfo.HTTP_SCHEME);
    Mockito.when(httpRequestInfo01.getStatusCode()).thenReturn(200);
    Mockito.when(httpRequestInfo02.getDirection()).thenReturn(HttpDirection.REQUEST);
    List<HttpRequestResponseInfo> value = new ArrayList<HttpRequestResponseInfo>();
    value.add(httpRequestInfo01);
    value.add(httpRequestInfo02);
    Mockito.when(session01.getRequestResponseInfo()).thenReturn(value);
    Mockito.when(session01.getDomainName()).thenReturn("www.google.com");
    List<Session> sessionList = new ArrayList<Session>();
    sessionList.add(session01);
    Mockito.when(tracedata.getSessionlist()).thenReturn(sessionList);
    http4xx5xxImpl = (Http4xx5xxImpl) context.getBean("http4xx5xx");
    AbstractBestPracticeResult result = http4xx5xxImpl.runTest(tracedata);
    assertEquals(BPResultType.PASS, result.getResultType());
}
Also used : HttpRequestResponseInfo(com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo) ArrayList(java.util.ArrayList) AbstractBestPracticeResult(com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult) Session(com.att.aro.core.packetanalysis.pojo.Session) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Example 30 with AbstractBestPracticeResult

use of com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult in project VideoOptimzer by attdevsupport.

the class PeriodicTransferImplTest method runTest_AresultIsPass.

@Test
public void runTest_AresultIsPass() {
    PacketAnalyzerResult tracedata01 = new PacketAnalyzerResult();
    Date date = new Date();
    List<Burst> burstCollection = new ArrayList<Burst>();
    BurstCollectionAnalysisData burstcollectionAnalysisData = new BurstCollectionAnalysisData();
    InetAddress remoteIP = null;
    InetAddress localIP = null;
    try {
        localIP = InetAddress.getLocalHost();
        remoteIP = InetAddress.getLocalHost();
    } catch (UnknownHostException e) {
        e.printStackTrace();
    }
    int remotePort = 80;
    int localPort = 80;
    byte[] d1 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 8, 0, 69, 0, 0, 52, -99, -87, 64, 0, 64, 6, -27, -25, 10, -27, 77, 114, 74, 125, 20, 95, -90, 2, 1, -69, -108, -18, 20, 87, -4, -110, -105, -88, -128, 16, 6, 88, 51, 24, 0, 0, 1, 1, 8, 10, -1, -1, -87, 50, 101, -15, -111, -73 };
    Packet packet01 = new Packet(1, 1418242722L, 324000, 66, d1);
    byte[] d2 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 8, 0, 69, 0, 0, 52, 0, 0, 64, 0, 64, 6, -125, -111, 74, 125, 20, 95, 10, -27, 77, 114, 1, -69, -90, 2, 0, 0, 0, 0, -108, -18, 20, 87, -128, 4, 0, 0, 119, -98, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    Packet packet02 = new Packet(1, 1418242722L, 325000, 63, d2);
    PacketInfo packetInfo01 = new PacketInfo(packet01);
    PacketInfo packetInfo02 = new PacketInfo(packet02);
    packetInfo01.setTcpInfo(TcpInfo.TCP_ESTABLISH);
    packetInfo01.setTimestamp((double) date.getTime());
    packetInfo02.setTcpInfo(TcpInfo.TCP_ACK);
    List<PacketInfo> packetlist = new ArrayList<PacketInfo>();
    packetlist.add(packetInfo01);
    packetlist.add(packetInfo02);
    Burst burst01 = new Burst(packetlist);
    burst01.setFirstUplinkDataPacket(packetInfo01);
    burst01.setBurstInfo(BurstCategory.CLIENT_APP);
    burstCollection.add(burst01);
    Session session01 = new Session(localIP, remoteIP, remotePort, localPort, "");
    session01.setUdpOnly(false);
    session01.setTcpPackets(packetlist);
    HttpRequestResponseInfo httpRequestResponseInfo01 = new HttpRequestResponseInfo();
    httpRequestResponseInfo01.setFirstDataPacket(packetInfo01);
    httpRequestResponseInfo01.setDirection(HttpDirection.REQUEST);
    httpRequestResponseInfo01.setHostName("yahoo.com");
    httpRequestResponseInfo01.setObjName("");
    List<HttpRequestResponseInfo> httpRequestResponseInfolist = new ArrayList<HttpRequestResponseInfo>();
    httpRequestResponseInfolist.add(httpRequestResponseInfo01);
    session01.setRequestResponseInfo(httpRequestResponseInfolist);
    List<Session> sessionlist = new ArrayList<Session>();
    sessionlist.add(session01);
    ProfileLTE profileLTE = new ProfileLTE();
    profileLTE.setPeriodMinCycle(10.0);
    profileLTE.setPeriodCycleTol(1.0);
    profileLTE.setPeriodMinSamples(3);
    profileLTE.setCloseSpacedBurstThreshold(0.0);
    burstcollectionAnalysisData.setBurstCollection(burstCollection);
    tracedata01.setSessionlist(sessionlist);
    tracedata01.setBurstCollectionAnalysisData(burstcollectionAnalysisData);
    tracedata01.setProfile(profileLTE);
    AbstractBestPracticeResult result01 = periodicTransferImpl.runTest(tracedata01);
    assertEquals(BPResultType.PASS, result01.getResultType());
}
Also used : Packet(com.att.aro.core.packetreader.pojo.Packet) UnknownHostException(java.net.UnknownHostException) HttpRequestResponseInfo(com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo) ArrayList(java.util.ArrayList) AbstractBestPracticeResult(com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult) ProfileLTE(com.att.aro.core.configuration.pojo.ProfileLTE) Date(java.util.Date) Burst(com.att.aro.core.packetanalysis.pojo.Burst) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) BurstCollectionAnalysisData(com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) InetAddress(java.net.InetAddress) Session(com.att.aro.core.packetanalysis.pojo.Session) BaseTest(com.att.aro.core.BaseTest) Test(org.junit.Test)

Aggregations

AbstractBestPracticeResult (com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult)66 BaseTest (com.att.aro.core.BaseTest)47 ArrayList (java.util.ArrayList)47 Test (org.junit.Test)47 Session (com.att.aro.core.packetanalysis.pojo.Session)33 HttpRequestResponseInfo (com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo)29 PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)17 Burst (com.att.aro.core.packetanalysis.pojo.Burst)8 BestPracticeType (com.att.aro.core.bestpractice.pojo.BestPracticeType)6 CacheEntry (com.att.aro.core.packetanalysis.pojo.CacheEntry)6 List (java.util.List)6 IBestPractice (com.att.aro.core.bestpractice.IBestPractice)5 BPResultType (com.att.aro.core.bestpractice.pojo.BPResultType)4 UnnecessaryConnectionResult (com.att.aro.core.bestpractice.pojo.UnnecessaryConnectionResult)4 BufferOccupancyResult (com.att.aro.core.bestpractice.pojo.BufferOccupancyResult)3 TsharkException (com.att.aro.core.exception.TsharkException)3 BurstCollectionAnalysisData (com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData)3 TraceDirectoryResult (com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult)3 AROTraceData (com.att.aro.core.pojo.AROTraceData)3 IOException (java.io.IOException)3