use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class OTelTraceGroupProcessorConfigTests method testInitialize.
@Test
public void testInitialize() {
try (MockedStatic<ConnectionConfiguration> connectionConfigurationMockedStatic = Mockito.mockStatic(ConnectionConfiguration.class)) {
connectionConfigurationMockedStatic.when(() -> ConnectionConfiguration.readConnectionConfiguration(any(PluginSetting.class))).thenReturn(connectionConfigurationMock);
PluginSetting testPluginSetting = new PluginSetting("otel_trace_group", new HashMap<>());
OTelTraceGroupProcessorConfig otelTraceGroupProcessorConfig = OTelTraceGroupProcessorConfig.buildConfig(testPluginSetting);
assertEquals(connectionConfigurationMock, otelTraceGroupProcessorConfig.getEsConnectionConfig());
}
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class IndexConfigurationTests method testReadIndexConfig_ServiceMapFlag.
@Test
public void testReadIndexConfig_ServiceMapFlag() {
final PluginSetting pluginSetting = generatePluginSetting(null, true, null, null, null, null);
final IndexConfiguration indexConfiguration = IndexConfiguration.readIndexConfig(pluginSetting);
final URL expTemplateFile = indexConfiguration.getClass().getClassLoader().getResource(SERVICE_MAP_DEFAULT_TEMPLATE_FILE);
assertEquals(IndexType.TRACE_ANALYTICS_SERVICE_MAP, indexConfiguration.getIndexType());
assertEquals(TYPE_TO_DEFAULT_ALIAS.get(IndexType.TRACE_ANALYTICS_SERVICE_MAP), indexConfiguration.getIndexAlias());
assertFalse(indexConfiguration.getIndexTemplate().isEmpty());
assertEquals(5, indexConfiguration.getBulkSize());
assertEquals("hashId", indexConfiguration.getDocumentIdField());
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class IndexConfigurationTests method testReadIndexConfig_InvalidIndexTypeValueString.
@Test
public void testReadIndexConfig_InvalidIndexTypeValueString() {
final Map<String, Object> metadata = initializeConfigMetaData(null, null, null, null, null, null);
metadata.put(INDEX_TYPE, "i-am-an-illegitimate-index-type");
final PluginSetting pluginSetting = getPluginSetting(metadata);
assertThrows(IllegalArgumentException.class, () -> IndexConfiguration.readIndexConfig(pluginSetting));
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class IndexConfigurationTests method testReadIndexConfigCustom.
@Test
public void testReadIndexConfigCustom() throws MalformedURLException {
final String defaultTemplateFilePath = Objects.requireNonNull(getClass().getClassLoader().getResource(DEFAULT_TEMPLATE_FILE)).getFile();
final String testIndexAlias = "foo";
final long testBulkSize = 10L;
final String testIdField = "someId";
final PluginSetting pluginSetting = generatePluginSetting(false, false, testIndexAlias, defaultTemplateFilePath, testBulkSize, testIdField);
final IndexConfiguration indexConfiguration = IndexConfiguration.readIndexConfig(pluginSetting);
assertEquals(IndexType.CUSTOM, indexConfiguration.getIndexType());
assertEquals(testIndexAlias, indexConfiguration.getIndexAlias());
assertFalse(indexConfiguration.getIndexTemplate().isEmpty());
assertEquals(testBulkSize, indexConfiguration.getBulkSize());
assertEquals(testIdField, indexConfiguration.getDocumentIdField());
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class IndexConfigurationTests method testReadIndexConfig_RawIndexType.
@Test
public void testReadIndexConfig_RawIndexType() {
final Map<String, Object> metadata = initializeConfigMetaData(null, null, null, null, null, null);
metadata.put(INDEX_TYPE, IndexType.TRACE_ANALYTICS_RAW.getValue());
final PluginSetting pluginSetting = getPluginSetting(metadata);
final IndexConfiguration indexConfiguration = IndexConfiguration.readIndexConfig(pluginSetting);
final URL expTemplateFile = indexConfiguration.getClass().getClassLoader().getResource(RAW_DEFAULT_TEMPLATE_FILE);
assertEquals(IndexType.TRACE_ANALYTICS_RAW, indexConfiguration.getIndexType());
assertEquals(TYPE_TO_DEFAULT_ALIAS.get(IndexType.TRACE_ANALYTICS_RAW), indexConfiguration.getIndexAlias());
assertFalse(indexConfiguration.getIndexTemplate().isEmpty());
assertEquals(5, indexConfiguration.getBulkSize());
assertEquals("spanId", indexConfiguration.getDocumentIdField());
}
Aggregations