com.testvagrant.mdb.ios.IOS Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of optimus-monitor Show documentation
Show all versions of optimus-monitor Show documentation
The Java Client provides access to Optimus cloud for all java based projects.
The newest version!
package com.testvagrant.mdb.ios;
import com.testvagrant.mdb.Exceptions.ConnectedDevicesException;
import com.testvagrant.mdb.Exceptions.UnsupportedPlatformException;
import com.testvagrant.mdb.core.Mobile;
import com.testvagrant.mdb.helpers.IOSHelper;
import com.testvagrant.monitor.entities.DeviceDetails;
import com.testvagrant.monitor.entities.device.Platform;
import org.apache.commons.lang3.SystemUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import static com.testvagrant.mdb.utils.Commands.AndroidCommands.ADB_HEADER;
public class IOS extends Mobile implements IDB {
private List deviceDetailsList;
public IOS() {
if(SystemUtils.IS_OS_MAC) {
deviceDetailsList = new ArrayList<>();
collectDeviceDetails();
} else
throw new UnsupportedPlatformException("Your OS does not support IOS Commands");
}
protected void collectDeviceDetails() {
List devices = collectDevicesOutput(Platform.IOS);
List collectedDevices = devices.stream().filter(line -> !(line.equals(ADB_HEADER))).collect(Collectors.toList());
if(collectedDevices.size()==0) {
throw new ConnectedDevicesException("Could not find any devices, are any devices available?");
} else {
IOSHelper helper = new IOSHelper(deviceDetailsList);
helper.initSimulators(collectedDevices);
helper.initIDevices(collectedDevices);
}
}
@Override
public List getDevices() {
return deviceDetailsList;
}
@Override
public List getDevices(Predicate deviceFilter) {
return deviceDetailsList.stream().filter(deviceFilter).collect(Collectors.toList());
}
@Override
public List getDevices(Predicate deviceFilter, Predicate deviceFilter1) {
return deviceDetailsList.stream().filter(deviceFilter).filter(deviceFilter1).collect(Collectors.toList());
}
@Override
public List getDevices(Predicate deviceFilter, Predicate deviceFilter2, Predicate deviceFilter3) {
return deviceDetailsList.stream().filter(deviceFilter).filter(deviceFilter2).filter(deviceFilter3).collect(Collectors.toList());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy