Revision 0fd7ff08
Added by Cherian Mathew almost 9 years ago
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmRemoteSourceBase.java | ||
---|---|---|
12 | 12 |
|
13 | 13 |
import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean; |
14 | 14 |
|
15 |
import eu.etaxonomy.cdm.api.service.IDatabaseService;
|
|
15 |
import eu.etaxonomy.cdm.api.service.IUserService;
|
|
16 | 16 |
import eu.etaxonomy.cdm.config.CdmSource; |
17 | 17 |
import eu.etaxonomy.cdm.config.CdmSourceException; |
18 | 18 |
import eu.etaxonomy.cdm.model.metadata.CdmMetaData.MetaDataPropertyName; |
... | ... | |
34 | 34 |
private String contextPath; |
35 | 35 |
private String baseUrl; |
36 | 36 |
|
37 |
private IDatabaseService databaseService;
|
|
37 |
private IUserService userService;
|
|
38 | 38 |
|
39 | 39 |
/** |
40 | 40 |
* Constructs a CdmRemoteSourceBase object with default values. |
... | ... | |
76 | 76 |
// application context initialsation) since it is required to |
77 | 77 |
// to make queries related to the source database |
78 | 78 |
HttpInvokerProxyFactoryBean proxy = new HttpInvokerProxyFactoryBean(); |
79 |
proxy.setServiceInterface(IDatabaseService.class);
|
|
79 |
proxy.setServiceInterface(IUserService.class);
|
|
80 | 80 |
// FIXME:Remoting need to fix this hardcoded url and make it configurable somehow |
81 |
proxy.setServiceUrl(baseUrl + "/remoting-public/database.service");
|
|
81 |
proxy.setServiceUrl(baseUrl + "/remoting-public/user.service");
|
|
82 | 82 |
proxy.afterPropertiesSet(); |
83 |
databaseService = (IDatabaseService) proxy.getObject();
|
|
83 |
userService = (IUserService) proxy.getObject();
|
|
84 | 84 |
|
85 | 85 |
} |
86 | 86 |
|
... | ... | |
128 | 128 |
*/ |
129 | 129 |
@Override |
130 | 130 |
public String getDbSchemaVersion() throws CdmSourceException { |
131 |
return databaseService.getDbSchemaVersion();
|
|
131 |
return userService.getDbSchemaVersion();
|
|
132 | 132 |
|
133 | 133 |
} |
134 | 134 |
|
... | ... | |
137 | 137 |
*/ |
138 | 138 |
@Override |
139 | 139 |
public boolean isDbEmpty() throws CdmSourceException { |
140 |
return databaseService.isDbEmpty();
|
|
140 |
return userService.isDbEmpty();
|
|
141 | 141 |
|
142 | 142 |
} |
143 | 143 |
|
... | ... | |
151 | 151 |
// if no exception is thrown then we assume that the |
152 | 152 |
// connection is up |
153 | 153 |
// FIXME:Remoting is this really correct? |
154 |
databaseService.getDbSchemaVersion();
|
|
154 |
userService.getDbSchemaVersion();
|
|
155 | 155 |
|
156 | 156 |
return true; |
157 | 157 |
} |
... | ... | |
167 | 167 |
|
168 | 168 |
@Override |
169 | 169 |
public Map<MetaDataPropertyName, String> getMetaDataMap() throws CdmSourceException { |
170 |
return databaseService.getCdmMetadataMap();
|
|
170 |
return userService.getCdmMetadataMap();
|
|
171 | 171 |
} |
172 | 172 |
|
173 | 173 |
|
eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/httpInvokerServiceClients.xml | ||
---|---|---|
395 | 395 |
<bean id="databaseService" lazy-init="true" |
396 | 396 |
class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean"> |
397 | 397 |
<property name="serviceUrl"> |
398 |
<value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting-public/database.service</value>
|
|
398 |
<value>http://${remoteServer}:${remotePort}/${remoteContext}/remoting/database.service</value> |
|
399 | 399 |
</property> |
400 | 400 |
<property name="serviceInterface"> |
401 | 401 |
<value>eu.etaxonomy.cdm.api.service.IDatabaseService</value> |
402 | 402 |
</property> |
403 | 403 |
<property name="httpInvokerRequestExecutor"> |
404 | 404 |
<bean |
405 |
class="org.springframework.remoting.httpinvoker.SimpleHttpInvokerRequestExecutor" />
|
|
405 |
class="eu.etaxonomy.taxeditor.service.CdmServiceRequestExecutor" />
|
|
406 | 406 |
</property> |
407 | 407 |
</bean> |
408 | 408 |
|
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/HttpInvokerServicesTest.java | ||
---|---|---|
13 | 13 |
import org.junit.Test; |
14 | 14 |
|
15 | 15 |
import eu.etaxonomy.cdm.config.CdmSourceException; |
16 |
import eu.etaxonomy.cdm.model.description.PolytomousKey; |
|
16 | 17 |
|
17 | 18 |
/** |
18 | 19 |
* Class to test the HttpInvoker services exposed by the CDM Sever |
... | ... | |
26 | 27 |
public void whenCallingMethodsOnRemoteServicesThenSucceed() { |
27 | 28 |
try { |
28 | 29 |
|
29 |
getRemoteApplicationController().getDatabaseService(); |
|
30 |
//getRemoteApplicationController().getDatabaseService();
|
|
30 | 31 |
String dbSchemaVersion = getRemoteApplicationController().getDatabaseService().getDbSchemaVersion(); |
31 | 32 |
logger.info("dbSchemaVersion is " + dbSchemaVersion); |
33 |
|
|
34 |
|
|
32 | 35 |
} catch (CdmSourceException e) { |
33 | 36 |
Assert.fail("pinging database service on active cdm server should not have thrown CdmSourceException"); |
34 | 37 |
} |
38 |
|
|
39 |
getRemoteApplicationController().getPolytomousKeyService().list(PolytomousKey.class, null, null, null, null); |
|
35 | 40 |
} |
36 | 41 |
|
37 | 42 |
} |
eu.etaxonomy.taxeditor.test/src/test/resources/.gitignore | ||
---|---|---|
1 |
server.properties |
eu.etaxonomy.taxeditor.test/src/test/resources/server.properties | ||
---|---|---|
1 |
httpPort=9090 |
|
2 |
stopPort=9191 |
|
3 |
stopKey=jetty-cdm-server |
|
4 |
user=admin |
|
5 |
password=00000 |
Also available in: Unified diff
CdmRemoteSourceBase : using user service for db checks
httpInvokerServiceClients.xml : updated database service config
HttpInvokerServicesTest : added polytomous key service ping
server.properties : added back server properties file