org.openqa.grid.common.exception.GridException Java Examples
The following examples show how to use
org.openqa.grid.common.exception.GridException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EnrollServlet.java From just-ask with Apache License 2.0 | 6 votes |
private StringEntity getJsonAsEntity(String host, int port) { try { InputStream isr = Thread.currentThread().getContextClassLoader().getResourceAsStream("ondemand.json"); String string = convert(isr, Charset.defaultCharset()); JsonObject ondemand = new JsonParser().parse(string).getAsJsonObject(); int maxSession =ConfigReader.getInstance().getMaxSession(); JsonArray capsArray = ondemand.get("capabilities").getAsJsonArray(); for (int i=0; i < capsArray.size(); i++) { capsArray.get(i).getAsJsonObject().addProperty("maxInstances", maxSession); } JsonObject configuration = ondemand.get("configuration").getAsJsonObject(); configuration.addProperty("maxSession", maxSession); configuration.addProperty("hub", String.format("http://%s:%d", host, port)); string = ondemand.toString(); return new StringEntity(string); } catch (IOException e) { throw new GridException(e.getMessage(), e); } }
Example #2
Source File: GhostProxy.java From just-ask with Apache License 2.0 | 5 votes |
private void startServerForTestSession(TestSession session) { try { SpawnedServer server = SpawnedServer.spawnInstance(session); String key = "http://" + server.getHost() + ":" + server.getPort(); URL url = new URL(key); servers.put(key, server); ((ProxiedTestSlot) session.getSlot()).setRemoteURL(url); if (LOG.isLoggable(Level.INFO)) { LOG.info(String.format("Forwarding session to: %s", session.getSlot().getRemoteURL())); LOG.info(String.format("Counter value after incrementing: %d", counter.incrementAndGet())); } } catch (Exception e) { throw new GridException(e.getMessage(), e); } }
Example #3
Source File: ProxiedTestSlot.java From just-ask with Apache License 2.0 | 5 votes |
@Override public URL getRemoteURL() { boolean isRemoteURLSet = remoteURL != null; String u = remoteURL + getPath(); try { return new URL(u); } catch (MalformedURLException e) { if (isRemoteURLSet) { throw new GridException("Configuration error for the node." + u + " isn't a valid URL"); } else { return super.getRemoteURL(); } } }
Example #4
Source File: ProxyStatusJsonServlet.java From selenium-grid2-api with Apache License 2.0 | 5 votes |
protected void process(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setContentType("text/json"); response.setCharacterEncoding("UTF-8"); response.setStatus(200); JSONObject res; try { res = getResponse(); response.getWriter().print(res.toString(4)); response.getWriter().close(); } catch (JSONException e) { throw new GridException(e.getMessage()); } }
Example #5
Source File: AllProxiesJsonServlet.java From selenium-grid2-api with Apache License 2.0 | 5 votes |
protected void process(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setContentType("text/json"); response.setCharacterEncoding("UTF-8"); response.setStatus(200); JSONObject res; try { res = getResponse(); response.getWriter().print(res.toString(4)); response.getWriter().close(); } catch (JSONException e) { throw new GridException(e.getMessage()); } }
Example #6
Source File: MockRemoteProxy.java From SeleniumGridScaler with GNU General Public License v2.0 | 4 votes |
@Override public JSONObject getStatus() throws GridException { return null; }