Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/test/java/org/ohdsi/webapi/test/VocabularyServiceIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public void init() throws Exception {
addConcept();
}

private String withSourceKey(String endpoint) {
return endpoint.replace("{sourceKey}", SOURCE_KEY);
}

private void addConcept() {
String resultSql = SqlRender.renderSql(ResourceHelper.GetResourceAsString(CONCEPT_FILE_PATH),
new String[]{"cdm_database_schema"}, new String[]{CDM_SCHEMA_NAME});
Expand All @@ -50,7 +54,7 @@ private void addConcept() {
public void canGetConcept() {

//Action
final ResponseEntity<String> entity = getRestTemplate().getForEntity(this.endpointConcept, String.class);
final ResponseEntity<String> entity = getRestTemplate().getForEntity(withSourceKey(this.endpointConcept), String.class);

//Assertion
assertOK(entity);
Expand All @@ -60,7 +64,7 @@ public void canGetConcept() {
public void canGetVocabularies() {

//Action
final ResponseEntity<String> entity = getRestTemplate().getForEntity(this.endpointVocabularies, String.class);
final ResponseEntity<String> entity = getRestTemplate().getForEntity(withSourceKey(this.endpointVocabularies), String.class);

//Assertion
assertOK(entity);
Expand All @@ -70,7 +74,7 @@ public void canGetVocabularies() {
public void canGetDomains() {

//Action
final ResponseEntity<String> entity = getRestTemplate().getForEntity(this.endpointDomains, String.class);
final ResponseEntity<String> entity = getRestTemplate().getForEntity(withSourceKey(this.endpointDomains), String.class);

//Assertion
assertOK(entity);
Expand All @@ -79,7 +83,7 @@ public void canGetDomains() {
@Test
public void canSearchConceptsWithQueryParam() {
// Test the GET /{sourceKey}/search?query=... endpoint format
String searchUrl = this.endpointSearch.replace("{sourceKey}", SOURCE_KEY) + "?query=test";
String searchUrl = withSourceKey(this.endpointSearch) + "?query=test";

//Action
final ResponseEntity<String> entity = getRestTemplate().getForEntity(searchUrl, String.class);
Expand Down
6 changes: 3 additions & 3 deletions src/test/resources/application-test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ security.auth.db.datasource.url=http://localhost:${datasource.url}/arachne_porta
vocabularyservice.endpoint=${baseUri}/vocabulary
cdmResultsService.endpoint=${baseUri}/cdmresults
#GET vocabularies
vocabularyservice.endpoint.vocabularies=${vocabularyservice.endpoint}/vocabularies
vocabularyservice.endpoint.vocabularies=${vocabularyservice.endpoint}/{sourceKey}/vocabularies
#GET domains
vocabularyservice.endpoint.domains=${vocabularyservice.endpoint}/domains
vocabularyservice.endpoint.domains=${vocabularyservice.endpoint}/{sourceKey}/domains
#GET concept
vocabularyservice.endpoint.concept=${vocabularyservice.endpoint}/concept/1
vocabularyservice.endpoint.concept=${vocabularyservice.endpoint}/{sourceKey}/concept/1
#GET search with query param
vocabularyservice.endpoint.search=${vocabularyservice.endpoint}/{sourceKey}/search
#GET cohortdefinitions
Expand Down
Loading