@@ -39,7 +39,7 @@ public class Node {
39
39
private final URI uri ;
40
40
private final Availability status ;
41
41
private final int maxSession ;
42
- private final Map <Capabilities , Integer > capabilities ;
42
+ private final Map <Capabilities , Integer > stereotypes ;
43
43
private final Map <Session , Slot > activeSessions ;
44
44
private final String version ;
45
45
@@ -48,22 +48,26 @@ public Node(NodeId id,
48
48
URI uri ,
49
49
Availability status ,
50
50
int maxSession ,
51
- Map <Capabilities , Integer > capabilities ,
51
+ Map <Capabilities , Integer > stereotypes ,
52
52
Map <Session , Slot > activeSessions ,
53
53
String version ) {
54
54
this .id = Require .nonNull ("Node id" , id );
55
55
this .uri = Require .nonNull ("Node uri" , uri );
56
56
this .status = status ;
57
57
this .maxSession = maxSession ;
58
- this .capabilities = Require .nonNull ("Node capabilities " , capabilities );
58
+ this .stereotypes = Require .nonNull ("Node stereotypes " , stereotypes );
59
59
this .activeSessions = Require .nonNull ("Active sessions" , activeSessions );
60
60
this .version = Require .nonNull ("Grid Node version" , version );
61
61
}
62
62
63
63
public List <org .openqa .selenium .grid .graphql .Session > getSessions () {
64
64
return activeSessions .entrySet ().stream ()
65
- .map (this ::createGraphqlSession )
66
- .collect (ImmutableList .toImmutableList ());
65
+ .map (this ::createGraphqlSession )
66
+ .collect (ImmutableList .toImmutableList ());
67
+ }
68
+
69
+ public int getSessionCount () {
70
+ return activeSessions .size ();
67
71
}
68
72
69
73
public NodeId getId () {
@@ -80,15 +84,15 @@ public int getMaxSession() {
80
84
81
85
public List <String > getActiveSessionIds () {
82
86
return activeSessions .keySet ().stream ().map (session -> session .getId ().toString ())
83
- .collect (ImmutableList .toImmutableList ());
87
+ .collect (ImmutableList .toImmutableList ());
84
88
}
85
89
86
- public String getCapabilities () {
87
- List <Map <String , Object > > toReturn = new ArrayList <>();
90
+ public String getStereotypes () {
91
+ List <Map <String , Object >> toReturn = new ArrayList <>();
88
92
89
- for (Map .Entry <Capabilities , Integer > entry : capabilities .entrySet ()) {
90
- Map <String , Object > details = new HashMap <>();
91
- details .put ("browserName " , entry .getKey (). getBrowserName ());
93
+ for (Map .Entry <Capabilities , Integer > entry : stereotypes .entrySet ()) {
94
+ Map <String , Object > details = new HashMap <>();
95
+ details .put ("stereotype " , entry .getKey ());
92
96
details .put ("slots" , entry .getValue ());
93
97
toReturn .add (details );
94
98
}
@@ -105,18 +109,18 @@ public String getVersion() {
105
109
}
106
110
107
111
private org .openqa .selenium .grid .graphql .Session createGraphqlSession (
108
- Map .Entry <Session , Slot > entry ) {
112
+ Map .Entry <Session , Slot > entry ) {
109
113
Session session = entry .getKey ();
110
114
Slot slot = entry .getValue ();
111
115
112
116
return new org .openqa .selenium .grid .graphql .Session (
113
- session .getId ().toString (),
114
- session .getCapabilities (),
115
- session .getStartTime (),
116
- session .getUri (),
117
- id .toString (),
118
- uri ,
119
- slot
117
+ session .getId ().toString (),
118
+ session .getCapabilities (),
119
+ session .getStartTime (),
120
+ session .getUri (),
121
+ id .toString (),
122
+ uri ,
123
+ slot
120
124
);
121
125
}
122
126
}
0 commit comments