a8564a5622dcb9cbdff763b41202c0e062874002
[taxeditor.git] / eu.etaxonomy.taxeditor.cdmlib / src / test / java / eu / etaxonomy / taxeditor / remoting / CdmServiceCacherTest.java
1 package eu.etaxonomy.taxeditor.remoting;
2
3 import org.apache.log4j.Level;
4 import org.apache.log4j.Logger;
5 import org.junit.Assert;
6 import org.junit.BeforeClass;
7 import org.junit.Test;
8 import org.springframework.beans.factory.annotation.Autowired;
9
10 import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
11 import eu.etaxonomy.cdm.model.common.Language;
12
13 public class CdmServiceCacherTest extends RemoteApplicationConfigurationTest {
14 private static final Logger logger = Logger.getLogger(CdmServiceCacherTest.class);
15
16
17 private static CdmServiceCacher cdmServiceCacher;
18
19 @BeforeClass
20 public static void initialize() {
21 Logger.getRootLogger().setLevel(Level.INFO);
22 cdmServiceCacher = (CdmServiceCacher)applicationController.getBean("cdmServiceCacher");
23 }
24
25 @Test
26 public void testLanguageCache() {
27 Language defaultLanguage = Language.getDefaultLanguage();
28
29 Language defaultLanguageInCache = (Language)cdmServiceCacher.getFromCache(defaultLanguage.getUuid());
30 Assert.assertEquals("Loaded Language Term should match Language Term in Cache",defaultLanguage,defaultLanguageInCache);
31
32 Language language = Language.getLanguageFromUuid(Language.uuidFrench);
33 Language languageInCache = (Language)cdmServiceCacher.getFromCache(language.getUuid());
34 Assert.assertEquals("Loaded Language Term should match Language Term in Cache",language,languageInCache);
35
36 }
37
38 }