Search in sources :

Example 1 with MobileDevice

use of com.testsigma.agent.mobile.MobileDevice in project testsigma by testsigmahq.

the class AndroidDeviceListener method deviceConnected.

@Override
public void deviceConnected(IDevice device) {
    log.info("Device connected event received by Listener");
    try {
        if (IDevice.DeviceState.ONLINE.equals(device.getState())) {
            MobileDevice mobileDevice = mobileDeviceMapper.map(device);
            mobileDevice.setIDevice(device);
            populateOtherAttributes(mobileDevice, device);
            this.addDevice(mobileDevice);
        }
    } catch (Exception e) {
        log.error(e.getMessage(), e);
    }
}
Also used : MobileDevice(com.testsigma.agent.mobile.MobileDevice) NativeBridgeException(com.testsigma.agent.exception.NativeBridgeException) TestsigmaException(com.testsigma.agent.exception.TestsigmaException) AdbCommandExecutionException(com.testsigma.agent.exception.AdbCommandExecutionException)

Example 2 with MobileDevice

use of com.testsigma.agent.mobile.MobileDevice in project testsigma by testsigmahq.

the class AndroidDeviceListener method getInitialDeviceList.

public void getInitialDeviceList() {
    try {
        if (agentConfig.getRegistered().equals(Boolean.FALSE)) {
            log.debug("Skipping initial agent devices collection since agent is not registered...");
            return;
        }
        log.debug("Started getting initial agent devices connected...");
        IDevice[] devices = adBridge.getDevices();
        for (IDevice device : devices) {
            if (IDevice.DeviceState.ONLINE.equals(device.getState())) {
                MobileDevice mobileDevice = mobileDeviceMapper.map(device);
                mobileDevice.setIDevice(device);
                populateOtherAttributes(mobileDevice, device);
                this.addDevice(mobileDevice);
            }
        }
    } catch (Exception e) {
        log.error(e.getMessage(), e);
    }
}
Also used : MobileDevice(com.testsigma.agent.mobile.MobileDevice) IDevice(com.android.ddmlib.IDevice) NativeBridgeException(com.testsigma.agent.exception.NativeBridgeException) TestsigmaException(com.testsigma.agent.exception.TestsigmaException) AdbCommandExecutionException(com.testsigma.agent.exception.AdbCommandExecutionException)

Example 3 with MobileDevice

use of com.testsigma.agent.mobile.MobileDevice in project testsigma by testsigmahq.

the class AndroidDeviceListener method deviceDisconnected.

@Override
public void deviceDisconnected(IDevice device) {
    log.info("Device disconnected event received by Listener");
    try {
        MobileDevice mobileDevice = mobileDeviceMapper.map(device);
        this.removeDevice(mobileDevice);
    } catch (Exception e) {
        log.error(e.getMessage(), e);
    }
}
Also used : MobileDevice(com.testsigma.agent.mobile.MobileDevice) NativeBridgeException(com.testsigma.agent.exception.NativeBridgeException) TestsigmaException(com.testsigma.agent.exception.TestsigmaException) AdbCommandExecutionException(com.testsigma.agent.exception.AdbCommandExecutionException)

Example 4 with MobileDevice

use of com.testsigma.agent.mobile.MobileDevice in project testsigma by testsigmahq.

the class AndroidDeviceListener method deviceChanged.

@Override
public void deviceChanged(IDevice device, int i) {
    log.info("Device changed event received by Listener");
    try {
        MobileDevice mobileDevice = mobileDeviceMapper.map(device);
        if (IDevice.DeviceState.ONLINE.equals(device.getState())) {
            populateOtherAttributes(mobileDevice, device);
        }
        mobileDevice.setIDevice(device);
        this.updateDevice(mobileDevice);
    } catch (Exception e) {
        log.error(e.getMessage(), e);
    }
}
Also used : MobileDevice(com.testsigma.agent.mobile.MobileDevice) NativeBridgeException(com.testsigma.agent.exception.NativeBridgeException) TestsigmaException(com.testsigma.agent.exception.TestsigmaException) AdbCommandExecutionException(com.testsigma.agent.exception.AdbCommandExecutionException)

Example 5 with MobileDevice

use of com.testsigma.agent.mobile.MobileDevice in project testsigma by testsigmahq.

the class IosMobileAutomationServer method deleteSession.

public void deleteSession(String uniqueId) throws TestsigmaException {
    MobileDevice device = deviceContainer.getDevice(uniqueId);
    RemoteWebDriver remoteWebDriver = device.getRemoteWebDriver();
    if (remoteWebDriver == null) {
        log.info("no appium session exists to quit....returning...");
        return;
    }
    remoteWebDriver.quit();
    device.setRemoteWebDriver(null);
}
Also used : MobileDevice(com.testsigma.agent.mobile.MobileDevice) RemoteWebDriver(org.openqa.selenium.remote.RemoteWebDriver)

Aggregations

MobileDevice (com.testsigma.agent.mobile.MobileDevice)14 TestsigmaException (com.testsigma.agent.exception.TestsigmaException)5 AdbCommandExecutionException (com.testsigma.agent.exception.AdbCommandExecutionException)4 NativeBridgeException (com.testsigma.agent.exception.NativeBridgeException)4 IDevice (com.android.ddmlib.IDevice)3 LibIMobileDevice (com.testsigma.agent.mobile.ios.libs.LibIMobileDevice)3 MobileLibraryInstallException (com.testsigma.agent.exception.MobileLibraryInstallException)2 DeviceNotConnectedException (com.testsigma.agent.exception.DeviceNotConnectedException)1 MobileAutomationServerSessionException (com.testsigma.agent.exception.MobileAutomationServerSessionException)1 URL (java.net.URL)1 JSONObject (org.json.JSONObject)1 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)1 RemoteWebDriver (org.openqa.selenium.remote.RemoteWebDriver)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1