Search in sources :

Example 1 with TestPlugin

use of com.amazon.dataprepper.plugins.TestPlugin 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));
}
Also used : HashMap(java.util.HashMap) TestPlugin(com.amazon.dataprepper.plugins.TestPlugin) PluginSetting(com.amazon.dataprepper.model.configuration.PluginSetting) Test(org.junit.jupiter.api.Test)

Aggregations

PluginSetting (com.amazon.dataprepper.model.configuration.PluginSetting)1 TestPlugin (com.amazon.dataprepper.plugins.TestPlugin)1 HashMap (java.util.HashMap)1 Test (org.junit.jupiter.api.Test)1