(
Tracer tracer, NodeId id, URI uri, Secret registrationSecret, Duration sessionTimeout)
| 135 | protected final AtomicBoolean registered = new AtomicBoolean(false); |
| 136 | |
| 137 | protected Node( |
| 138 | Tracer tracer, NodeId id, URI uri, Secret registrationSecret, Duration sessionTimeout) { |
| 139 | this.tracer = Require.nonNull("Tracer", tracer); |
| 140 | this.id = Require.nonNull("Node id", id); |
| 141 | this.uri = Require.nonNull("URI", uri); |
| 142 | this.sessionTimeout = Require.positive("Session timeout", sessionTimeout); |
| 143 | Require.nonNull("Registration secret", registrationSecret); |
| 144 | |
| 145 | RequiresSecretFilter requiresSecret = new RequiresSecretFilter(registrationSecret); |
| 146 | |
| 147 | Set<CustomLocator> customLocators = |
| 148 | StreamSupport.stream(ServiceLoader.load(CustomLocator.class).spliterator(), false) |
| 149 | .collect(Collectors.toSet()); |
| 150 | |
| 151 | if (!customLocators.isEmpty()) { |
| 152 | String names = |
| 153 | customLocators.stream() |
| 154 | .map(CustomLocator::getLocatorName) |
| 155 | .collect(Collectors.joining(", ")); |
| 156 | LOG.info("Binding additional locator mechanisms: " + names); |
| 157 | } |
| 158 | |
| 159 | Json json = new Json(); |
| 160 | routes = |
| 161 | combine( |
| 162 | // "getSessionId" is aggressive about finding session ids, so this needs to be the last |
| 163 | // route that is checked. |
| 164 | matching(req -> getSessionId(req.getUri()).map(SessionId::new).isPresent()) |
| 165 | .to(() -> new ForwardWebDriverCommand(this)) |
| 166 | .with(spanDecorator("node.forward_command")), |
| 167 | new CustomLocatorHandler(this, registrationSecret, customLocators), |
| 168 | post("/session/{sessionId}/se/file") |
| 169 | .to(params -> new UploadFile(this, sessionIdFrom(params))) |
| 170 | .with(spanDecorator("node.upload_file")), |
| 171 | get("/session/{sessionId}/se/files") |
| 172 | .to(params -> new DownloadFile(this, sessionIdFrom(params))) |
| 173 | .with(spanDecorator("node.download_file")), |
| 174 | get("/session/{sessionId}/se/files/{fileName}") |
| 175 | .to(params -> new DownloadFile(this, sessionIdFrom(params))) |
| 176 | .with(spanDecorator("node.download_file")), |
| 177 | post("/session/{sessionId}/se/files") |
| 178 | .to(params -> new DownloadFile(this, sessionIdFrom(params))) |
| 179 | .with(spanDecorator("node.download_file")), |
| 180 | delete("/session/{sessionId}/se/files") |
| 181 | .to(params -> new DownloadFile(this, sessionIdFrom(params))) |
| 182 | .with(spanDecorator("node.download_file")), |
| 183 | post("/session/{sessionId}/se/event") |
| 184 | .to(params -> new FireSessionEvent(this, sessionIdFrom(params))) |
| 185 | .with(spanDecorator("node.fire_session_event")), |
| 186 | get("/se/grid/node/owner/{sessionId}") |
| 187 | .to(params -> new IsSessionOwner(this, sessionIdFrom(params))) |
| 188 | .with(spanDecorator("node.is_session_owner").andThen(requiresSecret)), |
| 189 | delete("/se/grid/node/connection/{sessionId}") |
| 190 | .to(params -> new ReleaseConnection(this, sessionIdFrom(params))) |
| 191 | .with(spanDecorator("node.is_session_owner").andThen(requiresSecret)), |
| 192 | post("/se/grid/node/connection/{sessionId}") |
| 193 | .to(params -> new TryAcquireConnection(this, sessionIdFrom(params))) |
| 194 | .with(spanDecorator("node.is_session_owner").andThen(requiresSecret)), |
nothing calls this directly
no test coverage detected