richie
4 years ago
9 changed files with 121 additions and 8 deletions
@ -0,0 +1,17 @@
|
||||
package com.fanruan.api.cluster.state; |
||||
|
||||
import com.fr.store.impl.accessor.api.impl.StandAloneStore; |
||||
import com.fr.third.redis.clients.jedis.Jedis; |
||||
|
||||
/** |
||||
* 单机<code>Redis API</code>层. |
||||
* |
||||
* @author Dylan.Liu |
||||
* @version 10.0 |
||||
* Created by Dylan.Liu on 2021/1/18 |
||||
*/ |
||||
public class BaseStandAloneStore extends StandAloneStore { |
||||
public BaseStandAloneStore(Jedis jedis) { |
||||
super(jedis); |
||||
} |
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.fanruan.api.cluster.state; |
||||
|
||||
import com.fr.collections.FineCollections; |
||||
|
||||
/** |
||||
* @author Dylan.Liu |
||||
* @version 10.0 |
||||
* Created by Dylan.Liu on 2021/1/18 |
||||
*/ |
||||
public class FineCollectionsKit { |
||||
|
||||
public FineCollectionsKit() {} |
||||
|
||||
/** |
||||
* 销毁集群集合 |
||||
*/ |
||||
public static void destroy() { |
||||
FineCollections.getInstance().getClient().destroy(); |
||||
} |
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.fanruan.api.cluster.state; |
||||
|
||||
import com.fr.collections.api.FineCollectionClient; |
||||
import com.fr.collections.api.FineCollectionClientWrapper; |
||||
import org.junit.Test; |
||||
|
||||
/** |
||||
* @author Dylan.Liu |
||||
* @version 10.0 |
||||
* Created by Dylan.Liu on 2021/1/19 |
||||
*/ |
||||
public class FineCollectionsKitTest { |
||||
|
||||
@Test |
||||
public void testGetClient() throws Exception { |
||||
// test
|
||||
FineCollectionsKit.destroy(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,38 @@
|
||||
package com.fanruan.api.cluster.state; |
||||
|
||||
import com.fr.store.impl.accessor.FineStorePool; |
||||
import org.junit.Test; |
||||
import org.junit.runner.RunWith; |
||||
import org.powermock.api.easymock.PowerMock; |
||||
import org.powermock.core.classloader.annotations.PrepareForTest; |
||||
import org.powermock.modules.junit4.PowerMockRunner; |
||||
|
||||
import static org.easymock.EasyMock.*; |
||||
import static org.junit.Assert.*; |
||||
|
||||
/** |
||||
* @author Dylan.Liu |
||||
* @version 10.0 |
||||
* Created by Dylan.Liu on 2021/1/19 |
||||
*/ |
||||
@RunWith(PowerMockRunner.class) |
||||
@PrepareForTest({FineStorePool.class}) |
||||
public class StoreTemplateKitTest { |
||||
|
||||
@Test |
||||
public void testClose() throws Exception { |
||||
// test
|
||||
FineStorePool fineStorePool = mock(FineStorePool.class); |
||||
fineStorePool.close(); |
||||
expectLastCall().times(1); |
||||
|
||||
PowerMock.mockStaticPartial(FineStorePool.class, "getPool"); |
||||
expect(FineStorePool.getPool()).andReturn(fineStorePool).times(1); |
||||
|
||||
PowerMock.replayAll(); |
||||
|
||||
StoreTemplateKit.close(); |
||||
|
||||
PowerMock.verifyAll(); |
||||
} |
||||
} |
Loading…
Reference in new issue