use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class ConnectionConfigurationTests method testCreateClient_WithValidHttpProxy_HostIP.
@Test
public void testCreateClient_WithValidHttpProxy_HostIP() throws IOException {
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 = "121.121.121.121:80";
metadata.put(PROXY_PARAMETER, testHttpProxy);
final PluginSetting pluginSetting = getPluginSettingByConfigurationMetadata(metadata);
final ConnectionConfiguration connectionConfiguration = ConnectionConfiguration.readConnectionConfiguration(pluginSetting);
assertEquals(connectionConfiguration.getProxy().get(), testHttpProxy);
final RestHighLevelClient client = connectionConfiguration.createClient();
assertNotNull(client);
client.close();
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class ConnectionConfigurationTests method testCreateClientNoCert.
@Test
public void testCreateClientNoCert() throws IOException {
final PluginSetting pluginSetting = generatePluginSetting(TEST_HOSTS, TEST_USERNAME, TEST_PASSWORD, TEST_CONNECT_TIMEOUT, TEST_SOCKET_TIMEOUT, false, null, null, null, false);
final ConnectionConfiguration connectionConfiguration = ConnectionConfiguration.readConnectionConfiguration(pluginSetting);
final RestHighLevelClient client = connectionConfiguration.createClient();
assertNotNull(client);
client.close();
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class ConnectionConfigurationTests method testCreateClientWithAWSSigV4DefaultRegion.
@Test
public void testCreateClientWithAWSSigV4DefaultRegion() throws IOException {
final PluginSetting pluginSetting = generatePluginSetting(TEST_HOSTS, null, null, null, null, true, null, null, null, false);
final ConnectionConfiguration connectionConfiguration = ConnectionConfiguration.readConnectionConfiguration(pluginSetting);
assertEquals("us-east-1", connectionConfiguration.getAwsRegion());
assertTrue(connectionConfiguration.isAwsSigv4());
assertEquals(TEST_PIPELINE_NAME, connectionConfiguration.getPipelineName());
}
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());
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class ConnectionConfigurationTests method testReadConnectionConfigurationNoCert.
@Test
public void testReadConnectionConfigurationNoCert() {
final PluginSetting pluginSetting = generatePluginSetting(TEST_HOSTS, TEST_USERNAME, TEST_PASSWORD, TEST_CONNECT_TIMEOUT, TEST_SOCKET_TIMEOUT, false, null, null, null, false);
final ConnectionConfiguration connectionConfiguration = ConnectionConfiguration.readConnectionConfiguration(pluginSetting);
assertEquals(TEST_HOSTS, connectionConfiguration.getHosts());
assertEquals(TEST_USERNAME, connectionConfiguration.getUsername());
assertEquals(TEST_PASSWORD, connectionConfiguration.getPassword());
assertEquals(TEST_CONNECT_TIMEOUT, connectionConfiguration.getConnectTimeout());
assertEquals(TEST_SOCKET_TIMEOUT, connectionConfiguration.getSocketTimeout());
assertFalse(connectionConfiguration.isAwsSigv4());
assertEquals(TEST_PIPELINE_NAME, connectionConfiguration.getPipelineName());
}
Aggregations