aboutsummaryrefslogtreecommitdiffstats
path: root/asdc-controller
diff options
context:
space:
mode:
Diffstat (limited to 'asdc-controller')
-rw-r--r--asdc-controller/pom.xml22
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/RequestDBConfig.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java3
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java3
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java3
-rw-r--r--asdc-controller/src/main/resources/application-local.yaml22
-rw-r--r--asdc-controller/src/main/resources/application.yaml20
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java2
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedRequestDbConfig.java2
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java3
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCStatusCallBackTest.java2
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java51
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/HealthCheckTest.java2
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java2
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java14
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java157
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java4
-rw-r--r--asdc-controller/src/test/resources/application-test.yaml27
-rw-r--r--asdc-controller/src/test/resources/schema.sql2
21 files changed, 93 insertions, 254 deletions
diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml
index 9ea397701c..2a20b96048 100644
--- a/asdc-controller/pom.xml
+++ b/asdc-controller/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.4.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.so</groupId>
@@ -151,10 +151,6 @@
<version>1.5.16</version>
</dependency>
<dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- </dependency>
- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
@@ -241,11 +237,7 @@
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-dbcp2</artifactId>
- </dependency>
+ </dependency>
<dependency>
<groupId>ch.vorburger.mariaDB4j</groupId>
<artifactId>mariaDB4j</artifactId>
@@ -259,13 +251,15 @@
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
- <artifactId>micrometer-spring-legacy</artifactId>
- <version>1.0.5</version>
+ <artifactId>micrometer-core</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
- <artifactId>micrometer-registry-prometheus</artifactId>
- <version>1.0.5</version>
+ <artifactId>micrometer-registry-prometheus</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.interceptor</groupId>
+ <artifactId>javax.interceptor-api</artifactId>
</dependency>
</dependencies>
</project>
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java b/asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java
index 48f0990bf3..953c517702 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/CatalogDBConfig.java
@@ -24,7 +24,7 @@ package org.onap.so.asdc;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/RequestDBConfig.java b/asdc-controller/src/main/java/org/onap/so/asdc/RequestDBConfig.java
index da2fb2e8be..c623552113 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/RequestDBConfig.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/RequestDBConfig.java
@@ -25,7 +25,7 @@ import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java
index 8276826456..5710905660 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java
@@ -102,10 +102,9 @@ public class ASDCConfiguration implements IConfiguration {
this.asdcControllerName = asdcControllerName;
}
-
@Override
public java.lang.Boolean isUseHttpsWithDmaap() {
- return false;
+ return getBooleanPropertyWithDefault("mso.asdc-connections.asdc-controller1.useHttpsWithDmaap", true);
}
@Override
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java
index 248d94d530..d2ac8e7c2d 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java
@@ -56,7 +56,8 @@ public final class ASDCStatusCallBack implements IStatusCallback {
if(iStatus.getStatus() != null){
if(iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_OK) || iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_ERROR)) {
- WatchdogDistributionStatus watchdogDistributionStatus = watchdogDistributionStatusRepository.findOne(iStatus.getDistributionID ());
+ WatchdogDistributionStatus watchdogDistributionStatus = watchdogDistributionStatusRepository.findById(iStatus.getDistributionID ())
+ .orElseGet( () -> null);
if(watchdogDistributionStatus==null){
watchdogDistributionStatus = new WatchdogDistributionStatus();
watchdogDistributionStatus.setDistributionId(iStatus.getDistributionID ());
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
index f131b73175..f5215e9f1f 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
@@ -149,6 +149,8 @@ public class BpmnInstaller {
.setField("Content-Disposition", String.format("form-data; name=\"%s\"; filename=\"%s\"; size=%d", bpmnFileName, bpmnFileName, bytesToSend.length))
.build())
.build();
+
+ IOUtils.closeQuietly(bpmnFileStream);
return requestEntity;
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java
index 3f0392a04f..8c9fb62f31 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java
@@ -68,7 +68,8 @@ public class WatchdogDistribution {
String status = null;
try {
- WatchdogDistributionStatus watchdogDistributionStatus = watchdogDistributionStatusRepository.findOne(distributionId);
+ WatchdogDistributionStatus watchdogDistributionStatus = watchdogDistributionStatusRepository.findById(distributionId)
+ .orElseGet( () -> null);
if(watchdogDistributionStatus == null){
watchdogDistributionStatus = new WatchdogDistributionStatus();
watchdogDistributionStatus.setDistributionId(distributionId);
diff --git a/asdc-controller/src/main/resources/application-local.yaml b/asdc-controller/src/main/resources/application-local.yaml
index 28900f4f95..1b21d8b571 100644
--- a/asdc-controller/src/main/resources/application-local.yaml
+++ b/asdc-controller/src/main/resources/application-local.yaml
@@ -8,7 +8,7 @@ ssl-enable: false
# H2
spring:
datasource:
- url: jdbc:mariadb://localhost:3306/catalogdb
+ jdbc-url: jdbc:mariadb://localhost:3306/catalogdb
username: root
password: password
driver-class-name: org.mariadb.jdbc.Driver
@@ -33,7 +33,7 @@ spring:
role: ACTUATOR
request:
datasource:
- url: jdbc:mariadb://localhost:3306/requestdb
+ jdbc-url: jdbc:mariadb://localhost:3306/requestdb
username: root
password: password
driver-class-name: org.mariadb.jdbc.Driver
@@ -41,8 +41,19 @@ request:
initialization-mode: never
#Actuator
-management:
- context-path: /manage
+management:
+ endpoints:
+ web:
+ base-path: /manage
+ server:
+ servlet:
+ context-path: /manage
+ metrics:
+ se-global-registry: false
+ export:
+ prometheus:
+ enabled: true # Whether exporting of metrics to Prometheus is enabled.
+ step: 1m # Step size (i.e. reporting frequency) to use.
mso:
@@ -63,10 +74,11 @@ mso:
consumerId: msoasdc-id-local
environmentName: Pre-IST
asdcAddress: localhost:8443
- password: 658D6E9E0C087547284339181615C358
+ password: CB655C3C236F1F0370A347E3A0E0E133BE10ADCF4D16377E7378D3FE46A4BF60C27DF1FFB4
pollingInterval: 30
pollingTimeout: 30
relevantArtifactTypes: HEAT,HEAT_ENV,HEAT_VOL
+ useHttpsWithDmaap: true
activateServerTLSAuth: false
keyStorePassword:
keyStorePath:
diff --git a/asdc-controller/src/main/resources/application.yaml b/asdc-controller/src/main/resources/application.yaml
index ced8ab78fc..4eb3c482d9 100644
--- a/asdc-controller/src/main/resources/application.yaml
+++ b/asdc-controller/src/main/resources/application.yaml
@@ -4,7 +4,7 @@ server:
spring:
datasource:
- url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
+ jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
driver-class-name: org.mariadb.jdbc.Driver
@@ -23,23 +23,23 @@ spring:
request:
datasource:
- url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb
+ jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/requestdb
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
driver-class-name: org.mariadb.jdbc.Driver
- dbcp2:
- initial-size: 5
- max-total: 20
- validation-query: select 1
- test-on-borrow: true
#Actuator
-management:
- context-path: /manage
+management:
+ endpoints:
+ web:
+ base-path: /manage
+ server:
+ servlet:
+ context-path: /manage
metrics:
se-global-registry: false
export:
prometheus:
enabled: true # Whether exporting of metrics to Prometheus is enabled.
- step: 1m # Step size (i.e. reporting frequency) to use.
+ step: 1m # Step size (i.e. reporting frequency) to use.
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java b/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java
index f7e678731e..27b6c0ab53 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedCatalogDbConfig.java
@@ -25,7 +25,7 @@ import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedRequestDbConfig.java b/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedRequestDbConfig.java
index 6d1bfcdb8f..2827f8721e 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedRequestDbConfig.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/EmbeddedRequestDbConfig.java
@@ -25,7 +25,7 @@ import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java
index ce8b664bda..16bd97b409 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java
@@ -52,7 +52,8 @@ public class ASDCConfigurationTest extends BaseTest {
assertTrue(config.getPollingInterval() == 30);
assertTrue(config.getPollingTimeout() == 30);
assertTrue(config.getRelevantArtifactTypes().size() == config.SUPPORTED_ARTIFACT_TYPES_LIST.size());
- assertTrue(config.getWatchDogTimeout() == 1);
+ assertTrue(config.getWatchDogTimeout() == 1);
+ assertTrue(config.isUseHttpsWithDmaap() == true);
}
}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCStatusCallBackTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCStatusCallBackTest.java
index 97fa773fd5..ba95a6ea24 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCStatusCallBackTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCStatusCallBackTest.java
@@ -20,7 +20,7 @@
package org.onap.so.asdc.client;
-import static org.mockito.Matchers.isA;
+import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java
index 1944c3af73..546c4e2458 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java
@@ -27,73 +27,40 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import javax.transaction.Transactional;
import javax.ws.rs.core.Response;
-import org.junit.Ignore;
+import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
import org.mockito.Spy;
import org.onap.so.asdc.BaseTest;
import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator;
import org.onap.so.asdc.client.test.emulators.NotificationDataImpl;
import org.onap.so.db.catalog.beans.AllottedResource;
import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
-import org.onap.so.db.catalog.beans.CollectionResource;
-import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
-import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
-import org.onap.so.db.catalog.beans.ConfigurationResource;
-import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
-import org.onap.so.db.catalog.beans.InstanceGroup;
-import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
-import org.onap.so.db.catalog.beans.NetworkResource;
-import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
-import org.onap.so.db.catalog.beans.Service;
-import org.onap.so.db.catalog.beans.ServiceProxyResource;
-import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
-import org.onap.so.db.catalog.beans.ServiceRecipe;
-import org.onap.so.db.catalog.beans.ToscaCsar;
-import org.onap.so.db.catalog.beans.VnfResourceCustomization;
-import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
-import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.AllottedResourceRepository;
-import org.onap.so.db.catalog.data.repository.CollectionResourceInstanceGroupCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.CollectionResourceRepository;
-import org.onap.so.db.catalog.data.repository.ConfigurationResourceRepository;
-import org.onap.so.db.catalog.data.repository.InstanceGroupRepository;
import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
-import org.onap.so.db.catalog.data.repository.ServiceProxyResourceRepository;
import org.onap.so.db.catalog.data.repository.ServiceRepository;
-import org.onap.so.db.catalog.data.repository.VnfcInstanceGroupCustomizationRepository;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.context.embedded.LocalServerPort;
import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
public class ASDCRestInterfaceTest extends BaseTest {
- //ASDC Controller writes to this path
- static {
- System.setProperty("mso.config.path", "src/test/resources/");
- }
-
@Autowired
private AllottedResourceRepository allottedRepo;
@@ -116,6 +83,16 @@ public class ASDCRestInterfaceTest extends BaseTest {
@LocalServerPort
private int port;
+
+ @Rule
+ public TemporaryFolder folder= new TemporaryFolder();
+
+
+ @Before
+ public void setUp() {
+ //ASDC Controller writes to this path
+ System.setProperty("mso.config.path", folder.getRoot().toString());
+ }
@Test
@Transactional
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/HealthCheckTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/HealthCheckTest.java
index f5f7445771..cd2c3ee7e6 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/HealthCheckTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/HealthCheckTest.java
@@ -27,7 +27,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.asdc.Application;
import org.onap.so.asdc.BaseTest;
-import org.springframework.boot.context.embedded.LocalServerPort;
+import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.HttpEntity;
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java
index 6f07f44e2b..db797cff29 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/tests/ASDCConfigurationTest.java
@@ -55,7 +55,7 @@ public class ASDCConfigurationTest extends BaseTest {
@Test
public void isUseHttpsWithDmaapTest() {
- assertFalse(config.isUseHttpsWithDmaap());
+ assertTrue(config.isUseHttpsWithDmaap());
}
@Test
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java
index 535434db32..5d35ea30f1 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/bpmn/BpmnInstallerTest.java
@@ -21,7 +21,7 @@
package org.onap.so.asdc.installer.bpmn;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
@@ -41,15 +41,11 @@ import org.apache.http.message.BasicHttpResponse;
import org.apache.http.message.BasicStatusLine;
import org.junit.Before;
import org.junit.Test;
-import org.onap.so.asdc.BaseTest;
-import org.onap.so.asdc.installer.bpmn.BpmnInstaller;
-import org.springframework.beans.factory.annotation.Autowired;
@Transactional
-public class BpmnInstallerTest extends BaseTest {
+public class BpmnInstallerTest {
- @Autowired
- private BpmnInstaller bpmnInstaller;
+ private BpmnInstaller bpmnInstaller = new BpmnInstaller();
@Before
public void init() throws Exception {
@@ -65,7 +61,9 @@ public class BpmnInstallerTest extends BaseTest {
File mimeMultipartBody = new File(mimeMultipartBodyFilePath);
InputStream expectedContent = new FileInputStream(mimeMultipartBody);
- assertThat(IOUtils.contentEquals(expectedContent, entity.getContent()));
+ assertThat(IOUtils.contentEquals(expectedContent, entity.getContent()));
+
+ IOUtils.closeQuietly(expectedContent);
}
@Test
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
index 89bfe07374..9ab4c5ecb2 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
@@ -25,7 +25,7 @@ import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
@@ -221,161 +221,6 @@ public class ToscaResourceInstallerTest extends BaseTest {
}
@Test
- @Ignore
- @Transactional
- public void installTheResourceTest() throws Exception {
- notificationData.setDistributionID("testStatusSuccessTosca");
- notificationData.setServiceVersion("123456");
- notificationData.setServiceUUID("5df8b6de-2083-11e7-93ae-92361f002671");
- notificationData.setWorkloadContext("workloadContext");
-
- HashMap<String, VfModuleArtifact> vfModuleArtifacts = mock(HashMap.class);
- CapabilityAssignments capabilityAssignments = mock(CapabilityAssignments.class);
- CapabilityAssignment capabilityAssignment = mock(CapabilityAssignment.class);
-
- vfResourceStructure = spy(new VfResourceStructure(notificationData, resourceInstance));
-
- VnfResource vnfResource = new VnfResource();
- vnfResource.setModelName("modelName");
- vnfResource.setModelVersion("1.1");
- vnfResource.setModelUUID("modelUUID");
- vnfResource.setOrchestrationMode("orchestrationMode");
-
- VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
- vnfResourceCustomization.setVnfResources(vnfResource);
- vnfResourceCustomization.setModelCustomizationUUID("vnfResCustModelCustomizationUUID");
- vnfResourceCustomization.setModelInstanceName("modelInstanceName");
-
- AllottedResource allottedResource = new AllottedResource();
- allottedResource.setModelUUID("serviceMetadataValue");
- allottedResource.setModelInvariantUUID("modelInvariantUUID");
- allottedResource.setModelName("modelName");
- allottedResource.setModelVersion("1.1");
-
- AllottedResourceCustomization allottedResourceCustomization = new AllottedResourceCustomization();
- allottedResourceCustomization.setAllottedResource(allottedResource);
- allottedResourceCustomization.setModelCustomizationUUID("modelCustomizationUUID");
- allottedResourceCustomization.setModelInstanceName("modelInstanceName");
-
- Service catalogService = new Service();
- catalogService.setServiceType("serviceType");
- catalogService.setModelUUID("5df8b6de-2083-11e7-93ae-92361f002672");
- catalogService.setModelInvariantUUID("modelInvariantUUID");
- catalogService.setModelName("modelName");
- catalogService.setModelVersion("modelVersion");
- catalogService.getVnfCustomizations().add(vnfResourceCustomization);
-
- Iterator artifactIterator = mock(Iterator.class);
- Iterator nodeTemplateIterator = mock(Iterator.class);
- IDistributionClientDownloadResult clientResult = mock(IDistributionClientDownloadResult.class);
- doReturn(IOUtils.toByteArray(
- new FileInputStream(
- new File(
- getClass().getClassLoader().getResource("resource-examples/simpleTest.yaml").getFile())
- ))).when(clientResult).getArtifactPayload();
- VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactInfo, clientResult);
- Collection<VfModuleArtifact> vfModuleArtifactsValues = mock(Collection.class);
-
- NodeTemplate nodeTemplate = mock(NodeTemplate.class);
- List<NodeTemplate> nodeTemplateList = new ArrayList<>();
- nodeTemplateList.add(nodeTemplate);
-
- HeatTemplate heatTemplate = new HeatTemplate();
- heatTemplate.setArtifactUuid("ff874603-4222-11e7-9252-005056850d2e");
- heatTemplate.setArtifactChecksum("MANUAL RECORD");
- heatTemplate.setTemplateBody("templateBody");
- heatTemplate.setTemplateName("module_mns_zrdm3frwl01exn_01_rgvm_1.yml");
- heatTemplate.setVersion("1");
-
- NetworkResource networkResource = new NetworkResource();
- networkResource.setAicVersionMin("aicVersionMin");
- networkResource.setModelUUID("modelUUID");
- networkResource.setOrchestrationMode("orchestrationMode");
- networkResource.setModelVersion("modelVersion");
- networkResource.setNeutronNetworkType("neutronNetworkType");
- networkResource.setAicVersionMax("aicVersionMax");
- networkResource.setModelName("CONTRAIL30_GNDIRECT");
- networkResource.setModelInvariantUUID("modelInvariantUUID");
- networkResource.setHeatTemplate(heatTemplate);
-
- NetworkResourceCustomization networkResourceCustomization = new NetworkResourceCustomization();
- networkResourceCustomization.setModelCustomizationUUID("modelCustomizationUUID");
- networkResourceCustomization.setModelInstanceName("modelInstanceName");
- networkResourceCustomization.setNetworkResource(networkResource);
-
- WatchdogServiceModVerIdLookup expectedModVerIdLookup = new WatchdogServiceModVerIdLookup(notificationData.getDistributionID(), notificationData.getServiceUUID());
- WatchdogDistributionStatus expectedDistributionStatus = new WatchdogDistributionStatus(notificationData.getDistributionID());
- WatchdogComponentDistributionStatus expectedComponentDistributionStatus = new WatchdogComponentDistributionStatus(notificationData.getDistributionID(), MSO);
- expectedComponentDistributionStatus.setComponentDistributionStatus(DistributionStatusEnum.COMPONENT_DONE_OK.name());
-
- doReturn(sdcCsarHelper).when(toscaResourceStruct).getSdcCsarHelper();
- doReturn("metadataPropertyValue").when(sdcCsarHelper).getMetadataPropertyValue(any(Metadata.class), any(String.class));
- doReturn("ntPropertyLeafValue").when(sdcCsarHelper).getNodeTemplatePropertyLeafValue(any(NodeTemplate.class), any(String.class));
- doReturn("true").when(sdcCsarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK);
- doReturn("1").when(sdcCsarHelper).getCapabilityPropertyLeafValue(any(CapabilityAssignment.class), any(String.class));
- doReturn(vfGroups).when(sdcCsarHelper).getVfModulesByVf(any(String.class));
- doReturn(capabilityAssignments).when(sdcCsarHelper).getCapabilitiesOf(any(NodeTemplate.class));
- doReturn(capabilityAssignment).when(capabilityAssignments).getCapabilityByName(any(String.class));
-
- doReturn(catalogService).when(toscaResourceStruct).getCatalogService();
-
- doReturn(artifactInfo).when(toscaResourceStruct).getToscaArtifact();
- doReturn("artifactChecksum").when(artifactInfo).getArtifactChecksum();
- doReturn("artifactUUID").when(artifactInfo).getArtifactUUID();
- doReturn("artifactName").when(artifactInfo).getArtifactName();
- doReturn("1.0").when(artifactInfo).getArtifactVersion();
- doReturn("artifactDescription").when(artifactInfo).getArtifactDescription();
- doReturn("artifactURL").when(artifactInfo).getArtifactURL();
-
- doReturn(metadata).when(toscaResourceStruct).getServiceMetadata();
- doReturn("serviceMetadataValue").when(metadata).getValue(any(String.class));
- doReturn("CONTRAIL30_GNDIRECT").when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME);
-
- doReturn("serviceVersion").when(toscaResourceStruct).getServiceVersion();
- doReturn(nodeTemplateList).when(sdcCsarHelper).getServiceVfList();
- doReturn(nodeTemplateList).when(sdcCsarHelper).getServiceVlList();
- doReturn(nodeTemplateList).when(sdcCsarHelper).getAllottedResources();
- doReturn(metadata).when(nodeTemplate).getMetaData();
- doReturn("model_instance_name").when(nodeTemplate).getName();
- doReturn(vnfResourceCustomization).when(toscaResourceStruct).getCatalogVnfResourceCustomization();
- doReturn(allottedResource).when(toscaResourceStruct).getAllottedResource();
- doReturn(allottedResourceCustomization).when(toscaResourceStruct).getCatalogAllottedResourceCustomization();
-
- doReturn(vfModuleArtifacts).when(vfResourceStructure).getArtifactsMapByUUID();
- when(vfModuleArtifacts.values()).thenReturn(vfModuleArtifactsValues);
- when(vfModuleArtifactsValues.iterator()).thenReturn(artifactIterator);
- when(artifactIterator.hasNext()).thenReturn(true, false);
- when(artifactIterator.next()).thenReturn(vfModuleArtifact);
- when(artifactInfo.getArtifactType()).thenReturn(ASDCConfiguration.OTHER);
- when(nodeTemplateIterator.hasNext()).thenReturn(true, false);
-
- doReturn(networkResource).when(toscaResourceStruct).getCatalogNetworkResource();
- doReturn(networkResourceCustomization).when(toscaResourceStruct).getCatalogNetworkResourceCustomization();
-
- doNothing().when(toscaResourceStruct).setSuccessfulDeployment();
-
- toscaInstaller.installTheResource(toscaResourceStruct, vfResourceStructure);
-
- AllottedResource actualAllottedResource = allottedRepo.findResourceByModelUUID(allottedResource.getModelUUID());
- AllottedResourceCustomization actualAllottedResourceCustomization = allottedCustomizationRepo.findOne(allottedResourceCustomization.getModelCustomizationUUID());
- Service actualService = serviceRepo.findByServiceType(catalogService.getServiceType());
- WatchdogComponentDistributionStatus actualWatchdogComponentDistributionStatus = getWatchdogCDStatusWithName(watchdogCDStatusRepository.findByDistributionId(notificationData.getDistributionID()), MSO);
-
- verify(toscaResourceStruct, times(1)).setSuccessfulDeployment();
- assertThat(actualAllottedResource,
- sameBeanAs(allottedResource));
- assertThat(actualAllottedResourceCustomization, sameBeanAs(allottedResourceCustomization)
- .ignoring("created"));
- assertThat(actualService, sameBeanAs(catalogService)
- .ignoring("created")
- .ignoring("networkCustomizations.0x1.created")
- .ignoring("networkCustomizations.0x1.networkResource.created"));
- assertThat(actualWatchdogComponentDistributionStatus, sameBeanAs(expectedComponentDistributionStatus)
- .ignoring("createTime")
- .ignoring("modifyTime"));
- }
-
- @Test
public void installTheResourceExceptionTest() throws Exception {
expectedException.expect(ArtifactInstallerException.class);
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java
index b72e079e9e..cfce0f6a17 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java
@@ -21,8 +21,8 @@
package org.onap.so.asdc.tenantIsolation;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.isA;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
diff --git a/asdc-controller/src/test/resources/application-test.yaml b/asdc-controller/src/test/resources/application-test.yaml
index 9cfc500618..caaa5dd3b4 100644
--- a/asdc-controller/src/test/resources/application-test.yaml
+++ b/asdc-controller/src/test/resources/application-test.yaml
@@ -7,12 +7,11 @@ ssl-enable: false
spring:
datasource:
- url: jdbc:mariadb://localhost:3307/catalogdb
+ jdbc-url: jdbc:mariadb://localhost:3307/catalogdb
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: false
@@ -36,19 +35,26 @@ mariaDB4j:
request:
datasource:
- url: jdbc:mariadb://localhost:3307/requestdb
+ jdbc-url: jdbc:mariadb://localhost:3307/requestdb
username: root
password: password
driver-class-name: org.mariadb.jdbc.Driver
#Actuator
-management:
+management:
endpoints:
- enabled-by-default: false
- endpoint:
- info:
- enabled: true
+ web:
+ base-path: /manage
+ server:
+ servlet:
+ context-path: /manage
+ metrics:
+ se-global-registry: false
+ export:
+ prometheus:
+ enabled: true # Whether exporting of metrics to Prometheus is enabled.
+ step: 1m # Step size (i.e. reporting frequency) to use.
mso:
adapters:
@@ -70,10 +76,11 @@ mso:
consumerId: msoasdc-id-local
environmentName: Pre-IST
asdcAddress: localhost:8443
- password: 658D6E9E0C087547284339181615C358
+ password: CB655C3C236F1F0370A347E3A0E0E133BE10ADCF4D16377E7378D3FE46A4BF60C27DF1FFB4
pollingInterval: 30
pollingTimeout: 30
relevantArtifactTypes: HEAT,HEAT_ENV,HEAT_VOL
+ useHttpsWithDmaap: true
activateServerTLSAuth: false
keyStorePassword:
keyStorePath:
diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql
index 0372887f15..a84b02db63 100644
--- a/asdc-controller/src/test/resources/schema.sql
+++ b/asdc-controller/src/test/resources/schema.sql
@@ -935,6 +935,7 @@ CREATE TABLE `infra_active_requests` (
`CONFIGURATION_NAME` varchar(200) DEFAULT NULL,
`OPERATIONAL_ENV_ID` varchar(45) DEFAULT NULL,
`OPERATIONAL_ENV_NAME` varchar(200) DEFAULT NULL,
+ `REQUEST_URL` varchar(500) DEFAULT NULL,
PRIMARY KEY (`REQUEST_ID`),
UNIQUE KEY `UK_bhu6w8p7wvur4pin0gjw2d5ak` (`CLIENT_REQUEST_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
@@ -984,6 +985,7 @@ CREATE TABLE `archived_infra_requests` (
`CONFIGURATION_NAME` varchar(200) DEFAULT NULL,
`OPERATIONAL_ENV_ID` varchar(45) DEFAULT NULL,
`OPERATIONAL_ENV_NAME` varchar(200) DEFAULT NULL,
+ `REQUEST_URL` varchar(500) DEFAULT NULL,
PRIMARY KEY (`REQUEST_ID`),
UNIQUE KEY `UK_bhu6w8p7wvur4pin0gjw2d72h` (`CLIENT_REQUEST_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;