@Test(expected = SelendroidException.class) public void shouldThrowExceptionWhenRegisterAtGridFails() throws Exception { givenSupportedDevices(); givenRegistrationUrl(); givenResponseWithStatusCode(HTTP_STATUS_CODE_FORBIDDEN); givenHttpClient(); givenSelfRegisteringRemote(); remote.performRegistration(); }
public void performRegistration() throws Exception { String nodeConfigString = getNodeConfig().toString(); log.info("Registering Selendroid node with following config:\n" + nodeConfigString + "\n" + "at Selenium Grid hub: " + hub.toExternalForm()); BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", hub.toExternalForm()); request.setEntity(new StringEntity(nodeConfigString)); HttpResponse response = getHttpClient().execute(getHttpHost(), request); if (response.getStatusLine().getStatusCode() != 200) { throw new SelendroidException("Error sending the registration request. Response from server: " + response.getStatusLine().toString()); } }
SelfRegisteringRemote { public void performRegistration() throws Exception { String nodeConfigString = getNodeConfig().toString(); log.info("Registering Selendroid node with following config:\n" + nodeConfigString + "\n" + "at Selenium Grid hub: " + hub.toExternalForm()); BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", hub.toExternalForm()); request.setEntity(new StringEntity(nodeConfigString)); HttpResponse response = getHttpClient().execute(getHttpHost(), request); if (response.getStatusLine().getStatusCode() != 200) { throw new SelendroidException("Error sending the registration request. Response from server: " + response.getStatusLine().toString()); } } }
SelfRegisteringRemote { public void performRegistration() throws Exception { String nodeConfigString = getNodeConfig().toString(); log.info("Registering Selendroid node with following config:\n" + nodeConfigString + "\n" + "at Selenium Grid hub: " + hub.toExternalForm()); BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", hub.toExternalForm()); request.setEntity(new StringEntity(nodeConfigString)); HttpResponse response = getHttpClient().execute(getHttpHost(), request); if (response.getStatusLine().getStatusCode() != 200) { throw new SelendroidException("Error sending the registration request. Response from server: " + response.getStatusLine().toString()); } } SelfRegisteringRemote(SelendroidConfiguration config, SelendroidStandaloneDriver driver); }
SelfRegisteringRemote { public void performRegistration() throws Exception { String nodeConfigString = getNodeConfig().toString(); log.info("Registering Selendroid node with following config:\n" + nodeConfigString + "\n" + "at Selenium Grid hub: " + hub.toExternalForm()); BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", hub.toExternalForm()); request.setEntity(new StringEntity(nodeConfigString)); HttpResponse response = getHttpClient().execute(getHttpHost(), request); if (response.getStatusLine().getStatusCode() != 200) { throw new SelendroidException("Error sending the registration request. Response from server: " + response.getStatusLine().toString()); } } SelfRegisteringRemote(SelendroidConfiguration config, SelendroidStandaloneDriver driver); void performRegistrationIfNotRegistered(); void performRegistration(); }
SelfRegisteringRemote { public void performRegistration() throws Exception { String nodeConfigString = getNodeConfig().toString(); log.info("Registering Selendroid node with following config:\n" + nodeConfigString + "\n" + "at Selenium Grid hub: " + hub.toExternalForm()); BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", hub.toExternalForm()); request.setEntity(new StringEntity(nodeConfigString)); HttpResponse response = getHttpClient().execute(getHttpHost(), request); if (response.getStatusLine().getStatusCode() != 200) { throw new SelendroidException("Error sending the registration request. Response from server: " + response.getStatusLine().toString()); } } SelfRegisteringRemote(SelendroidConfiguration config, SelendroidStandaloneDriver driver); void performRegistrationIfNotRegistered(); void performRegistration(); static final String ANDROIDDRIVER_APP; }