mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
JLANG-39 HCOLL-214 refactored builders (leaved a single builder class), fixes in DataValueBytesMarshallers implementation
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package net.openhft.chronicle.map;
|
||||
|
||||
import net.openhft.chronicle.hash.ChronicleHashInstanceConfig;
|
||||
import net.openhft.chronicle.hash.replication.ReplicationHub;
|
||||
import net.openhft.chronicle.hash.replication.TcpTransportAndNetworkConfig;
|
||||
import org.junit.Before;
|
||||
@@ -45,16 +46,19 @@ public class MapByNameTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("builder is not serializable")
|
||||
public void testSerializingBuilder() throws TimeoutException, InterruptedException, IOException {
|
||||
|
||||
final ChronicleMapBuilder<CharSequence, CharSequence> builder = ChronicleMapBuilder.of(CharSequence.class, CharSequence.class)
|
||||
final MapInstanceConfig<CharSequence, CharSequence> config =
|
||||
(MapInstanceConfig<CharSequence, CharSequence>)
|
||||
ChronicleMapBuilder.of(CharSequence.class, CharSequence.class)
|
||||
.entries(2)
|
||||
.minSegments(2)
|
||||
.name("map1")
|
||||
.replication((byte) 1, TcpTransportAndNetworkConfig.of(8244))
|
||||
.removeReturnsNull(true);
|
||||
.removeReturnsNull(true)
|
||||
.instance().name("map1");
|
||||
|
||||
final ChronicleMap<CharSequence, CharSequence> map = findMapByName.create(builder);
|
||||
final ChronicleMap<CharSequence, CharSequence> map = findMapByName.create(config);
|
||||
map.put("hello", "world");
|
||||
|
||||
assertEquals(map.get("hello"), "world");
|
||||
@@ -71,14 +75,16 @@ public class MapByNameTest {
|
||||
|
||||
NodeDiscovery nodeDiscovery = new NodeDiscovery();
|
||||
|
||||
ChronicleMapBuilder<CharSequence, CharSequence> builder = ChronicleMapBuilder.of(CharSequence
|
||||
.class, CharSequence.class)
|
||||
MapInstanceConfig<CharSequence, CharSequence> config =
|
||||
(MapInstanceConfig<CharSequence, CharSequence>)
|
||||
ChronicleMapBuilder.of(CharSequence.class, CharSequence.class)
|
||||
.minSegments(2)
|
||||
.name("myMap")
|
||||
.removeReturnsNull(true);
|
||||
.removeReturnsNull(true)
|
||||
.instance()
|
||||
.name("myMap");
|
||||
|
||||
ReplicationHubFindByName<CharSequence> mapByName = nodeDiscovery.mapByName();
|
||||
// mapByName.add(builder);
|
||||
// mapByName.add(config);
|
||||
|
||||
ChronicleMap<CharSequence, CharSequence> myMap2 = mapByName.from("myMap");
|
||||
}
|
||||
@@ -89,14 +95,16 @@ public class MapByNameTest {
|
||||
final ReplicationHubFindByName<CharSequence> mapByName = nodeDiscovery.mapByName();
|
||||
Thread.sleep(2000);
|
||||
|
||||
ChronicleMapBuilder<CharSequence, CharSequence> builder = ChronicleMapBuilder.of(CharSequence
|
||||
.class, CharSequence.class)
|
||||
MapInstanceConfig<CharSequence, CharSequence> config =
|
||||
(MapInstanceConfig<CharSequence, CharSequence>)
|
||||
ChronicleMapBuilder.of(CharSequence.class, CharSequence.class)
|
||||
.minSegments(2)
|
||||
.entries(2)
|
||||
.name("myMap6")
|
||||
.removeReturnsNull(true);
|
||||
.removeReturnsNull(true)
|
||||
.instance()
|
||||
.name("myMap6");
|
||||
|
||||
ChronicleMap<String, String> map = mapByName.create(builder);
|
||||
ChronicleMap<String, String> map = mapByName.create(config);
|
||||
map.put("hello", "world");
|
||||
|
||||
// final ChronicleMap<CharSequence, CharSequence> map = mapByName.from("myMap5");
|
||||
|
||||
Reference in New Issue
Block a user