summaryrefslogtreecommitdiffstats
path: root/models-provider/src
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2025-01-16 11:18:38 +0000
committeradheli.tavares <adheli.tavares@est.tech>2025-01-16 16:02:56 +0000
commit57a9e3d70558d3b3b374ff0b09bd89837a5baa07 (patch)
tree7ad8235b4bfbe7db0b76762da277e8cb4b0fdba3 /models-provider/src
parentb60fb4d0e5ad3603f967029a2682484cbdd81cec (diff)
Remove MariaDB support
Issue-ID: POLICY-5196 Change-Id: Iee84ce0c24a89b47dbc34ba110e9c83103ef47ed Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'models-provider/src')
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyToscaPersistenceTest.java29
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyTypePersistenceTest.java33
2 files changed, 21 insertions, 41 deletions
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyToscaPersistenceTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyToscaPersistenceTest.java
index e9aedad99..55b9f9aae 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyToscaPersistenceTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyToscaPersistenceTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2021, 2023-2024 Nordix Foundation.
+ * Copyright (C) 2019-2021, 2023-2025 Nordix Foundation.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -60,8 +60,8 @@ import org.slf4j.LoggerFactory;
class PolicyToscaPersistenceTest {
private static final Logger LOGGER = LoggerFactory.getLogger(PolicyToscaPersistenceTest.class);
- private static YamlJsonTranslator yamlJsonTranslator = new YamlJsonTranslator();
- private StandardCoder standardCoder = new StandardCoder();
+ private static final YamlJsonTranslator yamlJsonTranslator = new YamlJsonTranslator();
+ private final StandardCoder standardCoder = new StandardCoder();
private static PolicyModelsProvider databaseProvider;
@@ -73,17 +73,11 @@ class PolicyToscaPersistenceTest {
*/
@BeforeAll
public static void setupParameters() throws Exception {
- // H2, use "org.mariadb.jdbc.Driver" and "jdbc:mariadb://localhost:3306/policy" for locally installed MariaDB
PolicyModelsProviderParameters parameters = new PolicyModelsProviderParameters();
- if (System.getProperty("USE-MARIADB") != null) {
- parameters.setDatabaseDriver("org.mariadb.jdbc.Driver");
- parameters.setDatabaseUrl("jdbc:mariadb://localhost:3306/policy");
- } else {
- parameters.setDatabaseDriver("org.h2.Driver");
- parameters.setDatabaseUrl("jdbc:h2:mem:PolicyToscaPersistenceTest");
- }
+ parameters.setDatabaseDriver("org.h2.Driver");
+ parameters.setDatabaseUrl("jdbc:h2:mem:PolicyToscaPersistenceTest");
parameters.setDatabaseUser("policy");
parameters.setDatabasePassword("P01icY");
@@ -257,14 +251,11 @@ class PolicyToscaPersistenceTest {
CountDownLatch threadCountDownLatch = new CountDownLatch(10);
for (int i = 0; i < 10; i++) {
- new Thread() {
- @Override
- public void run() {
- assertThatCode(() -> databaseProvider.createPolicies(serviceTemplate)).doesNotThrowAnyException();
- assertThatCode(() -> databaseProvider.updatePolicies(serviceTemplate)).doesNotThrowAnyException();
- threadCountDownLatch.countDown();
- }
- }.start();
+ new Thread(() -> {
+ assertThatCode(() -> databaseProvider.createPolicies(serviceTemplate)).doesNotThrowAnyException();
+ assertThatCode(() -> databaseProvider.updatePolicies(serviceTemplate)).doesNotThrowAnyException();
+ threadCountDownLatch.countDown();
+ }).start();
}
threadCountDownLatch.await(10, TimeUnit.SECONDS);
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyTypePersistenceTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyTypePersistenceTest.java
index 30824eb3a..057af7618 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyTypePersistenceTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyTypePersistenceTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2021, 2023-2024 Nordix Foundation.
+ * Copyright (C) 2019-2021, 2023-2025 Nordix Foundation.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -49,7 +49,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
* @author Liam Fallon (liam.fallon@est.tech)
*/
class PolicyTypePersistenceTest {
- private YamlJsonTranslator yamlTranslator = new YamlJsonTranslator();
+ private final YamlJsonTranslator yamlTranslator = new YamlJsonTranslator();
private static PolicyModelsProvider databaseProvider;
/**
@@ -59,18 +59,11 @@ class PolicyTypePersistenceTest {
*/
@BeforeAll
public static void setupParameters() throws PfModelException {
- // H2, use "org.mariadb.jdbc.Driver" and "jdbc:mariadb://localhost:3306/policy" for locally installed MariaDB
PolicyModelsProviderParameters parameters = new PolicyModelsProviderParameters();
- if (System.getProperty("USE-MARIADB") != null) {
- parameters.setDatabaseDriver("org.mariadb.jdbc.Driver");
- parameters.setDatabaseUrl("jdbc:mariadb://localhost:3306/policy");
- } else {
- parameters.setDatabaseDriver("org.h2.Driver");
- parameters.setDatabaseUrl("jdbc:h2:mem:PolicyToscaPersistenceTest");
- }
-
+ parameters.setDatabaseDriver("org.h2.Driver");
+ parameters.setDatabaseUrl("jdbc:h2:mem:PolicyToscaPersistenceTest");
parameters.setDatabaseUser("policy");
parameters.setDatabasePassword("P01icY");
parameters.setPersistenceUnit("ToscaConceptTest");
@@ -121,14 +114,11 @@ class PolicyTypePersistenceTest {
CountDownLatch threadCountDownLatch = new CountDownLatch(10);
for (int i = 0; i < 10; i++) {
- new Thread() {
- @Override
- public void run() {
- assertThatCode(() -> databaseProvider.createPolicyTypes(serviceTemplate))
- .doesNotThrowAnyException();
- threadCountDownLatch.countDown();
- }
- }.start();
+ new Thread(() -> {
+ assertThatCode(() -> databaseProvider.createPolicyTypes(serviceTemplate))
+ .doesNotThrowAnyException();
+ threadCountDownLatch.countDown();
+ }).start();
}
threadCountDownLatch.await(9, TimeUnit.SECONDS);
@@ -152,9 +142,8 @@ class PolicyTypePersistenceTest {
deleteUnreferencedPolicyTypes();
- assertThatThrownBy(() -> {
- databaseProvider.getPolicyTypes(null, null);
- }).hasMessageContaining("policy types for null:null do not exist");
+ assertThatThrownBy(() -> databaseProvider.getPolicyTypes(null, null))
+ .hasMessageContaining("policy types for null:null do not exist");
}
private void deleteUnreferencedPolicyTypes() throws PfModelException {