本文整理汇总了Java中com.musala.atmosphere.commons.cs.deviceselection.DeviceSelectorBuilder类的典型用法代码示例。如果您正苦于以下问题:Java DeviceSelectorBuilder类的具体用法?Java DeviceSelectorBuilder怎么用?Java DeviceSelectorBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DeviceSelectorBuilder类属于com.musala.atmosphere.commons.cs.deviceselection包,在下文中一共展示了DeviceSelectorBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPresentDeviceFirstTestTwo
import com.musala.atmosphere.commons.cs.deviceselection.DeviceSelectorBuilder; //导入依赖的package包/类
@Test
public void getPresentDeviceFirstTestTwo() throws Exception {
DeviceSelectorBuilder selectorBuilder = new DeviceSelectorBuilder().deviceType(DeviceType.EMULATOR_PREFERRED)
.screenHeight(600)
.screenWidth(800);
DeviceSelector deviceSelector = selectorBuilder.build();
when(devicePoolDao.getDevices(eq(deviceSelector), eq(false))).thenReturn(deviceList);
DeviceAllocationInformation deviceDescriptor = poolManager.allocateDevice(deviceSelector);
String deviceId = deviceDescriptor.getDeviceId();
doNothing().when(devicePoolDao).update(firstDevice);
when(devicePoolDao.getDevice(eq(deviceId))).thenReturn(firstDevice);
poolManager.releaseDevice(deviceId);
assertCorrectDeviceFetched(FIRST_DEVICE_SERIAL_NUMBER, deviceDescriptor);
}
示例2: largeNumberOfUnservedClientsTest
import com.musala.atmosphere.commons.cs.deviceselection.DeviceSelectorBuilder; //导入依赖的package包/类
@Test
public void largeNumberOfUnservedClientsTest() throws InterruptedException {
final int clientsCount = 100;
final int expectedServedClientsCount = 1;
int expectedUnservedClientsCount = clientsCount - expectedServedClientsCount;
poolManager.addDevice(generateDeviceInformation("d1", DEVICE_MODELS[0], 25), AGENT_ID);
DeviceSelector deviceSelector = new DeviceSelectorBuilder().targetApi(25)
.deviceType(DeviceType.DEVICE_PREFERRED)
.build();
generateConcurrentClients(deviceSelector, clientsCount, 250);
await().atMost(WAIT_FOR_OTHER_CLIENTS_TIMEOUT, TimeUnit.MILLISECONDS)
.until(() -> waitingClients.size() == 0 && servedClientsList.size() == expectedServedClientsCount
&& unservedClientsList.size() == expectedUnservedClientsCount);
Assert.assertEquals(0, waitingClients.size());
Assert.assertEquals(UNEXPECTED_SERVED_NUMBER_MESSAGE, expectedServedClientsCount, servedClientsList.size());
Assert.assertEquals(UNEXPECTED_UNSERVED_NUMBER_MESSAGE, expectedUnservedClientsCount, unservedClientsList.size());
}
示例3: getPresentDeviceFourth
import com.musala.atmosphere.commons.cs.deviceselection.DeviceSelectorBuilder; //导入依赖的package包/类
@Test
public void getPresentDeviceFourth() throws Exception {
DeviceSelectorBuilder selectorBuilder = new DeviceSelectorBuilder().deviceType(DeviceType.EMULATOR_ONLY)
.screenDpi(180);
DeviceSelector deviceSelector = selectorBuilder.build();
List<IDevice> deviceList = Arrays.asList(fourthDevice);
when(devicePoolDao.getDevices(eq(deviceSelector), eq(false))).thenReturn(deviceList);
DeviceAllocationInformation deviceDescriptor = poolManager.allocateDevice(deviceSelector);
String deviceId = deviceDescriptor.getDeviceId();
doNothing().when(devicePoolDao).update(fourthDevice);
when(devicePoolDao.getDevice(eq(deviceId))).thenReturn(fourthDevice);
poolManager.releaseDevice(deviceId);
assertCorrectDeviceFetched(FOURTH_DEVICE_SERIAL_NUMBER, deviceDescriptor);
}
示例4: setUp
import com.musala.atmosphere.commons.cs.deviceselection.DeviceSelectorBuilder; //导入依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
Class<?> agentClass = agent.getClass();
Field agentManagerField = agentClass.getDeclaredField("agentManager");
agentManagerField.setAccessible(true);
AgentManager agentManager = (AgentManager) agentManagerField.get(agent);
if (!agentManager.isAnyEmulatorPresent()) {
EmulatorParameters emulatorCreationParameters = new EmulatorParameters();
emulatorCreationParameters.setDpi(EMULATOR_CREATION_DPI);
emulatorCreationParameters.setRam(EMULATOR_CREATION_RAM);
emulatorCreationParameters.setResolution(new Pair<Integer, Integer>(EMULATOR_CREATION_RESOLUTION_H,
EMULATOR_CREATION_RESOLUTION_W));
}
DeviceSelectorBuilder selectorBuilder = new DeviceSelectorBuilder().deviceType(DeviceType.EMULATOR_ONLY);
DeviceSelector testDeviceSelector = selectorBuilder.build();
initTestDevice(testDeviceSelector);
}
示例5: getPresentDeviceThird
import com.musala.atmosphere.commons.cs.deviceselection.DeviceSelectorBuilder; //导入依赖的package包/类
@Test
public void getPresentDeviceThird() throws Exception {
DeviceSelectorBuilder selectorBuilder = new DeviceSelectorBuilder().ramCapacity(512)
.deviceType(DeviceType.DEVICE_ONLY);
DeviceSelector deviceSelector = selectorBuilder.build();
List<IDevice> deviceList = Arrays.asList(thirdDevice);
when(devicePoolDao.getDevices(eq(deviceSelector), eq(false))).thenReturn(deviceList);
DeviceAllocationInformation deviceDescriptor = poolManager.allocateDevice(deviceSelector);
String deviceId = deviceDescriptor.getDeviceId();
doNothing().when(devicePoolDao).update(thirdDevice);
when(devicePoolDao.getDevice(eq(deviceId))).thenReturn(thirdDevice);
poolManager.releaseDevice(deviceId);
assertCorrectDeviceFetched(THIRD_DEVICE_SERIAL_NUMBER, deviceDescriptor);
}
示例6: testFilterDevicesThatAreNotAllocatedByParametersWhenNoFreeEmulatorIsAvailable
import com.musala.atmosphere.commons.cs.deviceselection.DeviceSelectorBuilder; //导入依赖的package包/类
@Test
public void testFilterDevicesThatAreNotAllocatedByParametersWhenNoFreeEmulatorIsAvailable() throws Exception {
DeviceSelectorBuilder deviceSelectorBuilder = new DeviceSelectorBuilder().deviceType(DeviceType.EMULATOR_PREFERRED)
.targetApi(TEST_DEVICE_API_LEVELS[2])
.ramCapacity(TEST_DEVICE_RAM_VALUES[2]);
DeviceSelector deviceSelector = deviceSelectorBuilder.build();
allocateDevices(TEST_DEVICE_SERIAL_NUMBERS[2]);
boolean isAllocated = false;
List<IDevice> receivedDevices = deviceDao.filterDevices(deviceSelector, isAllocated);
assertFalse(EMPTY_RESULT_LIST_MISMATCH_ERROR_MESSAGE, receivedDevices.isEmpty());
DeviceInformation resultDeviceInformation = receivedDevices.get(0).getInformation();
assertFalse(DEVICE_MISMATCH_ERROR_MESSAGE, resultDeviceInformation.isEmulator());
releaseDevices(TEST_DEVICE_SERIAL_NUMBERS[2]);
}
示例7: getPresentDeviceSecond
import com.musala.atmosphere.commons.cs.deviceselection.DeviceSelectorBuilder; //导入依赖的package包/类
@Test
public void getPresentDeviceSecond() throws Exception {
DeviceSelectorBuilder selectorBuilder = new DeviceSelectorBuilder().screenDpi(240);
DeviceSelector deviceSelector = selectorBuilder.build();
List<IDevice> deviceList = Arrays.asList(secondDevice);
when(devicePoolDao.getDevices(eq(deviceSelector), eq(false))).thenReturn(deviceList);
DeviceAllocationInformation deviceDescriptor = poolManager.allocateDevice(deviceSelector);
String deviceId = deviceDescriptor.getDeviceId();
doNothing().when(devicePoolDao).update(secondDevice);
when(devicePoolDao.getDevice(eq(deviceId))).thenReturn(secondDevice);
poolManager.releaseDevice(deviceId);
assertCorrectDeviceFetched(SECOND_DEVICE_SERIAL_NUMBER, deviceDescriptor);
}
示例8: testGetDeviceByGivenRangeAndTargetForApiVersion
import com.musala.atmosphere.commons.cs.deviceselection.DeviceSelectorBuilder; //导入依赖的package包/类
@Test
public void testGetDeviceByGivenRangeAndTargetForApiVersion() {
int maxApiVersion = 20;
int minApiVersion = 5;
int targetApiVersion = 10;
DeviceSelectorBuilder selectorBuilder = new DeviceSelectorBuilder().minApi(minApiVersion)
.maxApi(maxApiVersion)
.targetApi(targetApiVersion);
DeviceSelector deviceSelector = selectorBuilder.build();
Device receivedDevice = builder.getDevice(deviceSelector);
DeviceInformation receivedDeviceInformation = receivedDevice.getInformation();
assertEquals("Received device has different API level than the set target API level.",
receivedDeviceInformation.getApiLevel(),
targetApiVersion);
}
开发者ID:MusalaSoft,项目名称:atmosphere-integration-tests,代码行数:19,代码来源:BuilderDeviceSelectionIntegrationTest.java
示例9: testHasDeviceByIdAndDeviceParameters
import com.musala.atmosphere.commons.cs.deviceselection.DeviceSelectorBuilder; //导入依赖的package包/类
@Test
public void testHasDeviceByIdAndDeviceParameters() throws Exception {
DeviceInformation deviceInformation = new DeviceInformation();
deviceInformation.setApiLevel(TEST_API_LEVEL);
deviceInformation.setRam(testRam[0]);
testDevicePoolDao.addDevice(deviceInformation, testDeviceIds[0], testAgentIds[0], testPasskeys[0]);
DeviceSelectorBuilder selectorBuilder = new DeviceSelectorBuilder();
DeviceSelector deviceSelector = selectorBuilder.ramCapacity(testRam[0]).targetApi(TEST_API_LEVEL).build();
DeviceSelector nonExistentDeviceSelector = selectorBuilder.targetApi(NON_EXISTENT_API_LEVEL).build();
assertTrue("The device searched by it's ID is not found when present. ",
testDevicePoolDao.hasDevice(testDeviceIds[0]));
assertTrue("The device searched by device selector is not found when present",
testDevicePoolDao.hasDevice(deviceSelector, false));
assertFalse("A device was found when given non existing ID.", testDevicePoolDao.hasDevice(NON_EXISTING_RMI_ID));
assertFalse("A device was found when given nonexistent DeviceParameters. ",
testDevicePoolDao.hasDevice(nonExistentDeviceSelector, false));
}
示例10: setUp
import com.musala.atmosphere.commons.cs.deviceselection.DeviceSelectorBuilder; //导入依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
DeviceSelectorBuilder selectorBuilder = new DeviceSelectorBuilder().deviceType(DeviceType.DEVICE_PREFERRED);
DeviceSelector testDeviceSelector = selectorBuilder.build();
initTestDevice(testDeviceSelector);
setTestDevice(testDevice);
startLogCatActivity();
Screen screen = testDevice.getActiveScreen();
UiElementSelector logsButtonSelector = new UiElementSelector();
logsButtonSelector.addSelectionAttribute(CssAttribute.CONTENT_DESCRIPTION, LOG_CAT_BUTTON_CONTENT_DECRIPTOR);
screen.waitForElementExists(logsButtonSelector, WAIT_FOR_ELEMENT_TIMEOUT);
generateLogsButton = screen.getElement(logsButtonSelector);
}
示例11: testFilterDevicesThatAreNotAllocatedWhenNoFreeDeviceIsAvailable
import com.musala.atmosphere.commons.cs.deviceselection.DeviceSelectorBuilder; //导入依赖的package包/类
@Test
public void testFilterDevicesThatAreNotAllocatedWhenNoFreeDeviceIsAvailable() throws Exception {
DeviceSelectorBuilder deviceSelectorBuilder = new DeviceSelectorBuilder().deviceType(DeviceType.DEVICE_PREFERRED)
.isCameraAvailable(TEST_DEVICE_CAMERA_AVAILABILITY[0])
.targetApi(TEST_DEVICE_API_LEVELS[0])
.ramCapacity(TEST_DEVICE_RAM_VALUES[0]);
DeviceSelector deviceSelector = deviceSelectorBuilder.build();
allocateDevices(TEST_DEVICE_SERIAL_NUMBERS[0]);
boolean isAllocated = false;
List<IDevice> receivedDevices = deviceDao.filterDevices(deviceSelector, isAllocated);
assertFalse(EMPTY_RESULT_LIST_MISMATCH_ERROR_MESSAGE, receivedDevices.isEmpty());
DeviceInformation resultDeviceInformation = receivedDevices.get(0).getInformation();
assertTrue(EMULATOR_MISMATCH_ERROR_MESSAGE, resultDeviceInformation.isEmulator());
releaseDevices(TEST_DEVICE_SERIAL_NUMBERS[0]);
}
示例12: allClientsShouldBeServedTest
import com.musala.atmosphere.commons.cs.deviceselection.DeviceSelectorBuilder; //导入依赖的package包/类
@Test
public void allClientsShouldBeServedTest() {
final int expectedServedClientsCount = 10;
for (int i = 0; i < expectedServedClientsCount; i++) {
poolManager.addDevice(generateDeviceInformation("d" + i, DEVICE_MODELS[0], 25), AGENT_ID);
}
DeviceSelector deviceSelector = new DeviceSelectorBuilder().targetApi(25)
.deviceType(DeviceType.DEVICE_PREFERRED)
.build();
generateConcurrentClients(deviceSelector, expectedServedClientsCount, 500);
await().atMost(WAIT_FOR_OTHER_CLIENTS_TIMEOUT, TimeUnit.MILLISECONDS)
.until(() -> waitingClients.size() == 0 && servedClientsList.size() == expectedServedClientsCount);
Assert.assertEquals(0, waitingClients.size());
Assert.assertEquals(expectedServedClientsCount, servedClientsList.size());
}
示例13: testFilterDevicesWithGivenMinimumAndTargetApi
import com.musala.atmosphere.commons.cs.deviceselection.DeviceSelectorBuilder; //导入依赖的package包/类
@Test
public void testFilterDevicesWithGivenMinimumAndTargetApi() throws Exception {
DeviceSelectorBuilder deviceSelectorBuilder = new DeviceSelectorBuilder().targetApi(NONEXISTENT_DEVICE_TARGET_API_LEVELS[1])
.minApi(18);
DeviceSelector deviceSelector = deviceSelectorBuilder.build();
int expectedDevicesSelected = 2;
List<IDevice> receivedDevices = deviceDao.filterDevices(deviceSelector, false);
assertEquals(DEVICES_LIST_MISMATCH_ERROR_MESSAGE, expectedDevicesSelected, receivedDevices.size());
deviceSelectorBuilder.minApi(14).maxApi(17).targetApi(TEST_DEVICE_API_LEVELS[0]);
deviceSelector = deviceSelectorBuilder.build();
List<IDevice> receivedDevicesChangedTargetApiLevel = deviceDao.filterDevices(deviceSelector, false);
assertEquals(DEVICES_LIST_MISMATCH_ERROR_MESSAGE,
expectedDevicesSelected,
receivedDevicesChangedTargetApiLevel.size());
}
示例14: testHasDevicesByDeviceParameters
import com.musala.atmosphere.commons.cs.deviceselection.DeviceSelectorBuilder; //导入依赖的package包/类
@Test
public void testHasDevicesByDeviceParameters() throws Exception {
Device attachedDevice = new Device(TEST_DEVICE_SERIAL_NUMBER, TEST_DEVICE_RMI_ID);
attachedDevice.setAgent(mockedAgent);
DeviceSelectorBuilder deviceSelectorBuilder = new DeviceSelectorBuilder().serialNumber(TEST_DEVICE_SERIAL_NUMBER);
DeviceSelector deviceSelector = deviceSelectorBuilder.build();
List<IDevice> expectedResultList = new ArrayList<IDevice>();
expectedResultList.add(attachedDevice);
boolean isAllocated = false;
when(mockedDeviceDao.filterDevices(eq(deviceSelector), any(Boolean.class))).thenReturn(expectedResultList);
boolean isDeviceFound = testDevicePoolDao.hasDevice(deviceSelector, isAllocated);
assertTrue("Finding device for the requested parameters failed.", isDeviceFound);
}
示例15: testGetDevicesWhenNoDevicesAreFound
import com.musala.atmosphere.commons.cs.deviceselection.DeviceSelectorBuilder; //导入依赖的package包/类
@Test
public void testGetDevicesWhenNoDevicesAreFound() throws Exception {
DeviceInformation deviceInformation = new DeviceInformation();
deviceInformation.setApiLevel(TEST_API_LEVEL);
deviceInformation.setRam(testRam[0]);
testDevicePoolDao.addDevice(deviceInformation, testDeviceIds[0], testAgentIds[0], testPasskeys[0]);
testDevicePoolDao.addDevice(deviceInformation, testDeviceIds[1], testAgentIds[1], testPasskeys[0]);
DeviceSelectorBuilder selectorBuilder = new DeviceSelectorBuilder().ramCapacity(NON_EXISTING_RAM)
.targetApi(TEST_API_LEVEL);
DeviceSelector deviceSelector = selectorBuilder.build();
List<IDevice> devices = testDevicePoolDao.getDevices(deviceSelector, false);
assertTrue("Expected empty result list, but instead received list containig devices when there should be none.",
devices.isEmpty());
}