| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package org.xwiki.cache.tests; |
| 21 |
|
|
| 22 |
|
import org.junit.Assert; |
| 23 |
|
import org.junit.Before; |
| 24 |
|
import org.junit.Rule; |
| 25 |
|
import org.xwiki.cache.CacheFactory; |
| 26 |
|
import org.xwiki.cache.CacheManager; |
| 27 |
|
import org.xwiki.configuration.internal.MemoryConfigurationSource; |
| 28 |
|
import org.xwiki.test.mockito.MockitoComponentManagerRule; |
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
@version |
| 34 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 3 |
Complexity Density: 0.43 |
|
| 35 |
|
public abstract class AbstractTestCache |
| 36 |
|
{ |
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
protected static final String KEY = "key"; |
| 41 |
|
|
| 42 |
|
|
| 43 |
|
|
| 44 |
|
|
| 45 |
|
protected static final String KEY2 = "key2"; |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
|
| 49 |
|
|
| 50 |
|
protected static final String VALUE = "value"; |
| 51 |
|
|
| 52 |
|
|
| 53 |
|
|
| 54 |
|
|
| 55 |
|
protected static final int VALUE2 = 2; |
| 56 |
|
|
| 57 |
|
|
| 58 |
|
|
| 59 |
|
|
| 60 |
|
@Rule |
| 61 |
|
public MockitoComponentManagerRule componentManager = new MockitoComponentManagerRule(); |
| 62 |
|
|
| 63 |
|
|
| 64 |
|
|
| 65 |
|
|
| 66 |
|
protected String roleHint; |
| 67 |
|
|
| 68 |
|
|
| 69 |
|
@param |
| 70 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 71 |
12 |
protected AbstractTestCache(String roleHint)... |
| 72 |
|
{ |
| 73 |
12 |
this.roleHint = roleHint; |
| 74 |
|
} |
| 75 |
|
|
| 76 |
|
|
| 77 |
|
|
| 78 |
|
|
| 79 |
|
@throws |
| 80 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 81 |
12 |
@Before... |
| 82 |
|
public void before() throws Exception |
| 83 |
|
{ |
| 84 |
12 |
MemoryConfigurationSource configuration = this.componentManager.registerMemoryConfigurationSource(); |
| 85 |
|
|
| 86 |
12 |
configuration.setProperty("cache.defaultCache", this.roleHint); |
| 87 |
|
} |
| 88 |
|
|
| 89 |
|
|
| 90 |
|
@return |
| 91 |
|
@throws |
| 92 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 93 |
13 |
public CacheFactory getCacheFactory() throws Exception... |
| 94 |
|
{ |
| 95 |
13 |
CacheManager cacheManager = this.componentManager.getInstance(CacheManager.class); |
| 96 |
|
|
| 97 |
13 |
CacheFactory factory = cacheManager.getCacheFactory(); |
| 98 |
|
|
| 99 |
13 |
Assert.assertNotNull(factory); |
| 100 |
|
|
| 101 |
13 |
return factory; |
| 102 |
|
} |
| 103 |
|
} |