|
|
|
@ -1,8 +1,8 @@
|
|
|
|
|
package com.fanruan.api.cluster.state; |
|
|
|
|
|
|
|
|
|
import com.fr.store.impl.redis.accessor.FineJedis; |
|
|
|
|
import com.fr.store.impl.redis.accessor.FineJedisPool; |
|
|
|
|
import com.fr.store.impl.redis.accessor.FineJedisWrapper; |
|
|
|
|
import com.fr.store.impl.accessor.FineStore; |
|
|
|
|
import com.fr.store.impl.accessor.FineStorePool; |
|
|
|
|
import com.fr.store.impl.accessor.FineStoreWrapper; |
|
|
|
|
import org.easymock.EasyMock; |
|
|
|
|
import org.junit.Assert; |
|
|
|
|
import org.junit.Test; |
|
|
|
@ -21,10 +21,10 @@ public class FineJedisPoolKitTest {
|
|
|
|
|
@Test |
|
|
|
|
public void TestSetRealClient() { |
|
|
|
|
|
|
|
|
|
FineJedisPoolKit.setRealClient(new FineJedisWrapper() { |
|
|
|
|
FineJedisPoolKit.setRealClient(new FineStoreWrapper() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public FineJedis getResource() { |
|
|
|
|
public FineStore getResource() { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -33,16 +33,16 @@ public class FineJedisPoolKitTest {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
Assert.assertNull(FineJedisPool.getInstance().getResource()); |
|
|
|
|
Assert.assertNull(FineStorePool.getInstance().getResource()); |
|
|
|
|
|
|
|
|
|
FineJedis mockFineJedis = mock(FineJedis.class); |
|
|
|
|
FineStore mockFineJedis = mock(FineStore.class); |
|
|
|
|
expect(mockFineJedis.type(anyObject())).andReturn("TestFineJedis"); |
|
|
|
|
EasyMock.replay(mockFineJedis); |
|
|
|
|
|
|
|
|
|
FineJedisPoolKit.setRealClient(new FineJedisWrapper() { |
|
|
|
|
FineJedisPoolKit.setRealClient(new FineStoreWrapper() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public FineJedis getResource() { |
|
|
|
|
public FineStore getResource() { |
|
|
|
|
return mockFineJedis; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -51,7 +51,7 @@ public class FineJedisPoolKitTest {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
Assert.assertEquals("TestFineJedis", FineJedisPool.getInstance().getResource().type(new byte[]{})); |
|
|
|
|
Assert.assertEquals("TestFineJedis", FineStorePool.getInstance().getResource().type(new byte[]{})); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |