@Test public void pluginsAreProvidedInOrderSpecifiedByActivePluginsCommaSeparatedList() { Map<String, SpiExtension> plugins = new LinkedHashMap<>(); Stream.of("two", "four", "three", "one") .forEach(key -> plugins.put(key, pluginMetadata())); PluginsMetadata pluginsMetadata = new PluginsMetadata("one,two,three,four", plugins); List<String> activePlugins = pluginsMetadata.activePlugins().stream() .map(Pair::key) .collect(toList()); assertThat(activePlugins, contains("one", "two", "three", "four")); }
public List<Pair<String, SpiExtension>> activePlugins() { return activePluginsNames.stream() .map(name -> pair(name, plugins.get(name))) .collect(toList()); }
PluginsMetadata implements Iterable<SpiExtension> { public List<Pair<String, SpiExtension>> activePlugins() { return activePluginsNames.stream() .map(name -> pair(name, plugins.get(name))) .collect(toList()); } }
PluginsMetadata implements Iterable<SpiExtension> { public List<Pair<String, SpiExtension>> activePlugins() { return activePluginsNames.stream() .map(name -> pair(name, plugins.get(name))) .collect(toList()); } PluginsMetadata(@JsonProperty("active") String active,
                    @JsonProperty("all") Map<String, SpiExtension> plugins); }
PluginsMetadata implements Iterable<SpiExtension> { public List<Pair<String, SpiExtension>> activePlugins() { return activePluginsNames.stream() .map(name -> pair(name, plugins.get(name))) .collect(toList()); } PluginsMetadata(@JsonProperty("active") String active,
                    @JsonProperty("all") Map<String, SpiExtension> plugins); List<Pair<String, SpiExtension>> plugins(); List<Pair<String, SpiExtension>> activePlugins(); @Override String toString(); @Override Iterator<SpiExtension> iterator(); }
PluginsMetadata implements Iterable<SpiExtension> { public List<Pair<String, SpiExtension>> activePlugins() { return activePluginsNames.stream() .map(name -> pair(name, plugins.get(name))) .collect(toList()); } PluginsMetadata(@JsonProperty("active") String active,
                    @JsonProperty("all") Map<String, SpiExtension> plugins); List<Pair<String, SpiExtension>> plugins(); List<Pair<String, SpiExtension>> activePlugins(); @Override String toString(); @Override Iterator<SpiExtension> iterator();  }