Skip to content

Commit 7692c29

Browse files
committed
add copyright and made small refactor
1 parent 11f80c1 commit 7692c29

File tree

6 files changed

+81
-2
lines changed

6 files changed

+81
-2
lines changed

dubbo-filter/dubbo-filter-cache/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
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>
3231
</properties>
3332
<dependencies>
3433
<dependency>
@@ -43,6 +42,7 @@
4342
<dependency>
4443
<groupId>com.hazelcast</groupId>
4544
<artifactId>hazelcast</artifactId>
45+
<scope>test</scope>
4646
<version>${hazelcast_version}</version>
4747
</dependency>
4848
</dependencies>

dubbo-filter/dubbo-filter-cache/src/test/java/com/alibaba/dubbo/cache/support/AbstractCacheFactoryTest.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
117
package com.alibaba.dubbo.cache.support;
218

319
import com.alibaba.dubbo.cache.Cache;
@@ -8,7 +24,7 @@
824
public abstract class AbstractCacheFactoryTest {
925

1026
protected Cache constructCache() {
11-
URL url = URL.valueOf("test://test:11/test?cache=jcache");
27+
URL url = URL.valueOf("test://test:11/test?cache=lru");
1228
Invocation invocation = new RpcInvocation();
1329
return getCacheFactory().getCache(url, invocation);
1430
}

dubbo-filter/dubbo-filter-cache/src/test/java/com/alibaba/dubbo/cache/support/jcache/JCacheFactoryTest.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
117
package com.alibaba.dubbo.cache.support.jcache;
218

319
import com.alibaba.dubbo.cache.Cache;
420
import com.alibaba.dubbo.cache.support.AbstractCacheFactory;
521
import com.alibaba.dubbo.cache.support.AbstractCacheFactoryTest;
22+
import com.alibaba.dubbo.common.URL;
23+
import com.alibaba.dubbo.rpc.Invocation;
24+
import com.alibaba.dubbo.rpc.RpcInvocation;
625
import org.junit.Test;
726

827
import static org.hamcrest.core.Is.is;
28+
import static org.junit.Assert.assertNull;
929
import static org.junit.Assert.assertThat;
1030

1131
public class JCacheFactoryTest extends AbstractCacheFactoryTest {
@@ -16,6 +36,16 @@ public void testJCacheFactory() throws Exception {
1636
assertThat(cache instanceof JCache, is(true));
1737
}
1838

39+
@Test
40+
public void testJCacheGetExpired() throws Exception {
41+
URL url = URL.valueOf("test://test:11/test?cache=jacache&.cache.write.expire=1");
42+
AbstractCacheFactory cacheFactory = getCacheFactory();
43+
Invocation invocation = new RpcInvocation();
44+
Cache cache = cacheFactory.getCache(url, invocation);
45+
cache.put("testKey", "testValue");
46+
assertNull(cache.get("testKey"));
47+
}
48+
1949
@Override
2050
protected AbstractCacheFactory getCacheFactory() {
2151
return new JCacheFactory();

dubbo-filter/dubbo-filter-cache/src/test/java/com/alibaba/dubbo/cache/support/lru/LruCacheFactoryTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
117
package com.alibaba.dubbo.cache.support.lru;
218

319
import com.alibaba.dubbo.cache.Cache;

dubbo-filter/dubbo-filter-cache/src/test/java/com/alibaba/dubbo/cache/support/threadlocal/ThreadLocalCacheFactoryTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
117
package com.alibaba.dubbo.cache.support.threadlocal;
218

319
import com.alibaba.dubbo.cache.Cache;

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
<properties>
9090
<!-- Test libs -->
9191
<junit_version>4.12</junit_version>
92+
<hazelcast_version>3.9-EA</hazelcast_version>
9293
<cglib_version>2.2</cglib_version>
9394
<mockito_version>2.18.3</mockito_version>
9495
<!-- Build args -->

0 commit comments

Comments
 (0)