summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapter/acumos-deployment/values.yaml3
-rw-r--r--mod/runtimeapi/Changelog.md10
-rw-r--r--mod/runtimeapi/pom.xml13
-rw-r--r--mod/runtimeapi/runtime-core/pom.xml6
-rw-r--r--mod/runtimeapi/runtime-web/pom.xml12
-rw-r--r--mod/runtimeapi/runtime-web/src/main/java/org/onap/dcae/runtime/web/RuntimeapiApplication.java2
-rw-r--r--mod/runtimeapi/runtime-web/src/test/java/org/onap/dcae/runtime/web/controllers/TestFlowGraphController.java2
-rw-r--r--mod2/catalog-service/pom.xml7
-rw-r--r--mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/deploymentartifact/DeploymentArtifact.java7
-rw-r--r--mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/util/BlueprintDistributionUtils.java140
-rw-r--r--mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/util/PolicyModelUtils.java36
-rw-r--r--mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/util/SSLUtils.java69
-rw-r--r--mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/web/controller/BlueprintDistributionController.java51
-rw-r--r--mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/web/service/blueprintdistributionservice/BlueprintDistributionService.java34
-rw-r--r--mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/web/service/blueprintdistributionservice/BlueprintDistributionServiceImpl.java113
-rw-r--r--mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/web/service/policymodel/PolicyModelServiceImpl.java10
-rw-r--r--mod2/catalog-service/src/main/resources/application.properties63
-rw-r--r--mod2/catalog-service/src/test/java/org/onap/dcaegen2/platform/mod/objectmothers/BlueprintDistributionObjectMother.java29
-rw-r--r--mod2/catalog-service/src/test/java/org/onap/dcaegen2/platform/mod/web/BlueprintDistributionControllerTest.java76
-rw-r--r--mod2/catalog-service/src/test/java/org/onap/dcaegen2/platform/mod/web/service/BlueprintDistributionServiceImplImplTest.java125
-rw-r--r--releases/1.2.1-runtimeapi-container.yaml9
-rw-r--r--releases/1.2.2-runtimeapi-container.yaml9
-rw-r--r--releases/1.7.2-blueprint-generator.yaml4
-rw-r--r--releases/2.12.4-onboardingapi-container.yaml9
24 files changed, 781 insertions, 58 deletions
diff --git a/adapter/acumos-deployment/values.yaml b/adapter/acumos-deployment/values.yaml
index 2769b95..4b4a1b7 100644
--- a/adapter/acumos-deployment/values.yaml
+++ b/adapter/acumos-deployment/values.yaml
@@ -29,7 +29,7 @@ global:
enabled: true
virtualhost:
enabled: true
- baseurl: "simpledemo.onap.org"
+ baseurl: "simpledemo.onap.org"
config:
distributorAPIURL: /distributor
@@ -54,6 +54,7 @@ ingress:
- baseaddr: "dcaemod"
name: "dcae-acumos-adapter"
port: 9000
+ path: "/acumos-adapter"
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "false"
# Adapter can take a long time to respond, since
diff --git a/mod/runtimeapi/Changelog.md b/mod/runtimeapi/Changelog.md
new file mode 100644
index 0000000..526159d
--- /dev/null
+++ b/mod/runtimeapi/Changelog.md
@@ -0,0 +1,10 @@
+# Change Log
+
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](http://keepachangelog.com/)
+and this project adheres to [Semantic Versioning](http://semver.org/).
+
+## [1.2.2]
+- Update SpringFox dependencies to version 3.0.0
+ - Swagger documentation URL changed from: /swagger-ui.html to: /swagger-ui/index.html
diff --git a/mod/runtimeapi/pom.xml b/mod/runtimeapi/pom.xml
index 61f6558..77d73b9 100644
--- a/mod/runtimeapi/pom.xml
+++ b/mod/runtimeapi/pom.xml
@@ -34,7 +34,7 @@ limitations under the License.
</parent>
<groupId>org.onap.dcaegen2.platform.mod</groupId>
<artifactId>runtimeapi</artifactId>
- <version>1.2.0</version>
+ <version>1.2.2</version>
<name>dcaegen2-platform-mod-runtimeapi</name>
<description>MOD Runtime API</description>
<properties>
@@ -108,6 +108,17 @@ limitations under the License.
<version>2.1.7.RELEASE</version>
<type>pom</type>
<scope>import</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.plugin</groupId>
+ <artifactId>spring-plugin-core</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.plugin</groupId>
+ <artifactId>spring-plugin-core</artifactId>
+ <version>2.0.0.RELEASE</version>
</dependency>
</dependencies>
</dependencyManagement>
diff --git a/mod/runtimeapi/runtime-core/pom.xml b/mod/runtimeapi/runtime-core/pom.xml
index 7031714..a1b05e6 100644
--- a/mod/runtimeapi/runtime-core/pom.xml
+++ b/mod/runtimeapi/runtime-core/pom.xml
@@ -25,12 +25,12 @@ limitations under the License.
<parent>
<artifactId>runtimeapi</artifactId>
<groupId>org.onap.dcaegen2.platform.mod</groupId>
- <version>1.2.0</version>
+ <version>1.2.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>runtime-core</artifactId>
- <version>1.2.0</version>
+ <version>1.2.2</version>
<dependencies>
<dependency>
@@ -46,7 +46,7 @@ limitations under the License.
<dependency>
<groupId>org.onap.dcaegen2.platform.mod</groupId>
<artifactId>blueprint-generator-onap</artifactId>
- <version>1.7.1</version>
+ <version>1.7.2</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
diff --git a/mod/runtimeapi/runtime-web/pom.xml b/mod/runtimeapi/runtime-web/pom.xml
index 4c1a7c4..f33cee1 100644
--- a/mod/runtimeapi/runtime-web/pom.xml
+++ b/mod/runtimeapi/runtime-web/pom.xml
@@ -24,10 +24,10 @@ limitations under the License.
<parent>
<groupId>org.onap.dcaegen2.platform.mod</groupId>
<artifactId>runtimeapi</artifactId>
- <version>1.2.0</version>
+ <version>1.2.2</version>
</parent>
<artifactId>runtime-web</artifactId>
- <version>1.2.0-SNAPSHOT</version>
+ <version>1.2.2-SNAPSHOT</version>
<packaging>jar</packaging>
<name>runtime-web</name>
<description>MOD Runtime Web Module</description>
@@ -35,7 +35,7 @@ limitations under the License.
<dependency>
<groupId>org.onap.dcaegen2.platform.mod</groupId>
<artifactId>runtime-core</artifactId>
- <version>1.2.0</version>
+ <version>1.2.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -65,13 +65,13 @@ limitations under the License.
</dependency>
<dependency>
<groupId>io.springfox</groupId>
- <artifactId>springfox-swagger2</artifactId>
- <version>2.10.5</version>
+ <artifactId>springfox-boot-starter</artifactId>
+ <version>3.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
- <version>2.10.5</version>
+ <version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
diff --git a/mod/runtimeapi/runtime-web/src/main/java/org/onap/dcae/runtime/web/RuntimeapiApplication.java b/mod/runtimeapi/runtime-web/src/main/java/org/onap/dcae/runtime/web/RuntimeapiApplication.java
index 611b332..df79251 100644
--- a/mod/runtimeapi/runtime-web/src/main/java/org/onap/dcae/runtime/web/RuntimeapiApplication.java
+++ b/mod/runtimeapi/runtime-web/src/main/java/org/onap/dcae/runtime/web/RuntimeapiApplication.java
@@ -19,10 +19,8 @@ package org.onap.dcae.runtime.web;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
@SpringBootApplication
-@EnableSwagger2WebMvc
public class RuntimeapiApplication {
public static void main(String[] args) {
diff --git a/mod/runtimeapi/runtime-web/src/test/java/org/onap/dcae/runtime/web/controllers/TestFlowGraphController.java b/mod/runtimeapi/runtime-web/src/test/java/org/onap/dcae/runtime/web/controllers/TestFlowGraphController.java
index 60ff810..942d2fd 100644
--- a/mod/runtimeapi/runtime-web/src/test/java/org/onap/dcae/runtime/web/controllers/TestFlowGraphController.java
+++ b/mod/runtimeapi/runtime-web/src/test/java/org/onap/dcae/runtime/web/controllers/TestFlowGraphController.java
@@ -81,7 +81,7 @@ public class TestFlowGraphController {
@Test
public void testSwaggerUi() throws Exception {
- mockMvc.perform(get("/swagger-ui.html"))
+ mockMvc.perform(get("/swagger-ui/index.html"))
.andExpect(status().isOk());
}
diff --git a/mod2/catalog-service/pom.xml b/mod2/catalog-service/pom.xml
index 9a82b7b..ff425cf 100644
--- a/mod2/catalog-service/pom.xml
+++ b/mod2/catalog-service/pom.xml
@@ -3,7 +3,7 @@
~ ============LICENSE_START=======================================================
~ org.onap.dcae
~ ================================================================================
- ~ Copyright (c) 2020 AT&T Intellectual Property. All rights reserved.
+ ~ Copyright (c) 2020-2021 AT&T Intellectual Property. All rights reserved.
~ ================================================================================
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -110,6 +110,11 @@
<version>4.2.2</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ <version>20190722</version>
+ </dependency>
</dependencies>
<dependencyManagement>
diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/deploymentartifact/DeploymentArtifact.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/deploymentartifact/DeploymentArtifact.java
index 600c735..72bba72 100644
--- a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/deploymentartifact/DeploymentArtifact.java
+++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/model/deploymentartifact/DeploymentArtifact.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.dcae
* ================================================================================
- * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2020-2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,10 @@
package org.onap.dcaegen2.platform.mod.model.deploymentartifact;
+import java.util.ArrayList;
+import java.util.List;
import lombok.Data;
+import org.onap.dcaegen2.platform.mod.model.policymodel.DistributionInfo;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.Map;
@@ -48,4 +51,6 @@ public class DeploymentArtifact {
private Map<String, Object> specificationInfo;
+ private DistributionInfo distributionInfo;
+
}
diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/util/BlueprintDistributionUtils.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/util/BlueprintDistributionUtils.java
new file mode 100644
index 0000000..2860a39
--- /dev/null
+++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/util/BlueprintDistributionUtils.java
@@ -0,0 +1,140 @@
+/*
+ * ============LICENSE_START=======================================================
+ * org.onap.dcae
+ * ================================================================================
+ * Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.mod.util;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.annotation.PostConstruct;
+import org.onap.dcaegen2.platform.mod.model.exceptions.policymodel.PolicyModelDistributionEnvNotFoundException;
+import org.onap.dcaegen2.platform.mod.model.policymodel.EnvInfo;
+import org.onap.dcaegen2.platform.mod.model.policymodel.PolicyModelDistributionEnv;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+/**
+ * Policy Model Service Utils to get URL, Username, Password, Webclient
+ */
+
+@Component
+public class BlueprintDistributionUtils {
+
+ @Value("${dcae.platform.url.path}")
+ private String urlpath;
+
+ @Value("${dcae.platform.dev.server}")
+ private String devServer;
+
+ @Value("${dcae.platform.dev.port}")
+ private String devServerPort;
+
+ @Value("${dcae.platform.dev.user}")
+ private String devServerUser;
+
+ @Value("${dcae.platform.dev.password}")
+ private String devServerUserPassword;
+
+ @Value("${dcae.platform.pst.server}")
+ private String pstServer;
+
+ @Value("${dcae.platform.pst.port}")
+ private String pstServerPort;
+
+ @Value("${dcae.platform.pst.user}")
+ private String pstServerUser;
+
+ @Value("${dcae.platform.pst.password}")
+ private String pstServerUserPassword;
+
+ @Value("${dcae.platform.ete.server}")
+ private String eteServer;
+
+ @Value("${dcae.platform.ete.port}")
+ private String eteServerPort;
+
+ @Value("${dcae.platform.ete.user}")
+ private String eteServerUser;
+
+ @Value("${dcae.platform.ete.password}")
+ private String eteServerUserPassword;
+
+ @Value("${dcae.platform.prod.server}")
+ private String prodServer;
+
+ @Value("${dcae.platform.prod.port}")
+ private String prodServerPort;
+
+ @Value("${dcae.platform.prod.user}")
+ private String prodServerUser;
+
+ @Value("${dcae.platform.prod.password}")
+ private String prodServerUserPassword;
+
+ Map<String, EnvInfo> envMap;
+
+ /**
+ * Creates a Blueprint Distribution Dashboard URL for the Environment requested
+ */
+ @PostConstruct
+ public void init() {
+ envMap = new HashMap<>();
+ envMap.put(PolicyModelDistributionEnv.DEV.name(), EnvInfo.builder().url("https://"+ devServer + ":" + devServerPort + urlpath).username(devServerUser).password(devServerUserPassword).build());
+ envMap.put(PolicyModelDistributionEnv.PST.name(), EnvInfo.builder().url("https://"+ pstServer + ":" + pstServerPort + urlpath).username(pstServerUser).password(pstServerUserPassword).build());
+ envMap.put(PolicyModelDistributionEnv.ETE.name(), EnvInfo.builder().url("https://"+ eteServer + ":" + eteServerPort + urlpath).username(eteServerUser).password(eteServerUserPassword).build());
+ envMap.put(PolicyModelDistributionEnv.PROD.name(), EnvInfo.builder().url("https://"+ prodServer + ":" + prodServerPort + urlpath).username(prodServerUser).password(prodServerUserPassword).build());
+ }
+
+ /**
+ * Generates a Blueprint Distribution Dashboard URL for the Environment
+ *
+ * @param env
+ * @return
+ */
+ public String getBlueprintDashboardURL(String env) {
+ if(!envMap.containsKey(env)) throw new PolicyModelDistributionEnvNotFoundException(String.format("Blueprint Dashboard Environment with env %s invalid", env));
+ return envMap.get(env).getUrl();
+ }
+
+ /**
+ * Generates a Blueprint Distribution Dashboard UserName for the Environment
+ *
+ * @param env
+ * @return
+ */
+
+ public String getBlueprintDashboardUserName(String env) {
+ if(!envMap.containsKey(env)) throw new PolicyModelDistributionEnvNotFoundException(String.format("Blueprint Dashboard Environment with env %s invalid", env));
+ return envMap.get(env).getUsername();
+ }
+
+
+ /**
+ * Generates a Blueprint Distribution Dashboard Password for the Environment
+ *
+ * @param env
+ * @return
+ */
+
+ public String getBlueprintDashboardPassword(String env) {
+ if(!envMap.containsKey(env)) throw new PolicyModelDistributionEnvNotFoundException(String.format("Blueprint Dashboard Environment with env %s invalid", env));
+ return envMap.get(env).getPassword();
+ }
+
+}
diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/util/PolicyModelUtils.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/util/PolicyModelUtils.java
index 30e13ea..347e66b 100644
--- a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/util/PolicyModelUtils.java
+++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/util/PolicyModelUtils.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.dcae
* ================================================================================
- * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2020-2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,55 +46,55 @@ import java.util.Map;
@Component
public class PolicyModelUtils {
- @Value("${url.path}")
+ @Value("${policymodel.url.path}")
private String urlpath;
- @Value("${dev.server}")
+ @Value("${policymodel.dev.server}")
private String devServer;
- @Value("${dev.port}")
+ @Value("${policymodel.dev.port}")
private String devServerPort;
- @Value("${dev.user}")
+ @Value("${policymodel.dev.user}")
private String devServerUser;
- @Value("${dev.password}")
+ @Value("${policymodel.dev.password}")
private String devServerUserPassword;
- @Value("${pst.server}")
+ @Value("${policymodel.pst.server}")
private String pstServer;
- @Value("${pst.port}")
+ @Value("${policymodel.pst.port}")
private String pstServerPort;
- @Value("${pst.user}")
+ @Value("${policymodel.pst.user}")
private String pstServerUser;
- @Value("${pst.password}")
+ @Value("${policymodel.pst.password}")
private String pstServerUserPassword;
- @Value("${ete.server}")
+ @Value("${policymodel.ete.server}")
private String eteServer;
- @Value("${ete.port}")
+ @Value("${policymodel.ete.port}")
private String eteServerPort;
- @Value("${ete.user}")
+ @Value("${policymodel.ete.user}")
private String eteServerUser;
- @Value("${ete.password}")
+ @Value("${policymodel.ete.password}")
private String eteServerUserPassword;
- @Value("${prod.server}")
+ @Value("${policymodel.prod.server}")
private String prodServer;
- @Value("${prod.port}")
+ @Value("${policymodel.prod.port}")
private String prodServerPort;
- @Value("${prod.user}")
+ @Value("${policymodel.prod.user}")
private String prodServerUser;
- @Value("${prod.password}")
+ @Value("${policymodel.prod.password}")
private String prodServerUserPassword;
Map<String, EnvInfo> envMap;
diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/util/SSLUtils.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/util/SSLUtils.java
new file mode 100644
index 0000000..a5d313d
--- /dev/null
+++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/util/SSLUtils.java
@@ -0,0 +1,69 @@
+/*
+ * ============LICENSE_START=======================================================
+ * org.onap.dcae
+ * ================================================================================
+ * Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.mod.util;
+
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.X509Certificate;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+
+public final class SSLUtils {
+
+ static {
+ // for localhost testing only
+ HttpsURLConnection.setDefaultHostnameVerifier(new javax.net.ssl.HostnameVerifier() {
+ public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
+ return true;
+ }
+ });
+ }
+
+ private static final TrustManager[] UNQUESTIONING_TRUST_MANAGER = new TrustManager[] { new X509TrustManager() {
+ public X509Certificate[] getAcceptedIssuers() {
+ return null;
+ }
+
+ public void checkClientTrusted(X509Certificate[] certs, String authType) {
+ }
+
+ public void checkServerTrusted(X509Certificate[] certs, String authType) {
+ }
+ } };
+
+ public static void turnOffSslChecking() throws NoSuchAlgorithmException, KeyManagementException {
+ // Install the all-trusting trust manager
+ final SSLContext sc = SSLContext.getInstance("SSL");
+ sc.init(null, UNQUESTIONING_TRUST_MANAGER, null);
+ HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
+ }
+
+ public static void turnOnSslChecking() throws KeyManagementException, NoSuchAlgorithmException {
+ // Return it to the initial state (discovered by reflection, now hardcoded)
+ SSLContext.getInstance("SSL").init(null, null, null);
+ }
+
+ private SSLUtils() {
+ throw new UnsupportedOperationException("Do not instantiate libraries.");
+ }
+} \ No newline at end of file
diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/web/controller/BlueprintDistributionController.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/web/controller/BlueprintDistributionController.java
new file mode 100644
index 0000000..36fbb2f
--- /dev/null
+++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/web/controller/BlueprintDistributionController.java
@@ -0,0 +1,51 @@
+/*
+ * ============LICENSE_START=======================================================
+ * org.onap.dcae
+ * ================================================================================
+ * Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.mod.web.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.onap.dcaegen2.platform.mod.model.policymodel.PolicyModelDistributionEnv;
+import org.onap.dcaegen2.platform.mod.web.service.blueprintdistributionservice.BlueprintDistributionService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping(value = "/api/deployment-artifact")
+@Api(tags = "Graph", description = "API to distribute Blueprint to DCAE")
+public class BlueprintDistributionController {
+
+ @Autowired
+ private BlueprintDistributionService blueprintDistributionService;
+
+ @PostMapping(value = "/{deploymentArtifactId}/distribute")
+ @ApiOperation("Distribution of Blueprint to DCAE")
+ public ResponseEntity distributeBlueprint(@PathVariable(value = "deploymentArtifactId") String deploymentArtifactId
+ ,@RequestParam PolicyModelDistributionEnv env){
+
+ return blueprintDistributionService.distributeBlueprint(deploymentArtifactId,env.name());
+ }
+
+}
diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/web/service/blueprintdistributionservice/BlueprintDistributionService.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/web/service/blueprintdistributionservice/BlueprintDistributionService.java
new file mode 100644
index 0000000..6f7ca68
--- /dev/null
+++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/web/service/blueprintdistributionservice/BlueprintDistributionService.java
@@ -0,0 +1,34 @@
+/*
+ * ============LICENSE_START=======================================================
+ * org.onap.dcae
+ * ================================================================================
+ * Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.mod.web.service.blueprintdistributionservice;
+
+
+import org.springframework.http.ResponseEntity;
+
+/**
+ * An interface to access Blueprint Distribution Services
+ */
+
+public interface BlueprintDistributionService {
+
+ public ResponseEntity distributeBlueprint(String deploymentArtifactId, String env);
+
+}
diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/web/service/blueprintdistributionservice/BlueprintDistributionServiceImpl.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/web/service/blueprintdistributionservice/BlueprintDistributionServiceImpl.java
new file mode 100644
index 0000000..6ae367c
--- /dev/null
+++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/web/service/blueprintdistributionservice/BlueprintDistributionServiceImpl.java
@@ -0,0 +1,113 @@
+/*
+ * ============LICENSE_START=======================================================
+ * org.onap.dcae
+ * ================================================================================
+ * Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.mod.web.service.blueprintdistributionservice;
+
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
+import org.json.JSONObject;
+import org.onap.dcaegen2.platform.mod.model.deploymentartifact.DeploymentArtifact;
+import org.onap.dcaegen2.platform.mod.model.policymodel.DistributionInfo;
+import org.onap.dcaegen2.platform.mod.model.policymodel.PolicyModelStatus;
+import org.onap.dcaegen2.platform.mod.model.restapi.ErrorResponse;
+import org.onap.dcaegen2.platform.mod.model.restapi.SuccessResponse;
+import org.onap.dcaegen2.platform.mod.util.BlueprintDistributionUtils;
+import org.onap.dcaegen2.platform.mod.util.SSLUtils;
+import org.onap.dcaegen2.platform.mod.web.service.deploymentartifact.DeploymentArtifactGateway;
+import org.onap.dcaegen2.platform.mod.web.service.deploymentartifact.DeploymentArtifactService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+@Service
+@Setter
+@Slf4j
+public class BlueprintDistributionServiceImpl implements BlueprintDistributionService{
+
+ @Autowired
+ private DeploymentArtifactService deploymentArtifactService;
+
+ @Autowired
+ private BlueprintDistributionUtils blueprintDistributionUtils;
+
+ @Autowired
+ private DeploymentArtifactGateway deploymentArtifactGateway;
+
+ @Autowired
+ private RestTemplate restTemplate;
+
+ public ResponseEntity distributeBlueprint(String deploymentArtifactId, String env){
+ DeploymentArtifact deploymentArtifact = deploymentArtifactService.findDeploymentArtifactById(deploymentArtifactId);
+ return postBlueprintToDcae(deploymentArtifact,env);
+ }
+
+ private ResponseEntity postBlueprintToDcae(DeploymentArtifact deploymentArtifact, String env){
+
+ HttpHeaders headers = new HttpHeaders();
+ headers.setContentType(MediaType.APPLICATION_JSON);
+ headers.setBasicAuth(blueprintDistributionUtils.getBlueprintDashboardUserName(env),blueprintDistributionUtils.getBlueprintDashboardPassword(env));
+
+ DistributionInfo distributionInfo = DistributionInfo.builder().url(blueprintDistributionUtils.getBlueprintDashboardURL(env)).build();
+ deploymentArtifact.setDistributionInfo(distributionInfo);
+ JSONObject blueprintJsonObject = prepareBlueprintJsonObject(deploymentArtifact);
+ HttpEntity<String> request = new HttpEntity<>(blueprintJsonObject.toString(), headers);
+
+ try{
+ SSLUtils.turnOffSslChecking();
+ String response = restTemplate.postForObject(blueprintDistributionUtils.getBlueprintDashboardURL(env),request,String.class);
+ log.info(response);
+ log.info(String.format("Distributed Blueprint to DCAE: %s", blueprintJsonObject.toString()));
+ distributionInfo.setStatus(PolicyModelStatus.SUCCESS);
+ deploymentArtifactGateway.save(deploymentArtifact);
+ blueprintJsonObject.put("distributionInfoStatus", PolicyModelStatus.SUCCESS.name());
+ return new ResponseEntity<>(new SuccessResponse(blueprintJsonObject.toString()), HttpStatus.OK);
+ }catch (Exception e) {
+ log.error("Failed to push Blueprint to DCAE");
+ log.error(e.getMessage());
+ distributionInfo.setStatus(PolicyModelStatus.FAILED);
+ deploymentArtifactGateway.save(deploymentArtifact);
+ return new ResponseEntity<>(new ErrorResponse(e.getMessage()), HttpStatus.BAD_REQUEST);
+ }
+ }
+
+ private JSONObject prepareBlueprintJsonObject(DeploymentArtifact deploymentArtifact) {
+ JSONObject blueprintJsonObject = new JSONObject();
+ blueprintJsonObject.put("owner","dcae_mod");
+ blueprintJsonObject.put("typeName",deploymentArtifact.getFileName());
+ blueprintJsonObject.put("typeVersion",deploymentArtifact.getVersion());
+ blueprintJsonObject.put("blueprintTemplate",deploymentArtifact.getContent());
+ blueprintJsonObject.put("application","DCAE");
+ blueprintJsonObject.put("component","dcae");
+ blueprintJsonObject.put("distributionInfoUrl", deploymentArtifact.getDistributionInfo().getUrl());
+ return blueprintJsonObject;
+ }
+
+ @Bean
+ private RestTemplate getRestTemplate(){
+ return new RestTemplate();
+ }
+
+}
diff --git a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/web/service/policymodel/PolicyModelServiceImpl.java b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/web/service/policymodel/PolicyModelServiceImpl.java
index 58fc447..a5dcfd0 100644
--- a/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/web/service/policymodel/PolicyModelServiceImpl.java
+++ b/mod2/catalog-service/src/main/java/org/onap/dcaegen2/platform/mod/web/service/policymodel/PolicyModelServiceImpl.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* org.onap.dcae
* ================================================================================
- * Copyright (c) 2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2020-2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -52,16 +52,16 @@ import java.util.List;
@Slf4j
public class PolicyModelServiceImpl implements PolicyModelService {
- @Value("${dev.server}")
+ @Value("${policymodel.dev.server}")
private String devServer;
- @Value("${dev.port}")
+ @Value("${policymodel.dev.port}")
private String devServerPort;
- @Value("${dev.user}")
+ @Value("${policymodel.dev.user}")
private String devServerUser;
- @Value("${dev.password}")
+ @Value("${policymodel.dev.password}")
private String devServerPassword;
@Autowired
diff --git a/mod2/catalog-service/src/main/resources/application.properties b/mod2/catalog-service/src/main/resources/application.properties
index 93c7883..9930866 100644
--- a/mod2/catalog-service/src/main/resources/application.properties
+++ b/mod2/catalog-service/src/main/resources/application.properties
@@ -2,7 +2,7 @@
# ============LICENSE_START=======================================================
# org.onap.dcae
# ================================================================================
-# Copyright (c) 2020 AT&T Intellectual Property. All rights reserved.
+# Copyright (c) 2020-2021 AT&T Intellectual Property. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -25,26 +25,51 @@ spring.data.mongodb.database=dcae_mod
-#Distribution Info Environment details
+# Policy Model Distribution Info Environment details
-url.path=/policy/api/v1/policytypes
+policymodel.url.path=/policy/api/v1/policytypes
-dev.server=10.12.6.2
-dev.port=30522
-dev.user=healthcheck
-dev.password=PASSWORD_GOES_HERE
+policymodel.dev.server=10.12.6.2
+policymodel.dev.port=30522
+policymodel.dev.user=healthcheck
+policymodel.dev.password=PASSWORD_GOES_HERE
-pst.server=policy-api
-pst.port=6969
-pst.user=healthcheck
-pst.password=PASSWORD_GOES_HERE
+policymodel.pst.server=policy-api
+policymodel.pst.port=6969
+policymodel.pst.user=healthcheck
+policymodel.pst.password=PASSWORD_GOES_HERE
-ete.server=policy-api
-ete.port=6969
-ete.user=healthcheck
-ete.password=PASSWORD_GOES_HERE
+policymodel.ete.server=policy-api
+policymodel.ete.port=6969
+policymodel.ete.user=healthcheck
+policymodel.ete.password=PASSWORD_GOES_HERE
-prod.server=policy-api
-prod.port=6969
-prod.user=healthcheck
-prod.password=PASSWORD_GOES_HERE \ No newline at end of file
+policymodel.prod.server=policy-api
+policymodel.prod.port=6969
+policymodel.prod.user=healthcheck
+policymodel.prod.password=PASSWORD_GOES_HERE
+
+
+# Blueprint Distribution Info Environment details
+
+dcae.platform.url.path=/ccsdk-app/nb-api/v2/blueprints
+
+dcae.platform.dev.server:10.12.5.222
+dcae.platform.dev.port:30418
+dcae.platform.dev.user=su1234
+dcae.platform.dev.password=PASSWORD_GOES_HERE
+
+dcae.platform.pst.server:10.12.5.222
+dcae.platform.pst.port:30418
+dcae.platform.pst.user=su1234
+dcae.platform.pst.password=PASSWORD_GOES_HERE
+
+dcae.platform.ete.server:10.12.5.222
+dcae.platform.ete.port:30418
+dcae.platform.ete.user=su1234
+dcae.platform.ete.password=PASSWORD_GOES_HERE
+
+dcae.platform.prod.server:10.12.5.222
+dcae.platform.prod.port:30418
+dcae.platform.prod.user=su1234
+dcae.platform.prod.password=PASSWORD_GOES_HERE \ No newline at end of file
diff --git a/mod2/catalog-service/src/test/java/org/onap/dcaegen2/platform/mod/objectmothers/BlueprintDistributionObjectMother.java b/mod2/catalog-service/src/test/java/org/onap/dcaegen2/platform/mod/objectmothers/BlueprintDistributionObjectMother.java
new file mode 100644
index 0000000..3d06f26
--- /dev/null
+++ b/mod2/catalog-service/src/test/java/org/onap/dcaegen2/platform/mod/objectmothers/BlueprintDistributionObjectMother.java
@@ -0,0 +1,29 @@
+/*
+ * ============LICENSE_START=======================================================
+ * org.onap.dcae
+ * ================================================================================
+ * Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.mod.objectmothers;
+
+public class BlueprintDistributionObjectMother {
+ public static final String BP_DISTRIBUTION_ENV = "DEV";
+ public static final String BP_DISTRIBUTION_MODEL_ID = "5f74ed7877b37173993057f5";
+ public static final String BP_DISTRIBUTION_USER = "User1";
+ public static final String BP_DISTRIBUTION_PWD = "pwd";
+
+}
diff --git a/mod2/catalog-service/src/test/java/org/onap/dcaegen2/platform/mod/web/BlueprintDistributionControllerTest.java b/mod2/catalog-service/src/test/java/org/onap/dcaegen2/platform/mod/web/BlueprintDistributionControllerTest.java
new file mode 100644
index 0000000..7414116
--- /dev/null
+++ b/mod2/catalog-service/src/test/java/org/onap/dcaegen2/platform/mod/web/BlueprintDistributionControllerTest.java
@@ -0,0 +1,76 @@
+/*
+ * ============LICENSE_START=======================================================
+ * org.onap.dcae
+ * ================================================================================
+ * Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.mod.web;
+
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.onap.dcaegen2.platform.mod.objectmothers.BlueprintDistributionObjectMother.BP_DISTRIBUTION_ENV;
+import static org.onap.dcaegen2.platform.mod.objectmothers.BlueprintDistributionObjectMother.BP_DISTRIBUTION_MODEL_ID;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.onap.dcaegen2.platform.mod.model.restapi.SuccessResponse;
+import org.onap.dcaegen2.platform.mod.web.controller.BlueprintDistributionController;
+import org.onap.dcaegen2.platform.mod.web.service.blueprintdistributionservice.BlueprintDistributionService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+import org.springframework.test.web.servlet.MockMvc;
+
+@ExtendWith(SpringExtension.class)
+@WebMvcTest(BlueprintDistributionController.class)
+public class BlueprintDistributionControllerTest {
+
+ @Autowired
+ MockMvc mockMvc;
+
+ @MockBean
+ private BlueprintDistributionService mockBlueprintDistributionService;
+
+ @BeforeEach
+ void setup() {
+ }
+
+
+ @Test
+ void test_distributeBlueprintById_shouldReturn201AndResponseBody() throws Exception {
+
+ ResponseEntity mockResponseEntity = new ResponseEntity<>(new SuccessResponse("Success"), HttpStatus.OK);
+
+ when(mockBlueprintDistributionService
+ .distributeBlueprint(BP_DISTRIBUTION_MODEL_ID,BP_DISTRIBUTION_ENV)).thenReturn(mockResponseEntity);
+
+ mockMvc.perform(post("/api/deployment-artifact/" + BP_DISTRIBUTION_MODEL_ID + "/distribute")
+ .param("env",BP_DISTRIBUTION_ENV).contentType(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk());
+
+ verify(mockBlueprintDistributionService, times(1)).distributeBlueprint(BP_DISTRIBUTION_MODEL_ID,BP_DISTRIBUTION_ENV);
+ }
+
+} \ No newline at end of file
diff --git a/mod2/catalog-service/src/test/java/org/onap/dcaegen2/platform/mod/web/service/BlueprintDistributionServiceImplImplTest.java b/mod2/catalog-service/src/test/java/org/onap/dcaegen2/platform/mod/web/service/BlueprintDistributionServiceImplImplTest.java
new file mode 100644
index 0000000..0a8a785
--- /dev/null
+++ b/mod2/catalog-service/src/test/java/org/onap/dcaegen2/platform/mod/web/service/BlueprintDistributionServiceImplImplTest.java
@@ -0,0 +1,125 @@
+/*
+ * ============LICENSE_START=======================================================
+ * org.onap.dcae
+ * ================================================================================
+ * Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcaegen2.platform.mod.web.service;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.onap.dcaegen2.platform.mod.objectmothers.BlueprintDistributionObjectMother.BP_DISTRIBUTION_ENV;
+import static org.onap.dcaegen2.platform.mod.objectmothers.BlueprintDistributionObjectMother.BP_DISTRIBUTION_MODEL_ID;
+import static org.onap.dcaegen2.platform.mod.objectmothers.BlueprintDistributionObjectMother.BP_DISTRIBUTION_PWD;
+import static org.onap.dcaegen2.platform.mod.objectmothers.BlueprintDistributionObjectMother.BP_DISTRIBUTION_USER;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.onap.dcaegen2.platform.mod.model.deploymentartifact.DeploymentArtifact;
+import org.onap.dcaegen2.platform.mod.model.deploymentartifact.DeploymentArtifactStatus;
+import org.onap.dcaegen2.platform.mod.objectmothers.DeploymentArtifactObjectMother;
+import org.onap.dcaegen2.platform.mod.util.BlueprintDistributionUtils;
+import org.onap.dcaegen2.platform.mod.web.service.blueprintdistributionservice.BlueprintDistributionServiceImpl;
+import org.onap.dcaegen2.platform.mod.web.service.deploymentartifact.DeploymentArtifactGateway;
+import org.onap.dcaegen2.platform.mod.web.service.deploymentartifact.DeploymentArtifactServiceImpl;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.client.RestTemplate;
+
+@ExtendWith(MockitoExtension.class)
+class BlueprintDistributionServiceImplImplTest {
+
+ @Spy
+ private BlueprintDistributionServiceImpl mockBlueprintDistributionServiceImpl = new BlueprintDistributionServiceImpl();
+
+ @Mock
+ private DeploymentArtifactServiceImpl deploymentArtifactService;
+
+ @Mock
+ private BlueprintDistributionUtils blueprintDistributionUtils;
+
+ @Mock
+ private DeploymentArtifactGateway deploymentArtifactGateway;
+
+ @Mock
+ private RestTemplate restTemplate;
+
+ DeploymentArtifact deploymentArtifact;
+
+
+
+ @BeforeEach
+ void initialize(){
+ mockBlueprintDistributionServiceImpl.setDeploymentArtifactService(deploymentArtifactService);
+ mockBlueprintDistributionServiceImpl.setDeploymentArtifactGateway(deploymentArtifactGateway);
+ mockBlueprintDistributionServiceImpl.setBlueprintDistributionUtils(blueprintDistributionUtils);
+ mockBlueprintDistributionServiceImpl.setRestTemplate(restTemplate);
+ deploymentArtifact = DeploymentArtifactObjectMother.createDeploymentArtifactDAO(DeploymentArtifactStatus.IN_DEV);
+ }
+
+
+ @Test
+ void test_distributeBlueprintReturnSucess() {
+
+ when(deploymentArtifactService.findDeploymentArtifactById(BP_DISTRIBUTION_MODEL_ID)).thenReturn(deploymentArtifact);
+ when(blueprintDistributionUtils.getBlueprintDashboardURL(BP_DISTRIBUTION_ENV)).thenReturn("/url");
+ when(blueprintDistributionUtils.getBlueprintDashboardUserName(BP_DISTRIBUTION_ENV)).thenReturn(BP_DISTRIBUTION_USER);
+ when(blueprintDistributionUtils.getBlueprintDashboardPassword(BP_DISTRIBUTION_ENV)).thenReturn(BP_DISTRIBUTION_PWD);
+
+ ResponseEntity expected = mockBlueprintDistributionServiceImpl.distributeBlueprint(BP_DISTRIBUTION_MODEL_ID,BP_DISTRIBUTION_ENV);
+
+ assertThat(expected.getStatusCode()).isEqualTo(HttpStatus.OK);
+ verify(deploymentArtifactService, times(1)).findDeploymentArtifactById(BP_DISTRIBUTION_MODEL_ID);
+ verify(blueprintDistributionUtils, times(2)).getBlueprintDashboardURL(BP_DISTRIBUTION_ENV);
+ verify(blueprintDistributionUtils, times(1)).getBlueprintDashboardUserName(BP_DISTRIBUTION_ENV);
+ verify(blueprintDistributionUtils, times(1)).getBlueprintDashboardPassword(BP_DISTRIBUTION_ENV);
+ verify(deploymentArtifactGateway, times(1)).save(any());
+
+ }
+
+ @Test
+ void test_distributeBlueprintReturnBadRequest() {
+
+ when(deploymentArtifactService.findDeploymentArtifactById(BP_DISTRIBUTION_MODEL_ID)).thenReturn(deploymentArtifact);
+ when(blueprintDistributionUtils.getBlueprintDashboardURL(BP_DISTRIBUTION_ENV)).thenReturn("/url");
+ when(blueprintDistributionUtils.getBlueprintDashboardUserName(BP_DISTRIBUTION_ENV)).thenReturn(BP_DISTRIBUTION_USER);
+ when(blueprintDistributionUtils.getBlueprintDashboardPassword(BP_DISTRIBUTION_ENV)).thenReturn(BP_DISTRIBUTION_PWD);
+ when(restTemplate.postForObject(blueprintDistributionUtils.getBlueprintDashboardURL(BP_DISTRIBUTION_ENV),
+ HttpEntity.class,String.class)).thenReturn("Bad request");
+
+ ResponseEntity expected = mockBlueprintDistributionServiceImpl.distributeBlueprint(BP_DISTRIBUTION_MODEL_ID,BP_DISTRIBUTION_ENV);
+
+ assertThat(expected.getStatusCode()).isEqualTo(HttpStatus.BAD_REQUEST);
+ verify(deploymentArtifactService, times(1)).findDeploymentArtifactById(BP_DISTRIBUTION_MODEL_ID);
+ verify(blueprintDistributionUtils, times(3)).getBlueprintDashboardURL(BP_DISTRIBUTION_ENV);
+ verify(blueprintDistributionUtils, times(1)).getBlueprintDashboardUserName(BP_DISTRIBUTION_ENV);
+ verify(blueprintDistributionUtils, times(1)).getBlueprintDashboardPassword(BP_DISTRIBUTION_ENV);
+ verify(deploymentArtifactGateway, times(1)).save(any());
+
+ }
+
+
+
+} \ No newline at end of file
diff --git a/releases/1.2.1-runtimeapi-container.yaml b/releases/1.2.1-runtimeapi-container.yaml
new file mode 100644
index 0000000..c6e04fc
--- /dev/null
+++ b/releases/1.2.1-runtimeapi-container.yaml
@@ -0,0 +1,9 @@
+distribution_type: 'container'
+container_release_tag: '1.2.1'
+project: 'dcaegen2-platform'
+log_dir: 'dcaegen2-platform-mod-master-runtimeapi-merge-java/26'
+ref: 898cf07d59c3586180b43bc4b1289d5c20d019fd
+containers:
+ - name: 'org.onap.dcaegen2.platform.mod.runtime-web'
+ version: '1.2.1-SNAPSHOT-20210129T134650Z'
+git_tag: '1.2.1-mod-runtimeapi'
diff --git a/releases/1.2.2-runtimeapi-container.yaml b/releases/1.2.2-runtimeapi-container.yaml
new file mode 100644
index 0000000..587b1d2
--- /dev/null
+++ b/releases/1.2.2-runtimeapi-container.yaml
@@ -0,0 +1,9 @@
+distribution_type: 'container'
+container_release_tag: '1.2.2'
+project: 'dcaegen2-platform'
+log_dir: 'dcaegen2-platform-mod-master-runtimeapi-merge-java/27'
+ref: 9bb10e0147e582b6272b40473abbb44fc361d29f
+containers:
+ - name: 'org.onap.dcaegen2.platform.mod.runtime-web'
+ version: '1.2.2-SNAPSHOT-20210210T222108Z'
+git_tag: '1.2.2-mod-runtimeapi'
diff --git a/releases/1.7.2-blueprint-generator.yaml b/releases/1.7.2-blueprint-generator.yaml
new file mode 100644
index 0000000..7d979a9
--- /dev/null
+++ b/releases/1.7.2-blueprint-generator.yaml
@@ -0,0 +1,4 @@
+distribution_type: 'maven'
+version: '1.7.2'
+project: 'dcaegen2/platform'
+log_dir: 'dcaegen2-platform-mod-bpgenerator-maven-stage-master/362'
diff --git a/releases/2.12.4-onboardingapi-container.yaml b/releases/2.12.4-onboardingapi-container.yaml
new file mode 100644
index 0000000..67e33d8
--- /dev/null
+++ b/releases/2.12.4-onboardingapi-container.yaml
@@ -0,0 +1,9 @@
+distribution_type: 'container'
+container_release_tag: '2.12.4'
+project: 'dcaegen2-platform'
+log_dir: 'dcaegen2-platform-mod-onboardingapi-docker-merge-master/53'
+ref: 59a85d1e280b011d05416ac3dbe6d823f60834f6
+containers:
+ - name: 'org.onap.dcaegen2.platform.mod.onboardingapi'
+ version: '2.12.4-SNAPSHOT-20210128T161153Z'
+git_tag: '2.12.4-mod-onboardingapi'