DEC-15442 feat: 状态服务器适配适配腾讯云redis,插件初始化, finekit适配 #2
Merged
richie
merged 2 commits from :master
into master
4 years ago
10 changed files with 115 additions and 14 deletions
@ -0,0 +1,16 @@
|
||||
package com.fanruan.api.cluster.state; |
||||
|
||||
import com.fr.collections.FineCollections; |
||||
import com.fr.collections.api.FineCollectionClient; |
||||
|
||||
/** |
||||
* @author Dylan.Liu |
||||
* @version 10.0 |
||||
* Created by Dylan.Liu on 2020/10/16 |
||||
*/ |
||||
public class FineCollectionsKit { |
||||
|
||||
public static FineCollectionClient getClient() { |
||||
return FineCollections.getInstance().getClient(); |
||||
} |
||||
} |
@ -0,0 +1,15 @@
|
||||
package com.fanruan.api.cluster.state; |
||||
|
||||
import com.fr.store.impl.StoreTemplate; |
||||
|
||||
/** |
||||
* @author Dylan.Liu |
||||
* @version 10.0 |
||||
* Created by Dylan.Liu on 2020/10/16 |
||||
*/ |
||||
public class StoreTemplateKit { |
||||
|
||||
public static void close(){ |
||||
StoreTemplate.getInstance().close(); |
||||
} |
||||
} |
@ -0,0 +1,24 @@
|
||||
package com.fanruan.api.cluster.state; |
||||
|
||||
import com.fr.collections.api.FineCollectionClient; |
||||
import com.fr.collections.api.FineCollectionClientWrapper; |
||||
import org.junit.Test; |
||||
|
||||
import static org.easymock.EasyMock.*; |
||||
import static org.junit.Assert.*; |
||||
|
||||
/** |
||||
* @author Dylan.Liu |
||||
* @version 10.0 |
||||
* Created by Dylan.Liu on 2020/10/23 |
||||
*/ |
||||
public class FineCollectionsKitTest { |
||||
|
||||
@Test |
||||
public void testGetClient() throws Exception { |
||||
// test
|
||||
FineCollectionClient client = FineCollectionsKit.getClient(); |
||||
|
||||
assertTrue(client instanceof FineCollectionClientWrapper); |
||||
} |
||||
} |
@ -0,0 +1,39 @@
|
||||
package com.fanruan.api.cluster.state; |
||||
|
||||
import com.fr.ftp.client.FineSFTPClient; |
||||
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 2020/10/23 |
||||
*/ |
||||
@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