Skip to content

Commit

Permalink
added back together corrected compose files
Browse files Browse the repository at this point in the history
  • Loading branch information
SevKohler committed May 29, 2024
1 parent 1e2b698 commit 11f8ca5
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 19 deletions.
16 changes: 14 additions & 2 deletions docker/docker-compose-ehrbase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
networks:
- ehrbase-net
environment:
DB_URL: jdbc:postgresql://ehrdb:5433/ehrbase
DB_URL: jdbc:postgresql://ehrdb:5432/ehrbase
DB_USER_ADMIN: ehrbase
DB_PASS_ADMIN: ehrbase
SECURITY_AUTHTYPE: BASIC
Expand All @@ -20,7 +20,8 @@ services:
DB_USER: ehrbase_restricted
DB_PASS: ehrbase_restricted
depends_on:
- ehrdb
ehrdb:
condition: service_healthy
restart: on-failure

ehrdb:
Expand All @@ -32,10 +33,21 @@ services:
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
PGDATA: /var/lib/postgresql/data/pgdata
EHRBASE_USER_ADMIN: ehrbase
EHRBASE_PASSWORD_ADMIN: ehrbase
EHRBASE_USER: ehrbase_restricted
EHRBASE_PASSWORD: ehrbase_restricted
volumes:
- ehrdb-pgdata:/var/lib/postgresql/data/pgdata
healthcheck:
test: "pg_isready -h localhost -U $$POSTGRES_USER"
interval: 10s
timeout: 5s
retries: 70

networks:
ehrbase-net: {}

volumes:
ehrdb-pgdata:
24 changes: 22 additions & 2 deletions docker/docker-compose-full.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#docker-compose-full.yml
services:

ehrbase:
image: ehrbase/ehrbase:next
ports:
Expand All @@ -19,7 +18,8 @@ services:
DB_USER: ehrbase_restricted
DB_PASS: ehrbase_restricted
depends_on:
- ehrdb
ehrdb:
condition: service_healthy
restart: on-failure

ehrdb:
Expand All @@ -31,10 +31,18 @@ services:
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
PGDATA: /var/lib/postgresql/data/pgdata
EHRBASE_USER_ADMIN: ehrbase
EHRBASE_PASSWORD_ADMIN: ehrbase
EHRBASE_USER: ehrbase_restricted
EHRBASE_PASSWORD: ehrbase_restricted
volumes:
- ehrdb-pgdata:/var/lib/postgresql/data/pgdata
healthcheck:
test: "pg_isready -h localhost -U $$POSTGRES_USER"
interval: 10s
timeout: 5s
retries: 70

aft:
image: aft:latest
Expand Down Expand Up @@ -78,11 +86,23 @@ services:
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
PGDATA: /var/lib/postgresql/data/pgdata
EHRBASE_USER_ADMIN: ehrbase
EHRBASE_PASSWORD_ADMIN: ehrbase
EHRBASE_USER: ehrbase_restricted
EHRBASE_PASSWORD: ehrbase_restricted
command: -p 5433
volumes:
- ehrdb2-pgdata:/var/lib/postgresql/data/pgdata
healthcheck:
test: "pg_isready -h localhost -U $$POSTGRES_USER"
interval: 10s
timeout: 5s
retries: 70

networks:
ehrbase-net: {}

volumes:
ehrdb-pgdata:
ehrdb2-pgdata:
25 changes: 23 additions & 2 deletions docker/docker-compose-without-aft.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#docker-compose-full.yml
services:

ehrbase:
image: ehrbase/ehrbase:next
ports:
Expand All @@ -19,8 +18,10 @@ services:
DB_USER: ehrbase_restricted
DB_PASS: ehrbase_restricted
depends_on:
- ehrdb
ehrdb:
condition: service_healthy
restart: on-failure

ehrdb:
image: ehrbase/ehrbase-postgres:latest
ports:
Expand All @@ -30,10 +31,18 @@ services:
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
PGDATA: /var/lib/postgresql/data/pgdata
EHRBASE_USER_ADMIN: ehrbase
EHRBASE_PASSWORD_ADMIN: ehrbase
EHRBASE_USER: ehrbase_restricted
EHRBASE_PASSWORD: ehrbase_restricted
volumes:
- ehrdb-pgdata:/var/lib/postgresql/data/pgdata
healthcheck:
test: "pg_isready -h localhost -U $$POSTGRES_USER"
interval: 10s
timeout: 5s
retries: 70

ehrbase2:
image: ehrbase/ehrbase:next
Expand Down Expand Up @@ -65,11 +74,23 @@ services:
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
PGDATA: /var/lib/postgresql/data/pgdata
EHRBASE_USER_ADMIN: ehrbase
EHRBASE_PASSWORD_ADMIN: ehrbase
EHRBASE_USER: ehrbase_restricted
EHRBASE_PASSWORD: ehrbase_restricted
command: -p 5433
volumes:
- ehrdb2-pgdata:/var/lib/postgresql/data/pgdata
healthcheck:
test: "pg_isready -h localhost -U $$POSTGRES_USER"
interval: 10s
timeout: 5s
retries: 70

networks:
ehrbase-net: {}

volumes:
ehrdb-pgdata:
ehrdb2-pgdata:
3 changes: 0 additions & 3 deletions src/main/java/org/bih/aft/controller/QueryController.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
import org.bih.aft.exceptions.InvalidCountQuery;
import org.bih.aft.controller.dao.AQLinput;
import org.bih.aft.ports.QueryUseCase;
import org.bih.aft.service.FederationService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/bih/aft/service/CountVerificator.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
import org.ehrbase.openehr.sdk.aql.dto.operand.AggregateFunction;
import org.ehrbase.openehr.sdk.aql.dto.select.SelectClause;
import org.ehrbase.openehr.sdk.aql.dto.select.SelectExpression;
import org.springframework.stereotype.Service;

import java.util.List;
@Slf4j
@Service
public class CountVerificator implements QueryVerificator {


@Override
public void verify(AQLinput aqlQuery) { // TODO: What return type here ? Response should be 400 in the end
String query = aqlQuery.aql();
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/org/bih/aft/service/FederationListService.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;

@Service
Expand All @@ -18,10 +19,8 @@ public class FederationListService implements LocationProvider {

private FederationList loadFederationfile() {
ObjectMapper mapper = new ObjectMapper();
ClassLoader classloader = Thread.currentThread().getContextClassLoader();
File file = new File(classloader.getResource(federationListPath).getFile());
try {
federationList = mapper.readValue(file, FederationList.class);
try(InputStream inputStream = getClass().getClassLoader().getResourceAsStream(federationListPath)){
federationList = mapper.readValue(inputStream, FederationList.class);
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/org/bih/aft/service/FederationService.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@ public class FederationService implements QueryUseCase {
@Value("${aft.location}")
private String homeLocation;

OpenEhrClient openEhrClient;
private final OpenEhrClient openEhrClient;

QueryVerificator queryVerificator;
private final QueryVerificator queryVerificator;

LocationProvider federationListService;

QueryService queryService;
private final LocationProvider federationListService;

private final QueryService queryService;

@Override
public List<FeasibilityOutput> federate(AQLinput aqlQuery) throws InvalidCountQuery {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ void getFederationList() {
List<Location> actual = service.locations();
Location location = new Location("Test2", "https://localhost:8091");
List<Location> expected = Lists.list(location);

assertEquals(expected, actual);
}
}

0 comments on commit 11f8ca5

Please sign in to comment.