Skip to content

Commit

Permalink
Wrap all the commands with a w3c handler to format exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
shs96c committed Oct 16, 2018
1 parent 7a03253 commit 27c5cc0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.openqa.selenium.grid.server.BaseServerOptions;
import org.openqa.selenium.grid.server.HelpFlags;
import org.openqa.selenium.grid.server.Server;
import org.openqa.selenium.grid.server.W3CCommandHandler;
import org.openqa.selenium.grid.sessionmap.SessionMap;
import org.openqa.selenium.grid.sessionmap.local.LocalSessionMap;
import org.openqa.selenium.net.NetworkUtils;
Expand Down Expand Up @@ -118,7 +119,7 @@ public Executable configure(String... args) {
distributor.add(node.build());

Server<?> server = new BaseServer<>(new BaseServerOptions(config));
server.addHandler(router, (inj, req) -> router);
server.addHandler(router, (inj, req) -> new W3CCommandHandler(router));
server.start();
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.openqa.selenium.grid.server.BaseServerOptions;
import org.openqa.selenium.grid.server.HelpFlags;
import org.openqa.selenium.grid.server.Server;
import org.openqa.selenium.grid.server.W3CCommandHandler;

@AutoService(CliCommand.class)
public class DistributorServer implements CliCommand {
Expand Down Expand Up @@ -85,7 +86,7 @@ public Executable configure(String... args) {
BaseServerOptions serverOptions = new BaseServerOptions(config);

Server<?> server = new BaseServer<>(serverOptions);
server.addHandler(distributor, (inj, req) -> distributor);
server.addHandler(distributor, (inj, req) -> new W3CCommandHandler(distributor));
server.start();
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.openqa.selenium.grid.server.BaseServerOptions;
import org.openqa.selenium.grid.server.HelpFlags;
import org.openqa.selenium.grid.server.Server;
import org.openqa.selenium.grid.server.W3CCommandHandler;
import org.openqa.selenium.grid.sessionmap.SessionMap;
import org.openqa.selenium.grid.sessionmap.SessionMapOptions;
import org.openqa.selenium.grid.sessionmap.remote.RemoteSessionMap;
Expand Down Expand Up @@ -109,11 +110,10 @@ public Executable configure(String... args) {
HttpClient.Factory.createDefault().createClient(distributorUrl));

Server<?> server = new BaseServer<>(serverOptions);
server.addHandler(node, (inj, req) -> node);
server.addHandler(node, (inj, req) -> new W3CCommandHandler(node));
server.start();

distributor.add(node);
System.out.println("Added node");
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.openqa.selenium.grid.server.BaseServerOptions;
import org.openqa.selenium.grid.server.HelpFlags;
import org.openqa.selenium.grid.server.Server;
import org.openqa.selenium.grid.server.W3CCommandHandler;
import org.openqa.selenium.grid.sessionmap.SessionMap;
import org.openqa.selenium.grid.sessionmap.SessionMapOptions;
import org.openqa.selenium.grid.sessionmap.remote.RemoteSessionMap;
Expand Down Expand Up @@ -108,7 +109,7 @@ public Executable configure(String... args) {
Router router = new Router(sessions, distributor);

Server<?> server = new BaseServer<>(serverOptions);
server.addHandler(router, (inj, req) -> router);
server.addHandler(router, (inj, req) -> new W3CCommandHandler(router));
server.start();
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.openqa.selenium.grid.server.BaseServerOptions;
import org.openqa.selenium.grid.server.HelpFlags;
import org.openqa.selenium.grid.server.Server;
import org.openqa.selenium.grid.server.W3CCommandHandler;
import org.openqa.selenium.grid.sessionmap.SessionMap;
import org.openqa.selenium.grid.sessionmap.local.LocalSessionMap;

Expand Down Expand Up @@ -85,7 +86,7 @@ public Executable configure(String... args) {
BaseServerOptions serverOptions = new BaseServerOptions(config);

Server<?> server = new BaseServer<>(serverOptions);
server.addHandler(sessions, (inj, req) -> sessions);
server.addHandler(sessions, (inj, req) -> new W3CCommandHandler(sessions));
server.start();
};
}
Expand Down

0 comments on commit 27c5cc0

Please sign in to comment.