Skip to content

Commit

Permalink
Fixing the build
Browse files Browse the repository at this point in the history
  • Loading branch information
diemol committed Apr 18, 2019
1 parent add55b4 commit 2213301
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions java/client/src/org/openqa/selenium/remote/HttpSessionId.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ private HttpSessionId() {
// Utility class
}

/**
* Scan {@code uri} for a session ID. This is identified by scanning for "{code /session/}" and
* then extracting the next fragment of the URL. This means that both "{@code /session/foo}" and
* "{@code /wd/hub/session/foo/bar}" would both identify the session id as being "foo".
*/
public static Optional<String> getSessionId(String uri) {
int sessionIndex = uri.indexOf("/session/");
if (sessionIndex != -1) {
Expand Down
8 changes: 5 additions & 3 deletions java/server/src/org/openqa/selenium/grid/node/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ protected Node(DistributedTracer tracer, UUID id, URI uri) {

Json json = new Json();
routes = combine(
// "getSessionId" is aggressive about finding session ids, so this needs to be the last
// route the is checked.
matching(req -> getSessionId(req.getUri()).map(SessionId::new).map(this::isSessionOwner).orElse(false))
.using(() -> new ForwardWebDriverCommand(this)),
get("/se/grid/node/owner/{sessionId}")
.using((params) -> new IsSessionOwner(this, json, new SessionId(params.get("sessionId")))),
delete("/se/grid/node/session/{sessionId}")
Expand All @@ -118,9 +122,7 @@ protected Node(DistributedTracer tracer, UUID id, URI uri) {
post("/se/grid/node/session").using(() -> new NewNodeSession(this, json)),
get("/se/grid/node/status")
.using((req, res) -> res.setContent(json.toJson(getStatus()).getBytes(UTF_8))),
get("/status").using(() -> new StatusHandler(this, json)),
matching(req -> getSessionId(req.getUri()).map(SessionId::new).map(this::isSessionOwner).orElse(false))
.using(() -> new ForwardWebDriverCommand(this))
get("/status").using(() -> new StatusHandler(this, json))
).build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public void eachSessionShouldReportTheNodesUrl() throws URISyntaxException {
}

@Test
public void quitingASessionShouldCauseASessionClosedEventToBeFired() {
public void quittingASessionShouldCauseASessionClosedEventToBeFired() {
AtomicReference<Object> obj = new AtomicReference<>();
bus.addListener(SESSION_CLOSED, event -> obj.set(event.getData(Object.class)));

Expand Down

0 comments on commit 2213301

Please sign in to comment.