Skip to content

Commit

Permalink
[grid] More migration away from gson
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Feb 21, 2018
1 parent bf33015 commit f1a97a4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
5 changes: 4 additions & 1 deletion java/server/src/org/openqa/grid/internal/RemoteProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,13 @@ default TestSlot createTestSlot(SeleniumProtocol protocol, Map<String, Object> c
* Renders the status of the node as JSON. Useful for APIs.
*
* @return the node status.
*
* @deprecated Use {@link #getProxyStatus()}.
*/
@Deprecated
JsonObject getStatus() ;

Map<String, Object> getProxyStatus();

/**
* Checks if the node has the capability requested.
* <br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public HtmlRenderer getHtmlRender() {
@ManagedAttribute
public boolean isAlive() {
try {
getStatus();
getProxyStatus();
return true;
} catch (Exception e) {
LOG.fine("Failed to check status of node: " + e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

package org.openqa.grid.web.servlet.console;

import com.google.gson.JsonObject;

import org.openqa.grid.common.SeleniumProtocol;
import org.openqa.grid.common.exception.GridException;
import org.openqa.grid.internal.RemoteProxy;
Expand All @@ -28,6 +26,8 @@
import org.openqa.selenium.Platform;
import org.openqa.selenium.remote.CapabilityType;

import java.util.Map;

public class DefaultProxyHtmlRenderer implements HtmlRenderer {

private RemoteProxy proxy;
Expand Down Expand Up @@ -73,13 +73,13 @@ public String renderSummary() {

private String getHtmlNodeVersion() {
try {
JsonObject object = proxy.getStatus();
String version = object.get("value").getAsJsonObject()
.get("build").getAsJsonObject()
.get("version").getAsString();
return " (version : "+version+ ")";
}catch (Exception e) {
return " unknown version,"+e.getMessage();
Map<String, Object> object = proxy.getProxyStatus();
Map<?, ?> value = (Map<?, ?>) object.get("value");
Map<?, ?> build = (Map<?, ?>) value.get("build");
String version = (String) build.get("version");
return " (version : " + version + ")";
} catch (Exception e) {
return " unknown version," + e.getMessage();
}
}

Expand Down

0 comments on commit f1a97a4

Please sign in to comment.