Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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