use of com.hazelcast.spi.impl.PortablePartitionLostEvent in project hazelcast by hazelcast.
the class ClientPartitionLostListenerTest method test_portableMapPartitionLostEvent_serialization.
@Test
public void test_portableMapPartitionLostEvent_serialization() throws IOException {
final Address source = new Address();
final PortablePartitionLostEvent event = new PortablePartitionLostEvent(1, 2, source);
final PortableWriter writer = mock(PortableWriter.class);
final ObjectDataOutput output = mock(ObjectDataOutput.class);
when(writer.getRawDataOutput()).thenReturn(output);
event.writePortable(writer);
verify(writer).writeInt("p", 1);
verify(writer).writeInt("l", 2);
verify(output).writeObject(source);
}
use of com.hazelcast.spi.impl.PortablePartitionLostEvent in project hazelcast by hazelcast.
the class ClientPartitionLostListenerTest method test_portableMapPartitionLostEvent_deserialization.
@Test
public void test_portableMapPartitionLostEvent_deserialization() throws IOException {
final Address source = new Address();
final PortablePartitionLostEvent event = new PortablePartitionLostEvent();
final PortableReader reader = mock(PortableReader.class);
final ObjectDataInput input = mock(ObjectDataInput.class);
when(reader.getRawDataInput()).thenReturn(input);
when(reader.readInt("p")).thenReturn(1);
when(reader.readInt("l")).thenReturn(2);
when(input.readObject()).thenReturn(source);
event.readPortable(reader);
assertEquals(1, event.getPartitionId());
assertEquals(2, event.getLostBackupCount());
assertEquals(source, event.getSource());
}
Aggregations