use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class OtelMetricsSourceConfigTests method testValidConfigWithS3CertAndKey.
@Test
public void testValidConfigWithS3CertAndKey() {
// Prepare
final PluginSetting validPluginSettingWithS3CertAndKey = completePluginSettingForOtelMetricsSource(TEST_REQUEST_TIMEOUT_MS, TEST_PORT, false, false, false, true, TEST_KEY_CERT_S3, TEST_KEY_S3, TEST_THREAD_COUNT, TEST_MAX_CONNECTION_COUNT);
validPluginSettingWithS3CertAndKey.getSettings().put(OTelMetricsSourceConfig.AWS_REGION, TEST_REGION);
final OTelMetricsSourceConfig otelMetricsSourceConfig = OBJECT_MAPPER.convertValue(validPluginSettingWithS3CertAndKey.getSettings(), OTelMetricsSourceConfig.class);
otelMetricsSourceConfig.validateAndInitializeCertAndKeyFileInS3();
// Then
assertEquals(TEST_REQUEST_TIMEOUT_MS, otelMetricsSourceConfig.getRequestTimeoutInMillis());
assertEquals(TEST_PORT, otelMetricsSourceConfig.getPort());
assertEquals(TEST_THREAD_COUNT, otelMetricsSourceConfig.getThreadCount());
assertEquals(TEST_MAX_CONNECTION_COUNT, otelMetricsSourceConfig.getMaxConnectionCount());
assertFalse(otelMetricsSourceConfig.hasHealthCheck());
assertFalse(otelMetricsSourceConfig.hasProtoReflectionService());
assertTrue(otelMetricsSourceConfig.isSsl());
assertTrue(otelMetricsSourceConfig.isSslCertAndKeyFileInS3());
assertEquals(TEST_KEY_CERT_S3, otelMetricsSourceConfig.getSslKeyCertChainFile());
assertEquals(TEST_KEY_S3, otelMetricsSourceConfig.getSslKeyFile());
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class OtelMetricsSourceConfigTests method testInvalidConfigWithEmptyKeyCert.
@Test
public void testInvalidConfigWithEmptyKeyCert() {
// Prepare
final PluginSetting sslEmptyKeyCertPluginSetting = completePluginSettingForOtelMetricsSource(DEFAULT_REQUEST_TIMEOUT_MS, DEFAULT_PORT, false, false, false, true, "", TEST_KEY, DEFAULT_THREAD_COUNT, DEFAULT_MAX_CONNECTION_COUNT);
final OTelMetricsSourceConfig otelMetricsSourceConfig = OBJECT_MAPPER.convertValue(sslEmptyKeyCertPluginSetting.getSettings(), OTelMetricsSourceConfig.class);
// When/Then
assertThrows(IllegalArgumentException.class, otelMetricsSourceConfig::validateAndInitializeCertAndKeyFileInS3);
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class CertificateProviderFactoryTest method getCertificateProviderS3ProviderSuccess.
@Test
public void getCertificateProviderS3ProviderSuccess() {
final Map<String, Object> settingsMap = new HashMap<>();
settingsMap.put("ssl", true);
settingsMap.put("awsRegion", "us-east-1");
settingsMap.put("sslKeyCertChainFile", "s3://data/certificate/test_cert.crt");
settingsMap.put("sslKeyFile", "s3://data/certificate/test_decrypted_key.key");
final PluginSetting pluginSetting = new PluginSetting(null, settingsMap);
pluginSetting.setPipelineName("pipeline");
oTelTraceSourceConfig = OBJECT_MAPPER.convertValue(pluginSetting.getSettings(), OTelMetricsSourceConfig.class);
oTelTraceSourceConfig.validateAndInitializeCertAndKeyFileInS3();
certificateProviderFactory = new CertificateProviderFactory(oTelTraceSourceConfig);
final CertificateProvider certificateProvider = certificateProviderFactory.getCertificateProvider();
assertThat(certificateProvider, IsInstanceOf.instanceOf(S3CertificateProvider.class));
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class MetricsPluginGaugeTest method init.
@Before
public void init() {
PluginSetting testsettings = new PluginSetting("testsettings", Collections.emptyMap());
testsettings.setPipelineName("testpipeline");
rawProcessor = new OTelMetricsRawProcessor(testsettings);
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class MetricsPluginSumTest method init.
@Before
public void init() {
PluginSetting testsettings = new PluginSetting("testsettings", Collections.emptyMap());
testsettings.setPipelineName("testpipeline");
rawProcessor = new OTelMetricsRawProcessor(testsettings);
}
Aggregations