Skip to content

Commit 32643ed

Browse files
add count service and integrate into the UI
1 parent db2c028 commit 32643ed

File tree

25 files changed

+4746
-7849
lines changed

25 files changed

+4746
-7849
lines changed
Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
#Creates the services.
2-
curl -S -s -i -X POST --url http://api-gateway:8001/services --data "name=counterparty-service" --data "url=http://counterparty-service:8080/counterparties"
3-
curl -S -s -i -X POST --url http://api-gateway:8001/services --data "name=instrument-service" --data "url=http://instrument-service:8080/instrument"
4-
curl -S -s -i -X POST --url http://api-gateway:8001/services --data "name=valuation-service" --data "url=http://valuation-service:8080/valuation"
5-
curl -S -s -i -X POST --url http://api-gateway:8001/services --data "name=regulatory-service" --data "url=http://regulatory-service:8080/regulatory"
2+
curl -S -s -i -X POST --url http://api-gateway:8001/services --data "name=counterparty-service" --data-urlencode "url=http://counterparty-service:8080/counterparties"
3+
curl -S -s -i -X POST --url http://api-gateway:8001/services --data "name=instrument-service" --data-urlencode "url=http://instrument-service:8080/instrument"
4+
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"
5+
curl -S -s -i -X POST --url http://api-gateway:8001/services --data "name=valuation-service" --data-urlencode "url=http://valuation-service:8080/valuation"
6+
curl -S -s -i -X POST --url http://api-gateway:8001/services --data "name=regulatory-service" --data-urlencode "url=http://regulatory-service:8080/regulatory"
67
#Creates the routes
7-
curl -S -s -i -X POST --url http://api-gateway:8001/services/counterparty-service/routes --data "paths[]=/api/v1/counterparty"
8-
curl -S -s -i -X POST --url http://api-gateway:8001/services/instrument-service/routes --data "paths[]=/api/v1/instrument"
9-
curl -S -s -i -X POST --url http://api-gateway:8001/services/valuation-service/routes --data "paths[]=/api/v1/valuation"
10-
curl -S -s -i -X POST --url http://api-gateway:8001/services/regulatory-service/routes --data "paths[]=/api/v1/regulatory"
8+
curl -S -s -i -X POST --url http://api-gateway:8001/services/counterparty-service/routes --data-urlencode "paths[]=/api/v1/counterparty"
9+
curl -S -s -i -X POST --url http://api-gateway:8001/services/instrument-service/routes --data-urlencode "paths[]=/api/v1/instrument"
10+
curl -S -s -i -X POST --url http://api-gateway:8001/services/init-instrument-service/routes --data-urlencode "paths[]=/api/v1/init-instrument"
11+
curl -S -s -i -X POST --url http://api-gateway:8001/services/valuation-service/routes --data-urlencode "paths[]=/api/v1/valuation"
12+
curl -S -s -i -X POST --url http://api-gateway:8001/services/regulatory-service/routes --data-urlencode "paths[]=/api/v1/regulatory"
1113
#Enable the Open ID Plugin
12-
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"
14+
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"
15+
#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"

counterparty-service/src/main/java/api/CounterpartyRestService.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ public List<Counterparty> getAll() {
2828
return counterpartyService.getAll();
2929
}
3030

31+
@GET
32+
@Path("/count")
33+
@Produces(MediaType.APPLICATION_JSON)
34+
@ApiOperation(value = "Count the number of counterparties")
35+
public Long count() {
36+
return counterpartyService.count();
37+
}
38+
3139
@GET
3240
@Path("{lei}")
3341
@Produces(MediaType.APPLICATION_JSON)

counterparty-service/src/main/java/domain/service/CounterpartyService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ public interface CounterpartyService {
88

99
List<Counterparty> getAll();
1010
Counterparty get(String lei);
11+
Long count();
1112

1213
}

counterparty-service/src/main/java/domain/service/CounterpartyServiceImpl.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,13 @@ public List<Counterparty> getAll() {
3131
public Counterparty get(String lei) {
3232
return em.find(Counterparty.class, lei);
3333
}
34+
35+
@Override
36+
public Long count() {
37+
log.info("Count the number of counterparties");
38+
CriteriaBuilder qb = em.getCriteriaBuilder();
39+
CriteriaQuery<Long> cq = qb.createQuery(Long.class);
40+
cq.select(qb.count(cq.from(Counterparty.class)));
41+
return em.createQuery(cq).getSingleResult();
42+
}
3443
}

counterparty-service/src/test/java/domain/service/CounterpartyServiceImplTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ void testGet() {
4747
assertEquals(counterparties.get(0).getLei(), cpty.getLei());
4848
assertEquals(counterparties.get(0).getLegalAddress(), cpty.getLegalAddress());
4949
}
50+
51+
@Test
52+
void testCount() {
53+
long size = initDataStore();
54+
long count = counterpartyServiceImpl.count();
55+
assertEquals(size, count);
56+
}
5057

5158
private List<Counterparty> getCounterparties() {
5259

docker-compose/docker-compose-api-gw.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ services:
4141
environment:
4242
KONG_DATABASE: postgres
4343
KONG_PG_HOST: kong-database
44+
KONG_LOG_LEVEL: debug
4445
KONG_PROXY_ACCESS_LOG: "/dev/stdout"
4546
KONG_ADMIN_ACCESS_LOG: "/dev/stdout"
4647
KONG_PROXY_ERROR_LOG: "/dev/stderr"

web-ui/angular.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
],
4343
"scripts": [
4444
"node_modules/pace-js/pace.min.js",
45+
"node_modules/keycloak-js/dist/keycloak.js",
4546
"node_modules/tinymce/tinymce.min.js",
4647
"node_modules/tinymce/themes/modern/theme.min.js",
4748
"node_modules/tinymce/plugins/link/plugin.min.js",

0 commit comments

Comments
 (0)