Search in sources :

Example 16 with PluginSetting

use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.

the class GrokPrepperConfigTests method testInvalidConfig.

@Test
public void testInvalidConfig() {
    final PluginSetting invalidPluginSetting = completePluginSettingForGrokPrepper(false, true, TEST_MATCH, false, TEST_KEYS_TO_OVERWRITE, TEST_PATTERNS_DIRECTORIES, TEST_PATTERNS_FILES_GLOB, TEST_PATTERN_DEFINITIONS, TEST_TIMEOUT_MILLIS, TEST_TARGET_KEY);
    invalidPluginSetting.getSettings().put(GrokPrepperConfig.MATCH, TEST_INVALID_MATCH);
    assertThrows(IllegalArgumentException.class, () -> GrokPrepperConfig.buildConfig(invalidPluginSetting));
}
Also used : PluginSetting(com.amazon.dataprepper.model.configuration.PluginSetting) Test(org.junit.jupiter.api.Test)

Example 17 with PluginSetting

use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.

the class SinkFactoryTests method testNewSinkClassByNameThatExists.

/**
 * Tests if SinkFactory is able to retrieve default Source plugins by name
 */
@Test
public void testNewSinkClassByNameThatExists() {
    final PluginSetting stdOutSinkConfiguration = new PluginSetting("stdout", new HashMap<>());
    final Sink actualSink = SinkFactory.newSink(stdOutSinkConfiguration);
    final Sink expectedSink = new StdOutSink();
    assertThat(actualSink, notNullValue());
    assertThat(actualSink.getClass().getSimpleName(), is(equalTo(expectedSink.getClass().getSimpleName())));
}
Also used : Sink(com.amazon.dataprepper.model.sink.Sink) PluginSetting(com.amazon.dataprepper.model.configuration.PluginSetting) Test(org.junit.Test)

Example 18 with PluginSetting

use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.

the class SourceFactoryTests method testSourceClassByName.

/**
 * Tests if SourceFactory is able to retrieve default Source plugins by name
 */
@Test
public void testSourceClassByName() {
    final PluginSetting stdInSourceConfiguration = new PluginSetting("stdin", new HashMap<>());
    stdInSourceConfiguration.setPipelineName(TEST_PIPELINE);
    final Source actualSource = SourceFactory.newSource(stdInSourceConfiguration);
    final Source expectedSource = new StdInSource(500, TEST_PIPELINE);
    assertThat(actualSource, notNullValue());
    assertThat(actualSource.getClass().getSimpleName(), is(equalTo(expectedSource.getClass().getSimpleName())));
}
Also used : PluginSetting(com.amazon.dataprepper.model.configuration.PluginSetting) Source(com.amazon.dataprepper.model.source.Source) Test(org.junit.Test)

Example 19 with PluginSetting

use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.

the class FileSourceTests method getBuffer.

private BlockingBuffer<Record<Object>> getBuffer() {
    final HashMap<String, Object> integerHashMap = new HashMap<>();
    integerHashMap.put("buffer_size", 2);
    integerHashMap.put("batch_size", 2);
    final PluginSetting pluginSetting = new PluginSetting("blocking_buffer", integerHashMap);
    pluginSetting.setPipelineName(TEST_PIPELINE_NAME);
    return new BlockingBuffer<>(pluginSetting);
}
Also used : HashMap(java.util.HashMap) BlockingBuffer(com.amazon.dataprepper.plugins.buffer.blockingbuffer.BlockingBuffer) PluginSetting(com.amazon.dataprepper.model.configuration.PluginSetting)

Example 20 with PluginSetting

use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.

the class AggregateProcessor method loadAggregateAction.

private AggregateAction loadAggregateAction(final PluginFactory pluginFactory) {
    final PluginModel actionConfiguration = aggregateProcessorConfig.getAggregateAction();
    final PluginSetting actionPluginSetting = new PluginSetting(actionConfiguration.getPluginName(), actionConfiguration.getPluginSettings());
    return pluginFactory.loadPlugin(AggregateAction.class, actionPluginSetting);
}
Also used : PluginModel(com.amazon.dataprepper.model.configuration.PluginModel) PluginSetting(com.amazon.dataprepper.model.configuration.PluginSetting)

Aggregations

PluginSetting (com.amazon.dataprepper.model.configuration.PluginSetting)150 Test (org.junit.jupiter.api.Test)58 HashMap (java.util.HashMap)55 Test (org.junit.Test)43 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)26 Record (com.amazon.dataprepper.model.record.Record)22 AsciiString (io.netty.util.AsciiString)16 Measurement (io.micrometer.core.instrument.Measurement)12 StringJoiner (java.util.StringJoiner)12 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)12 Map (java.util.Map)11 Path (java.nio.file.Path)9 Server (com.linecorp.armeria.server.Server)8 Before (org.junit.Before)8 BeforeEach (org.junit.jupiter.api.BeforeEach)8 BlockingBuffer (com.amazon.dataprepper.plugins.buffer.blockingbuffer.BlockingBuffer)7 RestHighLevelClient (org.opensearch.client.RestHighLevelClient)7 PluginMetrics (com.amazon.dataprepper.metrics.PluginMetrics)6 CertificateProvider (com.amazon.dataprepper.plugins.certificate.CertificateProvider)6 ACMCertificateProvider (com.amazon.dataprepper.plugins.certificate.acm.ACMCertificateProvider)6