use of com.att.aro.core.datacollector.pojo.StatusResult in project VideoOptimzer by attdevsupport.
the class RootedAndroidCollectorImplTest method teststartCollector_returnIsErrorCode209.
@Ignore
@Test
public void teststartCollector_returnIsErrorCode209() {
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(android.pushFile(any(IDevice.class), any(String.class), any(String.class))).thenReturn(false);
StatusResult testResult = rootedAndroidCollectorImpl.startCollector(true, "", VideoOption.NONE, false, "abc", null, null);
assertEquals(209, testResult.getError().getCode());
}
use of com.att.aro.core.datacollector.pojo.StatusResult in project VideoOptimzer by attdevsupport.
the class RootedAndroidCollectorImplTest method teststartCollector_returnIsErrorCode203.
// @Ignore
@Test
public void teststartCollector_returnIsErrorCode203() {
when(filemanager.directoryExist(any(String.class))).thenReturn(true);
IDevice[] devlist = {};
try {
when(adbservice.getConnectedDevices()).thenReturn(devlist);
} catch (Exception e) {
e.printStackTrace();
}
StatusResult testResult = rootedAndroidCollectorImpl.startCollector(true, "", VideoOption.NONE, false, "abc", null, null);
assertEquals(203, testResult.getError().getCode());
}
use of com.att.aro.core.datacollector.pojo.StatusResult in project VideoOptimzer by attdevsupport.
the class RootedAndroidCollectorImplTest method teststartCollector_returnIsErrorCode200.
// @Ignore
@Test
public void teststartCollector_returnIsErrorCode200() throws Exception {
when(filemanager.directoryExist(any(String.class))).thenReturn(true);
when(adbservice.getConnectedDevices()).thenThrow(new IOException("AndroidDebugBridge failed to start"));
StatusResult testResult = rootedAndroidCollectorImpl.startCollector(true, "", VideoOption.NONE, null);
assertEquals(200, testResult.getError().getCode());
}
use of com.att.aro.core.datacollector.pojo.StatusResult in project VideoOptimzer by attdevsupport.
the class RootedAndroidCollectorImplTest method teststartCollector_returnIsErrorCode212.
@Ignore
@Test
public void teststartCollector_returnIsErrorCode212() {
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(false);
StatusResult testResult = rootedAndroidCollectorImpl.startCollector(true, "", VideoOption.NONE, false, "abc", null, null);
assertEquals(212, testResult.getError().getCode());
}
use of com.att.aro.core.datacollector.pojo.StatusResult in project VideoOptimzer by attdevsupport.
the class AROController method startCollector.
/**
* Extract parameters from an AROCollectorActionEvent event. Initiate a
* collection on Android and iOS devices
*
* @param event
* @param actionCommand
* - "startCollector" or "startCollectorIos"
*/
private void startCollector(ActionEvent event, String actionCommand) {
StatusResult result;
this.theView.updateCollectorStatus(CollectorStatus.STARTING, null);
// reset so that a failure will be true
this.theView.setDeviceDataPulled(true);
if (event instanceof AROCollectorActionEvent) {
IAroDevice device = ((AROCollectorActionEvent) event).getDevice();
String traceName = ((AROCollectorActionEvent) event).getTrace();
extraParams = ((AROCollectorActionEvent) event).getExtraParams();
result = startCollector(device, traceName, extraParams);
LOG.info("---------- result: " + result.toString());
if (!result.isSuccess()) {
// report failure
if (result.getError().getCode() == 206) {
try {
(new File(traceFolderPath)).delete();
} catch (Exception e) {
LOG.warn("failed to delete trace folder :" + traceFolderPath);
}
this.theView.updateCollectorStatus(CollectorStatus.CANCELLED, result);
} else {
this.theView.updateCollectorStatus(null, result);
}
} else {
// apk has launched and been activated
if (!getVideoOption().equals(VideoOption.NONE) && "startCollector".equals(actionCommand)) {
this.theView.liveVideoDisplay(collector);
}
this.theView.updateCollectorStatus(CollectorStatus.STARTED, result);
}
if (device.getPlatform().equals(IAroDevice.Platform.iOS)) {
for (int i = 0; i < 30; i++) {
try {
if (!result.isSuccess() && result.getError().getCode() == 529) {
this.theView.updateCollectorStatus(CollectorStatus.CANCELLED, result);
this.theView.stopCollector();
break;
} else {
Thread.sleep(1000);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
Aggregations