diff options
author | 2021-01-11 22:37:56 +0000 | |
---|---|---|
committer | 2021-01-11 22:37:56 +0000 | |
commit | e71c86c428806b55076c1687bb180176f87e6a23 (patch) | |
tree | 20503887e1d42ade76d279dc3ec5a46321a8f174 /ms/generic-resource-api/src/main/java/org/onap | |
parent | 32ce2c60bd58043c18d87f7b14427aa573e700f6 (diff) |
sdnc-apps update
Fixing delete operation issue and add junit config and operation tests
Issue-ID: SDNC-1429
Signed-off-by: Cheung, Pat (kc1472) <kc1472@att.com>
Change-Id: I2e72db0db899ca52cbfd7910d8fb55be4cf05749
Diffstat (limited to 'ms/generic-resource-api/src/main/java/org/onap')
6 files changed, 35 insertions, 19 deletions
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiController.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiController.java index 6a4857b..2cef1a0 100644 --- a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiController.java +++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiController.java @@ -122,7 +122,9 @@ public class ConfigApiController implements ConfigApi { if (pmConfigurations.isEmpty()) { log.info("No configuration data found with id [{}]",configurationId); - return new ResponseEntity<>(HttpStatus.NOT_FOUND); + throw new RestApplicationException("data-missing", + "Request could not be completed because the relevant data model content does not exist", + HttpStatus.NOT_FOUND.value()); } else { ConfigPortMirrorConfigurations pmConfiguration = pmConfigurations.get(0); retval = new GenericResourceApiPortmirrorconfigurationsPortMirrorConfiguration(); @@ -183,7 +185,10 @@ public class ConfigApiController implements ConfigApi { List<ConfigPortMirrorConfigurations> configPortMirrorConfigurations = configPortMirrorConfigurationsRepository.findByConfigurationId(configurationId); if ((configPortMirrorConfigurations == null) || (configPortMirrorConfigurations.isEmpty())) { - throw new RestProtocolException("data-missing", "No port-mirror-configuration entry found", HttpStatus.NOT_FOUND.value()); + log.info("No configuration data found with id [{}]", configurationId); + throw new RestApplicationException("data-missing", + "Request could not be completed because the relevant data model content does not exist", + HttpStatus.NOT_FOUND.value()); } try { @@ -226,7 +231,10 @@ public class ConfigApiController implements ConfigApi { List<ConfigContrailRouteAllottedResources> allottedResources = configContrailRouteAllottedResourcesRepository.findByAllottedResourceId(allottedResourceId); if (allottedResources.isEmpty()) { - return new ResponseEntity<>(HttpStatus.NOT_FOUND); + log.info("No contrail-route-allotted-resource found with id [{}]", allottedResourceId); + throw new RestApplicationException("data-missing", + "Request could not be completed because the relevant data model content does not exist", + HttpStatus.NOT_FOUND.value()); } else { ConfigContrailRouteAllottedResources allottedResource = allottedResources.get(0); @@ -309,7 +317,10 @@ public class ConfigApiController implements ConfigApi { configContrailRouteAllottedResourcesRepository.findByAllottedResourceId(allottedResourceId); if ((configContrailRouteAllottedResources == null) || (configContrailRouteAllottedResources.isEmpty())) { - throw new RestProtocolException("data-missing", "No port-mirror-configuration entry found", HttpStatus.NOT_FOUND.value()); + log.info("No contrail-route-allotted-resoure data found with id [{}]", allottedResourceId); + throw new RestApplicationException("data-missing", + "Request could not be completed because the relevant data model content does not exist", + HttpStatus.NOT_FOUND.value()); } try { @@ -347,7 +358,6 @@ public class ConfigApiController implements ConfigApi { } - @Override public ResponseEntity<GenericResourceApiPreloadModelInformation> configGENERICRESOURCEAPIpreloadInformationGet() throws RestApplicationException { @@ -2038,7 +2048,9 @@ public class ConfigApiController implements ConfigApi { return new ResponseEntity<>(vfModule.get(), HttpStatus.OK); } else { log.info("No vf-module found for [{}]", vfModuleId); - throw new RestApplicationException("data-missing", "Request could not be completed because the relevant data model content does not exist", HttpStatus.NOT_FOUND.value()); + throw new RestApplicationException("data-missing", + "Request could not be completed because the relevant data model content does not exist", + HttpStatus.NOT_FOUND.value()); } } @@ -2157,14 +2169,16 @@ public class ConfigApiController implements ConfigApi { log.info("GET | vf-module-topology for ({})", vfModuleId); if(getObjectMapper().isPresent() && getAcceptHeader().isPresent()) { if (getAcceptHeader().get().contains("application/json")) { - + log.info("Something with header"); } } else { log.warn("ObjectMapper or HttpServletRequest not configured in default ConfigApi interface so no example is generated"); } List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId); if((services == null) || (services.isEmpty())) { - throw new RestProtocolException("data-missing", "No service entry found", HttpStatus.NOT_FOUND.value()); + throw new RestApplicationException("data-missing", + "Request could not be completed because the relevant data model content does not exist", + HttpStatus.NOT_FOUND.value()); } Optional<GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfModule> vfModule = @@ -2175,7 +2189,9 @@ public class ConfigApiController implements ConfigApi { return new ResponseEntity<>(vfModule.get().getVfModuleData().getVfModuleTopology(), HttpStatus.OK); } else { log.info("No information found for {}", vfModuleId); - throw new RestApplicationException("data-missing", "Request could not be completed because the relevant data model content does not exist", HttpStatus.NOT_FOUND.value()); + throw new RestApplicationException("data-missing", + "Request could not be completed because the relevant data model content does not exist", + HttpStatus.NOT_FOUND.value()); } } diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigContrailRouteAllottedResourcesRepository.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigContrailRouteAllottedResourcesRepository.java index 4aa0960..9c3aa91 100755 --- a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigContrailRouteAllottedResourcesRepository.java +++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigContrailRouteAllottedResourcesRepository.java @@ -21,10 +21,10 @@ package org.onap.sdnc.apps.ms.gra.data; import org.springframework.data.repository.CrudRepository; - +import org.springframework.transaction.annotation.Transactional; import java.util.List; - +@Transactional public interface ConfigContrailRouteAllottedResourcesRepository extends CrudRepository<ConfigContrailRouteAllottedResources, Long> { List<ConfigContrailRouteAllottedResources> findByAllottedResourceId(String allottedResourceId); diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigPortMirrorConfigurationsRepository.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigPortMirrorConfigurationsRepository.java index 4c630c9..9ca148b 100755 --- a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigPortMirrorConfigurationsRepository.java +++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigPortMirrorConfigurationsRepository.java @@ -21,10 +21,10 @@ package org.onap.sdnc.apps.ms.gra.data; import org.springframework.data.repository.CrudRepository; - +import org.springframework.transaction.annotation.Transactional; import java.util.List; - +@Transactional public interface ConfigPortMirrorConfigurationsRepository extends CrudRepository<ConfigPortMirrorConfigurations, Long> { List<ConfigPortMirrorConfigurations> findByConfigurationId(String configurationId); diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigServicesRepository.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigServicesRepository.java index 62e09b7..5b43947 100644 --- a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigServicesRepository.java +++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/ConfigServicesRepository.java @@ -21,10 +21,10 @@ package org.onap.sdnc.apps.ms.gra.data; import org.springframework.data.repository.CrudRepository; - +import org.springframework.transaction.annotation.Transactional; import java.util.List; - +@Transactional public interface ConfigServicesRepository extends CrudRepository<ConfigServices, Long> { List<ConfigServices> findBySvcInstanceId(String svcInstanceId); diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalContrailRouteAllottedResourcesRepository.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalContrailRouteAllottedResourcesRepository.java index 2bb98cb..c737721 100755 --- a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalContrailRouteAllottedResourcesRepository.java +++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalContrailRouteAllottedResourcesRepository.java @@ -21,10 +21,10 @@ package org.onap.sdnc.apps.ms.gra.data; import org.springframework.data.repository.CrudRepository; - +import org.springframework.transaction.annotation.Transactional; import java.util.List; - +@Transactional public interface OperationalContrailRouteAllottedResourcesRepository extends CrudRepository<OperationalContrailRouteAllottedResources, Long> { List<OperationalContrailRouteAllottedResources> findByAllottedResourceId(String allottedResourceId); diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalPortMirrorConfigurationsRepository.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalPortMirrorConfigurationsRepository.java index 5f4dce7..1d57c86 100755 --- a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalPortMirrorConfigurationsRepository.java +++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/data/OperationalPortMirrorConfigurationsRepository.java @@ -21,10 +21,10 @@ package org.onap.sdnc.apps.ms.gra.data; import org.springframework.data.repository.CrudRepository; - +import org.springframework.transaction.annotation.Transactional; import java.util.List; - +@Transactional public interface OperationalPortMirrorConfigurationsRepository extends CrudRepository<OperationalPortMirrorConfigurations, Long> { List<OperationalPortMirrorConfigurations> findByConfigurationId(String configurationId); |