Skip to content

Commit af62d05

Browse files
committed
Refactoring test code
Make buildGeoJSONFeatureProcessorConfig method to be more general Signed-off-by: Heemin Kim <heemin@amazon.com>
1 parent e0c3b07 commit af62d05

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/test/java/org/opensearch/geospatial/GeospatialRestTestCase.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private static String buildPipelinePath(String name) {
7575
return String.join(URL_DELIMITER, "_ingest", "pipeline", name);
7676
}
7777

78-
protected static void createPipeline(String name, Optional<String> description, List<Map<String, Object>> processorConfigs)
78+
protected static Response createPipeline(String name, Optional<String> description, List<Map<String, Object>> processorConfigs)
7979
throws IOException {
8080
XContentBuilder builder = XContentFactory.jsonBuilder().startObject();
8181
if (description.isPresent()) {
@@ -88,7 +88,7 @@ protected static void createPipeline(String name, Optional<String> description,
8888

8989
Request request = new Request("PUT", buildPipelinePath(name));
9090
request.setJsonEntity(Strings.toString(builder));
91-
client().performRequest(request);
91+
return client().performRequest(request);
9292
}
9393

9494
protected static void deletePipeline(String name) throws IOException {
@@ -137,9 +137,9 @@ public static String indexDocument(String indexName, String docID, String body,
137137
return docID;
138138
}
139139

140-
protected Map<String, Object> buildGeoJSONFeatureProcessorConfig(Map<String, String> properties) {
140+
protected Map<String, Object> buildProcessorConfig(final String processorType, final Map<String, String> properties) {
141141
Map<String, Object> featureProcessor = new HashMap<>();
142-
featureProcessor.put(FeatureProcessor.TYPE, properties);
142+
featureProcessor.put(processorType, properties);
143143
return featureProcessor;
144144
}
145145

src/test/java/org/opensearch/geospatial/processor/FeatureProcessorIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void testIndexGeoJSONSuccess() throws Exception {
4949

5050
Map<String, String> processorProperties = new HashMap<>();
5151
processorProperties.put(FeatureProcessor.FIELD_KEY, geoShapeField);
52-
Map<String, Object> geoJSONProcessorConfig = buildGeoJSONFeatureProcessorConfig(processorProperties);
52+
Map<String, Object> geoJSONProcessorConfig = buildProcessorConfig(FeatureProcessor.TYPE, processorProperties);
5353
List<Map<String, Object>> configs = new ArrayList<>();
5454
configs.add(geoJSONProcessorConfig);
5555

0 commit comments

Comments
 (0)