aboutsummaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'mso-catalog-db/src/test')
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/EmbeddedMariaDbConfig.java2
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java5
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java4
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java9
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java7
-rw-r--r--mso-catalog-db/src/test/resources/application-test.yaml7
6 files changed, 23 insertions, 11 deletions
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/EmbeddedMariaDbConfig.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/EmbeddedMariaDbConfig.java
index 147de51c67..06a7b1ed29 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/EmbeddedMariaDbConfig.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/EmbeddedMariaDbConfig.java
@@ -23,7 +23,7 @@ import ch.vorburger.exec.ManagedProcessException;
import ch.vorburger.mariadb4j.DBConfigurationBuilder;
import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java
index c5ae3cc83c..8978f38298 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java
@@ -24,6 +24,7 @@ import org.junit.Assert;
import org.junit.Test;
import org.onap.so.db.catalog.BaseTest;
import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.exceptions.NoEntityFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
@@ -43,7 +44,9 @@ public class CloudSiteRepositoryTest extends BaseTest {
@Test
public void findOneTest() throws Exception {
- CloudSite cloudSite = cloudSiteRepository.findOne("mtn13");
+ CloudSite cloudSite = cloudSiteRepository.findById("mtn13").
+ orElseThrow(() -> new NoEntityFoundException("Cannot Find Operation"));
+
Assert.assertNotNull(cloudSite);
Assert.assertEquals("mtn13",cloudSite.getId());
}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java
index 34c22b07b2..1ed8c84435 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java
@@ -24,6 +24,7 @@ import org.junit.Assert;
import org.junit.Test;
import org.onap.so.db.catalog.BaseTest;
import org.onap.so.db.catalog.beans.CloudifyManager;
+import org.onap.so.db.catalog.exceptions.NoEntityFoundException;
import org.springframework.beans.factory.annotation.Autowired;
public class CloudifyManagerRepositoryTest extends BaseTest {
@@ -33,7 +34,8 @@ public class CloudifyManagerRepositoryTest extends BaseTest {
@Test
public void findOneTest() throws Exception {
- CloudifyManager cloudifyManager = cloudifyManagerRepository.findOne("mtn13");
+ CloudifyManager cloudifyManager = cloudifyManagerRepository.findById("mtn13")
+ .orElseThrow(() -> new NoEntityFoundException("Cannot Find Operation"));
Assert.assertNotNull(cloudifyManager);
Assert.assertEquals("mtn13", cloudifyManager.getId());
}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java
index 52cb46f391..6f0e3020b1 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java
@@ -36,6 +36,7 @@ import org.onap.so.db.catalog.beans.VnfResource;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.VnfcCustomization;
+import org.onap.so.db.catalog.exceptions.NoEntityFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@@ -51,7 +52,10 @@ public class VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest extends Ba
List<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizationList = vnfVfmoduleCvnfcConfigurationCustomizationRepository.findAll();
Assert.assertFalse(CollectionUtils.isEmpty(vnfVfmoduleCvnfcConfigurationCustomizationList));
- VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomizationRepository.findOne(1);
+ VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization =
+ vnfVfmoduleCvnfcConfigurationCustomizationRepository.findById(1).orElseThrow(() -> new NoEntityFoundException("Cannot Find Operation"));
+
+
Assert.assertTrue(vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationFunction().equalsIgnoreCase("testConfigurationFunction"));
}
@@ -112,7 +116,8 @@ public class VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest extends Ba
vnfVfmoduleCvnfcConfigurationCustomizationRepository.save(vnfVfmoduleCvnfcConfigurationCustomization);
- VnfVfmoduleCvnfcConfigurationCustomization foundVnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomizationRepository.findOne(1);
+ VnfVfmoduleCvnfcConfigurationCustomization foundVnfVfmoduleCvnfcConfigurationCustomization =
+ vnfVfmoduleCvnfcConfigurationCustomizationRepository.findById(1).orElseThrow(() -> new NoEntityFoundException("Cannot Find Operation"));
if(foundVnfVfmoduleCvnfcConfigurationCustomization == null)
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java
index 0f82c8abf0..1fc6617c2c 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java
@@ -29,6 +29,7 @@ import org.junit.Assert;
import org.junit.Test;
import org.onap.so.db.catalog.BaseTest;
import org.onap.so.db.catalog.beans.VnfcCustomization;
+import org.onap.so.db.catalog.exceptions.NoEntityFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@@ -42,7 +43,8 @@ public class VnfcCustomizationRepositoryTest extends BaseTest {
List<VnfcCustomization> vnfcCustomizationList = vnfcCustomizationRepository.findAll();
Assert.assertFalse(CollectionUtils.isEmpty(vnfcCustomizationList));
- VnfcCustomization vnfcCustomization = vnfcCustomizationRepository.findOne("9bcce658-9b37-11e8-98d0-529269fb1459");
+ VnfcCustomization vnfcCustomization = vnfcCustomizationRepository.findById("9bcce658-9b37-11e8-98d0-529269fb1459").
+ orElseThrow(() -> new NoEntityFoundException("Cannot Find Operation"));
Assert.assertTrue(vnfcCustomization.getDescription().equalsIgnoreCase("testVnfcCustomizationDescription"));
}
@@ -54,7 +56,8 @@ public class VnfcCustomizationRepositoryTest extends BaseTest {
vnfcCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
vnfcCustomizationRepository.save(vnfcCustomization);
- VnfcCustomization foundVnfcCustomization = vnfcCustomizationRepository.findOne("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+ VnfcCustomization foundVnfcCustomization = vnfcCustomizationRepository.findById("cf9f6efc-9f14-11e8-98d0-529269fb1459").
+ orElseThrow(() -> new NoEntityFoundException("Cannot Find Operation"));
assertThat(vnfcCustomization, sameBeanAs(foundVnfcCustomization)
.ignoring("created"));
diff --git a/mso-catalog-db/src/test/resources/application-test.yaml b/mso-catalog-db/src/test/resources/application-test.yaml
index dbff1c1d2f..5d04aa49be 100644
--- a/mso-catalog-db/src/test/resources/application-test.yaml
+++ b/mso-catalog-db/src/test/resources/application-test.yaml
@@ -14,12 +14,11 @@ mso:
spring:
datasource:
- url: jdbc:mariadb://localhost:3307/
+ jdbc-url: jdbc:mariadb://localhost:3307/
username: root
password: password
driver-class-name: org.mariadb.jdbc.Driver
- initialize: true
- initialization-mode: never
+ initialization-mode: always
jpa:
generate-ddl: false
show-sql: true
@@ -44,7 +43,7 @@ spring:
role: ACTUATOR
mariaDB4j:
dataDir:
- port: 3307
+ port: 0
databaseName: catalog_db
server: