use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class DataPrepperServerConfigurationTest method testGivingSecureConfigThenCreateInsecureSettings.
@Test
public void testGivingSecureConfigThenCreateInsecureSettings() {
final PluginModel pluginModel = mock(PluginModel.class);
final Map<String, Object> settings = new HashMap<>();
when(pluginModel.getPluginName()).thenReturn("super secure plugin");
when(pluginModel.getPluginSettings()).thenReturn(settings);
final PluginSetting pluginSetting = serverConfiguration.pluginSetting(pluginModel);
assertThat(pluginSetting.getName(), is("super secure plugin"));
assertThat(pluginSetting.getSettings(), is(settings));
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class DataPrepperServerConfigurationTest method testGivingNoConfigThenCreateInsecureSettings.
@Test
public void testGivingNoConfigThenCreateInsecureSettings() {
final PluginSetting pluginSetting = serverConfiguration.pluginSetting(null);
assertThat(pluginSetting.getName(), is("unauthenticated"));
assertThat(pluginSetting.getSettings().isEmpty(), is(true));
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class DefaultPluginFactoryIT method loadPlugin_should_return_a_new_plugin_instance_with_the_expected_configuration.
@Test
void loadPlugin_should_return_a_new_plugin_instance_with_the_expected_configuration() {
final String requiredStringValue = UUID.randomUUID().toString();
final String optionalStringValue = UUID.randomUUID().toString();
final Map<String, Object> pluginSettingMap = new HashMap<>();
pluginSettingMap.put("required_string", requiredStringValue);
pluginSettingMap.put("optional_string", optionalStringValue);
final PluginSetting pluginSetting = createPluginSettings(pluginSettingMap);
final TestPluggableInterface plugin = createObjectUnderTest().loadPlugin(TestPluggableInterface.class, pluginSetting);
assertThat(plugin, instanceOf(TestPlugin.class));
final TestPlugin testPlugin = (TestPlugin) plugin;
final TestPluginConfiguration configuration = testPlugin.getConfiguration();
assertThat(configuration.getRequiredString(), equalTo(requiredStringValue));
assertThat(configuration.getOptionalString(), equalTo(optionalStringValue));
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class DefaultPluginFactoryIT method createPluginSettings.
private PluginSetting createPluginSettings(final Map<String, Object> pluginSettingMap) {
final PluginSetting pluginSetting = new PluginSetting(pluginName, pluginSettingMap);
pluginSetting.setPipelineName(pipelineName);
return pluginSetting;
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class PluginArgumentsContextTest method createArguments_with_PluginMetrics.
@Test
void createArguments_with_PluginMetrics() {
final PluginArgumentsContext objectUnderTest = new PluginArgumentsContext.Builder().withPluginSetting(pluginSetting).build();
final PluginMetrics pluginMetrics = mock(PluginMetrics.class);
final Object[] arguments;
try (final MockedStatic<PluginMetrics> pluginMetricsMockedStatic = mockStatic(PluginMetrics.class)) {
pluginMetricsMockedStatic.when(() -> PluginMetrics.fromPluginSetting(pluginSetting)).thenReturn(pluginMetrics);
arguments = objectUnderTest.createArguments(new Class[] { PluginSetting.class, PluginMetrics.class });
}
assertThat(arguments, equalTo(new Object[] { pluginSetting, pluginMetrics }));
}
Aggregations