1
|
package eu.etaxonomy.cdm.api.cache;
|
2
|
|
3
|
import java.util.List;
|
4
|
|
5
|
import net.sf.ehcache.Cache;
|
6
|
|
7
|
import org.apache.log4j.Logger;
|
8
|
import org.junit.Assert;
|
9
|
import org.junit.Test;
|
10
|
|
11
|
import eu.etaxonomy.taxeditor.remoting.cache.CdmModelCacher;
|
12
|
import eu.etaxonomy.taxeditor.remoting.cache.CdmModelFieldPropertyFromClass;
|
13
|
import eu.etaxonomy.taxeditor.remoting.cache.CdmRemoteCacheManager;
|
14
|
|
15
|
|
16
|
public class CdmModelGetMethodCacherTest {
|
17
|
|
18
|
private static final Logger logger = Logger.getLogger(CdmModelGetMethodCacherTest.class);
|
19
|
|
20
|
|
21
|
@Test
|
22
|
public void cacheGettersTest() {
|
23
|
|
24
|
CdmModelCacher cmdmc = new CdmModelCacher();
|
25
|
|
26
|
Cache cdmlibCache = CdmRemoteCacheManager.getInstance().getCdmModelGetMethodsCache();
|
27
|
List<CdmModelFieldPropertyFromClass> cmgmfcList = cmdmc.getCdmModelGetMethodFromClassList();
|
28
|
|
29
|
List<Object> keys = cdmlibCache.getKeys();
|
30
|
Assert.assertEquals(cmgmfcList.size(), keys.size());
|
31
|
|
32
|
for(CdmModelFieldPropertyFromClass cmgmfc: cmgmfcList) {
|
33
|
String className = cmgmfc.getClassName();
|
34
|
Assert.assertTrue(keys.contains(className));
|
35
|
logger.info("Class Name : " + className + " has been cached");
|
36
|
}
|
37
|
|
38
|
//FIXME:Remoting do we need to test this ?
|
39
|
// this will cause the following tests to fail since all caches are shutdown
|
40
|
//cdmlibCache.removeAll();
|
41
|
//CacheManager.create().shutdown();
|
42
|
}
|
43
|
|
44
|
|
45
|
|
46
|
|
47
|
}
|