use of org.openqa.selenium.remote.server.jmx.JMXHelper in project zalenium by zalando.
the class SauceLabsRemoteProxyTest method setUp.
@Before
public void setUp() {
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.
}
registry = ZaleniumRegistry.newInstance(new Hub(new GridHubConfiguration()));
// Creating the configuration and the registration request of the proxy (node)
RegistrationRequest request = TestUtils.getRegistrationRequestForTesting(30001, SauceLabsRemoteProxy.class.getCanonicalName());
CommonProxyUtilities commonProxyUtilities = mock(CommonProxyUtilities.class);
when(commonProxyUtilities.readJSONFromUrl(anyString(), anyString(), anyString())).thenReturn(null);
SauceLabsRemoteProxy.setCommonProxyUtilities(commonProxyUtilities);
sauceLabsProxy = SauceLabsRemoteProxy.getNewInstance(request, registry);
// we need to register a DockerSeleniumStarter proxy to have a proper functioning SauceLabsProxy
request = TestUtils.getRegistrationRequestForTesting(30000, DockerSeleniumStarterRemoteProxy.class.getCanonicalName());
DockerSeleniumStarterRemoteProxy dsStarterProxy = DockerSeleniumStarterRemoteProxy.getNewInstance(request, registry);
// We add both nodes to the registry
registry.add(sauceLabsProxy);
registry.add(dsStarterProxy);
}
use of org.openqa.selenium.remote.server.jmx.JMXHelper in project zalenium by zalando.
the class SauceLabsRemoteProxyTest method tearDown.
@After
public void tearDown() throws MalformedObjectNameException {
ObjectName objectName = new ObjectName("org.seleniumhq.grid:type=RemoteProxy,node=\"https://ondemand.saucelabs.com:443\"");
new JMXHelper().unregister(objectName);
objectName = new ObjectName("org.seleniumhq.grid:type=RemoteProxy,node=\"http://localhost:30000\"");
new JMXHelper().unregister(objectName);
SauceLabsRemoteProxy.restoreCommonProxyUtilities();
SauceLabsRemoteProxy.restoreGa();
SauceLabsRemoteProxy.restoreEnvironment();
}
use of org.openqa.selenium.remote.server.jmx.JMXHelper in project zalenium by zalando.
the class TestingBotRemoteProxyTest method tearDown.
@After
public void tearDown() throws MalformedObjectNameException {
ObjectName objectName = new ObjectName("org.seleniumhq.grid:type=RemoteProxy,node=\"http://hub.testingbot.com:80\"");
new JMXHelper().unregister(objectName);
objectName = new ObjectName("org.seleniumhq.grid:type=RemoteProxy,node=\"http://localhost:30000\"");
new JMXHelper().unregister(objectName);
TestingBotRemoteProxy.restoreCommonProxyUtilities();
TestingBotRemoteProxy.restoreGa();
TestingBotRemoteProxy.restoreEnvironment();
}
use of org.openqa.selenium.remote.server.jmx.JMXHelper in project zalenium by zalando.
the class TestingBotRemoteProxyTest method setUp.
@SuppressWarnings("ConstantConditions")
@Before
public void setUp() throws IOException {
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.
}
registry = ZaleniumRegistry.newInstance(new Hub(new GridHubConfiguration()));
// Creating the configuration and the registration request of the proxy (node)
RegistrationRequest request = TestUtils.getRegistrationRequestForTesting(30002, TestingBotRemoteProxy.class.getCanonicalName());
JsonElement informationSample = TestUtils.getTestInformationSample("testingbot_testinformation.json");
String userInfoUrl = "https://api.testingbot.com/v1/user";
Environment env = new Environment();
CommonProxyUtilities commonProxyUtilities = mock(CommonProxyUtilities.class);
when(commonProxyUtilities.readJSONFromUrl(userInfoUrl, env.getStringEnvVariable("TESTINGBOT_KEY", ""), env.getStringEnvVariable("TESTINGBOT_SECRET", ""))).thenReturn(null);
String mockTestInfoUrl = "https://api.testingbot.com/v1/tests/2cf5d115-ca6f-4bc4-bc06-a4fca00836ce";
when(commonProxyUtilities.readJSONFromUrl(mockTestInfoUrl, env.getStringEnvVariable("TESTINGBOT_KEY", ""), env.getStringEnvVariable("TESTINGBOT_SECRET", ""))).thenReturn(informationSample);
TestingBotRemoteProxy.setCommonProxyUtilities(commonProxyUtilities);
testingBotProxy = TestingBotRemoteProxy.getNewInstance(request, registry);
// we need to register a DockerSeleniumStarter proxy to have a proper functioning testingBotProxy
request = TestUtils.getRegistrationRequestForTesting(30000, DockerSeleniumStarterRemoteProxy.class.getCanonicalName());
DockerSeleniumStarterRemoteProxy dsStarterProxy = DockerSeleniumStarterRemoteProxy.getNewInstance(request, registry);
// Temporal folder for dashboard files
TestUtils.ensureRequiredInputFilesExist(temporaryFolder);
// We add both nodes to the registry
registry.add(testingBotProxy);
registry.add(dsStarterProxy);
}
use of org.openqa.selenium.remote.server.jmx.JMXHelper in project zalenium by zalando.
the class VncAuthenticationServletTest method tearDown.
@After
public void tearDown() throws MalformedObjectNameException {
ObjectName objectName = new ObjectName("org.seleniumhq.grid:type=RemoteProxy,node=\"http://localhost:40001\"");
new JMXHelper().unregister(objectName);
objectName = new ObjectName("org.seleniumhq.grid:type=RemoteProxy,node=\"http://localhost:40000\"");
new JMXHelper().unregister(objectName);
ContainerFactory.setContainerClientGenerator(originalContainerClient);
}
Aggregations