use of com.hazelcast.cache.impl.CachePartitionEventData in project hazelcast by hazelcast.
the class CacheSerializationTest method testCachePartitionEventData.
@Test
public void testCachePartitionEventData() throws UnknownHostException {
Address address = new Address("127.0.0.1", 5701);
Member member = new MemberImpl(address, MemberVersion.UNKNOWN, true, false);
CachePartitionEventData cachePartitionEventData = new CachePartitionEventData("test", 1, member);
CachePartitionEventData deserialized = service.toObject(cachePartitionEventData);
assertEquals(cachePartitionEventData, deserialized);
}
use of com.hazelcast.cache.impl.CachePartitionEventData in project hazelcast by hazelcast.
the class CachePartitionLostListenerTest method test_cachePartitionEventData_deserialization.
@Test
public void test_cachePartitionEventData_deserialization() throws IOException {
CachePartitionEventData cachePartitionEventData = new CachePartitionEventData("", 0, null);
ObjectDataInput input = mock(ObjectDataInput.class);
when(input.readUTF()).thenReturn("cacheName");
when(input.readInt()).thenReturn(1);
cachePartitionEventData.readData(input);
assertEquals("cacheName", cachePartitionEventData.getName());
assertEquals(1, cachePartitionEventData.getPartitionId());
}
use of com.hazelcast.cache.impl.CachePartitionEventData in project hazelcast by hazelcast.
the class InternalCachePartitionLostListenerAdapter method handleEvent.
@Override
public void handleEvent(Object eventObject) {
final CachePartitionEventData eventData = (CachePartitionEventData) eventObject;
final CachePartitionLostEvent event = new CachePartitionLostEvent(eventData.getName(), eventData.getMember(), CacheEventType.PARTITION_LOST.getType(), eventData.getPartitionId());
partitionLostListener.partitionLost(event);
}
use of com.hazelcast.cache.impl.CachePartitionEventData in project hazelcast by hazelcast.
the class CachePartitionLostListenerTest method test_cachePartitionEventData_serialization.
@Test
public void test_cachePartitionEventData_serialization() throws IOException {
CachePartitionEventData cachePartitionEventData = new CachePartitionEventData("cacheName", 1, null);
ObjectDataOutput output = mock(ObjectDataOutput.class);
cachePartitionEventData.writeData(output);
verify(output).writeUTF("cacheName");
verify(output).writeInt(1);
}
Aggregations