mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
HCOLL-81 StatelessClient : Add a visitor pattern to Chronicle Map ( tested with lamda expressions in java8 )
This commit is contained in:
@@ -19,17 +19,16 @@
|
||||
package net.openhft.chronicle.map;
|
||||
|
||||
import net.openhft.chronicle.hash.replication.TcpTransportAndNetworkConfig;
|
||||
import net.openhft.chronicle.java8.Function;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
|
||||
/**
|
||||
@@ -41,7 +40,7 @@ public class StatelessClientTest {
|
||||
public static final int SIZE = 100000;
|
||||
|
||||
|
||||
static class StringBuilderToStringFunction implements Function<StringBuilder, String>, Serializable {
|
||||
static class StringBuilderToStringFunction implements Function<StringBuilder, String> {
|
||||
|
||||
@Override
|
||||
public String apply(StringBuilder stringBuilder) {
|
||||
@@ -50,6 +49,27 @@ public class StatelessClientTest {
|
||||
}
|
||||
|
||||
|
||||
/* @Test
|
||||
public void testMapForKeyLambda() throws IOException, InterruptedException {
|
||||
|
||||
try (ChronicleMap<Integer, StringBuilder> serverMap = ChronicleMapBuilder.of(Integer.class,
|
||||
StringBuilder.class)
|
||||
.replication((byte) 2, TcpTransportAndNetworkConfig.of(8056)).create()) {
|
||||
|
||||
serverMap.put(10, new StringBuilder("Hello World"));
|
||||
|
||||
try (ChronicleMap<Integer, StringBuilder> statelessMap = ChronicleMapBuilder.of(Integer
|
||||
.class, StringBuilder.class)
|
||||
.statelessClient(new InetSocketAddress("localhost", 8056)).create()) {
|
||||
|
||||
String actual = (String) ((StatelessChronicleMap) statelessMap).mapForKey(10, b -> b.toString());
|
||||
|
||||
Assert.assertEquals("Hello World", actual);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
@Test
|
||||
public void testMapForKey() throws IOException, InterruptedException {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user