Merge "Add cloudSite Post to catalogDbClient"
authorSeshu Kumar M <seshu.kumar.m@huawei.com>
Wed, 26 Sep 2018 04:35:06 +0000 (04:35 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 26 Sep 2018 04:35:06 +0000 (04:35 +0000)
asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/TestApplication.java
mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
packages/docker/pom.xml

index 7ead6cb..9150591 100644 (file)
@@ -26,7 +26,6 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
 import java.util.List;
 
 import org.onap.sdc.api.IDistributionClient;
@@ -46,7 +45,6 @@ import org.onap.so.asdc.client.exceptions.ASDCParametersException;
 import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
 import org.onap.so.asdc.installer.IVfResourceInstaller;
 import org.onap.so.asdc.installer.ToscaResourceStructure;
-import org.onap.so.asdc.installer.VfModuleStructure;
 import org.onap.so.asdc.installer.VfResourceStructure;
 import org.onap.so.asdc.installer.bpmn.BpmnInstaller;
 import org.onap.so.asdc.installer.heat.ToscaResourceInstaller;
@@ -596,7 +594,7 @@ public class ASDCController {
                                distributionStatus = wd.getOverallDistributionStatus(iNotif.getDistributionID());
                                Thread.sleep(watchDogTimeout / 10);             
                        }catch(Exception e){
-                               LOGGER.debug ("Exception in Watchdog Loop " + e.getMessage());
+                               LOGGER.debug ("Exception in Watchdog Loop " + e);
                                Thread.sleep(watchDogTimeout / 10);
                        }
                        
@@ -628,7 +626,7 @@ public class ASDCController {
                        LOGGER.debug ("A&AI Updated succefully with Distribution Status!");
                }
                catch(Exception e) {
-                       LOGGER.debug ("Exception in Watchdog executePatchAAI(): " + e.getMessage());
+                       LOGGER.debug ("Exception in Watchdog executePatchAAI(): " + e);
                        watchdogError = "Error calling A&AI " + e.getMessage();
                        if(e.getCause() != null) {
                                LOGGER.debug ("Exception caused by: " + e.getCause().getMessage());
@@ -660,7 +658,7 @@ public class ASDCController {
                        LOGGER.debug ("A&AI Updated succefully with Distribution Status of " + DistributionStatusEnum.DISTRIBUTION_COMPLETE_ERROR.name());
                }
                catch(Exception aaiException) {
-                       LOGGER.debug ("Exception in executePatchAAI(): " + aaiException.getMessage());
+                       LOGGER.debug ("Exception in executePatchAAI(): " + aaiException);
                        if(aaiException.getCause() != null) {
                                LOGGER.debug ("Exception caused by: " + aaiException.getCause().getMessage());
                        }
@@ -708,6 +706,7 @@ public class ASDCController {
                                } catch(ArtifactInstallerException e){
                                        deploySuccessful = false;
                                        errorMessage = e.getMessage();
+                                       LOGGER.debug ("Exception in processResourceNotification(): " + e);
                                }  
                        } else { // Services with resources
                        
@@ -744,6 +743,7 @@ public class ASDCController {
                                } catch(ArtifactInstallerException e){
                                        deploySuccessful = false;
                                        errorMessage = e.getMessage();
+                                       LOGGER.debug ("Exception in processResourceNotification(): " + e);
                                }  
                                
                }       
index 5b6fbc8..9bb5cab 100644 (file)
@@ -27,7 +27,7 @@ import org.springframework.context.annotation.Profile;
 import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
 import org.springframework.web.client.RestTemplate;
 
-@SpringBootApplication(scanBasePackages = { "org.onap.so.db" })
+@SpringBootApplication(scanBasePackages = { "org.onap.so" })
 @Profile("test")
 public class TestApplication {
        public static void main(String... args) {
@@ -35,8 +35,4 @@ public class TestApplication {
                System.getProperties().setProperty("mso.db", "MARIADB");
                System.getProperties().setProperty("server.name", "Springboot");
        }
-       @Bean
-       public RestTemplate restTemplate() {
-               return new RestTemplate( new HttpComponentsClientHttpRequestFactory());
-       }
 }
index e68bdb3..07d185b 100644 (file)
 
 package org.onap.so.db.request.client;
 
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.PostConstruct;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriBuilder;
+
 import org.apache.http.HttpStatus;
 import org.onap.so.db.request.beans.ArchivedInfraRequests;
 import org.onap.so.db.request.beans.InfraActiveRequests;
@@ -41,6 +52,7 @@ import org.springframework.core.ParameterizedTypeReference;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
 import org.springframework.http.client.BufferingClientHttpRequestFactory;
 import org.springframework.http.client.ClientHttpRequestFactory;
 import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
@@ -50,16 +62,6 @@ import org.springframework.web.client.RestTemplate;
 import uk.co.blackpepper.bowman.ClientFactory;
 import uk.co.blackpepper.bowman.Configuration;
 
-import javax.annotation.PostConstruct;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriBuilder;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Iterator;
-
 @Component("RequestsDbClient")
 @Primary
 public class RequestsDbClient {
@@ -188,7 +190,12 @@ public class RequestsDbClient {
                URI uri = getUri(checkInstanceNameDuplicate);
                HttpEntity<InstanceNameDuplicateCheckRequest> entity = new HttpEntity<>(new InstanceNameDuplicateCheckRequest(instanceIdMap, instanceName, requestScope), headers);
                try{
-                       return restTemplate.exchange(uri, HttpMethod.POST, entity, InfraActiveRequests.class).getBody();
+                       ResponseEntity<InfraActiveRequests> response = restTemplate.exchange(uri, HttpMethod.POST, entity, InfraActiveRequests.class);
+                       if(response != null && response.hasBody()) {
+                               return restTemplate.exchange(uri, HttpMethod.POST, entity, InfraActiveRequests.class).getBody();
+                       } else {
+                               return null;
+                       }
                }catch(HttpClientErrorException e){
                        if(HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()){
                                return null;
index 3147c02..c2e6fe3 100644 (file)
                        <version>${project.version}</version>
                </dependency>
                <dependency>
-                       <groupId>org.onap.so-monitoring</groupId>
+                       <groupId>org.onap.so.monitoring</groupId>
                        <artifactId>so-monitoring-service</artifactId>
                        <version>${project.version}</version>
                </dependency>