aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-catalog-db-adapter/src/main/java
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-08-28 10:23:08 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-08-28 10:31:34 -0400
commit1ffe9a2d3bec70d522ff65b72b6b2726e9ce7de6 (patch)
treee8069fe77c5d208f1afac722e71496607d2d4090 /adapters/mso-catalog-db-adapter/src/main/java
parenteb94991c543a1d9cf3c9b6c4dfca921dedf48da5 (diff)
Converted ServiceInstances to catalog db client
- Fixed issues related to created Date Format, enabled required Test - Fixed issues related to queryParam names, enabled required Test - Fixed issues related to queryParam names - Improving coverage for catalogDbClient by another 10% (its 78% now) - Improving coverage for catalogDbClient by another 10%. There is a failing test which will be explored shortly - Improving coverage for catalogDbClient, adding some tests and their basic asserts - merging with dev and resolving the compilation issue arising due to it - Removing some TODO introduced in code for incremental pushes - Fixing failing unit test cases with the build - Refactoring done for code change in catalogDBClient - merged changes with development branch - Modified unit tests for Catalogdb Client related code - Modified unit tests for Catalogdb Client related code - Fixed some of the repository code for retrieving single resource - Modified unit tests for Catalogdb Client related code - Modified unit tests for Catalogdb Client related code - Modified unit tests for Catalogdb Client related code - Removed @Param from repositories and added -Parameters argument in maven compile plugin ... Change-Id: Ieeb7bcc21a573465e485fedfbbe771c8b89db3f8 Issue-ID: SO-925 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'adapters/mso-catalog-db-adapter/src/main/java')
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java37
1 files changed, 18 insertions, 19 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
index d77fb097ae..5cd2559ef2 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
@@ -53,19 +53,6 @@ min and initial counts can be 0. max can be null to indicate no maximum.
Once the network-level distribution artifacts are defined, similar updates can be made to the NETWORK_RESOURCE table.
*/
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.GenericEntity;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
import org.apache.http.HttpStatus;
import org.onap.so.adapters.catalogdb.catalogrest.CatalogQuery;
import org.onap.so.adapters.catalogdb.catalogrest.CatalogQueryException;
@@ -107,6 +94,18 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.GenericEntity;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* This class services calls to the REST interface for VF Modules (http://host:port/ecomp/mso/catalog/v1)
* Both XML and JSON can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default.
@@ -203,7 +202,7 @@ public class CatalogDbAdapterRest {
service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(serviceModelUUID);
else if (smiUuid != null && !"".equals(smiUuid))
if (smVer != null && !"".equals(smVer))
- service = serviceRepo.findByModelVersionAndModelInvariantUUID(smVer,smiUuid);
+ service = serviceRepo.findFirstByModelVersionAndModelInvariantUUID(smVer,smiUuid);
else
service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(smiUuid);
else if (smName != null && !"".equals(smName)) {
@@ -287,7 +286,7 @@ public class CatalogDbAdapterRest {
else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) {
uuid = serviceModelInvariantUuid;
if (serviceModelVersion != null && !"".equals(serviceModelVersion)) {
- service = serviceRepo.findByModelVersionAndModelInvariantUUID(serviceModelVersion, uuid);
+ service = serviceRepo.findFirstByModelVersionAndModelInvariantUUID(serviceModelVersion, uuid);
}
else {
service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid);
@@ -347,7 +346,7 @@ public class CatalogDbAdapterRest {
uuid = modelInvariantUUID;
if (modelVersion != null && !"".equals(modelVersion)) {
logger.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelInvariantUuid: {} serviceModelVersion: {}",uuid, modelVersion);
- Service serv = serviceRepo.findByModelVersionAndModelInvariantUUID(modelVersion, uuid);
+ Service serv = serviceRepo.findFirstByModelVersionAndModelInvariantUUID(modelVersion, uuid);
ret.setService(serv);
}
else {
@@ -419,7 +418,7 @@ public class CatalogDbAdapterRest {
else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) {
uuid = serviceModelInvariantUuid;
if (smVer != null && !"".equals(smVer)) {
- service = serviceRepo.findByModelVersionAndModelInvariantUUID(smVer, uuid);
+ service = serviceRepo.findFirstByModelVersionAndModelInvariantUUID(smVer, uuid);
}
else {
service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid);
@@ -558,10 +557,10 @@ public class CatalogDbAdapterRest {
logger.debug("Query recipe by resource model uuid: {}", rmUuid);
//check vnf and network and ar, the resource could be any resource.
VnfResource vnf = vnfResourceRepo.findResourceByModelUUID(rmUuid);
- Recipe recipe = vnfRecipeRepo.findVnfRecipeByNfRoleAndAction(vnf.getModelName(), action);
+ Recipe recipe = vnfRecipeRepo.findFirstVnfRecipeByNfRoleAndAction(vnf.getModelName(), action);
if (null == recipe) {
NetworkResource nResource = networkResourceRepo.findResourceByModelUUID(rmUuid);
- recipe = networkRecipeRepo.findByModelNameAndAction(nResource.getModelName(), action);
+ recipe = networkRecipeRepo.findFirstByModelNameAndAction(nResource.getModelName(), action);
}
if (null == recipe) {
AllottedResource arResource = arResourceRepo.findResourceByModelUUID(rmUuid);