use of com.ctrip.xpipe.redis.console.migration.status.migration.MigrationCheckingState in project x-pipe by ctripcorp.
the class DefaultMigrationClusterTest2 method testUpdateStat.
@Test(expected = ServerException.class)
public void testUpdateStat() throws Exception {
AtomicInteger counter = new AtomicInteger(1);
when(clusterService.find(anyString())).thenReturn(clusterTbl);
doAnswer(new Answer() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
int currentCounter = counter.getAndIncrement();
if (currentCounter % 5 == 0) {
clusterTbl.setStatus(((ClusterStatus) invocation.getArguments()[1]).toString());
}
return null;
}
}).when(clusterService).updateStatusById(anyLong(), any());
migrationCluster.updateStat(new MigrationCheckingState(migrationCluster));
}
Aggregations