Search in sources :

Example 26 with StatusResult

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

the class RootedAndroidCollectorImplTest method teststopCollector_returnIsErrorCode211.

@Test
public void teststopCollector_returnIsErrorCode211() {
    StatusResult testResult = rootedAndroidCollectorImpl.stopCollector();
    assertEquals(211, testResult.getError().getCode());
}
Also used : StatusResult(com.att.aro.core.datacollector.pojo.StatusResult) Test(org.junit.Test)

Example 27 with StatusResult

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

the class RootedAndroidCollectorImplTest method teststartCollector_returnIsErrorCode207.

// @Ignore
@Test
public void teststartCollector_returnIsErrorCode207() {
    when(filemanager.directoryExist(any(String.class))).thenReturn(false);
    StatusResult testResult = rootedAndroidCollectorImpl.startCollector(true, "", VideoOption.NONE, false, "abc", null, null);
    assertEquals(207, testResult.getError().getCode());
}
Also used : StatusResult(com.att.aro.core.datacollector.pojo.StatusResult) Test(org.junit.Test)

Example 28 with StatusResult

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

the class RootedAndroidCollectorImplTest method teststartCollector_returnIsSuccess.

@Ignore
@Test
public void teststartCollector_returnIsSuccess() {
    when(filemanager.directoryExist(any(String.class))).thenReturn(true);
    IDevice mockDevice = mock(IDevice.class);
    when(mockDevice.isEmulator()).thenReturn(true);
    IDevice[] devlist = { mockDevice };
    when(mockDevice.getSerialNumber()).thenReturn("abc");
    try {
        when(adbservice.getConnectedDevices()).thenReturn(devlist);
    } catch (Exception e) {
        e.printStackTrace();
    }
    try {
        when(androidev.isAndroidRooted(any(IDevice.class))).thenReturn(true);
    } catch (Exception e) {
        e.printStackTrace();
    }
    when(android.isSDCardEnoughSpace(any(IDevice.class), any(long.class))).thenReturn(true);
    when(filemanager.fileExist(any(String.class))).thenReturn(true);
    when(extractor.extractFiles(any(String.class), any(String.class), any(ClassLoader.class))).thenReturn(true);
    when(android.pushFile(any(IDevice.class), any(String.class), any(String.class))).thenReturn(true);
    when(android.setExecutePermission(any(IDevice.class), any(String.class))).thenReturn(true);
    when(android.checkTcpDumpRunning(any(IDevice.class))).thenReturn(false).thenReturn(true);
    StatusResult testResult = rootedAndroidCollectorImpl.startCollector(true, "", VideoOption.NONE, false, "abc", null, null);
    assertEquals(true, testResult.isSuccess());
}
Also used : StatusResult(com.att.aro.core.datacollector.pojo.StatusResult) IDevice(com.android.ddmlib.IDevice) TimeoutException(com.android.ddmlib.TimeoutException) AdbCommandRejectedException(com.android.ddmlib.AdbCommandRejectedException) IOException(java.io.IOException) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 29 with StatusResult

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

the class RootedAndroidCollectorImplTest method teststopCollector_ThrowException.

@Test
public void teststopCollector_ThrowException() throws TimeoutException, AdbCommandRejectedException, IOException {
    when(device.getSyncService()).thenThrow(new IOException());
    Date date = new Date();
    when(videocapture.getVideoStartTime()).thenReturn(date);
    StatusResult testResult = rootedAndroidCollectorImpl.stopCollector();
    assertEquals(211, testResult.getError().getCode());
}
Also used : StatusResult(com.att.aro.core.datacollector.pojo.StatusResult) IOException(java.io.IOException) Date(java.util.Date) Test(org.junit.Test)

Example 30 with StatusResult

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

the class RootedAndroidCollectorImplTest method teststopCollector_returnIsSuccess.

@Ignore
@Test
public void teststopCollector_returnIsSuccess() throws TimeoutException, AdbCommandRejectedException, IOException {
    doReturn(5).when(rootedAndroidCollectorImpl).getMilliSecondsForTimeout();
    when(filemanager.directoryExist(any(String.class))).thenReturn(true);
    IDevice mockDevice = mock(IDevice.class);
    when(mockDevice.isEmulator()).thenReturn(true);
    SyncService service = mock(SyncService.class);
    when(mockDevice.getSyncService()).thenReturn(service);
    IDevice[] devlist = { mockDevice };
    when(mockDevice.getSerialNumber()).thenReturn("abc");
    try {
        when(adbservice.getConnectedDevices()).thenReturn(devlist);
    } catch (Exception e) {
        e.printStackTrace();
    }
    try {
        when(androidev.isAndroidRooted(any(IDevice.class))).thenReturn(true);
    } catch (Exception e) {
        e.printStackTrace();
    }
    when(android.isSDCardEnoughSpace(any(IDevice.class), any(long.class))).thenReturn(true);
    when(filemanager.fileExist(any(String.class))).thenReturn(true);
    when(extractor.extractFiles(any(String.class), any(String.class), any(ClassLoader.class))).thenReturn(true);
    when(android.pushFile(any(IDevice.class), any(String.class), any(String.class))).thenReturn(true);
    when(android.setExecutePermission(any(IDevice.class), any(String.class))).thenReturn(true);
    rootedAndroidCollectorImpl.startCollector(true, "", VideoOption.LREZ, false, "abc", null, null);
    when(android.checkTcpDumpRunning(any(IDevice.class))).thenReturn(true);
    when(android.stopTcpDump(any(IDevice.class))).thenReturn(true);
    when(android.isTraceRunning()).thenReturn(false);
    Date date = new Date();
    when(mockDevice.isEmulator()).thenReturn(false);
    when(videocapture.getVideoStartTime()).thenReturn(date);
    when(videocapture.isVideoCaptureActive()).thenReturn(true);
    StatusResult testResult = rootedAndroidCollectorImpl.stopCollector();
    assertEquals(true, testResult.isSuccess());
}
Also used : StatusResult(com.att.aro.core.datacollector.pojo.StatusResult) IDevice(com.android.ddmlib.IDevice) SyncService(com.android.ddmlib.SyncService) TimeoutException(com.android.ddmlib.TimeoutException) AdbCommandRejectedException(com.android.ddmlib.AdbCommandRejectedException) IOException(java.io.IOException) Date(java.util.Date) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

StatusResult (com.att.aro.core.datacollector.pojo.StatusResult)42 IOException (java.io.IOException)28 Test (org.junit.Test)20 AdbCommandRejectedException (com.android.ddmlib.AdbCommandRejectedException)19 TimeoutException (com.android.ddmlib.TimeoutException)19 IDevice (com.android.ddmlib.IDevice)17 Ignore (org.junit.Ignore)13 File (java.io.File)8 Date (java.util.Date)7 SyncService (com.android.ddmlib.SyncService)5 InstallException (com.android.ddmlib.InstallException)3 SyncException (com.android.ddmlib.SyncException)3 IAroDevice (com.att.aro.core.mobiledevice.pojo.IAroDevice)3 FileWriter (java.io.FileWriter)3 Hashtable (java.util.Hashtable)3 IDataCollector (com.att.aro.core.datacollector.IDataCollector)2 IVideoImageSubscriber (com.att.aro.core.datacollector.IVideoImageSubscriber)2 EnvironmentDetails (com.att.aro.core.datacollector.pojo.EnvironmentDetails)2 IFileManager (com.att.aro.core.fileio.IFileManager)2 AROAndroidDevice (com.att.aro.core.mobiledevice.pojo.AROAndroidDevice)2