Search in sources :

Example 1 with ConfiguredPluginFactory

use of com.hotels.styx.startup.extensions.ConfiguredPluginFactory in project styx by ExpediaGroup.

the class StyxServerComponentsTest method loadsPlugins.

@Test
public void loadsPlugins() {
    ConfiguredPluginFactory f1 = new ConfiguredPluginFactory("plugin1", any -> stubPlugin("MyResponse1"));
    ConfiguredPluginFactory f2 = new ConfiguredPluginFactory("plugin2", any -> stubPlugin("MyResponse2"));
    StyxServerComponents components = new StyxServerComponents.Builder().registry(new MicrometerRegistry(new CompositeMeterRegistry())).styxConfig(new StyxConfig()).pluginFactories(List.of(f1, f2)).build();
    List<NamedPlugin> plugins = components.plugins();
    List<String> names = plugins.stream().map(NamedPlugin::name).collect(toList());
    assertThat(names, contains("plugin1", "plugin2"));
}
Also used : CompositeMeterRegistry(io.micrometer.core.instrument.composite.CompositeMeterRegistry) MicrometerRegistry(com.hotels.styx.api.MicrometerRegistry) StyxConfig(com.hotels.styx.StyxConfig) NamedPlugin(com.hotels.styx.proxy.plugin.NamedPlugin) ConfiguredPluginFactory(com.hotels.styx.startup.extensions.ConfiguredPluginFactory) Test(org.junit.jupiter.api.Test)

Aggregations

StyxConfig (com.hotels.styx.StyxConfig)1 MicrometerRegistry (com.hotels.styx.api.MicrometerRegistry)1 NamedPlugin (com.hotels.styx.proxy.plugin.NamedPlugin)1 ConfiguredPluginFactory (com.hotels.styx.startup.extensions.ConfiguredPluginFactory)1 CompositeMeterRegistry (io.micrometer.core.instrument.composite.CompositeMeterRegistry)1 Test (org.junit.jupiter.api.Test)1