diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-02-05 17:19:30 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-02-05 17:20:20 -0500 |
commit | f73e27f96ee88bee8f95da6470d5b7693efd2100 (patch) | |
tree | c0b7a746951875b950ba9b633ab3086252e989b9 /mso-catalog-db/src/main/java | |
parent | 632f2ff1ef005a801c0676367e90417f9ca00c57 (diff) |
provide correct custIds
correct variable name and use bean comparison
included object assertion in junit on catalog client
update test name to reflect return value
fix cvnfc query by 2 customization uuid relationships
provide customization ids to module query input
Change-Id: I99df11c417230e398f86554d889a40e9d157544c
Issue-ID: SO-1466
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'mso-catalog-db/src/main/java')
2 files changed, 10 insertions, 15 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 828b2ff920..ac123b280d 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 @@ -223,7 +223,7 @@ public class CatalogDbClient { private final Client<CloudifyManager> cloudifyManagerClient; - private Client<CvnfcCustomization> cvnfcCustomizationClient; + private final Client<CvnfcCustomization> cvnfcCustomizationClient; private final Client<ControllerSelectionReference> controllerSelectionReferenceClient; @@ -695,18 +695,11 @@ public class CatalogDbClient { } public List<CvnfcCustomization> getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(String vnfCustomizationUUID, String vfModuleCustomizationUUID){ - return this.getMultipleVnfcCustomizations( - UriBuilder.fromUri(endpoint + "/vnfcCustomization/search/findByVnfCustomizationUUIDAndVfModuleCustomizationUUID") - .queryParam("VNF_CUSTOMIZATION_UUID", vnfCustomizationUUID) - .queryParam("VFMODULE_CUSTOMIZATION_UUID", vfModuleCustomizationUUID).build()); - } - - private List<CvnfcCustomization> getMultipleVnfcCustomizations(URI uri) { - Iterable<CvnfcCustomization> vnfcIterator = cvnfcCustomizationClient.getAll(uri); - List<CvnfcCustomization> vnfcList = new ArrayList<>(); - Iterator<CvnfcCustomization> it = vnfcIterator.iterator(); - it.forEachRemaining(vnfcList::add); - return vnfcList; + + return this.getMultipleResources(cvnfcCustomizationClient,getUri(UriBuilder + .fromUri(endpoint + "/cvnfcCustomization/search/findByVnfResourceCustomizationAndVfModuleCustomization") + .queryParam("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID", vnfCustomizationUUID) + .queryParam("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID", vfModuleCustomizationUUID).build().toString())); } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java index 0c82b84c0f..a4281aea6c 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java @@ -24,6 +24,7 @@ import java.util.List; import org.onap.so.db.catalog.beans.CvnfcCustomization; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import org.springframework.data.rest.core.annotation.RepositoryRestResource; @@ -31,6 +32,7 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource; public interface CvnfcCustomizationRepository extends JpaRepository<CvnfcCustomization, String> { CvnfcCustomization findOneByModelCustomizationUUID(String modelCustomizationUuid); List<CvnfcCustomization> findByModelCustomizationUUID(String modelCustomizationUUID); - List<CvnfcCustomization> findByVnfResourceCustomizationAndVfModuleCustomization (@Param("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID") String vnfResourceCustomization, - @Param("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID") String vfModuleCustomization); + + @Query(value = "SELECT * FROM cvnfc_customization WHERE VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID = ?1 AND VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID = ?2", nativeQuery = true) + List<CvnfcCustomization> findByVnfResourceCustomizationAndVfModuleCustomization (@Param("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID") String vnfResourceCustomization,@Param("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID") String vfModuleCustomization); }
\ No newline at end of file |