From b84ab3e188bd62352751976f3ceb9ba88da9c784 Mon Sep 17 00:00:00 2001 From: Ankit Singh Date: Thu, 30 Jun 2022 10:54:28 +0530 Subject: [PATCH 1/5] Cover all lines in CacheServiceTest --- .../gis/server/cache/cacheImpl/CacheType.java | 3 ++- .../gis/server/cache/CacheServiceTest.java | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/main/java/iudx/gis/server/cache/cacheImpl/CacheType.java b/src/main/java/iudx/gis/server/cache/cacheImpl/CacheType.java index ff10242..f10ff07 100644 --- a/src/main/java/iudx/gis/server/cache/cacheImpl/CacheType.java +++ b/src/main/java/iudx/gis/server/cache/cacheImpl/CacheType.java @@ -1,7 +1,8 @@ package iudx.gis.server.cache.cacheImpl; public enum CacheType { - REVOKED_CLIENT("revoked_client"); + REVOKED_CLIENT("revoked_client"), + NOT_REVOKED_CLIENT("not_revoked_client"); String cacheName; diff --git a/src/test/java/iudx/gis/server/cache/CacheServiceTest.java b/src/test/java/iudx/gis/server/cache/CacheServiceTest.java index 7d6363f..cb803d8 100644 --- a/src/test/java/iudx/gis/server/cache/CacheServiceTest.java +++ b/src/test/java/iudx/gis/server/cache/CacheServiceTest.java @@ -46,6 +46,11 @@ public class CacheServiceTest { .put("type", CacheType.REVOKED_CLIENT) .put("key", "revoked_client_id_1") .put("value", "2020-10-19T14:20:00Z"); + static JsonObject testJson_2 = + new JsonObject() + .put("type", CacheType.NOT_REVOKED_CLIENT) + .put("key", null) + .put("value", null); @BeforeAll public static void setup(Vertx vertx, VertxTestContext testContext) { @@ -264,6 +269,23 @@ public void refreshCacheTest(Vertx vertx, VertxTestContext testContext) { } }); } + @Description("No Cache Passed") + @Test + public void refreshCacheTest2(Vertx vertx, VertxTestContext testContext) { + cacheService.refresh( + testJson_2, + handler -> { + if (handler.failed()) { + handler.cause(); + testContext.completeNow(); + // JsonObject json = testJson_0.copy(); + // json.remove("value"); + }else { + handler.succeeded(); + testContext.completeNow(); + } + }); + } @Description("refresh cache without passing key and value.") @Test public void refreshCacheTest_1(Vertx vertx, VertxTestContext testContext) { From 2dd944f10cc168722d44c5c2890b5848dc5275d6 Mon Sep 17 00:00:00 2001 From: Ankit Singh Date: Thu, 30 Jun 2022 11:06:40 +0530 Subject: [PATCH 2/5] Removed Extra lines in cache --- .../gis/server/cache/cacheImpl/CacheType.java | 3 +-- .../gis/server/cache/CacheServiceTest.java | 23 +------------------ 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/src/main/java/iudx/gis/server/cache/cacheImpl/CacheType.java b/src/main/java/iudx/gis/server/cache/cacheImpl/CacheType.java index f10ff07..ff10242 100644 --- a/src/main/java/iudx/gis/server/cache/cacheImpl/CacheType.java +++ b/src/main/java/iudx/gis/server/cache/cacheImpl/CacheType.java @@ -1,8 +1,7 @@ package iudx.gis.server.cache.cacheImpl; public enum CacheType { - REVOKED_CLIENT("revoked_client"), - NOT_REVOKED_CLIENT("not_revoked_client"); + REVOKED_CLIENT("revoked_client"); String cacheName; diff --git a/src/test/java/iudx/gis/server/cache/CacheServiceTest.java b/src/test/java/iudx/gis/server/cache/CacheServiceTest.java index cb803d8..d808264 100644 --- a/src/test/java/iudx/gis/server/cache/CacheServiceTest.java +++ b/src/test/java/iudx/gis/server/cache/CacheServiceTest.java @@ -46,11 +46,6 @@ public class CacheServiceTest { .put("type", CacheType.REVOKED_CLIENT) .put("key", "revoked_client_id_1") .put("value", "2020-10-19T14:20:00Z"); - static JsonObject testJson_2 = - new JsonObject() - .put("type", CacheType.NOT_REVOKED_CLIENT) - .put("key", null) - .put("value", null); @BeforeAll public static void setup(Vertx vertx, VertxTestContext testContext) { @@ -269,23 +264,7 @@ public void refreshCacheTest(Vertx vertx, VertxTestContext testContext) { } }); } - @Description("No Cache Passed") - @Test - public void refreshCacheTest2(Vertx vertx, VertxTestContext testContext) { - cacheService.refresh( - testJson_2, - handler -> { - if (handler.failed()) { - handler.cause(); - testContext.completeNow(); - // JsonObject json = testJson_0.copy(); - // json.remove("value"); - }else { - handler.succeeded(); - testContext.completeNow(); - } - }); - } + @Description("refresh cache without passing key and value.") @Test public void refreshCacheTest_1(Vertx vertx, VertxTestContext testContext) { From 0dc7e68d44e5cb72f662cc7250ebcb43517352e3 Mon Sep 17 00:00:00 2001 From: ankitmashu Date: Mon, 20 Mar 2023 18:11:55 +0530 Subject: [PATCH 3/5] Updated setup.md and readme --- README.md | 1 - SETUP.md | 63 +++++++++++++------------------------------------------ 2 files changed, 14 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 8d75a5e..1944439 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,6 @@ The api docs can be found [here](https://gis.iudx.io/apis). The Gis-interface Server connects with various external dependencies namely - PostgreSQL -- ImmuDB - RabbitMQ Find the installations of the above along with the configurations to modify the database url, port and associated credentials in the appropriate sections diff --git a/SETUP.md b/SETUP.md index 071e7ea..f89d8ae 100644 --- a/SETUP.md +++ b/SETUP.md @@ -12,7 +12,6 @@ The Gis Interface connects with various external dependencies namely - `PostgreSQL` : used to store and query data related to - Token Invalidation - Fetching data -- `ImmuDB` : used to store metering information - `RabbitMQ` : used to receive token invalidation info @@ -20,6 +19,7 @@ The Gis Interface connects with various external dependencies namely The Gis Interface also connects with various DX dependencies namely - Authorization Server : used to download the certificate for token decoding - Catalogue Server : used to download the list of resources, access policies and query types supported on a resource. +- Auditing Server : used to store information of metering in ImmuDB and Postgres. ---- ## Setting up RabbitMQ for IUDX Gis Interface @@ -35,7 +35,6 @@ In order to connect to the appropriate RabbitMQ instance, required information s "verticleInstances": , "dataBrokerIP": "localhost", "dataBrokerPort": , - "dataBrokerVhost": , "dataBrokerUserName": , "dataBrokerPassword": , Adding default apiserver ports @@ -48,7 +47,10 @@ Adding default apiserver ports "handshakeTimeout": , "requestedChannelMax": , "networkRecoveryInterval": , - "automaticRecoveryEnabled": "true" + "automaticRecoveryEnabled": "true", + "prodVhost": , + "internalVhost": , + "externalVhost": } ``` --- @@ -72,29 +74,15 @@ In order to connect to the appropriate Postgres database, required information s "databasePassword": , "poolSize": } -``` -**DatabaseVerticle** -``` -{ - "id": "iudx.gis.server.database.DatabaseVerticle", - "verticleInstances": , - "databaseIP": "localhost", - "databasePort": , - "databaseName": , - "databaseUserName": , - "databasePassword": , - "dbClientPoolSize": -} -``` - +``` #### Schemas for PostgreSQL tables in IUDX Gis Interface 1. **Token Invalidation Table Schema** ``` CREATE TABLE IF NOT EXISTS revoked_tokens ( _id uuid NOT NULL, - expiry timestamp with time zone NOT NULL, + expiry timestamp without time zone NOT NULL, created_at timestamp without time zone NOT NULL, modified_at timestamp without time zone NOT NULL, CONSTRAINT revoke_tokens_pk PRIMARY KEY (_id) @@ -119,10 +107,8 @@ CREATE TABLE IF NOT EXISTS gis ``` ---- -## Setting up ImmuDB for IUDX Gis Interface -- Refer to the docker files available [here](https://github.com/datakaveri/iudx-deployment/blob/master/Docker-Swarm-deployment/single-node/immudb) to setup ImmuDB. -- Refer [this](https://github.com/datakaveri/iudx-deployment/blob/master/Docker-Swarm-deployment/single-node/immudb/docker/immudb-config-generator/immudb-config-generator.py) to create table/user. -- In order to connect to the appropriate ImmuDB database, required information such as meteringDatabaseIP, meteringDatabasePort etc. should be updated in the MeteringVerticle module available in [config-example.json](configs/config-example.json). +## Setting up Metering for IUDX Gis Interface +- In Metering Verticle we are pushing data in Auditing Verticle through RabbitMQ. [config-example.json](configs/config-example.json). **MeteringVerticle** @@ -130,37 +116,14 @@ CREATE TABLE IF NOT EXISTS gis { "id": "iudx.gis.server.metering.MeteringVerticle", "verticleInstances": , - "meteringDatabaseIP": "localhost", - "meteringDatabasePort": , - "meteringDatabaseName": , - "meteringDatabaseUserName": , - "meteringDatabasePassword": , - "meteringDatabaseTableName": - "meteringPoolSize": } ``` -**Metering Table Schema** -``` -CREATE TABLE IF NOT EXISTS gisaudit ( - id VARCHAR[128] NOT NULL, - api VARCHAR[128], - userid VARCHAR[128], - epochtime INTEGER, - resourceid VARCHAR[200], - isotime VARCHAR[128], - providerid VARCHAR[128], - size INTEGER, - PRIMARY KEY id -); -``` - ---- ## Setting up RabbitMQ for IUDX Gis Interface - Refer to the docker files available [here](https://github.com/datakaveri/iudx-deployment/blob/master/Docker-Swarm-deployment/single-node/databroker) to setup RMQ. - In order to connect to the appropriate RabbitMQ instance, required information such as dataBrokerIP, dataBrokerPort etc. should be updated in the DataBrokerVerticle module available in [config-example.json](configs/config-example.json). **DataBrokerVerticle** @@ -170,16 +133,18 @@ In order to connect to the appropriate RabbitMQ instance, required information s "verticleInstances": , "dataBrokerIP": "localhost", "dataBrokerPort": , - "dataBrokerVhost": , "dataBrokerUserName": , "dataBrokerPassword": , - "dataBrokerManagementPort": , "connectionTimeout": , "requestedHeartbeat": , "handshakeTimeout": , "requestedChannelMax": , "networkRecoveryInterval": , - "automaticRecoveryEnabled": + "automaticRecoveryEnabled": , + "prodVhost": , + "internalVhost": , + "externalVhost": + } ``` From 086a8312e860a67cbb822d71b02dbb41edafca3c Mon Sep 17 00:00:00 2001 From: ankitmashu Date: Tue, 21 Mar 2023 09:14:48 +0530 Subject: [PATCH 4/5] issue solved --- SETUP.md | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/SETUP.md b/SETUP.md index f89d8ae..40fdbf8 100644 --- a/SETUP.md +++ b/SETUP.md @@ -22,38 +22,6 @@ The Gis Interface also connects with various DX dependencies namely - Auditing Server : used to store information of metering in ImmuDB and Postgres. ---- -## Setting up RabbitMQ for IUDX Gis Interface -- Refer to the docker files available [here](https://github.com/datakaveri/iudx-deployment/blob/master/Docker-Swarm-deployment/single-node/databroker) to setup RMQ. - - -In order to connect to the appropriate RabbitMQ instance, required information such as dataBrokerIP, dataBrokerPort etc. should be updated in the DataBrokerVerticle module available in [config-example.json](configs/config-example.json). - -**DataBrokerVerticle** -``` -{ - id": "iudx.gis.server.databroker.DataBrokerVerticle", - "verticleInstances": , - "dataBrokerIP": "localhost", - "dataBrokerPort": , - "dataBrokerUserName": , - "dataBrokerPassword": , -Adding default apiserver ports - -- Default http port is 8080. -- Default port when ssl is enabled is 8443. -- Apiserver port configurable using parameter 'httpPort "dataBrokerManagementPort": , - "connectionTimeout": , - "requestedHeartbeat": , - "handshakeTimeout": , - "requestedChannelMax": , - "networkRecoveryInterval": , - "automaticRecoveryEnabled": "true", - "prodVhost": , - "internalVhost": , - "externalVhost": -} -``` ---- ## Setting up PostgreSQL for IUDX Gis Interface - Refer to the docker files available [here](https://github.com/datakaveri/iudx-deployment/blob/master/Docker-Swarm-deployment/single-node/postgres) to setup PostgreSQL From c790986a44083b0e60a9e6ea51efa7dad5a57670 Mon Sep 17 00:00:00 2001 From: ankitmashu Date: Tue, 21 Mar 2023 09:31:26 +0530 Subject: [PATCH 5/5] Added cache in setup md --- SETUP.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/SETUP.md b/SETUP.md index 40fdbf8..ab420c6 100644 --- a/SETUP.md +++ b/SETUP.md @@ -76,7 +76,7 @@ CREATE TABLE IF NOT EXISTS gis ---- ## Setting up Metering for IUDX Gis Interface -- In Metering Verticle we are pushing data in Auditing Verticle through RabbitMQ. [config-example.json](configs/config-example.json). +- In Metering Verticle we are pushing data in Auditing Server through RabbitMQ. [config-example.json](configs/config-example.json). **MeteringVerticle** @@ -89,6 +89,20 @@ CREATE TABLE IF NOT EXISTS gis ---- +## Setting up Internal Cache Store +- In order to connect with the internal cache, we need to add cache verticle configs available in [config-example.json](configs/config-example.json). + +**CacheVerticle** + +``` +{ + "id": "iudx.gis.server.cache.CacheVerticle", + "verticleInstances": 1 +} +``` + +---- + ## Setting up RabbitMQ for IUDX Gis Interface - Refer to the docker files available [here](https://github.com/datakaveri/iudx-deployment/blob/master/Docker-Swarm-deployment/single-node/databroker) to setup RMQ.