3 * Copyright (C) 2015 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.httpinvoker
;
12 import org
.apache
.log4j
.Logger
;
13 import org
.junit
.After
;
14 import org
.junit
.Before
;
16 import eu
.etaxonomy
.cdm
.api
.application
.CdmApplicationState
;
17 import eu
.etaxonomy
.taxeditor
.remoting
.cache
.CdmTransientEntityCacher
;
18 import eu
.etaxonomy
.taxeditor
.session
.ICdmEntitySession
;
19 import eu
.etaxonomy
.taxeditor
.session
.MockSessionOwner
;
26 public abstract class RemotingSessionAwareTest
extends BaseRemotingTest
{
28 private static final Logger logger
= Logger
.getLogger(RemotingSessionAwareTest
.class);
30 protected CdmTransientEntityCacher cacher
;
31 protected MockSessionOwner sessionOwner
;
35 public void initializeSession() {
37 sessionOwner
= new MockSessionOwner();
38 logger
.info("created mock session owner : " + sessionOwner
);
39 ICdmEntitySession cdmEntitySession
= cdmEntitySessionManager
.newSession(sessionOwner
, true);
40 CdmApplicationState
.getCurrentDataChangeService().register(sessionOwner
);
41 sessionOwner
.setCdmEntitySession(cdmEntitySession
);
42 cacher
= getCacher(sessionOwner
);
46 public void postSessionAwareTest() {
47 sessionOwner
.dispose();
48 CdmApplicationState
.getCurrentDataChangeService().unregister(sessionOwner
);
49 logger
.info("disposed of mock session owner : " + sessionOwner
);