Skip to content

Commit

Permalink
add count service and integrate into the UI
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] authored and [email protected] committed Apr 4, 2019
1 parent db2c028 commit 32643ed
Show file tree
Hide file tree
Showing 25 changed files with 4,746 additions and 7,849 deletions.
21 changes: 12 additions & 9 deletions api-gateway/src/main/docker/config-kong.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#Creates the services.
curl -S -s -i -X POST --url http://api-gateway:8001/services --data "name=counterparty-service" --data "url=http://counterparty-service:8080/counterparties"
curl -S -s -i -X POST --url http://api-gateway:8001/services --data "name=instrument-service" --data "url=http://instrument-service:8080/instrument"
curl -S -s -i -X POST --url http://api-gateway:8001/services --data "name=valuation-service" --data "url=http://valuation-service:8080/valuation"
curl -S -s -i -X POST --url http://api-gateway:8001/services --data "name=regulatory-service" --data "url=http://regulatory-service:8080/regulatory"
curl -S -s -i -X POST --url http://api-gateway:8001/services --data "name=counterparty-service" --data-urlencode "url=http://counterparty-service:8080/counterparties"
curl -S -s -i -X POST --url http://api-gateway:8001/services --data "name=instrument-service" --data-urlencode "url=http://instrument-service:8080/instrument"
curl -S -s -i -X POST --url http://api-gateway:8001/services --data "name=init-instrument-service" --data-urlencode "url=http://instrument-service:8080/instrument/propagateAllInstruments"
curl -S -s -i -X POST --url http://api-gateway:8001/services --data "name=valuation-service" --data-urlencode "url=http://valuation-service:8080/valuation"
curl -S -s -i -X POST --url http://api-gateway:8001/services --data "name=regulatory-service" --data-urlencode "url=http://regulatory-service:8080/regulatory"
#Creates the routes
curl -S -s -i -X POST --url http://api-gateway:8001/services/counterparty-service/routes --data "paths[]=/api/v1/counterparty"
curl -S -s -i -X POST --url http://api-gateway:8001/services/instrument-service/routes --data "paths[]=/api/v1/instrument"
curl -S -s -i -X POST --url http://api-gateway:8001/services/valuation-service/routes --data "paths[]=/api/v1/valuation"
curl -S -s -i -X POST --url http://api-gateway:8001/services/regulatory-service/routes --data "paths[]=/api/v1/regulatory"
curl -S -s -i -X POST --url http://api-gateway:8001/services/counterparty-service/routes --data-urlencode "paths[]=/api/v1/counterparty"
curl -S -s -i -X POST --url http://api-gateway:8001/services/instrument-service/routes --data-urlencode "paths[]=/api/v1/instrument"
curl -S -s -i -X POST --url http://api-gateway:8001/services/init-instrument-service/routes --data-urlencode "paths[]=/api/v1/init-instrument"
curl -S -s -i -X POST --url http://api-gateway:8001/services/valuation-service/routes --data-urlencode "paths[]=/api/v1/valuation"
curl -S -s -i -X POST --url http://api-gateway:8001/services/regulatory-service/routes --data-urlencode "paths[]=/api/v1/regulatory"
#Enable the Open ID Plugin
curl -S -s -i -X POST --url http://api-gateway:8001/plugins --data "name=oidc" --data "config.client_id=api-gateway" --data "config.client_secret=798751a9-d274-4335-abf6-80611cd19ba1" --data "config.discovery=https%3A%2F%2Flocalhost%2Fauth%2Frealms%2Fapigw%2F.well-known%2Fopenid-configuration"
curl -S -s -i -X POST --url http://api-gateway:8001/plugins --data "name=oidc" --data "config.client_id=api-gateway" --data "config.client_secret=798751a9-d274-4335-abf6-80611cd19ba1" --data "config.discovery=https%3A%2F%2Flocalhost%2Fauth%2Frealms%2Fapigw%2F.well-known%2Fopenid-configuration"
#curl -S -s -i -X POST --url http://api-gateway:8001/plugins --data "name=oidc" --data "config.client_id=api-gateway" --data "config.client_secret=798751a9-d274-4335-abf6-80611cd19ba1" --data "config.discovery=http%3A%2F%2Fiam:8080%2Fauth%2Frealms%2Fapigw%2F.well-known%2Fopenid-configuration"
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ public List<Counterparty> getAll() {
return counterpartyService.getAll();
}

@GET
@Path("/count")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Count the number of counterparties")
public Long count() {
return counterpartyService.count();
}

@GET
@Path("{lei}")
@Produces(MediaType.APPLICATION_JSON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ public interface CounterpartyService {

List<Counterparty> getAll();
Counterparty get(String lei);
Long count();

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,13 @@ public List<Counterparty> getAll() {
public Counterparty get(String lei) {
return em.find(Counterparty.class, lei);
}

@Override
public Long count() {
log.info("Count the number of counterparties");
CriteriaBuilder qb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = qb.createQuery(Long.class);
cq.select(qb.count(cq.from(Counterparty.class)));
return em.createQuery(cq).getSingleResult();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ void testGet() {
assertEquals(counterparties.get(0).getLei(), cpty.getLei());
assertEquals(counterparties.get(0).getLegalAddress(), cpty.getLegalAddress());
}

@Test
void testCount() {
long size = initDataStore();
long count = counterpartyServiceImpl.count();
assertEquals(size, count);
}

private List<Counterparty> getCounterparties() {

Expand Down
1 change: 1 addition & 0 deletions docker-compose/docker-compose-api-gw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ services:
environment:
KONG_DATABASE: postgres
KONG_PG_HOST: kong-database
KONG_LOG_LEVEL: debug
KONG_PROXY_ACCESS_LOG: "/dev/stdout"
KONG_ADMIN_ACCESS_LOG: "/dev/stdout"
KONG_PROXY_ERROR_LOG: "/dev/stderr"
Expand Down
1 change: 1 addition & 0 deletions web-ui/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
],
"scripts": [
"node_modules/pace-js/pace.min.js",
"node_modules/keycloak-js/dist/keycloak.js",
"node_modules/tinymce/tinymce.min.js",
"node_modules/tinymce/themes/modern/theme.min.js",
"node_modules/tinymce/plugins/link/plugin.min.js",
Expand Down
Loading

0 comments on commit 32643ed

Please sign in to comment.