Search in sources :

Example 1 with ConfigGetMinSlavesToWrite

use of com.ctrip.xpipe.redis.core.protocal.cmd.ConfigGetCommand.ConfigGetMinSlavesToWrite in project x-pipe by ctripcorp.

the class ConfigCommandTest method testConfigMinSlaves.

@Test
public void testConfigMinSlaves() throws InterruptedException, ExecutionException, Exception {
    InetSocketAddress address = new InetSocketAddress(ip, port);
    Integer min = new ConfigGetMinSlavesToWrite(getXpipeNettyClientKeyedObjectPool().getKeyPool(address), scheduled).execute().get();
    logger.info("{}", min);
    Boolean result = new ConfigSetMinSlavesToWrite(getXpipeNettyClientKeyedObjectPool().getKeyPool(address), 100, scheduled).execute().get();
    logger.info("{}", result);
    min = new ConfigGetMinSlavesToWrite(getXpipeNettyClientKeyedObjectPool().getKeyPool(address), scheduled).execute().get();
    logger.info("{}", min);
}
Also used : InetSocketAddress(java.net.InetSocketAddress) ConfigGetMinSlavesToWrite(com.ctrip.xpipe.redis.core.protocal.cmd.ConfigGetCommand.ConfigGetMinSlavesToWrite) ConfigSetMinSlavesToWrite(com.ctrip.xpipe.redis.core.protocal.cmd.ConfigSetCommand.ConfigSetMinSlavesToWrite) AbstractRedisTest(com.ctrip.xpipe.redis.core.AbstractRedisTest) Test(org.junit.Test)

Example 2 with ConfigGetMinSlavesToWrite

use of com.ctrip.xpipe.redis.core.protocal.cmd.ConfigGetCommand.ConfigGetMinSlavesToWrite in project x-pipe by ctripcorp.

the class MinSlavesRedisReadOnlyTest method testMark.

// manual start redis at host:port
@Test
public void testMark() throws Exception {
    minSlavesRedisReadOnly.makeReadOnly();
    int number = new ConfigGetMinSlavesToWrite(getXpipeNettyClientKeyedObjectPool().getKeyPool(new InetSocketAddress(host, port)), scheduled).execute().get();
    Assert.assertEquals(MinSlavesRedisReadOnly.READ_ONLY_NUMBER, number);
    minSlavesRedisReadOnly.makeWritable();
    number = new ConfigGetMinSlavesToWrite(getXpipeNettyClientKeyedObjectPool().getKeyPool(new InetSocketAddress(host, port)), scheduled).execute().get();
    Assert.assertEquals(MinSlavesRedisReadOnly.WRITABLE_NUMBER, number);
}
Also used : InetSocketAddress(java.net.InetSocketAddress) ConfigGetMinSlavesToWrite(com.ctrip.xpipe.redis.core.protocal.cmd.ConfigGetCommand.ConfigGetMinSlavesToWrite) Test(org.junit.Test) AbstractMetaServerTest(com.ctrip.xpipe.redis.meta.server.AbstractMetaServerTest)

Aggregations

ConfigGetMinSlavesToWrite (com.ctrip.xpipe.redis.core.protocal.cmd.ConfigGetCommand.ConfigGetMinSlavesToWrite)2 InetSocketAddress (java.net.InetSocketAddress)2 Test (org.junit.Test)2 AbstractRedisTest (com.ctrip.xpipe.redis.core.AbstractRedisTest)1 ConfigSetMinSlavesToWrite (com.ctrip.xpipe.redis.core.protocal.cmd.ConfigSetCommand.ConfigSetMinSlavesToWrite)1 AbstractMetaServerTest (com.ctrip.xpipe.redis.meta.server.AbstractMetaServerTest)1