This commit is contained in:
Rob Austin
2014-11-04 14:44:59 +00:00
parent a0c89935f5
commit 9dec1ed4db
64 changed files with 700 additions and 865 deletions
@@ -19,8 +19,9 @@
package net.openhft.chronicle.map;
import net.openhft.chronicle.hash.replication.ReplicationHub;
import net.openhft.chronicle.hash.replication.TcpConfig;
import net.openhft.chronicle.hash.ChannelProvider;
import net.openhft.chronicle.hash.ChannelProviderBuilder;
import net.openhft.chronicle.hash.TcpReplicationConfig;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -47,8 +48,8 @@ public class PostChannelCreationTest {
private ChronicleMap<Integer, CharSequence> map1b;
private ChronicleMap<Integer, CharSequence> map2b;
private ReplicationHub hubA;
private ReplicationHub hubB;
private ChannelProvider channelProviderA;
private ChannelProvider channelProviderB;
public static File getPersistenceFile() {
String TMP = System.getProperty("java.io.tmpdir");
@@ -63,40 +64,40 @@ public class PostChannelCreationTest {
public void setup() throws IOException {
{
final TcpConfig tcpConfig = TcpConfig
.forSendingNode(8086, new InetSocketAddress("localhost", 8087))
final TcpReplicationConfig tcpConfig = TcpReplicationConfig
.of(8086, new InetSocketAddress("localhost", 8087))
.heartBeatInterval(1, SECONDS);
hubA = ReplicationHub.builder().tcpTransportAndNetwork(tcpConfig)
.create((byte) 1);
channelProviderA = new ChannelProviderBuilder()
.replicators((byte) 1, tcpConfig).create();
// this is how you add maps after the custer is created
map1a = ChronicleMapBuilder.of(Integer.class, CharSequence.class)
.entries(1000)
.instance().replicatedViaChannel(hubA.createChannel((short) 1)).create();
.channel(channelProviderA.createChannel((short) 1)).create();
map2a = ChronicleMapBuilder.of(Integer.class, CharSequence.class)
.entries(1000)
.instance().replicatedViaChannel(hubA.createChannel((short) 2)).create();
.channel(channelProviderA.createChannel((short) 2)).create();
}
{
final TcpConfig tcpConfig = TcpConfig
.forSendingNode(8087, new InetSocketAddress("localhost", 8086))
final TcpReplicationConfig tcpConfig = TcpReplicationConfig
.of(8087, new InetSocketAddress("localhost", 8086))
.heartBeatInterval(1, SECONDS);
hubB = ReplicationHub.builder().tcpTransportAndNetwork(tcpConfig)
.create((byte) 2);
channelProviderB = new ChannelProviderBuilder()
.replicators((byte) 2, tcpConfig).create();
// this is how you add maps after the custer is created
map1b = ChronicleMapBuilder.of(Integer.class, CharSequence.class)
.entries(1000)
.instance().replicatedViaChannel(hubB.createChannel((short) 1)).create();
.channel(channelProviderB.createChannel((short) 1)).create();
map2b = ChronicleMapBuilder.of(Integer.class, CharSequence.class)
.entries(1000)
.instance().replicatedViaChannel(hubB.createChannel((short) 2)).create();
.channel(channelProviderB.createChannel((short) 2)).create();
}
@@ -105,7 +106,7 @@ public class PostChannelCreationTest {
@After
public void tearDown() throws InterruptedException {
for (final Closeable closeable : new Closeable[]{map1a, map1b, map2a, map2b}) {
for (final Closeable closeable : new Closeable[]{channelProviderA, channelProviderB}) {
try {
closeable.close();
} catch (IOException e) {