Revision 04f2494e
Added by Cherian Mathew almost 9 years ago
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/BaseRemotingTest.java | ||
---|---|---|
37 | 37 |
import org.unitils.spring.annotation.SpringApplicationContext; |
38 | 38 |
|
39 | 39 |
import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController; |
40 |
import eu.etaxonomy.cdm.api.application.CdmApplicationState; |
|
40 | 41 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
41 | 42 |
import eu.etaxonomy.taxeditor.remoting.cache.CdmRemoteCacheManager; |
42 | 43 |
import eu.etaxonomy.taxeditor.remoting.cache.CdmTransientEntityCacher; |
... | ... | |
68 | 69 |
public static final Resource EDITOR_DATASOURCES_FILE = |
69 | 70 |
new ClassPathResource(".cdmLibrary/writableResources/cdm.datasources.xml"); |
70 | 71 |
|
71 |
private static CdmApplicationRemoteController remoteApplicationController; |
|
72 |
//private static CdmApplicationRemoteController remoteApplicationController;
|
|
72 | 73 |
private static ICdmRemoteSource cdmRemoteSource; |
73 | 74 |
private static CdmPersistentRemoteSource remotePersistentSource; |
74 | 75 |
|
... | ... | |
171 | 172 |
|
172 | 173 |
public static void initializeController(String sourceName, String host, int port, String contextPath, NomenclaturalCode ncode, String username, String password) { |
173 | 174 |
|
174 |
if(remoteApplicationController != null) {
|
|
175 |
if(CdmApplicationState.getCurrentAppConfig() != null) {
|
|
175 | 176 |
return; |
176 | 177 |
} |
177 | 178 |
cdmRemoteSource = CdmRemoteSource.NewInstance(sourceName, host, port, contextPath, ncode); |
178 |
remoteApplicationController = |
|
179 |
CdmApplicationRemoteController remoteApplicationController =
|
|
179 | 180 |
CdmApplicationRemoteController.NewInstance(cdmRemoteSource, |
180 | 181 |
null, |
181 | 182 |
null); |
182 |
|
|
183 |
CdmApplicationState.setCurrentAppConfig(remoteApplicationController); |
|
183 | 184 |
try { |
184 | 185 |
remotePersistentSource = CdmPersistentRemoteSource.NewInstance(sourceName); |
185 | 186 |
} catch (CdmRemoteSourceException e) { |
... | ... | |
187 | 188 |
} |
188 | 189 |
cdmEntitySessionManager = getRemoteApplicationController().getCdmEntitySessionManager(); |
189 | 190 |
|
191 |
//FIXME:Remoting the authentication code should be replaced by a method call which actually |
|
192 |
// does the authentication in the editor code so that the 'real' authentication can be tested |
|
190 | 193 |
SecurityContextHolder.clearContext(); |
191 | 194 |
SecurityContextImpl sc = new SecurityContextImpl(); |
192 | 195 |
Authentication token = new UsernamePasswordAuthenticationToken(username,password); |
... | ... | |
200 | 203 |
|
201 | 204 |
|
202 | 205 |
protected static CdmApplicationRemoteController getRemoteApplicationController() { |
203 |
return remoteApplicationController;
|
|
206 |
return (CdmApplicationRemoteController) CdmApplicationState.getCurrentAppConfig();
|
|
204 | 207 |
} |
205 | 208 |
|
206 | 209 |
protected static ICdmRemoteSource getCdmRemoteSource() { |
Also available in: Unified diff
CdmApplicationState:New class to handle application state
CdmStore, BaseRemotingTest : using new application state class
TaxonNavigatorTest : ignoring test for now
TaxonNavigatorTest : increased max memory for jetty