|
17 | 17 |
|
18 | 18 | package org.openqa.selenium.grid.sessionqueue.remote; |
19 | 19 |
|
| 20 | +import org.openqa.selenium.Capabilities; |
20 | 21 | import org.openqa.selenium.grid.config.Config; |
21 | 22 | import org.openqa.selenium.grid.data.RequestId; |
22 | 23 | import org.openqa.selenium.grid.log.LoggingOptions; |
|
30 | 31 | import org.openqa.selenium.grid.web.Values; |
31 | 32 | import org.openqa.selenium.internal.Require; |
32 | 33 | import org.openqa.selenium.json.Json; |
| 34 | +import org.openqa.selenium.json.TypeToken; |
33 | 35 | import org.openqa.selenium.remote.http.Contents; |
34 | 36 | import org.openqa.selenium.remote.http.Filter; |
35 | 37 | import org.openqa.selenium.remote.http.HttpClient; |
|
39 | 41 | import org.openqa.selenium.remote.tracing.Tracer; |
40 | 42 |
|
41 | 43 | import java.io.UncheckedIOException; |
| 44 | +import java.lang.reflect.Type; |
42 | 45 | import java.net.MalformedURLException; |
43 | 46 | import java.net.URI; |
44 | 47 | import java.util.List; |
45 | 48 | import java.util.Optional; |
| 49 | +import java.util.Set; |
46 | 50 |
|
47 | 51 | import static org.openqa.selenium.remote.http.HttpMethod.DELETE; |
48 | 52 | import static org.openqa.selenium.remote.http.HttpMethod.GET; |
49 | 53 | import static org.openqa.selenium.remote.http.HttpMethod.POST; |
50 | 54 |
|
51 | 55 | public class RemoteNewSessionQueuer extends NewSessionQueuer { |
52 | 56 |
|
| 57 | + private static final Type QUEUE_CONTENTS_TYPE = new TypeToken<List<Set<Capabilities>>>() {}.getType(); |
53 | 58 | private static final Json JSON = new Json(); |
54 | 59 | private final HttpClient client; |
55 | 60 | private final Filter addSecret; |
@@ -128,11 +133,12 @@ public int clearQueue() { |
128 | 133 | } |
129 | 134 |
|
130 | 135 | @Override |
131 | | - public List<Object> getQueueContents() { |
| 136 | + public List<Set<Capabilities>> getQueueContents() { |
132 | 137 | HttpRequest upstream = new HttpRequest(GET, "/se/grid/newsessionqueuer/queue"); |
133 | 138 | HttpTracing.inject(tracer, tracer.getCurrentContext(), upstream); |
134 | 139 | HttpResponse response = client.execute(upstream); |
135 | | - return Values.get(response, List.class); |
| 140 | + |
| 141 | + return Values.get(response, QUEUE_CONTENTS_TYPE); |
136 | 142 | } |
137 | 143 |
|
138 | 144 | @Override |
|
0 commit comments