Search in sources :

Example 6 with CpuActivityList

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

the class PacketAnalyzerImplTest method Test_analyzeTraceDirectory_returnIsPacketAnalyzerResult.

@Test
public void Test_analyzeTraceDirectory_returnIsPacketAnalyzerResult() throws Exception {
    iPacketAnalyzer.setEnergyModelFactory(energymodelfactory);
    iPacketAnalyzer.setBurstCollectionAnalayzer(burstcollectionanalyzer);
    iPacketAnalyzer.setRrcStateMachineFactory(statemachinefactory);
    iPacketAnalyzer.setProfileFactory(profilefactory);
    TraceDirectoryResult mockTraceDirResult = mock(TraceDirectoryResult.class);
    MetaDataHelper metaDataHelper = mock(MetaDataHelper.class);
    MetaDataModel metaDataModel = new MetaDataModel();
    AnalysisFilter filter = mock(AnalysisFilter.class);
    filter.setIpv4Sel(true);
    filter.setIpv6Sel(true);
    filter.setUdpSel(true);
    CpuActivityList cpuList = new CpuActivityList();
    cpuList.add(new CpuActivity());
    when(mockTraceDirResult.getCpuActivityList()).thenReturn(cpuList);
    when(tracereader.readTraceDirectory(any(String.class))).thenReturn(mockTraceDirResult);
    when(metaDataHelper.initMetaData(any(PacketAnalyzerResult.class))).thenReturn(metaDataModel);
    ProfileLTE profileLTE = new ProfileLTE();
    when(profilefactory.createLTEdefault()).thenReturn(profileLTE);
    PacketAnalyzerResult testResult = iPacketAnalyzer.analyzeTraceDirectory("", profileLTE, filter);
    assertEquals(null, testResult.getSessionlist());
}
Also used : CpuActivityList(com.att.aro.core.peripheral.pojo.CpuActivityList) AnalysisFilter(com.att.aro.core.packetanalysis.pojo.AnalysisFilter) MetaDataModel(com.att.aro.core.tracemetadata.pojo.MetaDataModel) TraceDirectoryResult(com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult) PacketAnalyzerResult(com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult) MetaDataHelper(com.att.aro.core.tracemetadata.impl.MetaDataHelper) ProfileLTE(com.att.aro.core.configuration.pojo.ProfileLTE) CpuActivity(com.att.aro.core.peripheral.pojo.CpuActivity) BaseTest(com.att.aro.core.BaseTest) Test(org.junit.Test)

Example 7 with CpuActivityList

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

the class CpuActivityReaderImplTest method readData.

@Test
public void readData() throws IOException {
    reader = (CpuActivityReaderImpl) context.getBean(ICpuActivityReader.class);
    IFileManager filereader = Mockito.mock(IFileManager.class);
    Mockito.when(filereader.fileExist(Mockito.anyString())).thenReturn(true);
    String[] arr = new String[] { "1.413913535E9 73 /sbin/adbd=14 com.att.android.arodatacollector=5 system_server=4 /system/bin/surfaceflinger=2 com.android.systemui=2 top=1 com.google.process.gapps=1", "1.41391354E9 49 /sbin/adbd=24 /system/bin/surfaceflinger=4 system_server=4 com.android.settings=3 com.android.htcdialer=1 top=1 com.att.android.arodatacollector=1", "1.413913545E9 46 /sbin/adbd=22 system_server=5 com.android.systemui=5 /system/bin/surfaceflinger=4 top=1", "1.41391355E9 60 /sbin/adbd=19 system_server=5 /system/bin/surfaceflinger=4 com.htc.launcher=2 ./data/data/com.att.android.arodatacollector/tcpdump=1 top=1", "1.413913556E9 87 com.android.browser=35 /sbin/adbd=18 ./data/data/com.att.android.arodatacollector/tcpdump=13 /system/bin/surfaceflinger=2 logcat=1 RX_Thread=1 kswapd0=1 system_server=1", "1.413913561E9 88 com.android.browser=38 /sbin/adbd=21 ./data/data/com.att.android.arodatacollector/tcpdump=3 /system/bin/surfaceflinger=2 system_server=1 top=1", "1.413913567E9 85 com.android.browser=38 /sbin/adbd=23 ./data/data/com.att.android.arodatacollector/tcpdump=11 /system/bin/surfaceflinger=2 top=1", "1.413913572E9 51 /sbin/adbd=30 com.android.browser=7 /system/bin/surfaceflinger=3 top=1", "1.413913577E9 41 /sbin/adbd=23 /system/bin/surfaceflinger=5 system_server=2 com.android.browser=1 top=1", "1.413913583E9 38 /sbin/adbd=18 com.android.browser=11 /system/bin/surfaceflinger=2 top=1", "1.413913588E9 93 com.android.browser=42 /sbin/adbd=20 ./data/data/com.att.android.arodatacollector/tcpdump=5 /system/bin/surfaceflinger=1 RX_Thread=1 logcat=1 top=1 system_server=1", "1.413913594E9 92 com.android.browser=23 /sbin/adbd=23 /system/bin/surfaceflinger=3 ./data/data/com.att.android.arodatacollector/tcpdump=2 system_server=1 top=1", "1.413913599E9 81 com.android.browser=22 /sbin/adbd=21 com.android.systemui=6 /system/bin/surfaceflinger=6 system_server=5 ./data/data/com.att.android.arodatacollector/tcpdump=1 top=1", "1.413913604E9 56 /sbin/adbd=29 com.android.systemui=9 /system/bin/surfaceflinger=4 system_server=3 top=1", "1.41391361E9 35 /sbin/adbd=18 /system/bin/surfaceflinger=4 system_server=2 top=1", "1.413913615E9 51 /sbin/adbd=41 /system/bin/surfaceflinger=4 top=2 system_server=1 kworker/0:2=1", "1.413913621E9 47 /sbin/adbd=23 /system/bin/surfaceflinger=5 com.android.settings=4 system_server=3 top=2", "1.413913626E9 56 /sbin/adbd=25 com.android.systemui=7 /system/bin/surfaceflinger=5 system_server=3 top=1", "1.413913632E9 87 com.android.browser=47 /sbin/adbd=21 ./data/data/com.att.android.arodatacollector/tcpdump=4 /system/bin/surfaceflinger=2 top=1 com.att.android.arodatacollector=1", "1.413913637E9 86 com.android.browser=45 /sbin/adbd=24 /system/bin/surfaceflinger=3 ./data/data/com.att.android.arodatacollector/tcpdump=1 top=1", "1.413913642E9 80 com.android.browser=38 /sbin/adbd=26 ./data/data/com.att.android.arodatacollector/tcpdump=9 /system/bin/surfaceflinger=3 top=1", "1.413913648E9 92 com.android.browser=45 /sbin/adbd=20 ./data/data/com.att.android.arodatacollector/tcpdump=8 /system/bin/surfaceflinger=4 system_server=2 top=1 kswapd0=1", "1.413913654E9 51 /sbin/adbd=34 /system/bin/surfaceflinger=2 top=1 com.android.browser=1 kworker/0:2=1", "" };
    Mockito.when(filereader.readAllLine(Mockito.anyString())).thenReturn(arr);
    reader.setFileReader(filereader);
    CpuActivityList info = reader.readData("/", 0.0);
    assertTrue(info.getCpuActivities().size() == 23);
    assertTrue("what", info.isProcessSelected("./data/data/com.att.android.arodatacollector"));
    info.recalculateTotalCpu();
    Mockito.when(filereader.fileExist(Mockito.anyString())).thenReturn(false);
    reader.setFileReader(filereader);
    info = reader.readData("/", 0.0);
    assertTrue(info.getCpuActivities().size() == 0);
}
Also used : CpuActivityList(com.att.aro.core.peripheral.pojo.CpuActivityList) IFileManager(com.att.aro.core.fileio.IFileManager) Test(org.junit.Test) BaseTest(com.att.aro.core.BaseTest)

Aggregations

CpuActivityList (com.att.aro.core.peripheral.pojo.CpuActivityList)7 BaseTest (com.att.aro.core.BaseTest)4 Test (org.junit.Test)4 PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)3 CpuActivity (com.att.aro.core.peripheral.pojo.CpuActivity)3 ProfileLTE (com.att.aro.core.configuration.pojo.ProfileLTE)2 IFileManager (com.att.aro.core.fileio.IFileManager)2 AnalysisFilter (com.att.aro.core.packetanalysis.pojo.AnalysisFilter)2 BurstCollectionAnalysisData (com.att.aro.core.packetanalysis.pojo.BurstCollectionAnalysisData)2 IOException (java.io.IOException)2 Profile (com.att.aro.core.configuration.pojo.Profile)1 EnergyModel (com.att.aro.core.packetanalysis.pojo.EnergyModel)1 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)1 RrcStateMachineLTE (com.att.aro.core.packetanalysis.pojo.RrcStateMachineLTE)1 RrcStateRange (com.att.aro.core.packetanalysis.pojo.RrcStateRange)1 TimeRange (com.att.aro.core.packetanalysis.pojo.TimeRange)1 TraceDirectoryResult (com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult)1 TraceFileResult (com.att.aro.core.packetanalysis.pojo.TraceFileResult)1 DomainNameSystem (com.att.aro.core.packetreader.pojo.DomainNameSystem)1 TCPPacket (com.att.aro.core.packetreader.pojo.TCPPacket)1