com.testvagrant.optimus.devicemanager.DeviceManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of optimus-lite Show documentation
Show all versions of optimus-lite Show documentation
Optimus Lite API to manage test devices and create appium driver based on platform
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