MikeThomsen commented on a change in pull request #3317: NIFI-6047 Add
DetectDuplicateRecord Processor
URL: https://github.com/apache/nifi/pull/3317#discussion_r284222697
##########
File path:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/MockCacheService.groovy
##########
@@ -0,0 +1,77 @@
+/*
Review comment:
I used IntelliJ's Groovy convert to Java function to get what you see below.
Just use this for now since the compiler plugin appears to not be behaving
itself here.
```
package org.apache.nifi.processors.standard;
import org.apache.nifi.controller.AbstractControllerService;
import org.apache.nifi.distributed.cache.client.Deserializer;
import org.apache.nifi.distributed.cache.client.DistributedMapCacheClient;
import org.apache.nifi.distributed.cache.client.Serializer;
import java.io.IOException;
import java.util.LinkedHashMap;
public class MockCacheService extends AbstractControllerService implements
DistributedMapCacheClient {
@Override
public <K, V> boolean putIfAbsent(K k, V v, Serializer<K> serializer,
Serializer<V> serializer1) throws IOException {
boolean retVal = map.containsKey(k);
if (retVal) {
return false;
} else {
map.put(k, v);
return true;
}
}
@Override
public <K, V> V getAndPutIfAbsent(K k, V v, Serializer<K> serializer,
Serializer<V> serializer1, Deserializer<V> deserializer) throws IOException {
return null;
}
@Override
public <K> boolean containsKey(K k, Serializer<K> serializer) throws
IOException {
return map.containsKey(k);
}
@Override
public <K, V> void put(K k, V v, Serializer<K> serializer, Serializer<V>
serializer1) throws IOException {
}
@Override
public <K, V> V get(K k, Serializer<K> serializer, Deserializer<V>
deserializer) throws IOException {
return null;
}
@Override
public void close() throws IOException {
}
@Override
public <K> boolean remove(K k, Serializer<K> serializer) throws
IOException {
return false;
}
@Override
public long removeByPattern(String s) throws IOException {
return 0;
}
public void assertContains(String key, String value) {
assert map.containsKey(key) && map.get(key).equals(value);
}
public LinkedHashMap<Object, Object> getMap() {
return map;
}
public void setMap(LinkedHashMap<Object, Object> map) {
this.map = map;
}
private LinkedHashMap<Object, Object> map = new LinkedHashMap<Object,
Object>();
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services