Search in sources :

Example 6 with NetworkFlushableChannelNetty4

use of org.neo4j.causalclustering.messaging.NetworkFlushableChannelNetty4 in project neo4j by neo4j.

the class RaftMembershipStateTest method shouldMarshalCorrectly.

@Test
public void shouldMarshalCorrectly() throws Exception {
    // given
    RaftMembershipState.Marshal marshal = new RaftMembershipState.Marshal();
    state = new RaftMembershipState(5, new MembershipEntry(7, membersA), new MembershipEntry(8, membersB));
    // when
    ByteBuf buffer = Unpooled.buffer(1_000);
    marshal.marshal(state, new NetworkFlushableChannelNetty4(buffer));
    final RaftMembershipState recovered = marshal.unmarshal(new NetworkReadableClosableChannelNetty4(buffer));
    // then
    assertEquals(state, recovered);
}
Also used : NetworkFlushableChannelNetty4(org.neo4j.causalclustering.messaging.NetworkFlushableChannelNetty4) ByteBuf(io.netty.buffer.ByteBuf) NetworkReadableClosableChannelNetty4(org.neo4j.causalclustering.messaging.NetworkReadableClosableChannelNetty4) Test(org.junit.Test)

Aggregations

NetworkFlushableChannelNetty4 (org.neo4j.causalclustering.messaging.NetworkFlushableChannelNetty4)6 ByteBuf (io.netty.buffer.ByteBuf)5 Test (org.junit.Test)3 NetworkReadableClosableChannelNetty4 (org.neo4j.causalclustering.messaging.NetworkReadableClosableChannelNetty4)3 IOException (java.io.IOException)2 MemberId (org.neo4j.causalclustering.identity.MemberId)2 EndOfStreamException (org.neo4j.causalclustering.messaging.EndOfStreamException)1 MessageTooBigException (org.neo4j.causalclustering.messaging.MessageTooBigException)1 LogEntryWriter (org.neo4j.kernel.impl.transaction.log.entry.LogEntryWriter)1