From e696cd9f5bafd0830017ad38355c2e8fe64f980b Mon Sep 17 00:00:00 2001 From: Chenfei Gao Date: Thu, 11 Apr 2019 18:47:26 -0400 Subject: Add junit tests for endpoints Add junit tests to improve code coverage to > 80%. Modify db setting and remove db authorization from persistence. Issue-ID: POLICY-1441 Change-Id: I6070ac9ba6adba836adeeb547610c27dccf577bd Signed-off-by: Chenfei Gao --- main/src/test/resources/parameters/ApiConfigParameters.json | 5 +++-- main/src/test/resources/parameters/ApiConfigParameters_Https.json | 1 + .../resources/parameters/ApiConfigParameters_InvalidName.json | 8 ++++++++ .../ApiConfigParameters_InvalidRestServerParameters.json | 1 + main/src/test/resources/parameters/MinimumParameters.json | 1 + main/src/test/resources/parameters/NoParameters.json | 1 + 6 files changed, 15 insertions(+), 2 deletions(-) (limited to 'main/src/test/resources/parameters') diff --git a/main/src/test/resources/parameters/ApiConfigParameters.json b/main/src/test/resources/parameters/ApiConfigParameters.json index c64271c7..be9f5811 100644 --- a/main/src/test/resources/parameters/ApiConfigParameters.json +++ b/main/src/test/resources/parameters/ApiConfigParameters.json @@ -9,9 +9,10 @@ "databaseProviderParameters": { "name": "PolicyProviderParameterGroup", "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", - "databaseUrl": "jdbc:mariadb://localhost:3306/policy", + "databaseDriver": "org.h2.Driver", + "databaseUrl": "jdbc:h2:mem:testdb", "databaseUser": "policy", "databasePassword": "UDAxaWNZ", - "persistenceUnit": "ToscaConceptMariaDBTest" + "persistenceUnit": "ToscaConceptTest" } } diff --git a/main/src/test/resources/parameters/ApiConfigParameters_Https.json b/main/src/test/resources/parameters/ApiConfigParameters_Https.json index 878dc1ff..d7774fcd 100644 --- a/main/src/test/resources/parameters/ApiConfigParameters_Https.json +++ b/main/src/test/resources/parameters/ApiConfigParameters_Https.json @@ -10,6 +10,7 @@ "databaseProviderParameters": { "name": "PolicyProviderParameterGroup", "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseDriver": "org.h2.Driver", "databaseUrl": "jdbc:h2:mem:testdb", "databaseUser": "policy", "databasePassword": "UDAxaWNZ", diff --git a/main/src/test/resources/parameters/ApiConfigParameters_InvalidName.json b/main/src/test/resources/parameters/ApiConfigParameters_InvalidName.json index 80fb8232..24cc69f3 100644 --- a/main/src/test/resources/parameters/ApiConfigParameters_InvalidName.json +++ b/main/src/test/resources/parameters/ApiConfigParameters_InvalidName.json @@ -5,5 +5,13 @@ "port":6969, "userName":"healthcheck", "password":"zb!XztG34" + }, + "databaseProviderParameters": { + "name": "PolicyProviderParameterGroup", + "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseUrl": "jdbc:h2:mem:testdb", + "databaseUser": "policy", + "databasePassword": "UDAxaWNZ", + "persistenceUnit": "ToscaConceptTest" } } diff --git a/main/src/test/resources/parameters/ApiConfigParameters_InvalidRestServerParameters.json b/main/src/test/resources/parameters/ApiConfigParameters_InvalidRestServerParameters.json index 67e461e0..339c20b6 100644 --- a/main/src/test/resources/parameters/ApiConfigParameters_InvalidRestServerParameters.json +++ b/main/src/test/resources/parameters/ApiConfigParameters_InvalidRestServerParameters.json @@ -9,6 +9,7 @@ "databaseProviderParameters": { "name": "PolicyProviderParameterGroup", "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseDriver": "org.h2.Driver", "databaseUrl": "jdbc:h2:mem:testdb", "databaseUser": "policy", "databasePassword": "UDAxaWNZ", diff --git a/main/src/test/resources/parameters/MinimumParameters.json b/main/src/test/resources/parameters/MinimumParameters.json index 2600d20f..8ac10805 100644 --- a/main/src/test/resources/parameters/MinimumParameters.json +++ b/main/src/test/resources/parameters/MinimumParameters.json @@ -9,6 +9,7 @@ "databaseProviderParameters": { "name": "PolicyProviderParameterGroup", "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseDriver": "org.h2.Driver", "databaseUrl": "jdbc:h2:mem:testdb", "databaseUser": "policy", "databasePassword": "UDAxaWNZ", diff --git a/main/src/test/resources/parameters/NoParameters.json b/main/src/test/resources/parameters/NoParameters.json index ed2fbde2..6f933890 100644 --- a/main/src/test/resources/parameters/NoParameters.json +++ b/main/src/test/resources/parameters/NoParameters.json @@ -8,6 +8,7 @@ "databaseProviderParameters": { "name": "PolicyProviderParameterGroup", "implementation": "org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl", + "databaseDriver": "org.h2.Driver", "databaseUrl": "jdbc:h2:mem:testdb", "databaseUser": "policy", "databasePassword": "UDAxaWNZ", -- cgit 1.2.3-korg