File tree Expand file tree Collapse file tree 5 files changed +86
-1
lines changed
dubbo-filter/dubbo-filter-cache
src/test/java/com/alibaba/dubbo/cache/support Expand file tree Collapse file tree 5 files changed +86
-1
lines changed Original file line number Diff line number Diff line change 2828 <description >The cache module of dubbo project</description >
2929 <properties >
3030 <skip_maven_deploy >false</skip_maven_deploy >
31+ <hazelcast_version >3.9-EA</hazelcast_version >
3132 </properties >
3233 <dependencies >
3334 <dependency >
4243 <dependency >
4344 <groupId >com.hazelcast</groupId >
4445 <artifactId >hazelcast</artifactId >
45- <version >3.9-EA </version >
46+ <version >${hazelcast_version} </version >
4647 </dependency >
4748 </dependencies >
4849</project >
Original file line number Diff line number Diff line change 1+ package com .alibaba .dubbo .cache .support ;
2+
3+ import com .alibaba .dubbo .cache .Cache ;
4+ import com .alibaba .dubbo .common .URL ;
5+ import com .alibaba .dubbo .rpc .Invocation ;
6+ import com .alibaba .dubbo .rpc .RpcInvocation ;
7+
8+ public abstract class AbstractCacheFactoryTest {
9+
10+ protected Cache constructCache () {
11+ URL url = URL .valueOf ("test://test:11/test?cache=jcache" );
12+ Invocation invocation = new RpcInvocation ();
13+ return getCacheFactory ().getCache (url , invocation );
14+ }
15+
16+ protected abstract AbstractCacheFactory getCacheFactory ();
17+ }
Original file line number Diff line number Diff line change 1+ package com .alibaba .dubbo .cache .support .jcache ;
2+
3+ import com .alibaba .dubbo .cache .Cache ;
4+ import com .alibaba .dubbo .cache .support .AbstractCacheFactory ;
5+ import com .alibaba .dubbo .cache .support .AbstractCacheFactoryTest ;
6+ import org .junit .Test ;
7+
8+ import static org .hamcrest .core .Is .is ;
9+ import static org .junit .Assert .assertThat ;
10+
11+ public class JCacheFactoryTest extends AbstractCacheFactoryTest {
12+
13+ @ Test
14+ public void testJCacheFactory () throws Exception {
15+ Cache cache = super .constructCache ();
16+ assertThat (cache instanceof JCache , is (true ));
17+ }
18+
19+ @ Override
20+ protected AbstractCacheFactory getCacheFactory () {
21+ return new JCacheFactory ();
22+ }
23+ }
Original file line number Diff line number Diff line change 1+ package com .alibaba .dubbo .cache .support .lru ;
2+
3+ import com .alibaba .dubbo .cache .Cache ;
4+ import com .alibaba .dubbo .cache .support .AbstractCacheFactory ;
5+ import com .alibaba .dubbo .cache .support .AbstractCacheFactoryTest ;
6+ import org .junit .Test ;
7+
8+ import static org .hamcrest .core .Is .is ;
9+ import static org .junit .Assert .assertThat ;
10+
11+ public class LruCacheFactoryTest extends AbstractCacheFactoryTest {
12+ @ Test
13+ public void testLruCacheFactory () throws Exception {
14+ Cache cache = super .constructCache ();
15+ assertThat (cache instanceof LruCache , is (true ));
16+ }
17+
18+ @ Override
19+ protected AbstractCacheFactory getCacheFactory () {
20+ return new LruCacheFactory ();
21+ }
22+ }
Original file line number Diff line number Diff line change 1+ package com .alibaba .dubbo .cache .support .threadlocal ;
2+
3+ import com .alibaba .dubbo .cache .Cache ;
4+ import com .alibaba .dubbo .cache .support .AbstractCacheFactory ;
5+ import com .alibaba .dubbo .cache .support .AbstractCacheFactoryTest ;
6+ import org .junit .Test ;
7+
8+ import static org .hamcrest .core .Is .is ;
9+ import static org .junit .Assert .assertThat ;
10+
11+ public class ThreadLocalCacheFactoryTest extends AbstractCacheFactoryTest {
12+ @ Test
13+ public void testThreadLocalCacheFactory () throws Exception {
14+ Cache cache = super .constructCache ();
15+ assertThat (cache instanceof ThreadLocalCache , is (true ));
16+ }
17+
18+ @ Override
19+ protected AbstractCacheFactory getCacheFactory () {
20+ return new ThreadLocalCacheFactory ();
21+ }
22+ }
You can’t perform that action at this time.
0 commit comments