mirror of
https://github.com/apache/nifi.git
synced 2025-02-06 10:08:42 +00:00
NIFI-6172 Fixed a bug that caused ElasticSearchStringLookupService to always return a value even when it should return Optional.empty().
NIFI-6172 Fixed broken integration test. Signed-off-by: Matthew Burgess <mattyb149@apache.org> This closes #3399
This commit is contained in:
parent
d372318d47
commit
4810f6d32e
@ -88,7 +88,11 @@ public class ElasticSearchStringLookupService extends AbstractControllerService
|
||||
try {
|
||||
final String id = (String) coordinates.get(ID);
|
||||
final Map<String, Object> enums = esClient.get(index, type, id);
|
||||
return Optional.of(mapper.writeValueAsString(enums));
|
||||
if (enums == null) {
|
||||
return Optional.empty();
|
||||
} else {
|
||||
return Optional.ofNullable(mapper.writeValueAsString(enums));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new LookupFailureException(e);
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ class ElasticSearchLookupService_IT {
|
||||
def result = lookupService.lookup(coordinates)
|
||||
Assert.assertTrue(result.isPresent())
|
||||
def rec = result.get()
|
||||
["dateField": "2018-08-14T10:08:00Z", "longField": 150000L].each { field ->
|
||||
["dateField2": "2018-08-14T10:08:00Z", "longField2": 150000L].each { field ->
|
||||
def value = rec.getValue(field.key)
|
||||
Assert.assertEquals(field.value, value)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user