use of com.hazelcast.core.MigrationEvent in project hazelcast by hazelcast.
the class MigrationListenerAdapterTest method test_migrationFailed.
@Test
public void test_migrationFailed() {
final MigrationEvent event = new MigrationEvent(0, null, null, FAILED);
adapter.onEvent(event);
verify(listener, never()).migrationStarted(any(MigrationEvent.class));
verify(listener, never()).migrationCompleted(any(MigrationEvent.class));
verify(listener).migrationFailed(event);
}
use of com.hazelcast.core.MigrationEvent in project hazelcast by hazelcast.
the class MigrationListenerAdapterTest method test_migrationEvent_deserialization.
@Test
public void test_migrationEvent_deserialization() throws IOException {
final ObjectDataInput input = mock(ObjectDataInput.class);
when(input.readInt()).thenReturn(0);
when(input.readObject()).thenReturn(null);
when(input.readObject()).thenReturn(null);
when(input.readByte()).thenReturn((byte) 0);
final MigrationEvent event = new MigrationEvent();
event.readData(input);
assertEquals(0, event.getPartitionId());
assertNull(event.getOldOwner());
assertNull(event.getNewOwner());
assertEquals(STARTED, event.getStatus());
}
use of com.hazelcast.core.MigrationEvent in project hazelcast by hazelcast.
the class MigrationListenerAdapterTest method test_migrationEvent_serialization.
@Test
public void test_migrationEvent_serialization() throws IOException {
final MigrationEvent event = new MigrationEvent(0, null, null, STARTED);
final ObjectDataOutput output = mock(ObjectDataOutput.class);
event.writeData(output);
verify(output).writeInt(0);
verify(output, times(2)).writeObject(null);
verify(output).writeByte(0);
}
use of com.hazelcast.core.MigrationEvent in project hazelcast by hazelcast.
the class MigrationListenerAdapterTest method test_migrationStarted.
@Test
public void test_migrationStarted() {
final MigrationEvent event = new MigrationEvent(0, null, null, STARTED);
adapter.onEvent(event);
verify(listener).migrationStarted(event);
verify(listener, never()).migrationCompleted(any(MigrationEvent.class));
verify(listener, never()).migrationFailed(any(MigrationEvent.class));
}
use of com.hazelcast.core.MigrationEvent in project hazelcast by hazelcast.
the class MigrationListenerAdapterTest method test_migrationCompleted.
@Test
public void test_migrationCompleted() {
final MigrationEvent event = new MigrationEvent(0, null, null, COMPLETED);
adapter.onEvent(event);
verify(listener, never()).migrationStarted(any(MigrationEvent.class));
verify(listener).migrationCompleted(event);
verify(listener, never()).migrationFailed(any(MigrationEvent.class));
}
Aggregations