use of org.openqa.grid.internal.GridRegistry in project zalenium by zalando.
the class ZaleniumRegistryTest method proxyIsAdded.
@Test
public void proxyIsAdded() throws Exception {
GridRegistry registry = ZaleniumRegistry.newInstance(new Hub(new GridHubConfiguration()));
DockerSeleniumRemoteProxy p1 = TestUtils.getNewBasicRemoteProxy("app1", "http://machine1:4444/", registry);
DockerSeleniumRemoteProxy p2 = TestUtils.getNewBasicRemoteProxy("app1", "http://machine2:4444/", registry);
DockerSeleniumRemoteProxy p3 = TestUtils.getNewBasicRemoteProxy("app1", "http://machine3:4444/", registry);
DockerSeleniumRemoteProxy p4 = TestUtils.getNewBasicRemoteProxy("app1", "http://machine4:4444/", registry);
try {
registry.add(p1);
registry.add(p2);
registry.add(p3);
registry.add(p4);
assertTrue(registry.getAllProxies().size() == 4);
} finally {
registry.stop();
}
}
use of org.openqa.grid.internal.GridRegistry in project zalenium by zalando.
the class ZaleniumRegistryTest method sessionIsProcessed.
@Test
public void sessionIsProcessed() {
Map<String, Object> requestedCapability = new HashMap<>();
requestedCapability.put(CapabilityType.BROWSER_NAME, BrowserType.CHROME);
requestedCapability.put(CapabilityType.PLATFORM_NAME, Platform.LINUX);
GridRegistry registry = ZaleniumRegistry.newInstance(new Hub(new GridHubConfiguration()));
RegistrationRequest req = TestUtils.getRegistrationRequestForTesting(40000, DockerSeleniumRemoteProxy.class.getCanonicalName());
req.getConfiguration().capabilities.clear();
req.getConfiguration().capabilities.addAll(TestUtils.getDockerSeleniumCapabilitiesForTesting());
DockerSeleniumRemoteProxy p1 = new DockerSeleniumRemoteProxy(req, registry);
try {
registry.add(p1);
RequestHandler newSessionRequest = TestUtils.createNewSessionHandler(registry, requestedCapability);
newSessionRequest.process();
TestSession session = newSessionRequest.getSession();
session.setExternalKey(new ExternalSessionKey(UUID.randomUUID().toString()));
registry.terminate(session, SessionTerminationReason.CLIENT_STOPPED_SESSION);
Callable<Boolean> callable = () -> registry.getActiveSessions().size() == 0;
await().pollInterval(Duration.FIVE_HUNDRED_MILLISECONDS).atMost(Duration.TWO_SECONDS).until(callable);
} finally {
registry.stop();
}
}
use of org.openqa.grid.internal.GridRegistry in project zalenium by zalando.
the class CloudTestingRemoteProxyTest method defaultValuesAreAlwaysNull.
@Test
public void defaultValuesAreAlwaysNull() {
try {
ObjectName objectName = new ObjectName("org.seleniumhq.grid:type=Hub");
ManagementFactory.getPlatformMBeanServer().getObjectInstance(objectName);
new JMXHelper().unregister(objectName);
} catch (MalformedObjectNameException | InstanceNotFoundException e) {
// Might be that the object does not exist, it is ok. Nothing to do, this is just a cleanup task.
}
GridRegistry registry = ZaleniumRegistry.newInstance(new Hub(new GridHubConfiguration()));
RegistrationRequest request = TestUtils.getRegistrationRequestForTesting(30003, CloudTestingRemoteProxy.class.getCanonicalName());
CloudTestingRemoteProxy proxy = CloudTestingRemoteProxy.getNewInstance(request, registry);
Assert.assertNull(proxy.getAccessKeyProperty());
Assert.assertNull(proxy.getAccessKeyValue());
Assert.assertNotNull(proxy.getCloudTestingServiceUrl());
Assert.assertNull(proxy.getUserNameProperty());
Assert.assertNull(proxy.getUserNameValue());
Assert.assertNotNull(proxy.getRemoteHost());
Assert.assertNull(proxy.getVideoFileExtension());
Assert.assertNull(proxy.getProxyName());
Assert.assertNull(proxy.getProxyClassName());
Assert.assertNull(proxy.getTestInformation("seleniumSessionId"));
}
use of org.openqa.grid.internal.GridRegistry in project zalenium by zalando.
the class ZaleniumRegistryTest method proxyIsRemoved.
@Test
public void proxyIsRemoved() throws Exception {
GridRegistry registry = ZaleniumRegistry.newInstance(new Hub(new GridHubConfiguration()));
DockerSeleniumRemoteProxy p1 = TestUtils.getNewBasicRemoteProxy("app1", "http://machine1:4444/", registry);
try {
registry.add(p1);
assertTrue(registry.getAllProxies().size() == 1);
registry.removeIfPresent(p1);
assertTrue(registry.getAllProxies().size() == 0);
} finally {
registry.stop();
}
}
Aggregations