Search in sources :

Example 21 with AROTraceData

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

the class AROServiceImplTest method analyzeDirectoryTest_resultIsNull.

@Test
public void analyzeDirectoryTest_resultIsNull() throws IOException {
    List<BestPracticeType> req = new ArrayList<BestPracticeType>();
    when(packetanalyzer.analyzeTraceDirectory(any(String.class), any(Profile.class), any(AnalysisFilter.class))).thenReturn(null);
    AROTraceData testResult = aro.analyzeDirectory(req, Util.getCurrentRunningDir());
    assertEquals(108, testResult.getError().getCode());
    assertFalse(testResult.isSuccess());
}
Also used : AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) ArrayList(java.util.ArrayList) BestPracticeType(com.att.aro.core.bestpractice.pojo.BestPracticeType) AROTraceData(com.att.aro.core.pojo.AROTraceData) Profile(com.att.aro.core.configuration.pojo.Profile) BaseTest(com.att.aro.core.BaseTest) Test(org.junit.Test)

Example 22 with AROTraceData

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

the class AROServiceImplTest method analyzeFileTest_resultIsNull.

@Test
public void analyzeFileTest_resultIsNull() throws IOException {
    when(packetanalyzer.analyzeTraceFile(any(String.class), any(Profile.class), any(AnalysisFilter.class))).thenReturn(null);
    List<BestPracticeType> req = new ArrayList<BestPracticeType>();
    AROTraceData testResult = aro.analyzeFile(req, "traffic.cap");
    assertEquals(104, testResult.getError().getCode());
    assertFalse(testResult.isSuccess());
}
Also used : AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) ArrayList(java.util.ArrayList) BestPracticeType(com.att.aro.core.bestpractice.pojo.BestPracticeType) AROTraceData(com.att.aro.core.pojo.AROTraceData) Profile(com.att.aro.core.configuration.pojo.Profile) BaseTest(com.att.aro.core.BaseTest) Test(org.junit.Test)

Example 23 with AROTraceData

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

the class AROServiceImplTest method analyzeFileTest.

@Test
public void analyzeFileTest() throws IOException {
    PacketAnalyzerResult analyze = new PacketAnalyzerResult();
    TraceFileResult traceresult = new TraceFileResult();
    List<PacketInfo> allpackets = new ArrayList<PacketInfo>();
    allpackets.add(new PacketInfo(new Packet(0, 0, 0, 0, null)));
    traceresult.setAllpackets(allpackets);
    analyze.setTraceresult(traceresult);
    PeriodicTransferResult periodicTransferResult = new PeriodicTransferResult();
    List<BestPracticeType> req = new ArrayList<BestPracticeType>();
    req.add(BestPracticeType.UNNECESSARY_CONNECTIONS);
    req.add(BestPracticeType.CONNECTION_CLOSING);
    req.add(BestPracticeType.CONNECTION_OPENING);
    req.add(BestPracticeType.PERIODIC_TRANSFER);
    req.add(BestPracticeType.SCREEN_ROTATION);
    req.add(BestPracticeType.ACCESSING_PERIPHERALS);
    req.add(BestPracticeType.COMBINE_CS_JSS);
    req.add(BestPracticeType.HTTP_1_0_USAGE);
    req.add(BestPracticeType.CACHE_CONTROL);
    req.add(BestPracticeType.USING_CACHE);
    req.add(BestPracticeType.DUPLICATE_CONTENT);
    req.add(BestPracticeType.HTTP_4XX_5XX);
    req.add(BestPracticeType.HTTP_3XX_CODE);
    req.add(BestPracticeType.FILE_COMPRESSION);
    req.add(BestPracticeType.IMAGE_SIZE);
    req.add(BestPracticeType.MINIFICATION);
    req.add(BestPracticeType.EMPTY_URL);
    req.add(BestPracticeType.SPRITEIMAGE);
    req.add(BestPracticeType.SCRIPTS_URL);
    req.add(BestPracticeType.ASYNC_CHECK);
    req.add(BestPracticeType.DISPLAY_NONE_IN_CSS);
    req.add(BestPracticeType.FILE_ORDER);
    req.add(BestPracticeType.MULTI_SIMULCONN);
    req.add(BestPracticeType.VIDEO_STALL);
    req.add(BestPracticeType.STARTUP_DELAY);
    req.add(BestPracticeType.BUFFER_OCCUPANCY);
    req.add(BestPracticeType.NETWORK_COMPARISON);
    req.add(BestPracticeType.TCP_CONNECTION);
    req.add(BestPracticeType.CHUNK_SIZE);
    req.add(BestPracticeType.CHUNK_PACING);
    req.add(BestPracticeType.VIDEO_REDUNDANCY);
    req.add(BestPracticeType.VIDEO_CONCURRENT_SESSION);
    req.add(BestPracticeType.VIDEO_VARIABLE_BITRATE);
    req.add(BestPracticeType.HTTPS_USAGE);
    req.add(BestPracticeType.TRANSMISSION_PRIVATE_DATA);
    req.add(BestPracticeType.DISPLAY_NONE_IN_CSS);
    packetanalyzer = Mockito.mock(IPacketAnalyzer.class);
    aro.setPacketAnalyzer(packetanalyzer);
    when(packetanalyzer.analyzeTraceFile(any(String.class), any(Profile.class), any(AnalysisFilter.class))).thenReturn(analyze);
    when(worker.runTest(any(PacketAnalyzerResult.class))).thenReturn(periodicTransferResult);
    List<BestPracticeType> list = SettingsUtil.retrieveBestPractices();
    SettingsUtil.saveBestPractices(req);
    try {
        AROTraceData testResult = aro.analyzeFile(req, "traffic.cap");
        assertEquals(TOTAL_BPTESTS, testResult.getBestPracticeResults().size());
    } finally {
        SettingsUtil.saveBestPractices(list);
    }
}
Also used : Packet(com.att.aro.core.packetreader.pojo.Packet) IPacketAnalyzer(com.att.aro.core.packetanalysis.IPacketAnalyzer) PeriodicTransferResult(com.att.aro.core.bestpractice.pojo.PeriodicTransferResult) AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) ArrayList(java.util.ArrayList) BestPracticeType(com.att.aro.core.bestpractice.pojo.BestPracticeType) AROTraceData(com.att.aro.core.pojo.AROTraceData) Profile(com.att.aro.core.configuration.pojo.Profile) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) TraceFileResult(com.att.aro.core.packetanalysis.pojo.TraceFileResult) BaseTest(com.att.aro.core.BaseTest) Test(org.junit.Test)

Example 24 with AROTraceData

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

the class AROServiceImplTest method analyzeDirectoryTest.

@Test
public void analyzeDirectoryTest() throws IOException {
    TraceDirectoryResult traceresult = new TraceDirectoryResult();
    List<PacketInfo> allpackets = new ArrayList<PacketInfo>();
    allpackets.add(new PacketInfo(new Packet(0, 0, 0, 0, null)));
    traceresult.setAllpackets(allpackets);
    PacketAnalyzerResult analyze = new PacketAnalyzerResult();
    analyze.setTraceresult(traceresult);
    CacheAnalysis cacheAnalysis = new CacheAnalysis();
    PeriodicTransferResult periodicTransferResult = new PeriodicTransferResult();
    List<BestPracticeType> req = new ArrayList<BestPracticeType>();
    req.add(BestPracticeType.UNNECESSARY_CONNECTIONS);
    req.add(BestPracticeType.CONNECTION_CLOSING);
    req.add(BestPracticeType.CONNECTION_OPENING);
    req.add(BestPracticeType.PERIODIC_TRANSFER);
    req.add(BestPracticeType.SCREEN_ROTATION);
    req.add(BestPracticeType.ACCESSING_PERIPHERALS);
    req.add(BestPracticeType.COMBINE_CS_JSS);
    req.add(BestPracticeType.HTTP_1_0_USAGE);
    req.add(BestPracticeType.CACHE_CONTROL);
    req.add(BestPracticeType.USING_CACHE);
    req.add(BestPracticeType.DUPLICATE_CONTENT);
    req.add(BestPracticeType.HTTP_4XX_5XX);
    req.add(BestPracticeType.HTTP_3XX_CODE);
    req.add(BestPracticeType.FILE_COMPRESSION);
    req.add(BestPracticeType.IMAGE_SIZE);
    req.add(BestPracticeType.MINIFICATION);
    req.add(BestPracticeType.EMPTY_URL);
    req.add(BestPracticeType.SPRITEIMAGE);
    req.add(BestPracticeType.SCRIPTS_URL);
    req.add(BestPracticeType.ASYNC_CHECK);
    req.add(BestPracticeType.DISPLAY_NONE_IN_CSS);
    req.add(BestPracticeType.FILE_ORDER);
    req.add(BestPracticeType.VIDEO_STALL);
    req.add(BestPracticeType.STARTUP_DELAY);
    req.add(BestPracticeType.BUFFER_OCCUPANCY);
    req.add(BestPracticeType.NETWORK_COMPARISON);
    req.add(BestPracticeType.TCP_CONNECTION);
    req.add(BestPracticeType.CHUNK_SIZE);
    req.add(BestPracticeType.CHUNK_PACING);
    req.add(BestPracticeType.VIDEO_REDUNDANCY);
    req.add(BestPracticeType.VIDEO_VARIABLE_BITRATE);
    req.add(BestPracticeType.HTTPS_USAGE);
    req.add(BestPracticeType.TRANSMISSION_PRIVATE_DATA);
    req.add(BestPracticeType.DISPLAY_NONE_IN_CSS);
    req.add(BestPracticeType.VIDEO_CONCURRENT_SESSION);
    req.add(BestPracticeType.AUDIO_STREAM);
    req.add(BestPracticeType.MULTI_SIMULCONN);
    List<BestPracticeType> list = SettingsUtil.retrieveBestPractices();
    SettingsUtil.saveBestPractices(req);
    when(packetanalyzer.analyzeTraceDirectory(any(String.class), any(Profile.class), any(AnalysisFilter.class))).thenReturn(analyze);
    when(worker.runTest(any(PacketAnalyzerResult.class))).thenReturn(periodicTransferResult);
    when(cacheAnalyzer.analyze(anyListOf(Session.class))).thenReturn(cacheAnalysis);
    try {
        AROTraceData testResult = aro.analyzeDirectory(req, Util.getCurrentRunningDir());
        assertEquals(null, testResult.getBestPracticeResults());
    } finally {
        SettingsUtil.saveBestPractices(list);
    }
}
Also used : Packet(com.att.aro.core.packetreader.pojo.Packet) PeriodicTransferResult(com.att.aro.core.bestpractice.pojo.PeriodicTransferResult) AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) ArrayList(java.util.ArrayList) BestPracticeType(com.att.aro.core.bestpractice.pojo.BestPracticeType) AROTraceData(com.att.aro.core.pojo.AROTraceData) Profile(com.att.aro.core.configuration.pojo.Profile) CacheAnalysis(com.att.aro.core.packetanalysis.pojo.CacheAnalysis) ICacheAnalysis(com.att.aro.core.packetanalysis.ICacheAnalysis) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) PacketInfo(com.att.aro.core.packetanalysis.pojo.PacketInfo) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) Session(com.att.aro.core.packetanalysis.pojo.Session) BaseTest(com.att.aro.core.BaseTest) Test(org.junit.Test)

Aggregations

AROTraceData (com.att.aro.core.pojo.AROTraceData)24 BaseTest (com.att.aro.core.BaseTest)10 Test (org.junit.Test)10 ArrayList (java.util.ArrayList)9 IOException (java.io.IOException)8 PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)6 BestPracticeType (com.att.aro.core.bestpractice.pojo.BestPracticeType)5 AnalysisFilter (com.att.aro.core.packetanalysis.pojo.AnalysisFilter)5 Profile (com.att.aro.core.configuration.pojo.Profile)4 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)4 IVideoBestPractices (com.att.aro.core.IVideoBestPractices)3 AbstractBestPracticeResult (com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult)3 TsharkException (com.att.aro.core.exception.TsharkException)3 TraceDirectoryResult (com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult)3 Packet (com.att.aro.core.packetreader.pojo.Packet)3 File (java.io.File)3 IAROService (com.att.aro.core.IAROService)2 PeriodicTransferResult (com.att.aro.core.bestpractice.pojo.PeriodicTransferResult)2 IPacketAnalyzer (com.att.aro.core.packetanalysis.IPacketAnalyzer)2 Session (com.att.aro.core.packetanalysis.pojo.Session)2