summaryrefslogtreecommitdiffstats
path: root/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src
diff options
context:
space:
mode:
Diffstat (limited to 'so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/src')
-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.