Java 类org.springframework.boot.autoconfigure.cache.support.MockCachingProvider 实例源码

项目:contestparser    文件:CacheAutoConfigurationTests.java   
@Test
public void jCacheCacheWithCachesAndCustomConfig() {
    String cachingProviderFqn = MockCachingProvider.class.getName();
    load(JCacheCustomConfiguration.class, "spring.cache.type=jcache",
            "spring.cache.jcache.provider=" + cachingProviderFqn,
            "spring.cache.cacheNames[0]=one", "spring.cache.cacheNames[1]=two");
    JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
    assertThat(cacheManager.getCacheNames(), containsInAnyOrder("one", "two"));
    assertThat(cacheManager.getCacheNames(), hasSize(2));

    CompleteConfiguration<?, ?> defaultCacheConfiguration = this.context
            .getBean(CompleteConfiguration.class);
    verify(cacheManager.getCacheManager()).createCache("one",
            defaultCacheConfiguration);
    verify(cacheManager.getCacheManager()).createCache("two",
            defaultCacheConfiguration);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CacheAutoConfigurationTests.java   
@Test
public void jCacheCacheWithProvider() {
    String cachingProviderFqn = MockCachingProvider.class.getName();
    load(DefaultCacheConfiguration.class, "spring.cache.type=jcache",
            "spring.cache.jcache.provider=" + cachingProviderFqn);
    JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
    assertThat(cacheManager.getCacheNames()).isEmpty();
    assertThat(this.context.getBean(javax.cache.CacheManager.class))
            .isEqualTo(cacheManager.getCacheManager());
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CacheAutoConfigurationTests.java   
@Test
public void jCacheCacheWithCaches() {
    String cachingProviderFqn = MockCachingProvider.class.getName();
    load(DefaultCacheConfiguration.class, "spring.cache.type=jcache",
            "spring.cache.jcache.provider=" + cachingProviderFqn,
            "spring.cache.cacheNames[0]=foo", "spring.cache.cacheNames[1]=bar");
    JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
    assertThat(cacheManager.getCacheNames()).containsOnly("foo", "bar");
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CacheAutoConfigurationTests.java   
@Test
public void jCacheCacheWithCachesAndCustomConfig() {
    String cachingProviderFqn = MockCachingProvider.class.getName();
    load(JCacheCustomConfiguration.class, "spring.cache.type=jcache",
            "spring.cache.jcache.provider=" + cachingProviderFqn,
            "spring.cache.cacheNames[0]=one", "spring.cache.cacheNames[1]=two");
    JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
    assertThat(cacheManager.getCacheNames()).containsOnly("one", "two");
    CompleteConfiguration<?, ?> defaultCacheConfiguration = this.context
            .getBean(CompleteConfiguration.class);
    verify(cacheManager.getCacheManager()).createCache("one",
            defaultCacheConfiguration);
    verify(cacheManager.getCacheManager()).createCache("two",
            defaultCacheConfiguration);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CacheAutoConfigurationTests.java   
@Test
public void jCacheCacheWithConfig() throws IOException {
    String cachingProviderFqn = MockCachingProvider.class.getName();
    String configLocation = "org/springframework/boot/autoconfigure/cache/hazelcast-specific.xml";
    load(JCacheCustomConfiguration.class, "spring.cache.type=jcache",
            "spring.cache.jcache.provider=" + cachingProviderFqn,
            "spring.cache.jcache.config=" + configLocation);
    JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
    Resource configResource = new ClassPathResource(configLocation);
    assertThat(cacheManager.getCacheManager().getURI())
            .isEqualTo(configResource.getURI());
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:CacheAutoConfigurationTests.java   
@Test
public void jCacheCacheWithWrongConfig() {
    String cachingProviderFqn = MockCachingProvider.class.getName();
    String configLocation = "org/springframework/boot/autoconfigure/cache/does-not-exist.xml";
    this.thrown.expect(BeanCreationException.class);
    this.thrown.expectMessage("does not exist");
    this.thrown.expectMessage(configLocation);
    load(JCacheCustomConfiguration.class, "spring.cache.type=jcache",
            "spring.cache.jcache.provider=" + cachingProviderFqn,
            "spring.cache.jcache.config=" + configLocation);
}
项目:spring-boot-concourse    文件:CacheAutoConfigurationTests.java   
@Test
public void jCacheCacheWithProvider() {
    String cachingProviderFqn = MockCachingProvider.class.getName();
    load(DefaultCacheConfiguration.class, "spring.cache.type=jcache",
            "spring.cache.jcache.provider=" + cachingProviderFqn);
    JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
    assertThat(cacheManager.getCacheNames()).isEmpty();
    assertThat(this.context.getBean(javax.cache.CacheManager.class))
            .isEqualTo(cacheManager.getCacheManager());
}
项目:spring-boot-concourse    文件:CacheAutoConfigurationTests.java   
@Test
public void jCacheCacheWithCaches() {
    String cachingProviderFqn = MockCachingProvider.class.getName();
    load(DefaultCacheConfiguration.class, "spring.cache.type=jcache",
            "spring.cache.jcache.provider=" + cachingProviderFqn,
            "spring.cache.cacheNames[0]=foo", "spring.cache.cacheNames[1]=bar");
    JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
    assertThat(cacheManager.getCacheNames()).containsOnly("foo", "bar");
}
项目:spring-boot-concourse    文件:CacheAutoConfigurationTests.java   
@Test
public void jCacheCacheWithCachesAndCustomConfig() {
    String cachingProviderFqn = MockCachingProvider.class.getName();
    load(JCacheCustomConfiguration.class, "spring.cache.type=jcache",
            "spring.cache.jcache.provider=" + cachingProviderFqn,
            "spring.cache.cacheNames[0]=one", "spring.cache.cacheNames[1]=two");
    JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
    assertThat(cacheManager.getCacheNames()).containsOnly("one", "two");
    CompleteConfiguration<?, ?> defaultCacheConfiguration = this.context
            .getBean(CompleteConfiguration.class);
    verify(cacheManager.getCacheManager()).createCache("one",
            defaultCacheConfiguration);
    verify(cacheManager.getCacheManager()).createCache("two",
            defaultCacheConfiguration);
}
项目:spring-boot-concourse    文件:CacheAutoConfigurationTests.java   
@Test
public void jCacheCacheWithConfig() throws IOException {
    String cachingProviderFqn = MockCachingProvider.class.getName();
    String configLocation = "org/springframework/boot/autoconfigure/cache/hazelcast-specific.xml";
    load(JCacheCustomConfiguration.class, "spring.cache.type=jcache",
            "spring.cache.jcache.provider=" + cachingProviderFqn,
            "spring.cache.jcache.config=" + configLocation);
    JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
    Resource configResource = new ClassPathResource(configLocation);
    assertThat(cacheManager.getCacheManager().getURI())
            .isEqualTo(configResource.getURI());
}
项目:spring-boot-concourse    文件:CacheAutoConfigurationTests.java   
@Test
public void jCacheCacheWithWrongConfig() {
    String cachingProviderFqn = MockCachingProvider.class.getName();
    String configLocation = "org/springframework/boot/autoconfigure/cache/does-not-exist.xml";
    this.thrown.expect(BeanCreationException.class);
    this.thrown.expectMessage("does not exist");
    this.thrown.expectMessage(configLocation);
    load(JCacheCustomConfiguration.class, "spring.cache.type=jcache",
            "spring.cache.jcache.provider=" + cachingProviderFqn,
            "spring.cache.jcache.config=" + configLocation);
}
项目:contestparser    文件:CacheAutoConfigurationTests.java   
@Test
public void jCacheCacheWithProvider() {
    String cachingProviderFqn = MockCachingProvider.class.getName();
    load(DefaultCacheConfiguration.class, "spring.cache.type=jcache",
            "spring.cache.jcache.provider=" + cachingProviderFqn);
    JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
    assertThat(cacheManager.getCacheNames(), empty());
    assertThat(this.context.getBean(javax.cache.CacheManager.class),
            equalTo(cacheManager.getCacheManager()));
}
项目:contestparser    文件:CacheAutoConfigurationTests.java   
@Test
public void jCacheCacheWithCaches() {
    String cachingProviderFqn = MockCachingProvider.class.getName();
    load(DefaultCacheConfiguration.class, "spring.cache.type=jcache",
            "spring.cache.jcache.provider=" + cachingProviderFqn,
            "spring.cache.cacheNames[0]=foo", "spring.cache.cacheNames[1]=bar");
    JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
    assertThat(cacheManager.getCacheNames(), containsInAnyOrder("foo", "bar"));
    assertThat(cacheManager.getCacheNames(), hasSize(2));
}
项目:contestparser    文件:CacheAutoConfigurationTests.java   
@Test
public void jCacheCacheWithConfig() throws IOException {
    String cachingProviderFqn = MockCachingProvider.class.getName();
    String configLocation = "org/springframework/boot/autoconfigure/cache/hazelcast-specific.xml";
    load(JCacheCustomConfiguration.class, "spring.cache.type=jcache",
            "spring.cache.jcache.provider=" + cachingProviderFqn,
            "spring.cache.jcache.config=" + configLocation);
    JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
    Resource configResource = new ClassPathResource(configLocation);
    assertThat(cacheManager.getCacheManager().getURI(),
            equalTo(configResource.getURI()));
}
项目:contestparser    文件:CacheAutoConfigurationTests.java   
@Test
public void jCacheCacheWithWrongConfig() {
    String cachingProviderFqn = MockCachingProvider.class.getName();
    String configLocation = "org/springframework/boot/autoconfigure/cache/does-not-exist.xml";
    this.thrown.expect(BeanCreationException.class);
    this.thrown.expectMessage("does not exist");
    this.thrown.expectMessage(configLocation);
    load(JCacheCustomConfiguration.class, "spring.cache.type=jcache",
            "spring.cache.jcache.provider=" + cachingProviderFqn,
            "spring.cache.jcache.config=" + configLocation);
}