Skip to content

Commit

Permalink
Merge pull request #63 from jfrosch/Fix_Cache_Config_Issue_62
Browse files Browse the repository at this point in the history
Made CacheConfig inner class of CachePluginConfiguration a nested (st…
  • Loading branch information
jameskleeh authored Oct 3, 2019
2 parents e66d145 + ed67f3e commit f52900c
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
11 changes: 11 additions & 0 deletions grails-app/conf/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,14 @@ grails:
endpoints:
jmx:
unique-names: true
---
environments:
test:
grails:
cache:
cacheManager: GrailsConcurrentLinkedMapCacheManager
caches:
foo:
maxCapacity: 100
bar:
maxCapacity: 200
32 changes: 32 additions & 0 deletions src/integration-test/groovy/com/demo/MaxCapacityCacheSpec.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.demo

import grails.plugin.cache.GrailsConcurrentLinkedMapCache
import grails.plugin.cache.GrailsConcurrentLinkedMapCacheManager
import grails.testing.mixin.integration.Integration
import spock.lang.Specification
import spock.lang.Unroll

/**
* This test case validates the documented cache configuration behavior and fix for
* issue https://github.com/grails-plugins/grails-cache/issues/62
*/
@Integration
class MaxCapacityCacheSpec extends Specification {

GrailsConcurrentLinkedMapCacheManager grailsCacheManager

@Unroll
void "Verify max capacities set for configured caches"() {
when:
GrailsConcurrentLinkedMapCache cache = grailsCacheManager.getCache(cacheName) as GrailsConcurrentLinkedMapCache

then:
cache.capacity == expectedCapacity

where:
cacheName | expectedCapacity
'foo' | 100
'bar' | 200

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CachePluginConfiguration {
Boolean clearAtStartup = false
Map<String, CacheConfig> caches = [:]

class CacheConfig {
static class CacheConfig {
Integer maxCapacity
}
}
Expand Down

0 comments on commit f52900c

Please sign in to comment.