Search in sources :

Example 1 with PluginSetting

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

the class AbstractBufferTest method setUp.

@BeforeEach
public void setUp() {
    MetricsTestUtil.initMetrics();
    testPluginSetting = new PluginSetting(BUFFER_NAME, Collections.emptyMap());
    testPluginSetting.setPipelineName(PIPELINE_NAME);
}
Also used : PluginSetting(com.amazon.dataprepper.model.configuration.PluginSetting) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with PluginSetting

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

the class ConnectionConfigurationTests method testCreateClient_WithInvalidHttpProxy_NotHttp.

@Test
public void testCreateClient_WithInvalidHttpProxy_NotHttp() {
    final Map<String, Object> metadata = generateConfigurationMetadata(TEST_HOSTS, TEST_USERNAME, TEST_PASSWORD, TEST_CONNECT_TIMEOUT, TEST_SOCKET_TIMEOUT, false, null, null, TEST_CERT_PATH, false);
    final String testHttpProxy = "socket://example.com:port";
    metadata.put(PROXY_PARAMETER, testHttpProxy);
    final PluginSetting pluginSetting = getPluginSettingByConfigurationMetadata(metadata);
    final ConnectionConfiguration connectionConfiguration = ConnectionConfiguration.readConnectionConfiguration(pluginSetting);
    assertEquals(connectionConfiguration.getProxy().get(), testHttpProxy);
    assertThrows(IllegalArgumentException.class, () -> connectionConfiguration.createClient());
}
Also used : PluginSetting(com.amazon.dataprepper.model.configuration.PluginSetting) Test(org.junit.Test)

Example 3 with PluginSetting

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

the class ConnectionConfigurationTests method testCreateClient_WithInvalidHttpProxy_PortNotInRange.

@Test
public void testCreateClient_WithInvalidHttpProxy_PortNotInRange() {
    final Map<String, Object> metadata = generateConfigurationMetadata(TEST_HOSTS, TEST_USERNAME, TEST_PASSWORD, TEST_CONNECT_TIMEOUT, TEST_SOCKET_TIMEOUT, false, null, null, TEST_CERT_PATH, false);
    final String testHttpProxy = "example.com:888888";
    metadata.put(PROXY_PARAMETER, testHttpProxy);
    final PluginSetting pluginSetting = getPluginSettingByConfigurationMetadata(metadata);
    final ConnectionConfiguration connectionConfiguration = ConnectionConfiguration.readConnectionConfiguration(pluginSetting);
    assertThrows(IllegalArgumentException.class, () -> connectionConfiguration.createClient());
}
Also used : PluginSetting(com.amazon.dataprepper.model.configuration.PluginSetting) Test(org.junit.Test)

Example 4 with PluginSetting

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

the class ConnectionConfigurationTests method getPluginSettingByConfigurationMetadata.

private PluginSetting getPluginSettingByConfigurationMetadata(final Map<String, Object> metadata) {
    final PluginSetting pluginSetting = new PluginSetting("opensearch", metadata);
    pluginSetting.setPipelineName(TEST_PIPELINE_NAME);
    return pluginSetting;
}
Also used : PluginSetting(com.amazon.dataprepper.model.configuration.PluginSetting)

Example 5 with PluginSetting

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

the class OpenSearchSinkConfigurationTests method generatePluginSetting.

private PluginSetting generatePluginSetting() {
    final Map<String, Object> metadata = new HashMap<>();
    metadata.put(IndexConfiguration.TRACE_ANALYTICS_RAW_FLAG, true);
    metadata.put(ConnectionConfiguration.HOSTS, TEST_HOSTS);
    final PluginSetting pluginSetting = new PluginSetting(PLUGIN_NAME, metadata);
    pluginSetting.setPipelineName(PIPELINE_NAME);
    return pluginSetting;
}
Also used : HashMap(java.util.HashMap) PluginSetting(com.amazon.dataprepper.model.configuration.PluginSetting)

Aggregations

PluginSetting (com.amazon.dataprepper.model.configuration.PluginSetting)115 Test (org.junit.Test)42 HashMap (java.util.HashMap)37 Test (org.junit.jupiter.api.Test)34 Record (com.amazon.dataprepper.model.record.Record)15 AsciiString (io.netty.util.AsciiString)8 Measurement (io.micrometer.core.instrument.Measurement)7 StringJoiner (java.util.StringJoiner)7 BeforeEach (org.junit.jupiter.api.BeforeEach)7 RestHighLevelClient (org.opensearch.client.RestHighLevelClient)7 BlockingBuffer (com.amazon.dataprepper.plugins.buffer.blockingbuffer.BlockingBuffer)6 Map (java.util.Map)6 Request (org.opensearch.client.Request)6 PluginMetrics (com.amazon.dataprepper.metrics.PluginMetrics)5 PipelineConfiguration (com.amazon.dataprepper.parser.model.PipelineConfiguration)5 Path (java.nio.file.Path)5 Response (org.opensearch.client.Response)5 PluginModel (com.amazon.dataprepper.model.configuration.PluginModel)4 Server (com.linecorp.armeria.server.Server)4 URL (java.net.URL)4