All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.testvagrant.optimus.devicemanager.DeviceManager Maven / Gradle / Ivy

Go to download

Optimus Lite API to manage test devices and create appium driver based on platform

There is a newer version: 0.1.7-beta
Show newest version
package com.testvagrant.optimus.devicemanager;

import com.testvagrant.optimus.cache.DeviceCache;
import com.testvagrant.optimus.core.models.TargetDetails;

import java.util.function.Predicate;

public abstract class DeviceManager {
  DeviceCache deviceCache;

  public DeviceManager(DeviceCache deviceCache) {
    this.deviceCache = deviceCache;
  }

  public synchronized void releaseDevice(TargetDetails targetDetails) {
    deviceCache.release(targetDetails.getUdid());
  }

  public long getTotalAvailableDevices() {
    return deviceCache.size();
  }

  public synchronized TargetDetails getAvailableDevice(
      Predicate deviceFilterPredicate) {
    return deviceCache.get(deviceFilterPredicate);
  }

  public TargetDetails getAvailableDevice() {
    return getAvailableDevice(platformQueryPredicate());
  }

  protected Predicate platformQueryPredicate() {
    return deviceDetails -> !deviceDetails.getPlatform().name().isEmpty();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy