use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class PluginFactoryTests method testNoMandatoryConstructor.
@Test
public void testNoMandatoryConstructor() {
final PluginSetting testPluginSettings = new PluginSetting("junit-test", new HashMap<>());
final Class<Source> clazz = PluginRepository.getSourceClass(testPluginSettings.getName());
assertNotNull(clazz);
try {
PluginFactory.newPlugin(testPluginSettings, clazz);
} catch (PluginException e) {
assertTrue("Incorrect exception or exception message was thrown", e.getMessage().startsWith("Data Prepper plugin requires a constructor with PluginSetting parameter; Plugin " + "ConstructorLessComponent with name junit-test is missing such constructor."));
}
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class PrepperFactoryTests method testNewSingletonPrepperClassByNameThatExists.
/**
* Tests if PrepperFactory is able to retrieve default Source plugins by name
*/
@Test
public void testNewSingletonPrepperClassByNameThatExists() {
PrepperFactory.dangerousMethod_setPluginFunction((s, c) -> new NoOpPrepper());
final PluginSetting noOpPrepperConfiguration = new PluginSetting("no-op", new HashMap<>());
noOpPrepperConfiguration.setPipelineName(TEST_PIPELINE);
final List<Processor> actualPrepperSets = PrepperFactory.newPreppers(noOpPrepperConfiguration);
assertEquals(1, actualPrepperSets.size());
final Processor actualPrepper = actualPrepperSets.get(0);
final Processor expectedPrepper = new NoOpPrepper();
assertThat(actualPrepper, notNullValue());
assertThat(actualPrepper.getClass().getSimpleName(), is(equalTo(expectedPrepper.getClass().getSimpleName())));
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class PrepperFactoryTests method testNewMultiInstancePrepperClassByNameThatExists.
@Test
public void testNewMultiInstancePrepperClassByNameThatExists() {
final PluginSetting testPrepperConfiguration = new PluginSetting("test_prepper", new HashMap<>());
testPrepperConfiguration.setProcessWorkers(2);
testPrepperConfiguration.setPipelineName(TEST_PIPELINE);
final List<Processor> actualPrepperSets = PrepperFactory.newPreppers(testPrepperConfiguration);
assertEquals(2, actualPrepperSets.size());
final Processor expectedPrepper = new TestPrepper(testPrepperConfiguration);
assertThat(actualPrepperSets.get(0), notNullValue());
assertThat(actualPrepperSets.get(0).getClass().getSimpleName(), is(equalTo(expectedPrepper.getClass().getSimpleName())));
assertThat(actualPrepperSets.get(1), notNullValue());
assertThat(actualPrepperSets.get(1).getClass().getSimpleName(), is(equalTo(expectedPrepper.getClass().getSimpleName())));
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class BlockingBufferTests method testBufferIsNotEmpty.
@Test
public void testBufferIsNotEmpty() throws Exception {
final PluginSetting completePluginSetting = completePluginSettingForBlockingBuffer();
final BlockingBuffer<Record<String>> blockingBuffer = new BlockingBuffer<>(completePluginSetting);
Record<String> record = new Record<>("TEST");
blockingBuffer.write(record, TEST_WRITE_TIMEOUT);
assertFalse(blockingBuffer.isEmpty());
}
use of com.amazon.dataprepper.model.configuration.PluginSetting in project data-prepper by opensearch-project.
the class BlockingBufferTests method testCreationUsingPluginSetting.
@Test
public void testCreationUsingPluginSetting() {
final PluginSetting completePluginSetting = completePluginSettingForBlockingBuffer();
final BlockingBuffer<Record<String>> blockingBuffer = new BlockingBuffer<>(completePluginSetting);
assertThat(blockingBuffer, notNullValue());
}
Aggregations