Search in sources :

Example 56 with Session

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

the class EmptyUrlImplTest method runTest_resIsFail.

@Test
public void runTest_resIsFail() {
    Mockito.when(httpRequestInfo01.getDirection()).thenReturn(HttpDirection.RESPONSE);
    Mockito.when(httpRequestInfo01.getContentType()).thenReturn("html");
    Mockito.when(httpRequestInfo01.getContentLength()).thenReturn(1);
    Mockito.when(httpRequestInfo02.getDirection()).thenReturn(HttpDirection.REQUEST);
    Mockito.when(httpRequestInfo02.getContentType()).thenReturn(null);
    Mockito.when(httpRequestInfo02.getContentLength()).thenReturn(0);
    Mockito.when(httpRequestInfo03.getDirection()).thenReturn(HttpDirection.RESPONSE);
    Mockito.when(httpRequestInfo03.getContentType()).thenReturn("html");
    Mockito.when(httpRequestInfo03.getContentLength()).thenReturn(2);
    Mockito.when(httpRequestInfo04.getDirection()).thenReturn(HttpDirection.RESPONSE);
    Mockito.when(httpRequestInfo04.getContentType()).thenReturn("html");
    Mockito.when(httpRequestInfo04.getContentLength()).thenReturn(3);
    Mockito.when(reqhelper.isHtml(any(String.class))).thenReturn(true);
    try {
        Mockito.when(reqhelper.getContentString(any(HttpRequestResponseInfo.class), any(Session.class))).thenReturn(htmlString2);
    } catch (Exception e) {
        e.printStackTrace();
    }
    List<HttpRequestResponseInfo> value = new ArrayList<HttpRequestResponseInfo>();
    value.add(httpRequestInfo01);
    value.add(httpRequestInfo02);
    value.add(httpRequestInfo03);
    value.add(httpRequestInfo04);
    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);
    emptyUrlImpl.setHttpReqResHelper(reqhelper);
    AbstractBestPracticeResult testResult = emptyUrlImpl.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 57 with Session

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

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

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

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

Aggregations

Session (com.att.aro.core.packetanalysis.pojo.Session)130 ArrayList (java.util.ArrayList)86 HttpRequestResponseInfo (com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo)74 BaseTest (com.att.aro.core.BaseTest)49 Test (org.junit.Test)49 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)32 AbstractBestPracticeResult (com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult)31 InetAddress (java.net.InetAddress)26 HashMap (java.util.HashMap)19 TCPPacket (com.att.aro.core.packetreader.pojo.TCPPacket)17 HashSet (java.util.HashSet)11 TreeMap (java.util.TreeMap)11 List (java.util.List)10 Statistic (com.att.aro.core.packetanalysis.pojo.Statistic)9 File (java.io.File)9 TraceDirectoryResult (com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult)8 DomainNameSystem (com.att.aro.core.packetreader.pojo.DomainNameSystem)8 BurstCollectionAnalysisData (com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData)7 HttpRequestResponseInfoWithSession (com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfoWithSession)7 UDPPacket (com.att.aro.core.packetreader.pojo.UDPPacket)7