Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion java/src/org/openqa/selenium/grid/data/NodeStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static NodeStatus fromJson(JsonInput input) {
Set<Slot> slots = null;
Availability availability = null;
Duration heartbeatPeriod = null;
Duration sessionTimeout = null;
Duration sessionTimeout = Duration.ofSeconds(300);
String version = null;
Map<String, String> osInfo = null;

Expand Down
75 changes: 75 additions & 0 deletions java/test/org/openqa/selenium/grid/data/NodeStatusTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,79 @@ void ensureRoundTripWorks() throws URISyntaxException {

assertThat(seen).isEqualTo(status);
}

@Test
void withoutSessionTimeoutInJsonStatus() throws URISyntaxException {
String source =
"{\n"
+ " \"availability\": \"UP\",\n"
+ " \"externalUri\": \"http:\\u002f\\u002f192.168.1.101:5555\",\n"
+ " \"heartbeatPeriod\": 60000,\n"
+ " \"maxSessions\": 1,\n"
+ " \"nodeId\": \"d136dd9b-6497-4049-9371-42f89b14ea2b\",\n"
+ " \"osInfo\": {\n"
+ " \"arch\": \"aarch64\",\n"
+ " \"name\": \"Mac OS X\",\n"
+ " \"version\": \"15.3\"\n"
+ " },\n"
+ " \"slots\": [\n"
+ " {\n"
+ " \"id\": {\n"
+ " \"hostId\": \"d136dd9b-6497-4049-9371-42f89b14ea2b\",\n"
+ " \"id\": \"965e8cb4-7b48-4638-8bc8-6889c6319682\"\n"
+ " },\n"
+ " \"lastStarted\": \"1970-01-01T00:00:00Z\",\n"
+ " \"session\": null,\n"
+ " \"stereotype\": {\n"
+ " \"browserName\": \"chrome\",\n"
+ " \"platformName\": \"mac\"\n"
+ " }\n"
+ " }\n"
+ " ],\n"
+ " \"version\": \"4.17.0 (revision unknown*)\"\n"
+ " }";

Json json = new Json();
NodeStatus nodeStatus = json.toType(source, NodeStatus.class);

assertThat(nodeStatus.getSessionTimeout()).isEqualTo(Duration.ofSeconds(300));
}

@Test
void withSessionTimeoutInJsonStatus() throws URISyntaxException {
String source =
"{\n"
+ " \"availability\": \"UP\",\n"
+ " \"externalUri\": \"http:\\u002f\\u002f192.168.1.101:5555\",\n"
+ " \"heartbeatPeriod\": 60000,\n"
+ " \"maxSessions\": 1,\n"
+ " \"sessionTimeout\": 600000,\n"
+ " \"nodeId\": \"d136dd9b-6497-4049-9371-42f89b14ea2b\",\n"
+ " \"osInfo\": {\n"
+ " \"arch\": \"aarch64\",\n"
+ " \"name\": \"Mac OS X\",\n"
+ " \"version\": \"15.3\"\n"
+ " },\n"
+ " \"slots\": [\n"
+ " {\n"
+ " \"id\": {\n"
+ " \"hostId\": \"d136dd9b-6497-4049-9371-42f89b14ea2b\",\n"
+ " \"id\": \"965e8cb4-7b48-4638-8bc8-6889c6319682\"\n"
+ " },\n"
+ " \"lastStarted\": \"1970-01-01T00:00:00Z\",\n"
+ " \"session\": null,\n"
+ " \"stereotype\": {\n"
+ " \"browserName\": \"chrome\",\n"
+ " \"platformName\": \"mac\"\n"
+ " }\n"
+ " }\n"
+ " ],\n"
+ " \"version\": \"4.17.0 (revision unknown*)\"\n"
+ " }";

Json json = new Json();
NodeStatus nodeStatus = json.toType(source, NodeStatus.class);

assertThat(nodeStatus.getSessionTimeout()).isEqualTo(Duration.ofSeconds(600));
}
}
Loading