use of com.att.aro.core.datacollector.pojo.StatusResult in project VideoOptimzer by attdevsupport.
the class RootedAndroidCollectorImplTest method teststopCollector_emulator_returnIsSuccess.
@Ignore
@Test
public void teststopCollector_emulator_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(true);
when(videocapture.getVideoStartTime()).thenReturn(date);
when(videocapture.isVideoCaptureActive()).thenReturn(true);
StatusResult testResult = rootedAndroidCollectorImpl.stopCollector();
assertEquals(true, testResult.isSuccess());
}
use of com.att.aro.core.datacollector.pojo.StatusResult in project VideoOptimzer by attdevsupport.
the class RootedAndroidCollectorImplTest method teststartCollector_returnIsErrorCode210.
@Ignore
@Test
public void teststartCollector_returnIsErrorCode210() {
when(filemanager.directoryExist(any(String.class))).thenReturn(true);
IDevice mockDevice = mock(IDevice.class);
when(mockDevice.isEmulator()).thenReturn(false);
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.checkPackageExist(any(IDevice.class), any(String.class))).thenReturn(true);
when(filemanager.fileExist(any(String.class))).thenReturn(true);
String[] testarray = { "does not exist" };
when(android.getShellReturn(any(IDevice.class), any(String.class))).thenReturn(testarray);
StatusResult testResult = rootedAndroidCollectorImpl.startCollector(true, "", VideoOption.NONE, false, "abc", null, null);
assertEquals(210, testResult.getError().getCode());
}
use of com.att.aro.core.datacollector.pojo.StatusResult in project VideoOptimzer by attdevsupport.
the class RootedAndroidCollectorImplTest method teststartCollector_returnIsErrorCode201.
@Ignore
@Test
public void teststartCollector_returnIsErrorCode201() {
when(filemanager.directoryExist(any(String.class))).thenReturn(true);
IDevice mockDevice = mock(IDevice.class);
when(mockDevice.isEmulator()).thenReturn(false);
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.checkPackageExist(any(IDevice.class), any(String.class))).thenReturn(false);
StatusResult testResult = rootedAndroidCollectorImpl.startCollector(true, "", VideoOption.NONE, false, "abc", null, null);
assertEquals(201, testResult.getError().getCode());
}
use of com.att.aro.core.datacollector.pojo.StatusResult in project VideoOptimzer by attdevsupport.
the class RootedAndroidCollectorImplTest method teststartCollector_ThrowException.
@Ignore
@Test
public void teststartCollector_ThrowException() throws TimeoutException, AdbCommandRejectedException, IOException {
when(filemanager.directoryExist(any(String.class))).thenReturn(true);
IDevice mockDevice = mock(IDevice.class);
IDevice[] devlist = { mockDevice };
when(mockDevice.getSerialNumber()).thenReturn("abc");
doThrow(new TimeoutException()).when(mockDevice).createForward(any(int.class), any(int.class));
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();
}
StatusResult testResult = rootedAndroidCollectorImpl.startCollector(true, "", VideoOption.NONE, false, "abc", null, null);
assertEquals(201, testResult.getError().getCode());
}
use of com.att.aro.core.datacollector.pojo.StatusResult in project VideoOptimzer by attdevsupport.
the class RootedAndroidCollectorImplTest method testdirectoryExists.
@Test
public void testdirectoryExists() {
when(filemanager.directoryExist(any(String.class))).thenReturn(true);
when(filemanager.directoryExistAndNotEmpty(any(String.class))).thenReturn(true);
StatusResult result = rootedAndroidCollectorImpl.startCollector(true, "", VideoOption.LREZ, false, "abc", null, null);
assertEquals(false, result.isSuccess());
}
Aggregations