Skip to content

Commit

Permalink
GitHub-issue#253 : Implemented GeoIP processor functionality. Address…
Browse files Browse the repository at this point in the history
…ed Code review comments

Signed-off-by: venkataraopasyavula <[email protected]>
  • Loading branch information
venkataraopasyavula committed Jul 11, 2023
1 parent a11b8af commit 9510e71
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion data-prepper-plugins/geoip-processor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pipeline:

- `url` (Required) : Provide URL for all three S3, maxmind URL or local file path.

- `load_type` (Required) : Load type used for better performance while enrich the data. There are two type load_type are present i.e "in_memory" or "cache".
- `load_type` (Required) : Load type used for better performance while enrich the data. There are two type load_type are present i.e "memory_map" or "cache".

- `cache_size` (Optional) : Used to mention the cache size. Default cache size is 2MB. Cache size applicable when load_type is cache.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

public class MaxMindServiceConfig {

private static final Duration DEFAULT_CACHE_REFRESH_SCHEDULE = Duration.parse("P15D");

@JsonProperty("database_path")
@NotNull
List<DatabasePathURLConfig> databasePath;
Expand All @@ -27,7 +29,7 @@ public class MaxMindServiceConfig {

@JsonProperty("cache_refresh_schedule")
@NotNull
private Duration cacheRefreshSchedule;
private Duration cacheRefreshSchedule = DEFAULT_CACHE_REFRESH_SCHEDULE;

/**
* Get the list of Configured Database path options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
public enum LoadTypeOptions {

INMEMORY("in_memory"),
INMEMORY("memory_map"),
CACHE("cache");

private final String option;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ void getCacheRefreshScheduleTestPositive() throws NoSuchFieldException, IllegalA
}

@Test
void getCacheRefreshScheduleTestNegative() {
assertThat(new MaxMindServiceConfig().getCacheRefreshSchedule(), equalTo(null));
void getCacheRefreshScheduleTest() {
assertThat(new MaxMindServiceConfig().getCacheRefreshSchedule(), equalTo(Duration.parse("P15D")));
}

private List<DatabasePathURLConfig> setDatabasePath() throws NoSuchFieldException, IllegalAccessException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void notNull_test() {

@Test
void fromOptionValue_test() {
LoadTypeOptions loadTypeOptions = LoadTypeOptions.fromOptionValue("in_memory");
LoadTypeOptions loadTypeOptions = LoadTypeOptions.fromOptionValue("memory_map");
assertNotNull(loadTypeOptions);
assertThat(loadTypeOptions.toString(), equalTo("INMEMORY"));
}
Expand Down

0 comments on commit 9510e71

Please sign in to comment.