Search in sources :

Example 81 with Session

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

the class ImageCompressionImpl method getEntryList.

private List<ImageCompressionEntry> getEntryList() {
    String originalImage = "";
    String midCompressedImagePath = "";
    String logCompressedImagepath = "";
    long lowQualityImgSize = 0L;
    long midQualityImgSize = 0L;
    long orgImageSize = 0L;
    String imgExtn = "";
    List<ImageCompressionEntry> entryList = new ArrayList<ImageCompressionEntry>();
    for (Session session : packetResult.getSessionlist()) {
        for (HttpRequestResponseInfo reqResp : session.getRequestResponseInfo()) {
            if (reqResp.getDirection() == HttpDirection.RESPONSE && reqResp.getContentType() != null && reqResp.getContentType().contains("image/")) {
                originalImage = ImageHelper.extractFullNameFromRRInfo(reqResp);
                if ((!originalImage.isEmpty() && !(originalImage.contains(".jpeg") || originalImage.contains(".jpg"))) && reqResp.getContentType().contains("jpeg")) {
                    originalImage = Util.parseImageName(originalImage, reqResp);
                }
                int pos = originalImage.lastIndexOf(".");
                if (pos != -1) {
                    imgExtn = originalImage.substring(pos + 1, originalImage.length());
                    if (Util.isJPG(new File(imageFolderPath + originalImage), imgExtn)) {
                        midCompressedImagePath = imageCompressionFolderPath + originalImage.substring(0, originalImage.lastIndexOf(".")) + Quality.MID.getFileDesc() + originalImage.substring(originalImage.lastIndexOf("."), originalImage.length());
                        logCompressedImagepath = imageCompressionFolderPath + originalImage.substring(0, originalImage.lastIndexOf(".")) + Quality.LOW.getFileDesc() + originalImage.substring(originalImage.lastIndexOf("."), originalImage.length());
                        orgImageSize = new File(imageFolderPath + originalImage).length();
                        midQualityImgSize = new File(midCompressedImagePath).length();
                        lowQualityImgSize = new File(logCompressedImagepath).length();
                        if (midQualityImgSize > 0 && ((orgImageSize - midQualityImgSize) * 100 / orgImageSize >= 15) && lowQualityImgSize < orgImageSize) {
                            orginalImagesSize = orginalImagesSize + orgImageSize;
                            midQualImgsSize = midQualImgsSize + midQualityImgSize;
                            entryList.add(new ImageCompressionEntry(reqResp, session.getDomainName(), imageFolderPath + originalImage, Util.doubleFileSize(orgImageSize), Util.doubleFileSize(midQualityImgSize), Util.doubleFileSize(lowQualityImgSize)));
                        }
                    }
                }
            }
        }
    }
    return entryList;
}
Also used : ImageCompressionEntry(com.att.aro.core.bestpractice.pojo.ImageCompressionEntry) HttpRequestResponseInfo(com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo) ArrayList(java.util.ArrayList) File(java.io.File) Session(com.att.aro.core.packetanalysis.pojo.Session)

Example 82 with Session

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

the class TransmissionPrivateDataImpl method search.

/**
 * searching method depends on the type of searching handler (exact keyword searching or pattern searching)
 * @param sessions
 * @param handler
 * @param privateDataSet
 * @return
 */
private List<TransmissionPrivateDataEntry> search(List<Session> sessions, ISearchingHandler handler, Map<String, String> privateDataSet) {
    List<TransmissionPrivateDataEntry> entries = new LinkedList<>();
    SearchingPattern pattern = getSearchingPattern(handler, privateDataSet);
    if (pattern.isEmpty()) {
        return entries;
    }
    for (Session session : sessions) {
        SearchingContent content = getContent(session);
        SearchingResult result = handler.search(pattern, content);
        List<String> wordsFound = result.getWords();
        List<String> types = result.getTypes();
        for (int i = 0; i < wordsFound.size(); i++) {
            entries.add(populateEntry(session, wordsFound.get(i), types.get(i)));
        }
    }
    return entries;
}
Also used : TransmissionPrivateDataEntry(com.att.aro.core.bestpractice.pojo.TransmissionPrivateDataEntry) SearchingResult(com.att.aro.core.searching.pojo.SearchingResult) SearchingContent(com.att.aro.core.searching.pojo.SearchingContent) SearchingPattern(com.att.aro.core.searching.pojo.SearchingPattern) LinkedList(java.util.LinkedList) Session(com.att.aro.core.packetanalysis.pojo.Session)

Example 83 with Session

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

the class VideoConcurrentSessionImpl method manifestConcurrentSessions.

public List<VideoConcurrentSession> manifestConcurrentSessions(SortedMap<Double, VideoStream> videoStreamMap) {
    List<VideoConcurrentSession> concurrentSessionList = new ArrayList<VideoConcurrentSession>();
    if (MapUtils.isNotEmpty(videoStreamCollection)) {
        for (VideoStream videoStream : videoStreamMap.values()) {
            if (videoStream.isSelected()) {
                ArrayList<Double> sessionStartTimes = new ArrayList<>();
                ArrayList<Double> sessionEndTimes = new ArrayList<>();
                ArrayList<Session> sessionList = new ArrayList<>();
                SortedMap<String, VideoEvent> videoEventList = videoStream.getVideoEventMap();
                for (VideoEvent veEntry : videoEventList.values()) {
                    Session session = veEntry.getSession();
                    if (!sessionList.contains(session)) {
                        sessionList.add(session);
                        sessionStartTimes.add(session.getSessionStartTime());
                        sessionEndTimes.add(session.getSessionEndTime());
                    }
                }
                VideoConcurrentSession videoConcurrentSession = findConcurrency(sessionStartTimes, sessionEndTimes);
                if (videoConcurrentSession != null && videoConcurrentSession.getConcurrentSessionCount() > 0) {
                    videoConcurrentSession.setVideoName(videoStream.getManifest().getVideoName());
                    concurrentSessionList.add(videoConcurrentSession);
                }
            }
        }
    }
    return concurrentSessionList;
}
Also used : VideoConcurrentSession(com.att.aro.core.bestpractice.pojo.VideoConcurrentSession) ArrayList(java.util.ArrayList) VideoStream(com.att.aro.core.videoanalysis.pojo.VideoStream) VideoEvent(com.att.aro.core.videoanalysis.pojo.VideoEvent) Session(com.att.aro.core.packetanalysis.pojo.Session) VideoConcurrentSession(com.att.aro.core.bestpractice.pojo.VideoConcurrentSession)

Example 84 with Session

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

the class EmptyUrlImplTest method runTest_resIsPass.

@Test
public void runTest_resIsPass() {
    Mockito.when(httpRequestInfo01.getDirection()).thenReturn(HttpDirection.RESPONSE);
    Mockito.when(httpRequestInfo01.getContentType()).thenReturn("abc");
    Mockito.when(httpRequestInfo01.getContentLength()).thenReturn(1);
    Mockito.when(httpRequestInfo02.getDirection()).thenReturn(HttpDirection.REQUEST);
    Mockito.when(httpRequestInfo03.getDirection()).thenReturn(HttpDirection.RESPONSE);
    Mockito.when(httpRequestInfo04.getDirection()).thenReturn(HttpDirection.RESPONSE);
    Mockito.when(reqhelper.isHtml(any(String.class))).thenReturn(true);
    try {
        Mockito.when(reqhelper.getContentString(any(HttpRequestResponseInfo.class), any(Session.class))).thenReturn(htmlString);
    } 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.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 85 with Session

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

the class Http10UsageImplTest method runTest_resTypeIsFail.

@Test
public void runTest_resTypeIsFail() {
    Mockito.when(httpRequestInfo01.getVersion()).thenReturn(HttpRequestResponseInfo.HTTP10);
    Mockito.when(httpRequestInfo02.getVersion()).thenReturn(HttpRequestResponseInfo.HTTP10);
    List<HttpRequestResponseInfo> value = new ArrayList<HttpRequestResponseInfo>();
    value.add(httpRequestInfo01);
    value.add(httpRequestInfo02);
    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.WARNING, 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