use of com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult 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);
}
}
use of com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult 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);
}
}
Aggregations