use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class OTelTraceSourceTest method configureObjectUnderTest.
private void configureObjectUnderTest(final String recordType) {
final Map<String, Object> settingsMap = new HashMap<>();
settingsMap.put("record_type", recordType);
settingsMap.put("request_timeout", 5);
settingsMap.put(SSL, false);
pluginSetting = new PluginSetting("otel_trace", settingsMap);
pluginSetting.setPipelineName("pipeline");
pluginMetrics = PluginMetrics.fromNames("otel_trace", "pipeline");
oTelTraceSourceConfig = OBJECT_MAPPER.convertValue(pluginSetting.getSettings(), OTelTraceSourceConfig.class);
SOURCE = new OTelTraceSource(oTelTraceSourceConfig, pluginMetrics, pluginFactory);
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class OTelTraceSourceTest method getBuffer.
private BlockingBuffer<Record<Object>> getBuffer() {
final HashMap<String, Object> integerHashMap = new HashMap<>();
integerHashMap.put("buffer_size", 1);
integerHashMap.put("batch_size", 1);
return new BlockingBuffer<>(new PluginSetting("blocking_buffer", integerHashMap));
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class OtelTraceSourceConfigTests method testConfigWithValidRecordType.
@ParameterizedTest
@ValueSource(strings = { "otlp", "event" })
public void testConfigWithValidRecordType(final String recordType) {
final PluginSetting pluginSetting = completePluginSettingForOtelTraceSource(TEST_REQUEST_TIMEOUT_MS, TEST_PORT, false, false, false, false, null, null, recordType, TEST_THREAD_COUNT, TEST_MAX_CONNECTION_COUNT);
final OTelTraceSourceConfig otelTraceSourceConfig = OBJECT_MAPPER.convertValue(pluginSetting.getSettings(), OTelTraceSourceConfig.class);
assertEquals(recordType, otelTraceSourceConfig.getRecordType().toString());
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class OtelTraceSourceConfigTests method testValidConfigWithoutS3CertAndKey.
@Test
public void testValidConfigWithoutS3CertAndKey() {
// Prepare
final PluginSetting validPluginSetting = completePluginSettingForOtelTraceSource(TEST_REQUEST_TIMEOUT_MS, TEST_PORT, true, true, false, true, TEST_KEY_CERT, TEST_KEY, RecordType.OTLP.toString(), TEST_THREAD_COUNT, TEST_MAX_CONNECTION_COUNT);
// When
final OTelTraceSourceConfig otelTraceSourceConfig = OBJECT_MAPPER.convertValue(validPluginSetting.getSettings(), OTelTraceSourceConfig.class);
otelTraceSourceConfig.validateAndInitializeCertAndKeyFileInS3();
// Then
assertEquals(TEST_REQUEST_TIMEOUT_MS, otelTraceSourceConfig.getRequestTimeoutInMillis());
assertEquals(TEST_PORT, otelTraceSourceConfig.getPort());
assertEquals(TEST_THREAD_COUNT, otelTraceSourceConfig.getThreadCount());
assertEquals(TEST_MAX_CONNECTION_COUNT, otelTraceSourceConfig.getMaxConnectionCount());
assertTrue(otelTraceSourceConfig.hasHealthCheck());
assertTrue(otelTraceSourceConfig.hasProtoReflectionService());
assertTrue(otelTraceSourceConfig.isSsl());
assertFalse(otelTraceSourceConfig.isSslCertAndKeyFileInS3());
assertEquals(TEST_KEY_CERT, otelTraceSourceConfig.getSslKeyCertChainFile());
assertEquals(TEST_KEY, otelTraceSourceConfig.getSslKeyFile());
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class OtelTraceSourceConfigTests method testInvalidConfigWithEmptyKeyCert.
@Test
public void testInvalidConfigWithEmptyKeyCert() {
// Prepare
final PluginSetting sslEmptyKeyCertPluginSetting = completePluginSettingForOtelTraceSource(DEFAULT_REQUEST_TIMEOUT_MS, DEFAULT_PORT, false, false, false, true, "", TEST_KEY, RecordType.OTLP.toString(), DEFAULT_THREAD_COUNT, DEFAULT_MAX_CONNECTION_COUNT);
final OTelTraceSourceConfig otelTraceSourceConfig = OBJECT_MAPPER.convertValue(sslEmptyKeyCertPluginSetting.getSettings(), OTelTraceSourceConfig.class);
// When/Then
assertThrows(IllegalArgumentException.class, otelTraceSourceConfig::validateAndInitializeCertAndKeyFileInS3);
}
Aggregations