summaryrefslogtreecommitdiffstats
path: root/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service
diff options
context:
space:
mode:
authorwaqas.ikram <waqas.ikram@est.tech>2023-01-23 11:58:29 +0000
committerwaqas.ikram <waqas.ikram@est.tech>2023-01-23 11:58:40 +0000
commitbd591af78a4ab97af4f65d6b7094d9c60f7879c4 (patch)
treed16a23906298c6b1875712ab2acae64716531ff5 /so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service
parent80d8598e1013ddee747957adf7d96ec7fb901f0b (diff)
Adding common classes for workflows
Change-Id: Id86256ee21ee8c78da82ae3141f7936191593597 Issue-ID: SO-4068 Signed-off-by: waqas.ikram <waqas.ikram@est.tech>
Diffstat (limited to 'so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service')
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsLifecycleParam.java2
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/utils/Utils.java21
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/config/CnfmDatabaseConfiguration.java5
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/test/java/org/onap/so/cnfm/lcm/database/beans/utils/UtilsTest.java5
-rw-r--r--so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/test/java/org/onap/so/cnfm/lcm/database/service/DatabaseServiceProviderTest.java2
5 files changed, 19 insertions, 16 deletions
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsLifecycleParam.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsLifecycleParam.java
index 607886c..ed8b098 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsLifecycleParam.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/AsLifecycleParam.java
@@ -54,7 +54,7 @@ public class AsLifecycleParam {
private String lifecycleParam;
public AsLifecycleParam() {
-
+ // default constructor
}
public void setAsLifecycleParamId(final Integer asLifecycleParamId) {
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/utils/Utils.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/utils/Utils.java
index 4d40087..5e1c638 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/utils/Utils.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/beans/utils/Utils.java
@@ -40,19 +40,20 @@ public class Utils {
return second == null;
}
- if (first.isEmpty()) {
- return second.isEmpty();
+ if (second == null) {
+ return false;
+ }
+
+ if (first.size() != second.size()) {
+ return false;
}
- if ((first != null && second != null) && (first.size() == second.size())) {
- for (int index = 0; index < first.size(); index++) {
- if (!Objects.equals(first.get(index), second.get(index))) {
- return false;
- }
- }
- return true;
+ for (int index = 0; index < first.size(); index++) {
+ if (!Objects.equals(first.get(index), second.get(index))) {
+ return false;
+ }
}
- return false;
+ return true;
}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/config/CnfmDatabaseConfiguration.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/config/CnfmDatabaseConfiguration.java
index 62a90f8..043b846 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/config/CnfmDatabaseConfiguration.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/main/java/org/onap/so/cnfm/lcm/database/config/CnfmDatabaseConfiguration.java
@@ -55,9 +55,6 @@ public class CnfmDatabaseConfiguration {
private static final String PERSISTENCE_UNIT = "cnfm";
private static final String CNFM_DATA_SOURCE_QUALIFIER = "cnfmDataSource";
- @Autowired(required = false)
- private MBeanExporter mBeanExporter;
-
@Bean
@ConfigurationProperties(prefix = "spring.datasource.hikari.cnfm")
public HikariConfig cnfmDbConfig() {
@@ -68,7 +65,7 @@ public class CnfmDatabaseConfiguration {
@Primary
@FlywayDataSource
@Bean(name = CNFM_DATA_SOURCE_QUALIFIER)
- public DataSource dataSource() {
+ public DataSource dataSource(@Autowired(required = false) final MBeanExporter mBeanExporter) {
if (mBeanExporter != null) {
mBeanExporter.addExcludedBean(CNFM_DATA_SOURCE_QUALIFIER);
}
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/test/java/org/onap/so/cnfm/lcm/database/beans/utils/UtilsTest.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/test/java/org/onap/so/cnfm/lcm/database/beans/utils/UtilsTest.java
index ab24f94..9d9714e 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/test/java/org/onap/so/cnfm/lcm/database/beans/utils/UtilsTest.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/test/java/org/onap/so/cnfm/lcm/database/beans/utils/UtilsTest.java
@@ -50,6 +50,11 @@ public class UtilsTest {
public void testNullListAndEmptyList_notEqual() {
assertFalse(Utils.isEquals(null, Collections.emptyList()));
}
+
+ @Test
+ public void testEmptyListAndNullList_notEqual() {
+ assertFalse(Utils.isEquals(Collections.emptyList(), null));
+ }
@Test
public void testTwoNotEmptyListsContainSameObjects_equal() {
diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/test/java/org/onap/so/cnfm/lcm/database/service/DatabaseServiceProviderTest.java b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/test/java/org/onap/so/cnfm/lcm/database/service/DatabaseServiceProviderTest.java
index d353ea6..4397fb5 100644
--- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/test/java/org/onap/so/cnfm/lcm/database/service/DatabaseServiceProviderTest.java
+++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src/test/java/org/onap/so/cnfm/lcm/database/service/DatabaseServiceProviderTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
+ * Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.