forked from ctripcorp/x-pipe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e9b3b4
commit 80f7cb9
Showing
2 changed files
with
66 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
.../test/java/com/ctrip/xpipe/redis/meta/server/dchange/impl/MinSlavesRedisReadOnlyTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.ctrip.xpipe.redis.meta.server.dchange.impl; | ||
|
||
import java.net.InetSocketAddress; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import com.ctrip.xpipe.redis.core.protocal.cmd.ConfigGetCommand.ConfigGetMinSlavesToWrite; | ||
import com.ctrip.xpipe.redis.meta.server.AbstractMetaServerTest; | ||
import com.ctrip.xpipe.redis.meta.server.dcchange.impl.MinSlavesRedisReadOnly; | ||
|
||
/** | ||
* | ||
* @author wenchao.meng | ||
* | ||
* Jan 22, 2017 | ||
*/ | ||
public class MinSlavesRedisReadOnlyTest extends AbstractMetaServerTest{ | ||
|
||
private MinSlavesRedisReadOnly minSlavesRedisReadOnly; | ||
private String host = "localhost"; | ||
private int port = 6379; | ||
|
||
|
||
@Before | ||
public void beforeMinSlavesRedisReadOnlyTest() throws Exception{ | ||
|
||
minSlavesRedisReadOnly = new MinSlavesRedisReadOnly(host, port, getXpipeNettyClientKeyedObjectPool(), scheduled); | ||
} | ||
|
||
@Test //manual start redis at host:port | ||
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); | ||
} | ||
|
||
} |