You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2016/08/15 07:38:31 UTC
[02/30] ignite git commit: IGNITE-3634 - SpringCacheManager should
support null values
IGNITE-3634 - SpringCacheManager should support null values
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/00f47d78
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/00f47d78
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/00f47d78
Branch: refs/heads/ignite-1926
Commit: 00f47d78216db5de75dda2a1b5fef2c1e65d9871
Parents: d945a5d
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Fri Aug 5 18:04:01 2016 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Fri Aug 5 18:04:01 2016 -0700
----------------------------------------------------------------------
.../apache/ignite/cache/spring/SpringCache.java | 44 +-
.../ignite/cache/spring/SpringCacheManager.java | 7 +-
.../spring/GridSpringCacheManagerSelfTest.java | 438 +++++++++++++++++++
.../cache/spring/GridSpringCacheTestKey.java | 61 +++
.../spring/GridSpringCacheTestKeyGenerator.java | 40 ++
.../spring/GridSpringCacheTestService.java | 181 ++++++++
.../GridSpringDynamicCacheTestService.java | 85 ++++
.../SpringCacheManagerContextInjectionTest.java | 125 ++++++
.../ignite/cache/spring/spring-caching.xml | 57 +++
.../spring/GridSpringCacheManagerSelfTest.java | 342 ---------------
.../ignite/spring/GridSpringCacheTestKey.java | 61 ---
.../spring/GridSpringCacheTestKeyGenerator.java | 40 --
.../spring/GridSpringCacheTestService.java | 125 ------
.../GridSpringDynamicCacheTestService.java | 85 ----
.../SpringCacheManagerContextInjectionTest.java | 126 ------
.../org/apache/ignite/spring/spring-caching.xml | 57 ---
.../testsuites/IgniteSpringTestSuite.java | 4 +-
17 files changed, 1032 insertions(+), 846 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCache.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCache.java b/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCache.java
index 6014205..afd060a 100644
--- a/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCache.java
+++ b/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCache.java
@@ -17,6 +17,7 @@
package org.apache.ignite.cache.spring;
+import java.io.Serializable;
import org.apache.ignite.IgniteCache;
import org.springframework.cache.Cache;
import org.springframework.cache.support.SimpleValueWrapper;
@@ -26,6 +27,9 @@ import org.springframework.cache.support.SimpleValueWrapper;
*/
class SpringCache implements Cache {
/** */
+ private static final Object NULL = new NullValue();
+
+ /** */
private final IgniteCache<Object, Object> cache;
/**
@@ -51,7 +55,7 @@ class SpringCache implements Cache {
@Override public ValueWrapper get(Object key) {
Object val = cache.get(key);
- return val != null ? new SimpleValueWrapper(val) : null;
+ return val != null ? fromValue(val) : null;
}
/** {@inheritDoc} */
@@ -59,6 +63,9 @@ class SpringCache implements Cache {
@Override public <T> T get(Object key, Class<T> type) {
Object val = cache.get(key);
+ if (NULL.equals(val))
+ val = null;
+
if (val != null && type != null && !type.isInstance(val))
throw new IllegalStateException("Cached value is not of required type [cacheName=" + cache.getName() +
", key=" + key + ", val=" + val + ", requiredType=" + type + ']');
@@ -68,14 +75,22 @@ class SpringCache implements Cache {
/** {@inheritDoc} */
@Override public void put(Object key, Object val) {
- cache.put(key, val);
+ if (val == null)
+ cache.withSkipStore().put(key, NULL);
+ else
+ cache.put(key, val);
}
/** {@inheritDoc} */
@Override public ValueWrapper putIfAbsent(Object key, Object val) {
- Object old = cache.putIfAbsent(key, val);
+ Object old;
+
+ if (val == null)
+ old = cache.withSkipStore().putIfAbsent(key, NULL);
+ else
+ old = cache.putIfAbsent(key, val);
- return old != null ? new SimpleValueWrapper(old) : null;
+ return old != null ? fromValue(old) : null;
}
/** {@inheritDoc} */
@@ -87,4 +102,23 @@ class SpringCache implements Cache {
@Override public void clear() {
cache.removeAll();
}
-}
\ No newline at end of file
+
+ /**
+ * @param val Cache value.
+ * @return Wrapped value.
+ */
+ private static ValueWrapper fromValue(Object val) {
+ assert val != null;
+
+ return new SimpleValueWrapper(NULL.equals(val) ? null : val);
+ }
+
+ /**
+ */
+ private static class NullValue implements Serializable {
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ return this == o || (o != null && getClass() == o.getClass());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCacheManager.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCacheManager.java b/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCacheManager.java
index 6d1a9b6..fbdeb73 100644
--- a/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCacheManager.java
+++ b/modules/spring/src/main/java/org/apache/ignite/cache/spring/SpringCacheManager.java
@@ -28,6 +28,7 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.jsr166.ConcurrentHashMap8;
import org.springframework.beans.factory.InitializingBean;
+import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
@@ -158,7 +159,7 @@ public class SpringCacheManager implements CacheManager, InitializingBean, Appli
/** Ignite instance. */
private Ignite ignite;
- /** Spring context */
+ /** Spring context. */
private ApplicationContext springCtx;
/** {@inheritDoc} */
@@ -276,7 +277,7 @@ public class SpringCacheManager implements CacheManager, InitializingBean, Appli
}
/** {@inheritDoc} */
- @Override public org.springframework.cache.Cache getCache(String name) {
+ @Override public Cache getCache(String name) {
assert ignite != null;
SpringCache cache = caches.get(name);
@@ -308,4 +309,4 @@ public class SpringCacheManager implements CacheManager, InitializingBean, Appli
return new ArrayList<>(caches.keySet());
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheManagerSelfTest.java b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheManagerSelfTest.java
new file mode 100644
index 0000000..601401c
--- /dev/null
+++ b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheManagerSelfTest.java
@@ -0,0 +1,438 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.cache.spring;
+
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * Spring cache test.
+ */
+public class GridSpringCacheManagerSelfTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static final String CACHE_NAME = "testCache";
+
+ /** */
+ private static final String DYNAMIC_CACHE_NAME = "dynamicCache";
+
+ /** */
+ private static final Object NULL;
+
+ /**
+ */
+ static {
+ try {
+ NULL = U.field(SpringCache.class, "NULL");
+ }
+ catch (IgniteCheckedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /** */
+ private GridSpringCacheTestService svc;
+
+ /** */
+ private GridSpringDynamicCacheTestService dynamicSvc;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ CacheConfiguration cache = new CacheConfiguration();
+
+ cache.setName(CACHE_NAME);
+
+ cfg.setCacheConfiguration(cache);
+
+ TcpDiscoverySpi disco = new TcpDiscoverySpi();
+
+ disco.setIpFinder(IP_FINDER);
+
+ cfg.setDiscoverySpi(disco);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override public String getTestGridName() {
+ return "testGrid";
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ startGrid();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ stopAllGrids();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ BeanFactory factory = new ClassPathXmlApplicationContext("org/apache/ignite/cache/spring/spring-caching.xml");
+
+ svc = (GridSpringCacheTestService)factory.getBean("testService");
+ dynamicSvc = (GridSpringDynamicCacheTestService)factory.getBean("dynamicTestService");
+
+ svc.reset();
+ dynamicSvc.reset();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ grid().cache(CACHE_NAME).removeAll();
+
+ grid().destroyCache(DYNAMIC_CACHE_NAME);
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSimpleKey() throws Exception {
+ for (int i = 0; i < 3; i++) {
+ assertEquals("value" + i, svc.simpleKey(i));
+ assertEquals("value" + i, svc.simpleKey(i));
+ }
+
+ assertEquals(3, svc.called());
+
+ IgniteCache<Integer, String> c = grid().cache(CACHE_NAME);
+
+ assertEquals(3, c.size());
+
+ for (int i = 0; i < 3; i++)
+ assertEquals("value" + i, c.get(i));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSimpleKeyNullValue() throws Exception {
+ for (int i = 0; i < 3; i++) {
+ assertNull(svc.simpleKeyNullValue(i));
+ assertNull(svc.simpleKeyNullValue(i));
+ }
+
+ assertEquals(3, svc.called());
+
+ IgniteCache<Integer, String> c = grid().cache(CACHE_NAME);
+
+ assertEquals(3, c.size());
+
+ for (int i = 0; i < 3; i++)
+ assertEquals(NULL, c.get(i));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testComplexKey() throws Exception {
+ for (int i = 0; i < 3; i++) {
+ assertEquals("value" + i + "suffix" + i, svc.complexKey(i, "suffix" + i));
+ assertEquals("value" + i + "suffix" + i, svc.complexKey(i, "suffix" + i));
+ }
+
+ assertEquals(3, svc.called());
+
+ IgniteCache<GridSpringCacheTestKey, String> c = grid().cache(CACHE_NAME);
+
+ assertEquals(3, c.size());
+
+ for (int i = 0; i < 3; i++)
+ assertEquals("value" + i + "suffix" + i, c.get(new GridSpringCacheTestKey(i, "suffix" + i)));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testComplexKeyNullValue() throws Exception {
+ for (int i = 0; i < 3; i++) {
+ assertNull(svc.complexKeyNullValue(i, "suffix" + i));
+ assertNull(svc.complexKeyNullValue(i, "suffix" + i));
+ }
+
+ assertEquals(3, svc.called());
+
+ IgniteCache<GridSpringCacheTestKey, String> c = grid().cache(CACHE_NAME);
+
+ assertEquals(3, c.size());
+
+ for (int i = 0; i < 3; i++)
+ assertEquals(NULL, c.get(new GridSpringCacheTestKey(i, "suffix" + i)));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSimpleKeyPut() throws Exception {
+ IgniteCache<Integer, String> c = grid().cache(CACHE_NAME);
+
+ for (int i = 0; i < 3; i++) {
+ assertEquals("value" + i + "odd", svc.simpleKeyPut(i));
+
+ assertEquals(i + 1, c.size());
+ assertEquals("value" + i + "odd", c.get(i));
+
+ assertEquals("value" + i + "even", svc.simpleKeyPut(i));
+
+ assertEquals(i + 1, c.size());
+ assertEquals("value" + i + "even", c.get(i));
+ }
+
+ assertEquals(6, svc.called());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSimpleKeyPutNullValue() throws Exception {
+ IgniteCache<Integer, String> c = grid().cache(CACHE_NAME);
+
+ for (int i = 0; i < 3; i++) {
+ assertNull(svc.simpleKeyPutNullValue(i));
+
+ assertEquals(i + 1, c.size());
+ assertEquals(NULL, c.get(i));
+
+ assertNull(svc.simpleKeyPutNullValue(i));
+
+ assertEquals(i + 1, c.size());
+ assertEquals(NULL, c.get(i));
+ }
+
+ assertEquals(6, svc.called());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testComplexKeyPut() throws Exception {
+ IgniteCache<GridSpringCacheTestKey, String> c = grid().cache(CACHE_NAME);
+
+ for (int i = 0; i < 3; i++) {
+ assertEquals("value" + i + "suffix" + i + "odd", svc.complexKeyPut(i, "suffix" + i));
+
+ assertEquals(i + 1, c.size());
+ assertEquals("value" + i + "suffix" + i + "odd", c.get(new GridSpringCacheTestKey(i, "suffix" + i)));
+
+ assertEquals("value" + i + "suffix" + i + "even", svc.complexKeyPut(i, "suffix" + i));
+
+ assertEquals(i + 1, c.size());
+ assertEquals("value" + i + "suffix" + i + "even", c.get(new GridSpringCacheTestKey(i, "suffix" + i)));
+ }
+
+ assertEquals(6, svc.called());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testComplexKeyPutNullValue() throws Exception {
+ IgniteCache<GridSpringCacheTestKey, String> c = grid().cache(CACHE_NAME);
+
+ for (int i = 0; i < 3; i++) {
+ assertNull(svc.complexKeyPutNullValue(i, "suffix" + i));
+
+ assertEquals(i + 1, c.size());
+ assertEquals(NULL, c.get(new GridSpringCacheTestKey(i, "suffix" + i)));
+
+ assertNull(svc.complexKeyPutNullValue(i, "suffix" + i));
+
+ assertEquals(i + 1, c.size());
+ assertEquals(NULL, c.get(new GridSpringCacheTestKey(i, "suffix" + i)));
+ }
+
+ assertEquals(6, svc.called());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSimpleKeyEvict() throws Exception {
+ IgniteCache<Integer, String> c = grid().cache(CACHE_NAME);
+
+ for (int i = 0; i < 3; i++)
+ c.put(i, "value" + i);
+
+ assertEquals(3, c.size());
+
+ assertEquals("value0", c.get(0));
+ assertEquals("value1", c.get(1));
+ assertEquals("value2", c.get(2));
+
+ svc.simpleKeyEvict(2);
+
+ assertEquals(2, c.size());
+
+ assertEquals("value0", c.get(0));
+ assertEquals("value1", c.get(1));
+ assertNull(c.get(2));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testComplexKeyEvict() throws Exception {
+ IgniteCache<GridSpringCacheTestKey, String> c = grid().cache(CACHE_NAME);
+
+ for (int i = 0; i < 3; i++)
+ c.put(new GridSpringCacheTestKey(i, "suffix" + i), "value" + i);
+
+ assertEquals(3, c.size());
+
+ assertEquals("value0", c.get(new GridSpringCacheTestKey(0, "suffix" + 0)));
+ assertEquals("value1", c.get(new GridSpringCacheTestKey(1, "suffix" + 1)));
+ assertEquals("value2", c.get(new GridSpringCacheTestKey(2, "suffix" + 2)));
+
+ svc.complexKeyEvict(2, "suffix" + 2);
+
+ assertEquals(2, c.size());
+
+ assertEquals("value0", c.get(new GridSpringCacheTestKey(0, "suffix" + 0)));
+ assertEquals("value1", c.get(new GridSpringCacheTestKey(1, "suffix" + 1)));
+ assertNull(c.get(new GridSpringCacheTestKey(2, "suffix" + 2)));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testEvictAll() throws Exception {
+ IgniteCache<Integer, String> c = grid().cache(CACHE_NAME);
+
+ for (int i = 0; i < 3; i++)
+ c.put(i, "value" + i);
+
+ assertEquals(3, c.size());
+
+ assertEquals("value0", c.get(0));
+ assertEquals("value1", c.get(1));
+ assertEquals("value2", c.get(2));
+
+ svc.evictAll();
+
+ assertEquals(0, c.size());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDynamicCache() throws Exception {
+ for (int i = 0; i < 3; i++) {
+ assertEquals("value" + i, dynamicSvc.cacheable(i));
+ assertEquals("value" + i, dynamicSvc.cacheable(i));
+ }
+
+ assertEquals(3, dynamicSvc.called());
+
+ IgniteCache<Integer, String> c = grid().cache(DYNAMIC_CACHE_NAME);
+
+ // Check that correct config is used.
+ assertEquals(2, c.getConfiguration(CacheConfiguration.class).getBackups());
+
+ assertEquals(3, c.size());
+
+ for (int i = 0; i < 3; i++)
+ assertEquals("value" + i, c.get(i));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDynamicCachePut() throws Exception {
+ for (int i = 0; i < 3; i++) {
+ assertEquals("value" + i, dynamicSvc.cachePut(i));
+ assertEquals("value" + i, dynamicSvc.cachePut(i));
+ }
+
+ assertEquals(6, dynamicSvc.called());
+
+ IgniteCache<Integer, String> c = grid().cache(DYNAMIC_CACHE_NAME);
+
+ // Check that correct config is used.
+ assertEquals(2, c.getConfiguration(CacheConfiguration.class).getBackups());
+
+ assertEquals(3, c.size());
+
+ for (int i = 0; i < 3; i++)
+ assertEquals("value" + i, c.get(i));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDynamicCacheEvict() throws Exception {
+ CacheConfiguration<Integer, String> cacheCfg = new CacheConfiguration<>();
+
+ cacheCfg.setName(DYNAMIC_CACHE_NAME);
+
+ IgniteCache<Integer, String> c = grid().createCache(cacheCfg);
+
+ for (int i = 0; i < 3; i++)
+ c.put(i, "value" + i);
+
+ assertEquals(3, c.size());
+
+ for (int i = 0; i < 2; i++) {
+ dynamicSvc.cacheEvict(i);
+ dynamicSvc.cacheEvict(i);
+ }
+
+ assertEquals(4, dynamicSvc.called());
+
+ assertEquals(1, c.size());
+
+ assertEquals("value2", c.get(2));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testDynamicCacheEvictAll() throws Exception {
+ CacheConfiguration<Integer, String> cacheCfg = new CacheConfiguration<>();
+
+ cacheCfg.setName(DYNAMIC_CACHE_NAME);
+
+ IgniteCache<Integer, String> c = grid().createCache(cacheCfg);
+
+ for (int i = 0; i < 3; i++)
+ c.put(i, "value" + i);
+
+ assertEquals(3, c.size());
+
+ dynamicSvc.cacheEvictAll();
+ dynamicSvc.cacheEvictAll();
+
+ assertEquals(2, dynamicSvc.called());
+
+ assertEquals(0, c.size());
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestKey.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestKey.java b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestKey.java
new file mode 100644
index 0000000..3f55112
--- /dev/null
+++ b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestKey.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.cache.spring;
+
+import java.io.Serializable;
+
+/**
+ * Complex key.
+ */
+public class GridSpringCacheTestKey implements Serializable {
+ /** */
+ private final Integer p1;
+
+ /** */
+ private final String p2;
+
+ /**
+ * @param p1 Parameter 1.
+ * @param p2 Parameter 2.
+ */
+ public GridSpringCacheTestKey(Integer p1, String p2) {
+ assert p1 != null;
+ assert p2 != null;
+
+ this.p1 = p1;
+ this.p2 = p2;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean equals(Object o) {
+ if (this == o)
+ return true;
+
+ if (o == null || getClass() != o.getClass())
+ return false;
+
+ GridSpringCacheTestKey key = (GridSpringCacheTestKey)o;
+
+ return p1.equals(key.p1) && p2.equals(key.p2);
+ }
+
+ /** {@inheritDoc} */
+ @Override public int hashCode() {
+ return 31 * p1 + p2.hashCode();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestKeyGenerator.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestKeyGenerator.java b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestKeyGenerator.java
new file mode 100644
index 0000000..7bab6cb
--- /dev/null
+++ b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestKeyGenerator.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.cache.spring;
+
+import java.lang.reflect.Method;
+import org.springframework.cache.interceptor.KeyGenerator;
+
+/**
+ * Key generator.
+ */
+public class GridSpringCacheTestKeyGenerator implements KeyGenerator {
+ /** {@inheritDoc} */
+ @Override public Object generate(Object target, Method mtd, Object... params) {
+ assert params != null;
+ assert params.length > 0;
+
+ if (params.length == 1)
+ return params[0];
+ else {
+ assert params.length == 2;
+
+ return new GridSpringCacheTestKey((Integer)params[0], (String)params[1]);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestService.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestService.java b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestService.java
new file mode 100644
index 0000000..544997d
--- /dev/null
+++ b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringCacheTestService.java
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.cache.spring;
+
+import java.util.concurrent.atomic.AtomicInteger;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.CachePut;
+import org.springframework.cache.annotation.Cacheable;
+
+/**
+ * Test service.
+ */
+public class GridSpringCacheTestService {
+ /** */
+ private final AtomicInteger cnt = new AtomicInteger();
+
+ /**
+ * @return How many times service was called.
+ */
+ public int called() {
+ return cnt.get();
+ }
+
+ /**
+ * Resets service.
+ */
+ public void reset() {
+ cnt.set(0);
+ }
+
+ /**
+ * @param key Key.
+ * @return Value.
+ */
+ @Cacheable("testCache")
+ public String simpleKey(Integer key) {
+ assert key != null;
+
+ cnt.incrementAndGet();
+
+ return "value" + key;
+ }
+
+ /**
+ * @param key Key.
+ * @return Value.
+ */
+ @Cacheable("testCache")
+ public String simpleKeyNullValue(Integer key) {
+ assert key != null;
+
+ cnt.incrementAndGet();
+
+ return null;
+ }
+
+ /**
+ * @param p1 Parameter 1.
+ * @param p2 Parameter 2.
+ * @return Value.
+ */
+ @Cacheable("testCache")
+ public String complexKey(Integer p1, String p2) {
+ assert p1 != null;
+ assert p2 != null;
+
+ cnt.incrementAndGet();
+
+ return "value" + p1 + p2;
+ }
+
+ /**
+ * @param p1 Parameter 1.
+ * @param p2 Parameter 2.
+ * @return Value.
+ */
+ @Cacheable("testCache")
+ public String complexKeyNullValue(Integer p1, String p2) {
+ assert p1 != null;
+ assert p2 != null;
+
+ cnt.incrementAndGet();
+
+ return null;
+ }
+
+ /**
+ * @param key Key.
+ * @return Value.
+ */
+ @CachePut("testCache")
+ public String simpleKeyPut(Integer key) {
+ assert key != null;
+
+ int cnt0 = cnt.incrementAndGet();
+
+ return "value" + key + (cnt0 % 2 == 0 ? "even" : "odd");
+ }
+
+ /**
+ * @param key Key.
+ * @return Value.
+ */
+ @CachePut("testCache")
+ public String simpleKeyPutNullValue(Integer key) {
+ assert key != null;
+
+ cnt.incrementAndGet();
+
+ return null;
+ }
+
+ /**
+ * @param p1 Parameter 1.
+ * @param p2 Parameter 2.
+ * @return Value.
+ */
+ @CachePut("testCache")
+ public String complexKeyPut(Integer p1, String p2) {
+ assert p1 != null;
+ assert p2 != null;
+
+ int cnt0 = cnt.incrementAndGet();
+
+ return "value" + p1 + p2 + (cnt0 % 2 == 0 ? "even" : "odd");
+ }
+
+ /**
+ * @param p1 Parameter 1.
+ * @param p2 Parameter 2.
+ * @return Value.
+ */
+ @CachePut("testCache")
+ public String complexKeyPutNullValue(Integer p1, String p2) {
+ assert p1 != null;
+ assert p2 != null;
+
+ cnt.incrementAndGet();
+
+ return null;
+ }
+
+ /**
+ * @param key Key.
+ */
+ @CacheEvict("testCache")
+ public void simpleKeyEvict(Integer key) {
+ // No-op.
+ }
+
+ /**
+ * @param p1 Parameter 1.
+ * @param p2 Parameter 2.
+ */
+ @CacheEvict("testCache")
+ public void complexKeyEvict(Integer p1, String p2) {
+ // No-op.
+ }
+
+ /**
+ */
+ @CacheEvict(value = "testCache", allEntries = true)
+ public void evictAll() {
+ // No-op.
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringDynamicCacheTestService.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringDynamicCacheTestService.java b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringDynamicCacheTestService.java
new file mode 100644
index 0000000..6584277
--- /dev/null
+++ b/modules/spring/src/test/java/org/apache/ignite/cache/spring/GridSpringDynamicCacheTestService.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.cache.spring;
+
+import java.util.concurrent.atomic.AtomicInteger;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.CachePut;
+import org.springframework.cache.annotation.Cacheable;
+
+/**
+ * Test service.
+ */
+public class GridSpringDynamicCacheTestService {
+ /** */
+ private final AtomicInteger cnt = new AtomicInteger();
+
+ /**
+ * @param key Key.
+ * @return Value.
+ */
+ @Cacheable("dynamicCache")
+ public String cacheable(Integer key) {
+ assert key != null;
+
+ cnt.incrementAndGet();
+
+ return "value" + key;
+ }
+
+ /**
+ * @param key Key.
+ * @return Value.
+ */
+ @CachePut("dynamicCache")
+ public String cachePut(Integer key) {
+ assert key != null;
+
+ cnt.incrementAndGet();
+
+ return "value" + key;
+ }
+
+ /**
+ * @param key Key.
+ */
+ @CacheEvict("dynamicCache")
+ public void cacheEvict(Integer key) {
+ cnt.incrementAndGet();
+ }
+
+ /**
+ */
+ @CacheEvict(value = "dynamicCache", allEntries = true)
+ public void cacheEvictAll() {
+ cnt.incrementAndGet();
+ }
+
+ /**
+ * @return Calls count.
+ */
+ public int called() {
+ return cnt.get();
+ }
+
+ /**
+ */
+ public void reset() {
+ cnt.set(0);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/cache/spring/SpringCacheManagerContextInjectionTest.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/cache/spring/SpringCacheManagerContextInjectionTest.java b/modules/spring/src/test/java/org/apache/ignite/cache/spring/SpringCacheManagerContextInjectionTest.java
new file mode 100644
index 0000000..0a898b6
--- /dev/null
+++ b/modules/spring/src/test/java/org/apache/ignite/cache/spring/SpringCacheManagerContextInjectionTest.java
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.cache.spring;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.TestInjectionLifecycleBean;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgnitionEx;
+import org.apache.ignite.lifecycle.LifecycleBean;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.context.annotation.AnnotationConfigApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ *
+ */
+public class SpringCacheManagerContextInjectionTest extends GridCommonAbstractTest {
+ /**
+ * @throws Exception If failed.
+ */
+ public void testBeanInjectionUsingConfigPath() throws Exception {
+ new AnnotationConfigApplicationContext(TestPathConfiguration.class);
+
+ Ignite grid = IgnitionEx.grid("springInjectionTest");
+
+ IgniteConfiguration cfg = grid.configuration();
+
+ LifecycleBean[] beans = cfg.getLifecycleBeans();
+
+ assertEquals(2, beans.length);
+
+ TestInjectionLifecycleBean bean1 = (TestInjectionLifecycleBean)beans[0];
+ TestInjectionLifecycleBean bean2 = (TestInjectionLifecycleBean)beans[1];
+
+ bean1.checkState();
+ bean2.checkState();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testBeanInjectionUsingConfiguration() throws Exception {
+ BeanFactory factory = new AnnotationConfigApplicationContext(TestCfgConfiguration.class);
+
+ TestInjectionLifecycleBean bean1 = (TestInjectionLifecycleBean)factory.getBean("bean1");
+ TestInjectionLifecycleBean bean2 = (TestInjectionLifecycleBean)factory.getBean("bean2");
+
+ bean1.checkState();
+ bean2.checkState();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ super.afterTest();
+ }
+
+ /** */
+ @SuppressWarnings("WeakerAccess")
+ @Configuration
+ static class TestPathConfiguration {
+ /** */
+ @Bean(name = "mgr")
+ public SpringCacheManager springCacheManager() {
+ SpringCacheManager mgr = new SpringCacheManager();
+
+ mgr.setConfigurationPath("org/apache/ignite/spring-injection-test.xml");
+
+ return mgr;
+ }
+ }
+
+ /** */
+ @SuppressWarnings("WeakerAccess")
+ @Configuration
+ static class TestCfgConfiguration {
+ /** */
+ @Bean(name = "mgr")
+ public SpringCacheManager springCacheManager() {
+ IgniteConfiguration cfg = new IgniteConfiguration();
+
+ cfg.setLocalHost("127.0.0.1");
+
+ cfg.setGridName("scmt");
+
+ cfg.setLifecycleBeans(bean1(), bean2());
+
+ SpringCacheManager mgr = new SpringCacheManager();
+
+ mgr.setConfiguration(cfg);
+
+ return mgr;
+ }
+
+ /** */
+ @Bean(name = "bean1")
+ LifecycleBean bean1() {
+ return new TestInjectionLifecycleBean();
+ }
+
+ /** */
+ @Bean(name = "bean2")
+ LifecycleBean bean2() {
+ return new TestInjectionLifecycleBean();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/cache/spring/spring-caching.xml
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/cache/spring/spring-caching.xml b/modules/spring/src/test/java/org/apache/ignite/cache/spring/spring-caching.xml
new file mode 100644
index 0000000..355f6e0
--- /dev/null
+++ b/modules/spring/src/test/java/org/apache/ignite/cache/spring/spring-caching.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cache="http://www.springframework.org/schema/cache"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">
+ <!--
+ Test service with cacheable methods.
+ -->
+ <bean id="testService" class="org.apache.ignite.cache.spring.GridSpringCacheTestService"/>
+
+ <!--
+ Test service with cacheable methods (dynamic cache).
+ -->
+ <bean id="dynamicTestService" class="org.apache.ignite.cache.spring.GridSpringDynamicCacheTestService"/>
+
+ <!--
+ Cache manager.
+ -->
+ <bean id="cacheManager" class="org.apache.ignite.cache.spring.SpringCacheManager">
+ <property name="gridName" value="testGrid"/>
+ <property name="dynamicCacheConfiguration">
+ <bean class="org.apache.ignite.configuration.CacheConfiguration">
+ <property name="backups" value="2"/>
+ </bean>
+ </property>
+ </bean>
+
+ <!--
+ Key generator.
+ -->
+ <bean id="keyGenerator" class="org.apache.ignite.cache.spring.GridSpringCacheTestKeyGenerator"/>
+
+ <!--
+ Enable annotation-driver configuration for caching.
+ -->
+ <cache:annotation-driven key-generator="keyGenerator"/>
+</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheManagerSelfTest.java b/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheManagerSelfTest.java
deleted file mode 100644
index 0293e66..0000000
--- a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheManagerSelfTest.java
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.spring;
-
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-/**
- * Spring cache test.
- */
-public class GridSpringCacheManagerSelfTest extends GridCommonAbstractTest {
- /** */
- private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
- /** */
- private static final String CACHE_NAME = "testCache";
-
- /** */
- private static final String DYNAMIC_CACHE_NAME = "dynamicCache";
-
- /** */
- private GridSpringCacheTestService svc;
-
- /** */
- private GridSpringDynamicCacheTestService dynamicSvc;
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- CacheConfiguration cache = new CacheConfiguration();
-
- cache.setName(CACHE_NAME);
-
- cfg.setCacheConfiguration(cache);
-
- TcpDiscoverySpi disco = new TcpDiscoverySpi();
-
- disco.setIpFinder(IP_FINDER);
-
- cfg.setDiscoverySpi(disco);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override public String getTestGridName() {
- return "testGrid";
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- startGrid();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- stopAllGrids();
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- BeanFactory factory = new ClassPathXmlApplicationContext("org/apache/ignite/spring/spring-caching.xml");
-
- svc = (GridSpringCacheTestService)factory.getBean("testService");
- dynamicSvc = (GridSpringDynamicCacheTestService)factory.getBean("dynamicTestService");
-
- svc.reset();
- dynamicSvc.reset();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- grid().cache(CACHE_NAME).removeAll();
-
- grid().destroyCache(DYNAMIC_CACHE_NAME);
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testSimpleKey() throws Exception {
- for (int i = 0; i < 3; i++) {
- assertEquals("value" + i, svc.simpleKey(i));
- assertEquals("value" + i, svc.simpleKey(i));
- }
-
- assertEquals(3, svc.called());
-
- IgniteCache<Integer, String> c = grid().cache(CACHE_NAME);
-
- assertEquals(3, c.size());
-
- for (int i = 0; i < 3; i++)
- assertEquals("value" + i, c.get(i));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testComplexKey() throws Exception {
- for (int i = 0; i < 3; i++) {
- assertEquals("value" + i + "suffix" + i, svc.complexKey(i, "suffix" + i));
- assertEquals("value" + i + "suffix" + i, svc.complexKey(i, "suffix" + i));
- }
-
- assertEquals(3, svc.called());
-
- IgniteCache<GridSpringCacheTestKey, String> c = grid().cache(CACHE_NAME);
-
- assertEquals(3, c.size());
-
- for (int i = 0; i < 3; i++)
- assertEquals("value" + i + "suffix" + i, c.get(new GridSpringCacheTestKey(i, "suffix" + i)));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testSimpleKeyPut() throws Exception {
- IgniteCache<Integer, String> c = grid().cache(CACHE_NAME);
-
- for (int i = 0; i < 3; i++) {
- assertEquals("value" + i + "odd", svc.simpleKeyPut(i));
-
- assertEquals(i + 1, c.size());
- assertEquals("value" + i + "odd", c.get(i));
-
- assertEquals("value" + i + "even", svc.simpleKeyPut(i));
-
- assertEquals(i + 1, c.size());
- assertEquals("value" + i + "even", c.get(i));
- }
-
- assertEquals(6, svc.called());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testComplexKeyPut() throws Exception {
- IgniteCache<GridSpringCacheTestKey, String> c = grid().cache(CACHE_NAME);
-
- for (int i = 0; i < 3; i++) {
- assertEquals("value" + i + "suffix" + i + "odd", svc.complexKeyPut(i, "suffix" + i));
-
- assertEquals(i + 1, c.size());
- assertEquals("value" + i + "suffix" + i + "odd", c.get(new GridSpringCacheTestKey(i, "suffix" + i)));
-
- assertEquals("value" + i + "suffix" + i + "even", svc.complexKeyPut(i, "suffix" + i));
-
- assertEquals(i + 1, c.size());
- assertEquals("value" + i + "suffix" + i + "even", c.get(new GridSpringCacheTestKey(i, "suffix" + i)));
- }
-
- assertEquals(6, svc.called());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testSimpleKeyEvict() throws Exception {
- IgniteCache<Integer, String> c = grid().cache(CACHE_NAME);
-
- for (int i = 0; i < 3; i++)
- c.put(i, "value" + i);
-
- assertEquals(3, c.size());
-
- assertEquals("value0", c.get(0));
- assertEquals("value1", c.get(1));
- assertEquals("value2", c.get(2));
-
- svc.simpleKeyEvict(2);
-
- assertEquals(2, c.size());
-
- assertEquals("value0", c.get(0));
- assertEquals("value1", c.get(1));
- assertNull(c.get(2));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testComplexKeyEvict() throws Exception {
- IgniteCache<GridSpringCacheTestKey, String> c = grid().cache(CACHE_NAME);
-
- for (int i = 0; i < 3; i++)
- c.put(new GridSpringCacheTestKey(i, "suffix" + i), "value" + i);
-
- assertEquals(3, c.size());
-
- assertEquals("value0", c.get(new GridSpringCacheTestKey(0, "suffix" + 0)));
- assertEquals("value1", c.get(new GridSpringCacheTestKey(1, "suffix" + 1)));
- assertEquals("value2", c.get(new GridSpringCacheTestKey(2, "suffix" + 2)));
-
- svc.complexKeyEvict(2, "suffix" + 2);
-
- assertEquals(2, c.size());
-
- assertEquals("value0", c.get(new GridSpringCacheTestKey(0, "suffix" + 0)));
- assertEquals("value1", c.get(new GridSpringCacheTestKey(1, "suffix" + 1)));
- assertNull(c.get(new GridSpringCacheTestKey(2, "suffix" + 2)));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testEvictAll() throws Exception {
- IgniteCache<Integer, String> c = grid().cache(CACHE_NAME);
-
- for (int i = 0; i < 3; i++)
- c.put(i, "value" + i);
-
- assertEquals(3, c.size());
-
- assertEquals("value0", c.get(0));
- assertEquals("value1", c.get(1));
- assertEquals("value2", c.get(2));
-
- svc.evictAll();
-
- assertEquals(0, c.size());
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDynamicCache() throws Exception {
- for (int i = 0; i < 3; i++) {
- assertEquals("value" + i, dynamicSvc.cacheable(i));
- assertEquals("value" + i, dynamicSvc.cacheable(i));
- }
-
- assertEquals(3, dynamicSvc.called());
-
- IgniteCache<Integer, String> c = grid().cache(DYNAMIC_CACHE_NAME);
-
- // Check that correct config is used.
- assertEquals(2, c.getConfiguration(CacheConfiguration.class).getBackups());
-
- assertEquals(3, c.size());
-
- for (int i = 0; i < 3; i++)
- assertEquals("value" + i, c.get(i));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDynamicCachePut() throws Exception {
- for (int i = 0; i < 3; i++) {
- assertEquals("value" + i, dynamicSvc.cachePut(i));
- assertEquals("value" + i, dynamicSvc.cachePut(i));
- }
-
- assertEquals(6, dynamicSvc.called());
-
- IgniteCache<Integer, String> c = grid().cache(DYNAMIC_CACHE_NAME);
-
- // Check that correct config is used.
- assertEquals(2, c.getConfiguration(CacheConfiguration.class).getBackups());
-
- assertEquals(3, c.size());
-
- for (int i = 0; i < 3; i++)
- assertEquals("value" + i, c.get(i));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDynamicCacheEvict() throws Exception {
- CacheConfiguration<Integer, String> cacheCfg = new CacheConfiguration<>();
-
- cacheCfg.setName(DYNAMIC_CACHE_NAME);
-
- IgniteCache<Integer, String> c = grid().createCache(cacheCfg);
-
- for (int i = 0; i < 3; i++)
- c.put(i, "value" + i);
-
- assertEquals(3, c.size());
-
- for (int i = 0; i < 2; i++) {
- dynamicSvc.cacheEvict(i);
- dynamicSvc.cacheEvict(i);
- }
-
- assertEquals(4, dynamicSvc.called());
-
- assertEquals(1, c.size());
-
- assertEquals("value2", c.get(2));
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testDynamicCacheEvictAll() throws Exception {
- CacheConfiguration<Integer, String> cacheCfg = new CacheConfiguration<>();
-
- cacheCfg.setName(DYNAMIC_CACHE_NAME);
-
- IgniteCache<Integer, String> c = grid().createCache(cacheCfg);
-
- for (int i = 0; i < 3; i++)
- c.put(i, "value" + i);
-
- assertEquals(3, c.size());
-
- dynamicSvc.cacheEvictAll();
- dynamicSvc.cacheEvictAll();
-
- assertEquals(2, dynamicSvc.called());
-
- assertEquals(0, c.size());
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestKey.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestKey.java b/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestKey.java
deleted file mode 100644
index c54fa82..0000000
--- a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestKey.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.spring;
-
-import java.io.Serializable;
-
-/**
- * Complex key.
- */
-public class GridSpringCacheTestKey implements Serializable {
- /** */
- private final Integer p1;
-
- /** */
- private final String p2;
-
- /**
- * @param p1 Parameter 1.
- * @param p2 Parameter 2.
- */
- public GridSpringCacheTestKey(Integer p1, String p2) {
- assert p1 != null;
- assert p2 != null;
-
- this.p1 = p1;
- this.p2 = p2;
- }
-
- /** {@inheritDoc} */
- @Override public boolean equals(Object o) {
- if (this == o)
- return true;
-
- if (o == null || getClass() != o.getClass())
- return false;
-
- GridSpringCacheTestKey key = (GridSpringCacheTestKey)o;
-
- return p1.equals(key.p1) && p2.equals(key.p2);
- }
-
- /** {@inheritDoc} */
- @Override public int hashCode() {
- return 31 * p1 + p2.hashCode();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestKeyGenerator.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestKeyGenerator.java b/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestKeyGenerator.java
deleted file mode 100644
index 4585ceb..0000000
--- a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestKeyGenerator.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.spring;
-
-import java.lang.reflect.Method;
-import org.springframework.cache.interceptor.KeyGenerator;
-
-/**
- * Key generator.
- */
-public class GridSpringCacheTestKeyGenerator implements KeyGenerator {
- /** {@inheritDoc} */
- @Override public Object generate(Object target, Method mtd, Object... params) {
- assert params != null;
- assert params.length > 0;
-
- if (params.length == 1)
- return params[0];
- else {
- assert params.length == 2;
-
- return new GridSpringCacheTestKey((Integer)params[0], (String)params[1]);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestService.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestService.java b/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestService.java
deleted file mode 100644
index c528650..0000000
--- a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringCacheTestService.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.spring;
-
-import java.util.concurrent.atomic.AtomicInteger;
-import org.springframework.cache.annotation.CacheEvict;
-import org.springframework.cache.annotation.CachePut;
-import org.springframework.cache.annotation.Cacheable;
-
-/**
- * Test service.
- */
-public class GridSpringCacheTestService {
- /** */
- private final AtomicInteger cnt = new AtomicInteger();
-
- /**
- * @return How many times service was called.
- */
- public int called() {
- return cnt.get();
- }
-
- /**
- * Resets service.
- */
- public void reset() {
- cnt.set(0);
- }
-
- /**
- * @param key Key.
- * @return Value.
- */
- @Cacheable("testCache")
- public String simpleKey(Integer key) {
- assert key != null;
-
- cnt.incrementAndGet();
-
- return "value" + key;
- }
-
- /**
- * @param p1 Parameter 1.
- * @param p2 Parameter 2.
- * @return Value.
- */
- @Cacheable("testCache")
- public String complexKey(Integer p1, String p2) {
- assert p1 != null;
- assert p2 != null;
-
- cnt.incrementAndGet();
-
- return "value" + p1 + p2;
- }
-
- /**
- * @param key Key.
- * @return Value.
- */
- @CachePut("testCache")
- public String simpleKeyPut(Integer key) {
- assert key != null;
-
- int cnt0 = cnt.incrementAndGet();
-
- return "value" + key + (cnt0 % 2 == 0 ? "even" : "odd");
- }
-
- /**
- * @param p1 Parameter 1.
- * @param p2 Parameter 2.
- * @return Value.
- */
- @CachePut("testCache")
- public String complexKeyPut(Integer p1, String p2) {
- assert p1 != null;
- assert p2 != null;
-
- int cnt0 = cnt.incrementAndGet();
-
- return "value" + p1 + p2 + (cnt0 % 2 == 0 ? "even" : "odd");
- }
-
- /**
- * @param key Key.
- */
- @CacheEvict("testCache")
- public void simpleKeyEvict(Integer key) {
- // No-op.
- }
-
- /**
- * @param p1 Parameter 1.
- * @param p2 Parameter 2.
- */
- @CacheEvict("testCache")
- public void complexKeyEvict(Integer p1, String p2) {
- // No-op.
- }
-
- /**
- */
- @CacheEvict(value = "testCache", allEntries = true)
- public void evictAll() {
- // No-op.
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringDynamicCacheTestService.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringDynamicCacheTestService.java b/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringDynamicCacheTestService.java
deleted file mode 100644
index 510d24d..0000000
--- a/modules/spring/src/test/java/org/apache/ignite/spring/GridSpringDynamicCacheTestService.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.spring;
-
-import java.util.concurrent.atomic.AtomicInteger;
-import org.springframework.cache.annotation.CacheEvict;
-import org.springframework.cache.annotation.CachePut;
-import org.springframework.cache.annotation.Cacheable;
-
-/**
- * Test service.
- */
-public class GridSpringDynamicCacheTestService {
- /** */
- private final AtomicInteger cnt = new AtomicInteger();
-
- /**
- * @param key Key.
- * @return Value.
- */
- @Cacheable("dynamicCache")
- public String cacheable(Integer key) {
- assert key != null;
-
- cnt.incrementAndGet();
-
- return "value" + key;
- }
-
- /**
- * @param key Key.
- * @return Value.
- */
- @CachePut("dynamicCache")
- public String cachePut(Integer key) {
- assert key != null;
-
- cnt.incrementAndGet();
-
- return "value" + key;
- }
-
- /**
- * @param key Key.
- */
- @CacheEvict("dynamicCache")
- public void cacheEvict(Integer key) {
- cnt.incrementAndGet();
- }
-
- /**
- */
- @CacheEvict(value = "dynamicCache", allEntries = true)
- public void cacheEvictAll() {
- cnt.incrementAndGet();
- }
-
- /**
- * @return Calls count.
- */
- public int called() {
- return cnt.get();
- }
-
- /**
- */
- public void reset() {
- cnt.set(0);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/spring/SpringCacheManagerContextInjectionTest.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/spring/SpringCacheManagerContextInjectionTest.java b/modules/spring/src/test/java/org/apache/ignite/spring/SpringCacheManagerContextInjectionTest.java
deleted file mode 100644
index 1554198..0000000
--- a/modules/spring/src/test/java/org/apache/ignite/spring/SpringCacheManagerContextInjectionTest.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.spring;
-
-import org.apache.ignite.Ignite;
-import org.apache.ignite.TestInjectionLifecycleBean;
-import org.apache.ignite.cache.spring.SpringCacheManager;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.internal.IgnitionEx;
-import org.apache.ignite.lifecycle.LifecycleBean;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- *
- */
-public class SpringCacheManagerContextInjectionTest extends GridCommonAbstractTest {
- /**
- * @throws Exception If failed.
- */
- public void testBeanInjectionUsingConfigPath() throws Exception {
- new AnnotationConfigApplicationContext(TestPathConfiguration.class);
-
- Ignite grid = IgnitionEx.grid("springInjectionTest");
-
- IgniteConfiguration cfg = grid.configuration();
-
- LifecycleBean[] beans = cfg.getLifecycleBeans();
-
- assertEquals(2, beans.length);
-
- TestInjectionLifecycleBean bean1 = (TestInjectionLifecycleBean)beans[0];
- TestInjectionLifecycleBean bean2 = (TestInjectionLifecycleBean)beans[1];
-
- bean1.checkState();
- bean2.checkState();
- }
-
- /**
- * @throws Exception If failed.
- */
- public void testBeanInjectionUsingConfiguration() throws Exception {
- BeanFactory factory = new AnnotationConfigApplicationContext(TestCfgConfiguration.class);
-
- TestInjectionLifecycleBean bean1 = (TestInjectionLifecycleBean)factory.getBean("bean1");
- TestInjectionLifecycleBean bean2 = (TestInjectionLifecycleBean)factory.getBean("bean2");
-
- bean1.checkState();
- bean2.checkState();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- stopAllGrids();
-
- super.afterTest();
- }
-
- /** */
- @SuppressWarnings("WeakerAccess")
- @Configuration
- static class TestPathConfiguration {
- /** */
- @Bean(name = "mgr")
- public SpringCacheManager springCacheManager() {
- SpringCacheManager mgr = new SpringCacheManager();
-
- mgr.setConfigurationPath("org/apache/ignite/spring-injection-test.xml");
-
- return mgr;
- }
- }
-
- /** */
- @SuppressWarnings("WeakerAccess")
- @Configuration
- static class TestCfgConfiguration {
- /** */
- @Bean(name = "mgr")
- public SpringCacheManager springCacheManager() {
- IgniteConfiguration cfg = new IgniteConfiguration();
-
- cfg.setLocalHost("127.0.0.1");
-
- cfg.setGridName("scmt");
-
- cfg.setLifecycleBeans(bean1(), bean2());
-
- SpringCacheManager mgr = new SpringCacheManager();
-
- mgr.setConfiguration(cfg);
-
- return mgr;
- }
-
- /** */
- @Bean(name = "bean1")
- LifecycleBean bean1() {
- return new TestInjectionLifecycleBean();
- }
-
- /** */
- @Bean(name = "bean2")
- LifecycleBean bean2() {
- return new TestInjectionLifecycleBean();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/spring/spring-caching.xml
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/spring/spring-caching.xml b/modules/spring/src/test/java/org/apache/ignite/spring/spring-caching.xml
deleted file mode 100644
index 784cf01..0000000
--- a/modules/spring/src/test/java/org/apache/ignite/spring/spring-caching.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:cache="http://www.springframework.org/schema/cache"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">
- <!--
- Test service with cacheable methods.
- -->
- <bean id="testService" class="org.apache.ignite.spring.GridSpringCacheTestService"/>
-
- <!--
- Test service with cacheable methods (dynamic cache).
- -->
- <bean id="dynamicTestService" class="org.apache.ignite.spring.GridSpringDynamicCacheTestService"/>
-
- <!--
- Cache manager.
- -->
- <bean id="cacheManager" class="org.apache.ignite.cache.spring.SpringCacheManager">
- <property name="gridName" value="testGrid"/>
- <property name="dynamicCacheConfiguration">
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="backups" value="2"/>
- </bean>
- </property>
- </bean>
-
- <!--
- Key generator.
- -->
- <bean id="keyGenerator" class="org.apache.ignite.spring.GridSpringCacheTestKeyGenerator"/>
-
- <!--
- Enable annotation-driver configuration for caching.
- -->
- <cache:annotation-driven key-generator="keyGenerator"/>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/00f47d78/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java b/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java
index 9ae3423..cd5645d 100644
--- a/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java
+++ b/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java
@@ -25,10 +25,10 @@ import org.apache.ignite.internal.GridFactorySelfTest;
import org.apache.ignite.internal.GridSpringBeanSerializationSelfTest;
import org.apache.ignite.internal.IgniteDynamicCacheConfigTest;
import org.apache.ignite.p2p.GridP2PUserVersionChangeSelfTest;
-import org.apache.ignite.spring.GridSpringCacheManagerSelfTest;
+import org.apache.ignite.cache.spring.GridSpringCacheManagerSelfTest;
import org.apache.ignite.spring.IgniteExcludeInConfigurationTest;
import org.apache.ignite.spring.IgniteStartFromStreamConfigurationTest;
-import org.apache.ignite.spring.SpringCacheManagerContextInjectionTest;
+import org.apache.ignite.cache.spring.SpringCacheManagerContextInjectionTest;
import org.apache.ignite.spring.injection.GridServiceInjectionSpringResourceTest;
import org.apache.ignite.transactions.spring.GridSpringTransactionManagerSelfTest;
import org.apache.ignite.transactions.spring.SpringTransactionManagerContextInjectionTest;