Search in sources :

Example 1 with DefaultKeeperMonitor

use of com.ctrip.xpipe.redis.keeper.monitor.impl.DefaultKeeperMonitor in project x-pipe by ctripcorp.

the class PsyncHandlerTest method beforePsyncHandlerTest.

@Before
public void beforePsyncHandlerTest() {
    when(redisSlave.getRedisKeeperServer()).thenReturn(redisKeeperServer);
    when(redisKeeperServer.getKeeperRepl()).thenReturn(keeperRepl);
    when(redisKeeperServer.getKeeperMonitor()).thenReturn(new DefaultKeeperMonitor(redisKeeperServer));
    when(redisKeeperServer.getKeeperConfig()).thenReturn(KeeperConfig);
    when(keeperRepl.getBeginOffset()).thenReturn(begin);
    when(keeperRepl.getEndOffset()).thenReturn(end);
    when(keeperRepl.replId()).thenReturn(replId);
    when(keeperRepl.replId2()).thenReturn(replId2);
    when(keeperRepl.secondReplIdOffset()).thenReturn(secondReplOffset);
    when(KeeperConfig.getReplicationStoreMaxCommandsToTransferBeforeCreateRdb()).thenReturn(maxToTransfer);
    psyncHandler = new PsyncHandler() {

        @Override
        protected void doPartialSync(RedisSlave redisSlave, String replId, Long offset) {
            function = PARTIAL;
        }

        @Override
        protected void doFullSync(RedisSlave redisSlave) {
            function = FULL;
        }

        @Override
        protected void waitForoffset(String[] args, RedisSlave redisSlave, String replId, Long offsetRequest) {
            function = WAIT;
        }
    };
}
Also used : DefaultKeeperMonitor(com.ctrip.xpipe.redis.keeper.monitor.impl.DefaultKeeperMonitor) RedisSlave(com.ctrip.xpipe.redis.keeper.RedisSlave) Before(org.junit.Before)

Aggregations

RedisSlave (com.ctrip.xpipe.redis.keeper.RedisSlave)1 DefaultKeeperMonitor (com.ctrip.xpipe.redis.keeper.monitor.impl.DefaultKeeperMonitor)1 Before (org.junit.Before)1