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
黄志磊
committed
Feb 4, 2016
1 parent
c88ff6e
commit 6a1ea57
Showing
11 changed files
with
64 additions
and
16 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...mpush/tools/redis/ConsistentHashTest.java → .../mpush/test/redis/ConsistentHashTest.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
40 changes: 40 additions & 0 deletions
40
mpush-test/src/main/java/com/shinemo/mpush/test/redis/PubSubTest.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,40 @@ | ||
package com.shinemo.mpush.test.redis; | ||
|
||
import java.util.List; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import com.google.common.collect.Lists; | ||
import com.shinemo.mpush.tools.redis.RedisGroup; | ||
import com.shinemo.mpush.tools.redis.RedisNode; | ||
import com.shinemo.mpush.tools.redis.RedisRegister; | ||
import com.shinemo.mpush.tools.redis.manage.RedisManage; | ||
import com.shinemo.mpush.tools.redis.pubsub.Subscriber; | ||
import com.shinemo.mpush.tools.spi.ServiceContainer; | ||
|
||
public class PubSubTest { | ||
|
||
private RedisRegister redisRegister = ServiceContainer.getInstance(RedisRegister.class); | ||
|
||
@Before | ||
public void init(){ | ||
RedisNode node = new RedisNode("127.0.0.1", 6379, "shinemoIpo"); | ||
RedisGroup group = new RedisGroup(); | ||
group.addRedisNode(node); | ||
List<RedisGroup> listGroup = Lists.newArrayList(group); | ||
redisRegister.init(listGroup); | ||
} | ||
|
||
@Test | ||
public void pubSubTest(){ | ||
|
||
RedisManage.subscribe(Subscriber.holder, "/hello/123"); | ||
|
||
RedisManage.subscribe(Subscriber.holder, "/hello/124"); | ||
|
||
RedisManage.publish("/hello/123", "123"); | ||
RedisManage.publish("/hello/124", "124"); | ||
} | ||
|
||
} |
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
File renamed without changes.
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
2 changes: 1 addition & 1 deletion
2
...a/com/shinemo/mpush/tools/redis/User.java → ...va/com/shinemo/mpush/test/redis/User.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
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
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
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
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
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