Browse Source

No more transaction cache

pull/6787/head
Andrii Shvaika 4 years ago
parent
commit
923dcff8e5
  1. 16
      common/cache/src/test/java/org/thingsboard/server/cache/CacheSpecsMapTest.java

16
common/cache/src/test/java/org/thingsboard/server/cache/CacheSpecsMapTest.java

@ -21,8 +21,8 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cache.CacheManager;
import org.springframework.cache.transaction.TransactionAwareCacheDecorator;
import org.springframework.cache.transaction.TransactionAwareCacheManagerProxy;
import org.springframework.cache.caffeine.CaffeineCache;
import org.springframework.cache.support.SimpleCacheManager;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@ -45,14 +45,16 @@ public class CacheSpecsMapTest {
CacheManager cacheManager;
@Test
public void verifyTransactionAwareCacheManagerProxy() {
assertThat(cacheManager).isInstanceOf(TransactionAwareCacheManagerProxy.class);
public void verifyNotTransactionAwareCacheManagerProxy() {
// We no longer use built-in transaction support for the caches, because we have our own cache cleanup and transaction logic that implements CAS.
assertThat(cacheManager).isInstanceOf(SimpleCacheManager.class);
}
@Test
public void givenCacheConfig_whenCacheManagerReady_thenVerifyExistedCachesWithTransactionAwareCacheDecorator() {
assertThat(cacheManager.getCache("relations")).isInstanceOf(TransactionAwareCacheDecorator.class);
assertThat(cacheManager.getCache("devices")).isInstanceOf(TransactionAwareCacheDecorator.class);
public void givenCacheConfig_whenCacheManagerReady_thenVerifyExistedCachesWithNoTransactionAwareCacheDecorator() {
// We no longer use built-in transaction support for the caches, because we have our own cache cleanup and transaction logic that implements CAS.
assertThat(cacheManager.getCache("relations")).isInstanceOf(CaffeineCache.class);
assertThat(cacheManager.getCache("devices")).isInstanceOf(CaffeineCache.class);
}
@Test

Loading…
Cancel
Save