use of com.hazelcast.test.starter.constructor.DataAwareEntryEventConstructor in project hazelcast by hazelcast.
the class DataAwareEntryEventConstructorTest method testConstructor.
@Test
public void testConstructor() {
SerializationService serializationService = new DefaultSerializationServiceBuilder().build();
String key = "key";
String newValue = "newValue";
String oldValue = "oldValue";
String mergingValue = "mergingValue";
Member from = mock(Member.class);
int eventType = EntryEventType.MERGED.getType();
String source = UuidUtil.newUnsecureUuidString();
Data dataKey = serializationService.toData(key);
Data dataNewValue = serializationService.toData(newValue);
Data dataOldValue = serializationService.toData(oldValue);
Data dataMergingValue = serializationService.toData(mergingValue);
DataAwareEntryEvent dataAwareEntryEvent = new DataAwareEntryEvent(from, eventType, source, dataKey, dataNewValue, dataOldValue, dataMergingValue, serializationService);
DataAwareEntryEventConstructor constructor = new DataAwareEntryEventConstructor(DataAwareEntryEvent.class);
DataAwareEntryEvent clonedDataAwareEntryEvent = (DataAwareEntryEvent) constructor.createNew(dataAwareEntryEvent);
assertEquals(dataAwareEntryEvent.getName(), clonedDataAwareEntryEvent.getName());
assertEquals(dataAwareEntryEvent.getMember(), clonedDataAwareEntryEvent.getMember());
assertEquals(dataAwareEntryEvent.getEventType(), clonedDataAwareEntryEvent.getEventType());
assertEquals(dataAwareEntryEvent.getSource(), clonedDataAwareEntryEvent.getSource());
assertEquals(dataAwareEntryEvent.getKey(), clonedDataAwareEntryEvent.getKey());
assertEquals(dataAwareEntryEvent.getKeyData(), clonedDataAwareEntryEvent.getKeyData());
assertEquals(dataAwareEntryEvent.getValue(), clonedDataAwareEntryEvent.getValue());
assertEquals(dataAwareEntryEvent.getNewValueData(), clonedDataAwareEntryEvent.getNewValueData());
assertEquals(dataAwareEntryEvent.getOldValue(), clonedDataAwareEntryEvent.getOldValue());
assertEquals(dataAwareEntryEvent.getOldValueData(), clonedDataAwareEntryEvent.getOldValueData());
assertEquals(dataAwareEntryEvent.getMergingValue(), clonedDataAwareEntryEvent.getMergingValue());
assertEquals(dataAwareEntryEvent.getMergingValueData(), clonedDataAwareEntryEvent.getMergingValueData());
}
Aggregations