use of com.amazon.dataprepper.parser.model.DataPrepperConfiguration in project data-prepper by opensearch-project.
the class DataPrepperAppConfigurationTest method testGivenPipelineConfigArgThenResultOfObjectMapperReadValueIsReturned.
@Test
public void testGivenPipelineConfigArgThenResultOfObjectMapperReadValueIsReturned() throws IOException {
final DataPrepperArgs dataPrepperArgs = mock(DataPrepperArgs.class);
final ObjectMapper objectMapper = mock(ObjectMapper.class);
final DataPrepperConfiguration expected = mock(DataPrepperConfiguration.class);
when(dataPrepperArgs.getDataPrepperConfigFileLocation()).thenReturn(TestDataProvider.VALID_SINGLE_PIPELINE_EMPTY_SOURCE_PLUGIN_FILE);
when(objectMapper.readValue(any(File.class), eq(DataPrepperConfiguration.class))).thenReturn(expected);
final DataPrepperConfiguration configuration = appConfiguration.dataPrepperConfiguration(dataPrepperArgs, objectMapper);
assertThat(configuration, is(expected));
}
use of com.amazon.dataprepper.parser.model.DataPrepperConfiguration in project data-prepper by opensearch-project.
the class DataPrepperAppConfigurationTest method testGivenNoPipelineConfigArgThenResultOfObjectMapperReadValueIsReturned.
@Test
public void testGivenNoPipelineConfigArgThenResultOfObjectMapperReadValueIsReturned() {
final DataPrepperArgs dataPrepperArgs = mock(DataPrepperArgs.class);
final ObjectMapper objectMapper = mock(ObjectMapper.class);
final DataPrepperConfiguration configuration = appConfiguration.dataPrepperConfiguration(dataPrepperArgs, objectMapper);
verify(dataPrepperArgs).getDataPrepperConfigFileLocation();
assertThat(configuration, notNullValue());
}
use of com.amazon.dataprepper.parser.model.DataPrepperConfiguration in project data-prepper by opensearch-project.
the class MetricsConfigTest method testGivenConfigWithNoCloudWatchMeterRegistryThenNoMeterRegistryCreated.
@Test
public void testGivenConfigWithNoCloudWatchMeterRegistryThenNoMeterRegistryCreated() {
final DataPrepperConfiguration dataPrepperConfiguration = mock(DataPrepperConfiguration.class);
when(dataPrepperConfiguration.getMetricRegistryTypes()).thenReturn(Collections.singletonList(MetricRegistryType.Prometheus));
final MeterRegistry meterRegistry = metricsConfig.cloudWatchMeterRegistry(dataPrepperConfiguration, null);
assertThat(meterRegistry, is(nullValue()));
}
use of com.amazon.dataprepper.parser.model.DataPrepperConfiguration in project data-prepper by opensearch-project.
the class MetricsConfigTest method testGivenConfigWithEMFLoggingMeterRegistryThenMeterRegistryCreated.
@Test
public void testGivenConfigWithEMFLoggingMeterRegistryThenMeterRegistryCreated() {
final DataPrepperConfiguration dataPrepperConfiguration = mock(DataPrepperConfiguration.class);
when(dataPrepperConfiguration.getMetricRegistryTypes()).thenReturn(Collections.singletonList(MetricRegistryType.EmbeddedMetricsFormat));
final MeterRegistry meterRegistry = metricsConfig.emfLoggingMeterRegistry(dataPrepperConfiguration);
final Counter counter = meterRegistry.counter("counter");
final List<Tag> commonTags = counter.getId().getConventionTags(meterRegistry.config().namingConvention());
assertThat(meterRegistry, isA(EMFLoggingMeterRegistry.class));
assertThat(commonTags.size(), equalTo(1));
final Tag commonTag = commonTags.get(0);
assertThat(commonTag.getKey(), equalTo(MetricNames.SERVICE_NAME));
assertThat(commonTag.getValue(), equalTo(DataPrepper.getServiceNameForMetrics()));
}
use of com.amazon.dataprepper.parser.model.DataPrepperConfiguration in project data-prepper by opensearch-project.
the class MetricsConfigTest method testGivenConfigWithPrometheusMeterRegistryThenMeterRegistryCreated.
@Test
public void testGivenConfigWithPrometheusMeterRegistryThenMeterRegistryCreated() {
final DataPrepperConfiguration dataPrepperConfiguration = mock(DataPrepperConfiguration.class);
when(dataPrepperConfiguration.getMetricRegistryTypes()).thenReturn(Collections.singletonList(MetricRegistryType.Prometheus));
final MeterRegistry meterRegistry = metricsConfig.prometheusMeterRegistry(dataPrepperConfiguration);
assertThat(meterRegistry, isA(PrometheusMeterRegistry.class));
}
Aggregations