File tree Expand file tree Collapse file tree 2 files changed +25
-10
lines changed
config/src/main/java/ru/qatools/gridrouter/config Expand file tree Collapse file tree 2 files changed +25
-10
lines changed Original file line number Diff line number Diff line change 1+ package ru .qatools .gridrouter .config ;
2+
3+ import java .util .List ;
4+
5+ import static java .util .stream .Collectors .toList ;
6+
7+ /**
8+ * @author Dmitry Baev charlie@yandex-team.ru
9+ * @author Innokenty Shuvalov innokenty@yandex-team.ru
10+ */
11+ public interface WithHosts {
12+
13+ default List <Host > getHosts () {
14+ return getBrowsers ().stream ()
15+ .flatMap (b -> b .getVersions ().stream ())
16+ .flatMap (v -> v .getRegions ().stream ())
17+ .flatMap (r -> r .getHosts ().stream ())
18+ .collect (toList ());
19+ }
20+
21+ List <Browser > getBrowsers ();
22+ }
Original file line number Diff line number Diff line change 11package ru .qatools .gridrouter .config ;
22
33import java .util .HashMap ;
4- import java .util .List ;
54import java .util .Map ;
65
76/**
87 * @author Dmitry Baev charlie@yandex-team.ru
98 * @author Innokenty Shuvalov innokenty@yandex-team.ru
109 */
11- public interface WithRoutesMap {
12-
13- List <Browser > getBrowsers ();
10+ public interface WithRoutesMap extends WithHosts {
1411
1512 default Map <String , String > getRoutesMap () {
16- HashMap <String , String > routes = new HashMap <>();
17- getBrowsers ().stream ()
18- .flatMap (b -> b .getVersions ().stream ())
19- .flatMap (v -> v .getRegions ().stream ())
20- .flatMap (r -> r .getHosts ().stream ())
21- .forEach (h -> routes .put (h .getRouteId (), h .getRoute ()));
13+ Map <String , String > routes = new HashMap <>();
14+ getHosts ().forEach (h -> routes .put (h .getRouteId (), h .getRoute ()));
2215 return routes ;
2316 }
2417}
You can’t perform that action at this time.
0 commit comments