Skip to content

Commit

Permalink
FIX: sty and broken tests
Browse files Browse the repository at this point in the history
Signed-off-by: George Chen <[email protected]>
  • Loading branch information
chenqi0805 committed Oct 1, 2024
1 parent 323773f commit 817d764
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
import org.opensearch.dataprepper.model.annotations.DataPrepperPlugin;
import org.opensearch.dataprepper.model.annotations.UsesDataPrepperPlugin;
import org.opensearch.dataprepper.plugin.PluginProvider;
import org.reflections.Reflections;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class JsonSchemaConverter {
private static final Logger LOG = LoggerFactory.getLogger(JsonSchemaConverter.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.opensearch.dataprepper.model.annotations.DataPrepperPlugin;
import org.reflections.Reflections;
import org.opensearch.dataprepper.plugin.PluginProvider;

import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -40,7 +40,7 @@ class PluginConfigsJsonSchemaConverterTest {
private JsonSchemaConverter jsonSchemaConverter;

@Mock
private Reflections reflections;
private PluginProvider pluginProvider;

@InjectMocks
private PluginConfigsJsonSchemaConverter objectUnderTest;
Expand All @@ -67,7 +67,7 @@ void testPluginTypeNameToPluginTypeWithInValidInput() {

@Test
void testConvertPluginConfigsIntoJsonSchemasHappyPath() throws JsonProcessingException {
when(reflections.getTypesAnnotatedWith(eq(DataPrepperPlugin.class))).thenReturn(Set.of(TestPlugin.class));
when(pluginProvider.findPluginClasses(eq(TestPluginType.class))).thenReturn(Set.of(TestPlugin.class));
final ObjectNode objectNode = OBJECT_MAPPER.createObjectNode();
when(jsonSchemaConverter.convertIntoJsonSchema(
any(SchemaVersion.class), any(OptionPreset.class), eq(TestPluginConfig.class))).thenReturn(objectNode);
Expand All @@ -84,7 +84,7 @@ void testConvertPluginConfigsIntoJsonSchemasHappyPath() throws JsonProcessingExc

@Test
void testConvertPluginConfigsIntoJsonSchemasWithError() throws JsonProcessingException {
when(reflections.getTypesAnnotatedWith(eq(DataPrepperPlugin.class))).thenReturn(Set.of(TestPlugin.class));
when(pluginProvider.findPluginClasses(eq(TestPluginType.class))).thenReturn(Set.of(TestPlugin.class));
final JsonProcessingException jsonProcessingException = mock(JsonProcessingException.class);
when(jsonSchemaConverter.convertIntoJsonSchema(
any(SchemaVersion.class), any(OptionPreset.class), eq(TestPluginConfig.class))).thenThrow(
Expand All @@ -96,7 +96,7 @@ void testConvertPluginConfigsIntoJsonSchemasWithError() throws JsonProcessingExc

@DataPrepperPlugin(
name = "test_plugin", pluginType = TestPluginType.class, pluginConfigurationType = TestPluginConfig.class)
static class TestPlugin {
static class TestPlugin extends TestPluginType {

}

Expand Down

0 comments on commit 817d764

Please sign in to comment.