update pojo to have json property and remove constructor 26/115226/1
authorKalkere Ramesh, Sharan <sk720x@att.com>
Mon, 23 Nov 2020 13:51:22 +0000 (08:51 -0500)
committerSeshu Kumar M <seshu.kumar.m@huawei.com>
Tue, 24 Nov 2020 09:09:43 +0000 (09:09 +0000)
Issue-ID: SO-3399
Change-Id: Ied4baf50f17d5ea6593fb8ac816d799b42ad8565
Signed-off-by: Kalkere Ramesh, Sharan <sk720x@att.com>
(cherry picked from commit 1416bf28ddf51ede1aa4a3adcdf157b75d53b6ac)

bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/CnfAdapterClient.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java

index b74aa90..60ad211 100644 (file)
@@ -54,14 +54,14 @@ public class CnfAdapterClient {
     @Autowired
     private Environment env;
 
-    private static final String INSTANCE_CREATE_PATH = "/api/multicloud-k8s/v1/v1/instance";
+    private static final String INSTANCE_CREATE_PATH = "/api/cnf-adapter/v1/instance";
 
     @Retryable(value = {HttpServerErrorException.class}, maxAttempts = 3, backoff = @Backoff(delay = 3000))
     public InstanceResponse createVfModule(InstanceRequest request) throws CnfAdapterClientException {
         try {
             // String uri = env.getRequiredProperty("mso.cnf.adapter.endpoint"); //TODO: This needs to be added as well
             // for configuration
-            String uri = "https://localhost:32780"; // TODO: What is the correct uri?
+            String uri = "https://cnf-adapter:8090"; // TODO: What is the correct uri?
             String endpoint = UriBuilder.fromUri(uri).path(INSTANCE_CREATE_PATH).build().toString();
             HttpEntity<?> entity = getHttpEntity(request);
             ResponseEntity<InstanceResponse> result =
@@ -81,7 +81,7 @@ public class CnfAdapterClient {
         try {
             // String uri = env.getRequiredProperty("mso.cnf.adapter.endpoint"); //TODO: This needs to be added as well
             // for configuration
-            String uri = "https://localhost:32780"; // TODO: What is the correct uri?
+            String uri = "https://cnf-adapter:8090"; // TODO: What is the correct uri?
             String endpoint = UriBuilder.fromUri(uri).path("/api/cnf-adapter/v1/healthcheck").build().toString();
             HttpEntity<?> entity = new HttpEntity<>(getHttpHeaders());
             ResponseEntity<InstanceResponse> result =
index 6278d48..7291b71 100644 (file)
 package org.onap.so.client.adapter.vnf.mapper;
 
 import java.io.Serializable;
+import com.fasterxml.jackson.annotation.JsonProperty;
 
 public class AttributeNameValue implements Serializable {
     private static final long serialVersionUID = -5215028275587848311L;
 
+    @JsonProperty("attribute_name")
     private String attributeName;
+    @JsonProperty("attribute_value")
     private transient Object attributeValue;
 
-    public AttributeNameValue(String attributeName, Object attributeValue) {
-        this.attributeName = attributeName;
-        this.attributeValue = attributeValue;
-    }
-
     public String getAttributeName() {
         return attributeName;
     }
index 59da22f..7c686bd 100644 (file)
@@ -235,7 +235,10 @@ public class VnfAdapterVfModuleObjectMapper {
                         logger.error("No value tag found for attribute: {}", attributeName);
                         throw new MissingValueTagException("No value tag found for " + attributeName);
                     }
-                    directives.append(new AttributeNameValue(attributeName, attributeValue.toString()));
+                    String nameValue = new StringBuilder().append("{\"attribute_name\": \"").append(attributeName)
+                            .append("\", \"attribute_value\": \"").append(attributeValue.toString()).append("\"}")
+                            .toString();
+                    directives.append(nameValue);
                     if (i < (srcMap.size() - 1 + noOfDirectivesSize))
                         directives.append(", ");
                     i++;