use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class ConnectionConfigurationTests method testCreateClient_WithValidHttpProxy_HostName.
@Test
public void testCreateClient_WithValidHttpProxy_HostName() 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 = "example.com: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 testCreateClient_WithValidHttpProxy_SchemeProvided.
@Test
public void testCreateClient_WithValidHttpProxy_SchemeProvided() 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 = "http://example.com:4350";
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 testCreateClientWithAWSSigV4AndCertPath.
@Test
public void testCreateClientWithAWSSigV4AndCertPath() throws IOException {
final PluginSetting pluginSetting = generatePluginSetting(TEST_HOSTS, null, null, null, null, true, null, null, TEST_CERT_PATH, 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 testCreateClientWithAWSSigV4AndSTSRole.
@Test
public void testCreateClientWithAWSSigV4AndSTSRole() throws IOException {
final PluginSetting pluginSetting = generatePluginSetting(TEST_HOSTS, null, null, null, null, true, null, "arn:aws:iam::123456789012:iam-role", TEST_CERT_PATH, false);
final ConnectionConfiguration connectionConfiguration = ConnectionConfiguration.readConnectionConfiguration(pluginSetting);
assertEquals("us-east-1", connectionConfiguration.getAwsRegion());
assertTrue(connectionConfiguration.isAwsSigv4());
assertEquals("arn:aws:iam::123456789012:iam-role", connectionConfiguration.getAwsStsRoleArn());
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 testCreateClientWithCertPath.
@Test
public void testCreateClientWithCertPath() throws IOException {
final PluginSetting pluginSetting = generatePluginSetting(TEST_HOSTS, TEST_USERNAME, TEST_PASSWORD, TEST_CONNECT_TIMEOUT, TEST_SOCKET_TIMEOUT, false, null, null, TEST_CERT_PATH, false);
final ConnectionConfiguration connectionConfiguration = ConnectionConfiguration.readConnectionConfiguration(pluginSetting);
final RestHighLevelClient client = connectionConfiguration.createClient();
assertNotNull(client);
client.close();
}
Aggregations