Search in sources :

Example 66 with PluginSetting

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

the class ConnectionConfigurationTests method testCreateClient_WithInvalidHttpProxy_NoPort.

@Test
public void testCreateClient_WithInvalidHttpProxy_NoPort() {
    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";
    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 67 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 68 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 69 with PluginSetting

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

the class ConnectionConfigurationTests method testReadConnectionConfigurationDefault.

@Test
public void testReadConnectionConfigurationDefault() {
    final PluginSetting pluginSetting = generatePluginSetting(TEST_HOSTS, null, null, null, null, false, null, null, null, false);
    final ConnectionConfiguration connectionConfiguration = ConnectionConfiguration.readConnectionConfiguration(pluginSetting);
    assertEquals(TEST_HOSTS, connectionConfiguration.getHosts());
    assertNull(connectionConfiguration.getUsername());
    assertNull(connectionConfiguration.getPassword());
    assertFalse(connectionConfiguration.isAwsSigv4());
    assertNull(connectionConfiguration.getCertPath());
    assertNull(connectionConfiguration.getConnectTimeout());
    assertNull(connectionConfiguration.getSocketTimeout());
    assertEquals(TEST_PIPELINE_NAME, connectionConfiguration.getPipelineName());
}
Also used : PluginSetting(com.amazon.dataprepper.model.configuration.PluginSetting) Test(org.junit.Test)

Example 70 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)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