Search in sources :

Example 1 with DeviceNotConnectedException

use of com.testsigma.agent.exception.DeviceNotConnectedException in project testsigma by testsigmahq.

the class AgentDevicesController method show.

/**
 * fetch the device details using device unique id.
 *
 * @param uniqueId
 * @return AgentDeviceDTO - connected agent device details
 * @throws DeviceNotConnectedException
 */
@GetMapping(produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public AgentDeviceDTO show(@PathVariable("unique_id") String uniqueId) throws DeviceNotConnectedException, TestsigmaException {
    log.info("Received request fetch device details - " + uniqueId);
    MobileDevice mobileDevice = deviceContainer.getDevice(uniqueId);
    if (mobileDevice == null) {
        throw new DeviceNotConnectedException("Device not online. Please check if the device is connected properly.");
    }
    return mobileDeviceMapper.map(mobileDevice);
}
Also used : MobileDevice(com.testsigma.agent.mobile.MobileDevice) DeviceNotConnectedException(com.testsigma.agent.exception.DeviceNotConnectedException) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 2 with DeviceNotConnectedException

use of com.testsigma.agent.exception.DeviceNotConnectedException in project testsigma by testsigmahq.

the class TestPlanRunTask method setupLocalDevice.

protected void setupLocalDevice() throws AutomatorException {
    log.info("Setting up local mobile device");
    try {
        checkDeviceAvailability();
        TestDeviceSettings testDeviceSettings = environment.getEnvSettings();
        setAppiumUrl(testDeviceSettings);
        testDeviceSettings.setDeviceName(mobileDevice.getName());
        testDeviceSettings.setDeviceUniqueId(mobileDevice.getUniqueId());
        if (Platform.Android.equals(getEnvPlatform())) {
            testDeviceSettings.setChromedriverExecutableDir(PathUtil.getInstance().getDriversPath());
        } else if (Platform.iOS.equals(getEnvPlatform())) {
            iosDeviceService.setupWda(mobileDevice);
        }
        environment.setEnvSettings(testDeviceSettings);
        mobileAutomationServerService.installDrivers(this.mobileDevice.getOsName(), this.mobileDevice.getUniqueId());
    } catch (TestsigmaException | DeviceNotConnectedException | MobileLibraryInstallException e) {
        log.error(e.getMessage(), e);
        throw new AutomatorException(e.getMessage(), e);
    }
}
Also used : AutomatorException(com.testsigma.automator.exceptions.AutomatorException) MobileLibraryInstallException(com.testsigma.agent.exception.MobileLibraryInstallException) TestDeviceSettings(com.testsigma.automator.entity.TestDeviceSettings) TestsigmaException(com.testsigma.agent.exception.TestsigmaException) DeviceNotConnectedException(com.testsigma.agent.exception.DeviceNotConnectedException)

Aggregations

DeviceNotConnectedException (com.testsigma.agent.exception.DeviceNotConnectedException)2 MobileLibraryInstallException (com.testsigma.agent.exception.MobileLibraryInstallException)1 TestsigmaException (com.testsigma.agent.exception.TestsigmaException)1 MobileDevice (com.testsigma.agent.mobile.MobileDevice)1 TestDeviceSettings (com.testsigma.automator.entity.TestDeviceSettings)1 AutomatorException (com.testsigma.automator.exceptions.AutomatorException)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1