summaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/main
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-08-23 08:55:54 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-08-23 08:58:09 -0400
commit1dce2e1792763171edad8a5a2afbb0321c189cc7 (patch)
tree5c42972aa18faf6dfb2b97e297d4accf429d4fb6 /mso-catalog-db/src/main
parentbb6310f30287b352ad941ecc97aeb278a327d595 (diff)
Changed RequestFactory for Catalog DB client
- Missed some files, the repository isn't required now that we dont fetch the identity service directly - Fixing review comments and removing the unused import - Fixing the build :) Now that cloudSite has a 1-1 relationship with cloudidentity, there shouldn't be a need to query the identity on its own unless the site is missing Refactored some code to use site to fetch identity as a composition - Changing the catalogDb client to use HttpComponentsClientHttpRequestFactory instead of SimpleClientHttpRequestFactory, the later would lead to a IOException (FileNotFoundException specifically) whenever a 40X type of a response code is returned from the spring rest endpoint. Adding some tests for the catalogDbClient which earlier got missed in handover. Also fixing another issue with cloudSite repository which was not fetching data correctly. Fixed a repository which was added initially but later the same went missing (Not sure how) Change-Id: I72506865c4c5f7fd07a6031c146a4aba1a96c2c8 Issue-ID: SO-892 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'mso-catalog-db/src/main')
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java13
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java3
2 files changed, 7 insertions, 9 deletions
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index 0caafc794b..3b1535d66e 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -43,17 +43,14 @@ import org.onap.so.logging.jaxrs.filter.jersey.SpringClientFilter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
import org.springframework.http.client.ClientHttpRequestFactory;
-import org.springframework.http.client.SimpleClientHttpRequestFactory;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Component;
-import org.springframework.web.client.RestTemplate;
import uk.co.blackpepper.bowman.Client;
import uk.co.blackpepper.bowman.ClientFactory;
import uk.co.blackpepper.bowman.Configuration;
-import uk.co.blackpepper.bowman.RestTemplateConfigurer;
import javax.annotation.PostConstruct;
import javax.ws.rs.core.UriBuilder;
-import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.Iterator;
@@ -119,7 +116,7 @@ public class CatalogDbClient {
}
public CatalogDbClient() {
- ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory());
+ ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory());
ClientFactory clientFactory = Configuration.builder().setClientHttpRequestFactory(factory).setRestTemplateConfigurer(restTemplate -> {
restTemplate.getInterceptors().add((new SpringClientFilter()));
@@ -316,9 +313,9 @@ public class CatalogDbClient {
return this.getSingleCloudIdentity(UriBuilder.fromUri(endpoint+"/cloudIdentity/"+id).build());
}
- public CloudSite getCloudSiteByClliAndAicVersion (String clli, String aicVersion){
- return this.getSinglCloudSite(UriBuilder.fromUri(endpoint+"/cloud_sites/search/findByClliAndCloudVersion")
- .queryParam("CLLI",clli).queryParam("AIC_VERSION",aicVersion)
+ public CloudSite getCloudSiteByClliAndAicVersion (String clli, String cloudVersion){
+ return this.getSinglCloudSite(UriBuilder.fromUri(endpoint+"/cloudSite/search/findByClliAndCloudVersion")
+ .queryParam("CLLI",clli).queryParam("CLOUD_VERSION",cloudVersion)
.build());
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java
index 78f117b3ae..65181ff070 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java
@@ -2,6 +2,7 @@ package org.onap.so.db.catalog.data.repository;
import org.onap.so.db.catalog.beans.CloudSite;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import javax.transaction.Transactional;
@@ -10,5 +11,5 @@ import javax.transaction.Transactional;
@Transactional
public interface CloudSiteRepository extends JpaRepository<CloudSite, String> {
- CloudSite findByClliAndCloudVersion(String clli, String aicVersion);
+ CloudSite findByClliAndCloudVersion(@Param("CLLI") String clli,@Param("CLOUD_VERSION") String cloudVersion);
}