2 * Copyright (C) 2018 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.service
;
11 import java
.util
.List
;
12 import java
.util
.UUID
;
14 import org
.apache
.logging
.log4j
.LogManager
;
15 import org
.apache
.logging
.log4j
.Logger
;
16 import org
.junit
.Assert
;
17 import org
.junit
.Test
;
19 import eu
.etaxonomy
.cdm
.api
.application
.CdmApplicationState
;
20 import eu
.etaxonomy
.cdm
.api
.cache
.CdmServiceCachingProxy
;
21 import eu
.etaxonomy
.cdm
.api
.service
.ITermService
;
22 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
23 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
24 import eu
.etaxonomy
.cdm
.model
.term
.DefinedTermBase
;
25 import eu
.etaxonomy
.cdm
.model
.term
.TermType
;
26 import eu
.etaxonomy
.taxeditor
.httpinvoker
.RemotingSessionAwareTest
;
28 public class ServiceInterceptorTest
extends RemotingSessionAwareTest
{
30 @SuppressWarnings("unused")
31 private static final Logger logger
= LogManager
.getLogger(ServiceInterceptorTest
.class);
33 private final ITermService termService
= getRemoteApplicationController().getTermService();
34 private static CdmServiceCachingProxy cdmTermCache
= CdmApplicationState
.getTermProxy();
38 public void termServiceInterceptorTest() {
39 List
<DefinedTermBase
<?
>> terms
= termService
.listByTermType(TermType
.Language
, null, null, null, null);
40 int cacheLanguageSize
= 0;
41 List
<UUID
> keys
= cdmTermCache
.getPermanentCache().getKeys();
42 for(UUID key
: keys
) {
43 CdmBase cdmBase
= cdmTermCache
.getFromCache(key
);
44 if(cdmBase
!= null && cdmBase
.getClass().equals(Language
.class)) {
47 System
.err
.println("There is no element for key" + key
.toString());
50 Assert
.assertEquals(terms
.size(), cacheLanguageSize
);
51 // TO DO : get the static termTypeMap from TermServiceRequestExecutor and check the size