Search in sources :

Example 6 with StatusResult

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

the class RootedAndroidCollectorImplTest method teststartCollector_returnIsErrorCode204.

// @Ignore
@Test
public void teststartCollector_returnIsErrorCode204() {
    when(filemanager.directoryExist(any(String.class))).thenReturn(true);
    IDevice mockDevice = mock(IDevice.class);
    IDevice[] devlist = { mockDevice };
    when(mockDevice.getSerialNumber()).thenReturn("abc");
    try {
        when(adbservice.getConnectedDevices()).thenReturn(devlist);
    } catch (Exception e) {
        e.printStackTrace();
    }
    StatusResult testResult = rootedAndroidCollectorImpl.startCollector(true, "", VideoOption.NONE, false, "cde", null, null);
    assertEquals(204, testResult.getError().getCode());
}
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) Test(org.junit.Test)

Example 7 with StatusResult

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

the class RootedAndroidCollectorImplTest method teststartCollector_returnIsErrorCode206.

@Ignore
@Test
public void teststartCollector_returnIsErrorCode206() {
    when(filemanager.directoryExist(any(String.class))).thenReturn(true);
    IDevice mockDevice = mock(IDevice.class);
    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.checkTcpDumpRunning(any(IDevice.class))).thenReturn(true);
    StatusResult testResult = rootedAndroidCollectorImpl.startCollector(true, "", VideoOption.NONE, false, "abc", null, null);
    assertEquals(206, testResult.getError().getCode());
}
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 8 with StatusResult

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

the class RootedAndroidCollectorImplTest method teststartCollector_returnIsErrorCode213.

@Ignore
@Test
public void teststartCollector_returnIsErrorCode213() {
    when(filemanager.directoryExist(any(String.class))).thenReturn(true);
    IDevice mockDevice = mock(IDevice.class);
    IDevice[] devlist = { mockDevice };
    when(mockDevice.getSerialNumber()).thenReturn("abc");
    try {
        when(adbservice.getConnectedDevices()).thenReturn(devlist);
    } catch (Exception e) {
        e.printStackTrace();
    }
    StatusResult testResult = rootedAndroidCollectorImpl.startCollector(true, "", VideoOption.NONE, false, "abc", null, null);
    assertEquals(213, testResult.getError().getCode());
}
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 9 with StatusResult

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

the class Compressor method run.

@Override
public void run() {
    LOG.info("preparingPayload");
    // message status update
    notifyListeners(new StatusResult(null, null, State.COMPRESSING.toString() + ": " + new File(targetFolder).getName()));
    String base64WrappedZipFile = null;
    try {
        base64WrappedZipFile = zipBase64();
    } catch (Exception e1) {
        String error = "Exception :" + e1.getMessage();
        LOG.error(error);
        // message status failed
        notifyListeners(new StatusResult(false, null, error));
        return;
    }
    // message completed success, zip base64 filename
    notifyListeners(new StatusResult(true, null, base64WrappedZipFile));
}
Also used : StatusResult(com.att.aro.core.datacollector.pojo.StatusResult) ZipFile(net.lingala.zip4j.core.ZipFile) File(java.io.File) IOException(java.io.IOException) ZipException(net.lingala.zip4j.exception.ZipException)

Example 10 with StatusResult

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

the class NorootedAndroidCollectorImpl method stopCollector.

/**
 * issue commands to stop the collector on vpn This cannot halt the vpn connection programmatically. VPN must be
 * revoked through gestures. Best done by human interaction. With sufficient knowledge of screen size, VPN
 * implementation, Android Version gestures can be programmatically performed to close the connection.
 */
@Override
public StatusResult stopCollector() {
    StatusResult result = new StatusResult();
    if (!stopAllServices()) {
        LOG.error("Cannot stop all services, please check services in device Settings->Apps->Running");
    }
    if (!forceStopProcess()) {
        LOG.error("Cannot force stop VPN Collector");
    }
    userInputTraceCollector.stopUserInputTraceCapture(this.device);
    if (isAndroidVersionNougatOrHigher(device) == true)
        cpuTraceCollector.stopCpuTraceCapture(this.device);
    if (isVideo()) {
        LOG.debug("stopping video capture");
        this.stopCaptureVideo();
    }
    if (this.attnrScriptRun) {
        attnr.stopAtenuationScript(this.device);
    }
    uiXmlCollector.stopUiXmlCapture(this.device);
    LOG.info("pulling trace to local dir");
    new LogcatCollector(adbService, device.getSerialNumber()).collectLogcat(localTraceFolder, "Logcat.log");
    result = pullTrace(this.mDataDeviceCollectortraceFileNames);
    if (result.isSuccess()) {
        try {
            metaDataHelper.initMetaData(localTraceFolder, traceDesc, traceType, targetedApp, appProducer);
        } catch (Exception e) {
            LOG.warn("Exception while initializing meta data", e);
        }
    }
    GoogleAnalyticsUtil.getGoogleAnalyticsInstance().sendAnalyticsEvents(GoogleAnalyticsUtil.getAnalyticsEvents().getNonRootedCollector(), // GA Request
    GoogleAnalyticsUtil.getAnalyticsEvents().getEndTrace());
    running = false;
    return result;
}
Also used : StatusResult(com.att.aro.core.datacollector.pojo.StatusResult) AdbCommandRejectedException(com.android.ddmlib.AdbCommandRejectedException) InstallException(com.android.ddmlib.InstallException) TimeoutException(com.android.ddmlib.TimeoutException) IOException(java.io.IOException)

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