1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2015 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
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.
|
9
|
*/
|
10
|
package eu.etaxonomy.taxeditor.httpinvoker;
|
11
|
|
12
|
import org.apache.log4j.Logger;
|
13
|
import org.junit.After;
|
14
|
import org.junit.Before;
|
15
|
|
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;
|
20
|
|
21
|
/**
|
22
|
* @author cmathew
|
23
|
* @date 12 Jun 2015
|
24
|
*
|
25
|
*/
|
26
|
public abstract class RemotingSessionAwareTest extends BaseRemotingTest {
|
27
|
|
28
|
private static final Logger logger = Logger.getLogger(RemotingSessionAwareTest.class);
|
29
|
|
30
|
protected CdmTransientEntityCacher cacher;
|
31
|
protected MockSessionOwner sessionOwner;
|
32
|
|
33
|
|
34
|
@Before
|
35
|
public void initializeSession() {
|
36
|
|
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);
|
43
|
}
|
44
|
|
45
|
@After
|
46
|
public void postSessionAwareTest() {
|
47
|
sessionOwner.dispose();
|
48
|
CdmApplicationState.getCurrentDataChangeService().unregister(sessionOwner);
|
49
|
logger.info("disposed of mock session owner : " + sessionOwner);
|
50
|
}
|
51
|
}
|