summaryrefslogtreecommitdiffstats
path: root/ms
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2020-11-05 10:25:30 -0500
committerDan Timoney <dtimoney@att.com>2020-11-05 10:25:47 -0500
commit8478c087e47ab2b56d5fb5bd8fba8f91f2f7e108 (patch)
tree5205fe7bbf1167c47bd449bbcd90cd000a87aac5 /ms
parentb2ec6199c755d31701a75361cb8b73722027c646 (diff)
Update to avoid dup module names
Update GRA microservice to use updated swagger which no longer duplicates module names in config URLs. Change-Id: Iad63f356d4854c7cefdde46215a1b448b281e2ca Issue-ID: SDNC-1406 Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'ms')
-rw-r--r--ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiController.java44
-rw-r--r--ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationalApiController.java10
-rw-r--r--ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiPreloadControllerTest.java40
-rw-r--r--ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiServicesControllerTest.java65
-rw-r--r--ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiControllerTest.java19
5 files changed, 86 insertions, 92 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 16db766..5695cfc 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
@@ -187,20 +187,20 @@ public class ConfigApiController implements ConfigApi {
}
@Override
- public ResponseEntity<Void> configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPost(@Valid GenericResourceApiPreloadmodelinformationPreloadList preloadListItem) throws RestProtocolException {
+ public ResponseEntity<Void> configGENERICRESOURCEAPIpreloadInformationPreloadListPost(@Valid GenericResourceApiPreloadmodelinformationPreloadList preloadListItem) throws RestProtocolException {
throw new RestProtocolException("data-missing", "Missing key for list \"preload-list\"", HttpStatus.NOT_FOUND.value());
}
@Override
- public ResponseEntity<Void> configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypeDelete(String preloadId, String preloadType) {
+ public ResponseEntity<Void> configGENERICRESOURCEAPIpreloadInformationPreloadListPreloadIdPreloadTypeDelete(String preloadId, String preloadType) {
configPreloadDataRepository.deleteByPreloadIdAndPreloadType(preloadId, preloadType);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Override
- public ResponseEntity<GenericResourceApiPreloadmodelinformationPreloadList> configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypeGet(String preloadId, String preloadType) throws RestApplicationException {
+ public ResponseEntity<GenericResourceApiPreloadmodelinformationPreloadList> configGENERICRESOURCEAPIpreloadInformationPreloadListPreloadIdPreloadTypeGet(String preloadId, String preloadType) throws RestApplicationException {
List<ConfigPreloadData> preloadData = configPreloadDataRepository.findByPreloadIdAndPreloadType(preloadId, preloadType);
if (preloadData != null) {
if (!preloadData.isEmpty()) {
@@ -221,7 +221,7 @@ public class ConfigApiController implements ConfigApi {
}
@Override
- public ResponseEntity<Void> configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypePost(String preloadId, String preloadType, @Valid GenericResourceApiPreloadmodelinformationPreloadList preloadListItem) throws RestApplicationException, RestProtocolException {
+ public ResponseEntity<Void> configGENERICRESOURCEAPIpreloadInformationPreloadListPreloadIdPreloadTypePost(String preloadId, String preloadType, @Valid GenericResourceApiPreloadmodelinformationPreloadList preloadListItem) throws RestApplicationException, RestProtocolException {
List<ConfigPreloadData> preloadDataItems = configPreloadDataRepository.findByPreloadIdAndPreloadType(preloadId, preloadType);
if ((preloadDataItems != null) && !preloadDataItems.isEmpty()) {
@@ -241,7 +241,7 @@ public class ConfigApiController implements ConfigApi {
}
@Override
- public ResponseEntity<Void> configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypePut(String preloadId, String preloadType, @Valid GenericResourceApiPreloadmodelinformationPreloadList preloadListItem) throws RestApplicationException, RestProtocolException {
+ public ResponseEntity<Void> configGENERICRESOURCEAPIpreloadInformationPreloadListPreloadIdPreloadTypePut(String preloadId, String preloadType, @Valid GenericResourceApiPreloadmodelinformationPreloadList preloadListItem) throws RestApplicationException, RestProtocolException {
List<ConfigPreloadData> preloadDataItems = configPreloadDataRepository.findByPreloadIdAndPreloadType(preloadId, preloadType);
boolean dataExists = false;
if ((preloadDataItems != null) && !preloadDataItems.isEmpty()) {
@@ -279,7 +279,7 @@ public class ConfigApiController implements ConfigApi {
@Override
- public ResponseEntity<Void> configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypeGENERICRESOURCEAPIpreloadDataDelete(String preloadId, String preloadType) throws RestProtocolException {
+ public ResponseEntity<Void> configGENERICRESOURCEAPIpreloadInformationPreloadListPreloadIdPreloadTypePreloadDataDelete(String preloadId, String preloadType) throws RestProtocolException {
List<ConfigPreloadData> preloadData = configPreloadDataRepository.findByPreloadIdAndPreloadType(preloadId, preloadType);
if ((preloadData == null) || preloadData.isEmpty()) {
@@ -300,7 +300,7 @@ public class ConfigApiController implements ConfigApi {
@Override
- public ResponseEntity<GenericResourceApiPreloaddataPreloadData> configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypeGENERICRESOURCEAPIpreloadDataGet(String preloadId, String preloadType) throws RestApplicationException, RestProtocolException {
+ public ResponseEntity<GenericResourceApiPreloaddataPreloadData> configGENERICRESOURCEAPIpreloadInformationPreloadListPreloadIdPreloadTypePreloadDataGet(String preloadId, String preloadType) throws RestApplicationException, RestProtocolException {
List<ConfigPreloadData> preloadData = configPreloadDataRepository.findByPreloadIdAndPreloadType(preloadId, preloadType);
if ((preloadData == null) || preloadData.isEmpty()) {
@@ -321,7 +321,7 @@ public class ConfigApiController implements ConfigApi {
}
@Override
- public ResponseEntity<Void> configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypeGENERICRESOURCEAPIpreloadDataPost(String preloadId, String preloadType, @Valid GenericResourceApiPreloaddataPreloadData preloadData) throws RestApplicationException, RestProtocolException {
+ public ResponseEntity<Void> configGENERICRESOURCEAPIpreloadInformationPreloadListPreloadIdPreloadTypePreloadDataPost(String preloadId, String preloadType, @Valid GenericResourceApiPreloaddataPreloadData preloadData) throws RestApplicationException, RestProtocolException {
List<ConfigPreloadData> preloadDataEntries = configPreloadDataRepository.findByPreloadIdAndPreloadType(preloadId, preloadType);
List<ConfigPreloadData> preloadDataItems = configPreloadDataRepository.findByPreloadIdAndPreloadType(preloadId, preloadType);
@@ -353,7 +353,7 @@ public class ConfigApiController implements ConfigApi {
}
@Override
- public ResponseEntity<Void> configGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypeGENERICRESOURCEAPIpreloadDataPut(String preloadId, String preloadType, @Valid GenericResourceApiPreloaddataPreloadData preloadData) throws RestApplicationException, RestProtocolException {
+ public ResponseEntity<Void> configGENERICRESOURCEAPIpreloadInformationPreloadListPreloadIdPreloadTypePreloadDataPut(String preloadId, String preloadType, @Valid GenericResourceApiPreloaddataPreloadData preloadData) throws RestApplicationException, RestProtocolException {
boolean dataExists = false;
List<ConfigPreloadData> preloadDataItems = configPreloadDataRepository.findByPreloadIdAndPreloadType(preloadId, preloadType);
if ((preloadDataItems == null) || (preloadDataItems.isEmpty())) {
@@ -491,7 +491,7 @@ public class ConfigApiController implements ConfigApi {
}
@Override
- public ResponseEntity<Void> configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIservicePost(@Valid GenericResourceApiServicemodelinfrastructureService servicesData) throws RestApplicationException {
+ public ResponseEntity<Void> configGENERICRESOURCEAPIservicesServicePost(@Valid GenericResourceApiServicemodelinfrastructureService servicesData) throws RestApplicationException {
String svcInstanceId = servicesData.getServiceInstanceId();
try {
String svcData = objectMapper.writeValueAsString(servicesData.getServiceData());
@@ -507,13 +507,13 @@ public class ConfigApiController implements ConfigApi {
}
@Override
- public ResponseEntity<Void> configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdDelete(String serviceInstanceId) {
+ public ResponseEntity<Void> configGENERICRESOURCEAPIservicesServiceServiceInstanceIdDelete(String serviceInstanceId) {
configServicesRepository.deleteBySvcInstanceId(serviceInstanceId);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Override
- public ResponseEntity<GenericResourceApiServicemodelinfrastructureService> configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdGet(String serviceInstanceId) throws RestApplicationException {
+ public ResponseEntity<GenericResourceApiServicemodelinfrastructureService> configGENERICRESOURCEAPIservicesServiceServiceInstanceIdGet(String serviceInstanceId) throws RestApplicationException {
GenericResourceApiServicemodelinfrastructureService retval = null;
List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId);
@@ -540,7 +540,7 @@ public class ConfigApiController implements ConfigApi {
}
@Override
- public ResponseEntity<Void> configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdPost(String svcInstanceId, @Valid GenericResourceApiServicemodelinfrastructureService newService) throws RestApplicationException, RestProtocolException {
+ public ResponseEntity<Void> configGENERICRESOURCEAPIservicesServiceServiceInstanceIdPost(String svcInstanceId, @Valid GenericResourceApiServicemodelinfrastructureService newService) throws RestApplicationException, RestProtocolException {
List<ConfigServices> existingService = configServicesRepository.findBySvcInstanceId(svcInstanceId);
if ((existingService != null) && !existingService.isEmpty()) {
@@ -563,7 +563,7 @@ public class ConfigApiController implements ConfigApi {
}
@Override
- public ResponseEntity<Void> configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdPut(String serviceInstanceId, @Valid GenericResourceApiServicemodelinfrastructureService newService) throws RestApplicationException {
+ public ResponseEntity<Void> configGENERICRESOURCEAPIservicesServiceServiceInstanceIdPut(String serviceInstanceId, @Valid GenericResourceApiServicemodelinfrastructureService newService) throws RestApplicationException {
boolean dataExists = false;
@@ -598,7 +598,7 @@ public class ConfigApiController implements ConfigApi {
@Override
- public ResponseEntity<Void> configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdGENERICRESOURCEAPIserviceDataDelete(String serviceInstanceId) throws RestProtocolException {
+ public ResponseEntity<Void> configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataDelete(String serviceInstanceId) throws RestProtocolException {
List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId);
if ((services == null) || (services.isEmpty())) {
@@ -616,7 +616,7 @@ public class ConfigApiController implements ConfigApi {
}
@Override
- public ResponseEntity<GenericResourceApiServicedataServiceData> configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdGENERICRESOURCEAPIserviceDataGet(String serviceInstanceId) throws RestApplicationException, RestProtocolException {
+ public ResponseEntity<GenericResourceApiServicedataServiceData> configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataGet(String serviceInstanceId) throws RestApplicationException, RestProtocolException {
GenericResourceApiServicedataServiceData serviceData = null;
List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId);
@@ -635,7 +635,7 @@ public class ConfigApiController implements ConfigApi {
}
@Override
- public ResponseEntity<Void> configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdGENERICRESOURCEAPIserviceDataPost(String serviceInstanceId, @Valid GenericResourceApiServicedataServiceData serviceData) throws RestApplicationException, RestProtocolException {
+ public ResponseEntity<Void> configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataPost(String serviceInstanceId, @Valid GenericResourceApiServicedataServiceData serviceData) throws RestApplicationException, RestProtocolException {
ConfigServices service;
List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId);
if ((services == null) || (services.isEmpty())) {
@@ -669,7 +669,7 @@ public class ConfigApiController implements ConfigApi {
}
@Override
- public ResponseEntity<Void> configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdGENERICRESOURCEAPIserviceDataPut(String serviceInstanceId, @Valid GenericResourceApiServicedataServiceData serviceData) throws RestApplicationException, RestProtocolException {
+ public ResponseEntity<Void> configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataPut(String serviceInstanceId, @Valid GenericResourceApiServicedataServiceData serviceData) throws RestApplicationException, RestProtocolException {
ConfigServices service;
boolean dataExists = false;
@@ -705,7 +705,7 @@ public class ConfigApiController implements ConfigApi {
}
@Override
- public ResponseEntity<Void> configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdGENERICRESOURCEAPIserviceStatusDelete(String serviceInstanceId) throws RestProtocolException {
+ public ResponseEntity<Void> configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceStatusDelete(String serviceInstanceId) throws RestProtocolException {
List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId);
if ((services == null) || (services.isEmpty())) {
@@ -724,7 +724,7 @@ public class ConfigApiController implements ConfigApi {
}
@Override
- public ResponseEntity<GenericResourceApiServicestatusServiceStatus> configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdGENERICRESOURCEAPIserviceStatusGet(String serviceInstanceId) throws RestApplicationException, RestProtocolException {
+ public ResponseEntity<GenericResourceApiServicestatusServiceStatus> configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceStatusGet(String serviceInstanceId) throws RestApplicationException, RestProtocolException {
GenericResourceApiServicestatusServiceStatus serviceStatus = null;
List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId);
@@ -737,7 +737,7 @@ public class ConfigApiController implements ConfigApi {
}
@Override
- public ResponseEntity<Void> configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdGENERICRESOURCEAPIserviceStatusPost(String serviceInstanceId, @Valid GenericResourceApiServicestatusServiceStatus serviceStatus) throws RestProtocolException {
+ public ResponseEntity<Void> configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceStatusPost(String serviceInstanceId, @Valid GenericResourceApiServicestatusServiceStatus serviceStatus) throws RestProtocolException {
ConfigServices service;
List<ConfigServices> services = configServicesRepository.findBySvcInstanceId(serviceInstanceId);
if ((services == null) || (services.isEmpty())) {
@@ -766,7 +766,7 @@ public class ConfigApiController implements ConfigApi {
}
@Override
- public ResponseEntity<Void> configGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdGENERICRESOURCEAPIserviceStatusPut(String serviceInstanceId, @Valid GenericResourceApiServicestatusServiceStatus serviceStatus) throws RestProtocolException {
+ public ResponseEntity<Void> configGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceStatusPut(String serviceInstanceId, @Valid GenericResourceApiServicestatusServiceStatus serviceStatus) throws RestProtocolException {
ConfigServices service;
boolean dataExists = false;
diff --git a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationalApiController.java b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationalApiController.java
index 14e285f..aeecd63 100644
--- a/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationalApiController.java
+++ b/ms/generic-resource-api/src/main/java/org/onap/sdnc/apps/ms/gra/controllers/OperationalApiController.java
@@ -80,7 +80,7 @@ public class OperationalApiController implements OperationalApi {
@Override
- public ResponseEntity<GenericResourceApiPreloadmodelinformationPreloadList> operationalGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypeGet(String preloadId, String preloadType) {
+ public ResponseEntity<GenericResourceApiPreloadmodelinformationPreloadList> operationalGENERICRESOURCEAPIpreloadInformationPreloadListPreloadIdPreloadTypeGet(String preloadId, String preloadType) {
List<OperationalPreloadData> preloadData = operationalPreloadDataRepository.findByPreloadIdAndPreloadType(preloadId, preloadType);
if (preloadData != null) {
if (!preloadData.isEmpty()) {
@@ -101,7 +101,7 @@ public class OperationalApiController implements OperationalApi {
@Override
- public ResponseEntity<GenericResourceApiPreloaddataPreloadData> operationalGENERICRESOURCEAPIpreloadInformationGENERICRESOURCEAPIpreloadListPreloadIdPreloadTypeGENERICRESOURCEAPIpreloadDataGet(String preloadId, String preloadType) {
+ public ResponseEntity<GenericResourceApiPreloaddataPreloadData> operationalGENERICRESOURCEAPIpreloadInformationPreloadListPreloadIdPreloadTypePreloadDataGet(String preloadId, String preloadType) {
List<OperationalPreloadData> preloadData = operationalPreloadDataRepository.findByPreloadIdAndPreloadType(preloadId, preloadType);
if (preloadData != null) {
if (!preloadData.isEmpty()) {
@@ -146,7 +146,7 @@ public class OperationalApiController implements OperationalApi {
@Override
- public ResponseEntity<GenericResourceApiServicemodelinfrastructureService> operationalGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdGet(String serviceInstanceId) {
+ public ResponseEntity<GenericResourceApiServicemodelinfrastructureService> operationalGENERICRESOURCEAPIservicesServiceServiceInstanceIdGet(String serviceInstanceId) {
GenericResourceApiServicemodelinfrastructureService retval = null;
List<OperationalServices> services = operationalServicesRepository.findBySvcInstanceId(serviceInstanceId);
@@ -175,7 +175,7 @@ public class OperationalApiController implements OperationalApi {
@Override
- public ResponseEntity<GenericResourceApiServicedataServiceData> operationalGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdGENERICRESOURCEAPIserviceDataGet(String serviceInstanceId) {
+ public ResponseEntity<GenericResourceApiServicedataServiceData> operationalGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceDataGet(String serviceInstanceId) {
GenericResourceApiServicedataServiceData serviceData = null;
List<OperationalServices> services = operationalServicesRepository.findBySvcInstanceId(serviceInstanceId);
@@ -193,7 +193,7 @@ public class OperationalApiController implements OperationalApi {
}
@Override
- public ResponseEntity<GenericResourceApiServicestatusServiceStatus> operationalGENERICRESOURCEAPIservicesGENERICRESOURCEAPIserviceServiceInstanceIdGENERICRESOURCEAPIserviceStatusGet(String serviceInstanceId) {
+ public ResponseEntity<GenericResourceApiServicestatusServiceStatus> operationalGENERICRESOURCEAPIservicesServiceServiceInstanceIdServiceStatusGet(String serviceInstanceId) {
GenericResourceApiServicestatusServiceStatus serviceStatus = null;
List<OperationalServices> services = operationalServicesRepository.findBySvcInstanceId(serviceInstanceId);
diff --git a/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiPreloadControllerTest.java b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiPreloadControllerTest.java
index 5b0a8e6..95226f7 100644
--- a/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiPreloadControllerTest.java
+++ b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiPreloadControllerTest.java
@@ -1,12 +1,17 @@
package org.onap.sdnc.apps.ms.gra.controllers;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.sdnc.apps.ms.gra.GenericResourceMsApp;
import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadData;
import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadDataRepository;
-import org.onap.sdnc.apps.ms.gra.data.ConfigServicesRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
@@ -17,13 +22,6 @@ import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.transaction.annotation.Transactional;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-
-import static org.junit.Assert.assertEquals;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.request;
-
@RunWith(SpringRunner.class)
@SpringBootTest(classes={GenericResourceMsApp.class})
@AutoConfigureMockMvc
@@ -31,7 +29,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
public class ConfigApiPreloadControllerTest {
private final static String CONFIG_PRELOAD_URL = "/config/GENERIC-RESOURCE-API:preload-information/";
- private final static String CONFIG_PRELOAD_LIST_URL = "/config/GENERIC-RESOURCE-API:preload-information/GENERIC-RESOURCE-API:preload-list/";
+ private final static String CONFIG_PRELOAD_LIST_URL = "/config/GENERIC-RESOURCE-API:preload-information/preload-list/";
@Autowired
@@ -254,7 +252,7 @@ public class ConfigApiPreloadControllerTest {
// Test with data
loadData(CONFIG_PRELOAD_URL, "src/test/resources/preload1-net-model-info.json");
assert(configPreloadDataRepository.count() > 0);
- MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content(""))
+ MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_PRELOAD_LIST_URL+"preload1/network/preload-data/").contentType(MediaType.APPLICATION_JSON).content(""))
.andReturn();
assertEquals(204, mvcResult.getResponse().getStatus());
assertEquals(1, configPreloadDataRepository.count());
@@ -262,7 +260,7 @@ public class ConfigApiPreloadControllerTest {
// Test without data
configPreloadDataRepository.deleteAll();
assertEquals(0, configPreloadDataRepository.count());
- mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content(""))
+ mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_PRELOAD_LIST_URL+"preload1/network/preload-data/").contentType(MediaType.APPLICATION_JSON).content(""))
.andReturn();
assertEquals(404, mvcResult.getResponse().getStatus());
assertEquals(0, configPreloadDataRepository.count());
@@ -278,13 +276,13 @@ public class ConfigApiPreloadControllerTest {
loadData(CONFIG_PRELOAD_URL, "src/test/resources/preload1-net-model-info.json");
assert(configPreloadDataRepository.count() > 0);
- MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content(""))
+ MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_PRELOAD_LIST_URL+"preload1/network/preload-data/").contentType(MediaType.APPLICATION_JSON).content(""))
.andReturn();
assertEquals(200, mvcResult.getResponse().getStatus());
// Test with no data
configPreloadDataRepository.deleteAll();
- mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data").contentType(MediaType.APPLICATION_JSON).content(""))
+ mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_PRELOAD_LIST_URL+"preload1/network/preload-data").contentType(MediaType.APPLICATION_JSON).content(""))
.andReturn();
assertEquals(404, mvcResult.getResponse().getStatus());
}
@@ -298,7 +296,7 @@ public class ConfigApiPreloadControllerTest {
// Test with no data
- MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content(goodContent))
+ MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_PRELOAD_LIST_URL+"preload1/network/preload-data/").contentType(MediaType.APPLICATION_JSON).content(goodContent))
.andReturn();
assertEquals(404, mvcResult.getResponse().getStatus());
assertEquals(0, configPreloadDataRepository.count());
@@ -321,7 +319,7 @@ public class ConfigApiPreloadControllerTest {
configPreloadDataRepository.save(preloadData);
// Test with bad file content
- MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content(badContent))
+ MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_PRELOAD_LIST_URL+"preload1/network/preload-data/").contentType(MediaType.APPLICATION_JSON).content(badContent))
.andReturn();
assertEquals(400, mvcResult.getResponse().getStatus());
assertEquals(1, configPreloadDataRepository.count());
@@ -344,7 +342,7 @@ public class ConfigApiPreloadControllerTest {
// Test with no existing preload data
- MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content(goodContent))
+ MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_PRELOAD_LIST_URL+"preload1/network/preload-data/").contentType(MediaType.APPLICATION_JSON).content(goodContent))
.andReturn();
assertEquals(201, mvcResult.getResponse().getStatus());
@@ -365,7 +363,7 @@ public class ConfigApiPreloadControllerTest {
// Test with existing preload dat
- MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content(goodContent))
+ MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_PRELOAD_LIST_URL+"preload1/network/preload-data/").contentType(MediaType.APPLICATION_JSON).content(goodContent))
.andReturn();
assertEquals(409, mvcResult.getResponse().getStatus());
assertEquals(1, configPreloadDataRepository.count());
@@ -381,7 +379,7 @@ public class ConfigApiPreloadControllerTest {
// Test with no data
- MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content(goodContent))
+ MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_PRELOAD_LIST_URL+"preload1/network/preload-data/").contentType(MediaType.APPLICATION_JSON).content(goodContent))
.andReturn();
assertEquals(404, mvcResult.getResponse().getStatus());
assertEquals(0, configPreloadDataRepository.count());
@@ -402,7 +400,7 @@ public class ConfigApiPreloadControllerTest {
configPreloadDataRepository.save(preloadData);
// Test with bad file content
- MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content(badContent))
+ MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_PRELOAD_LIST_URL+"preload1/network/preload-data/").contentType(MediaType.APPLICATION_JSON).content(badContent))
.andReturn();
assertEquals(400, mvcResult.getResponse().getStatus());
assertEquals(1, configPreloadDataRepository.count());
@@ -425,7 +423,7 @@ public class ConfigApiPreloadControllerTest {
// Test with no existing preload data
- MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content(goodContent))
+ MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_PRELOAD_LIST_URL+"preload1/network/preload-data/").contentType(MediaType.APPLICATION_JSON).content(goodContent))
.andReturn();
assertEquals(201, mvcResult.getResponse().getStatus());
@@ -446,7 +444,7 @@ public class ConfigApiPreloadControllerTest {
// Test with existing preload dat
- MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_PRELOAD_LIST_URL+"preload1/network/GENERIC-RESOURCE-API:preload-data/").contentType(MediaType.APPLICATION_JSON).content(goodContent))
+ MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_PRELOAD_LIST_URL+"preload1/network/preload-data/").contentType(MediaType.APPLICATION_JSON).content(goodContent))
.andReturn();
assertEquals(204, mvcResult.getResponse().getStatus());
assertEquals(1, configPreloadDataRepository.count());
diff --git a/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiServicesControllerTest.java b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiServicesControllerTest.java
index e9a5c8b..609e780 100644
--- a/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiServicesControllerTest.java
+++ b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiServicesControllerTest.java
@@ -1,16 +1,22 @@
package org.onap.sdnc.apps.ms.gra.controllers;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.List;
+
import com.fasterxml.jackson.databind.ObjectMapper;
+
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.sdnc.apps.ms.gra.GenericResourceMsApp;
-import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadData;
-import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadDataRepository;
import org.onap.sdnc.apps.ms.gra.data.ConfigServices;
import org.onap.sdnc.apps.ms.gra.data.ConfigServicesRepository;
-import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServiceModelInfrastructure;
-import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicemodelinfrastructureService;
+import org.onap.sdnc.apps.ms.gra.swagger.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
@@ -21,15 +27,6 @@ import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.transaction.annotation.Transactional;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.request;
-
@RunWith(SpringRunner.class)
@SpringBootTest(classes={GenericResourceMsApp.class})
@AutoConfigureMockMvc
@@ -37,7 +34,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
public class ConfigApiServicesControllerTest {
private final static String CONFIG_SERVICES_URL = "/config/GENERIC-RESOURCE-API:services/";
- private final static String CONFIG_SERVICES_SERVICE_URL = "/config/GENERIC-RESOURCE-API:services/GENERIC-RESOURCE-API:service/";
+ private final static String CONFIG_SERVICES_SERVICE_URL = "/config/GENERIC-RESOURCE-API:services/service/";
@Autowired
private MockMvc mvc;
@@ -241,7 +238,7 @@ public class ConfigApiServicesControllerTest {
configServicesRepository.deleteAll();
// Test with no data
- MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-data/").contentType(MediaType.APPLICATION_JSON).content(""))
+ MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_SERVICES_SERVICE_URL+"service1/service-data/").contentType(MediaType.APPLICATION_JSON).content(""))
.andReturn();
assertEquals(404, mvcResult.getResponse().getStatus());
assertEquals(0, configServicesRepository.count());
@@ -251,7 +248,7 @@ public class ConfigApiServicesControllerTest {
assertEquals(1, configServicesRepository.count());
// Test with data
- mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-data/").contentType(MediaType.APPLICATION_JSON).content(""))
+ mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_SERVICES_SERVICE_URL+"service1/service-data/").contentType(MediaType.APPLICATION_JSON).content(""))
.andReturn();
assertEquals(204, mvcResult.getResponse().getStatus());
assertEquals(1, configServicesRepository.count());
@@ -271,13 +268,13 @@ public class ConfigApiServicesControllerTest {
loadServicesData("src/test/resources/service1.json");
assert(configServicesRepository.count() > 0);
- MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-data/").contentType(MediaType.APPLICATION_JSON).content(""))
+ MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_SERVICES_SERVICE_URL+"service1/service-data/").contentType(MediaType.APPLICATION_JSON).content(""))
.andReturn();
assertEquals(200, mvcResult.getResponse().getStatus());
// Test with no data
configServicesRepository.deleteAll();
- mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-data/").contentType(MediaType.APPLICATION_JSON).content(""))
+ mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_SERVICES_SERVICE_URL+"service1/service-data/").contentType(MediaType.APPLICATION_JSON).content(""))
.andReturn();
assertEquals(404, mvcResult.getResponse().getStatus());
}
@@ -290,7 +287,7 @@ public class ConfigApiServicesControllerTest {
String content = readFileContent("src/test/resources/service1-servicedata.json");
// Test with no data
- MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-data/").contentType(MediaType.APPLICATION_JSON).content(content))
+ MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_SERVICE_URL+"service1/service-data/").contentType(MediaType.APPLICATION_JSON).content(content))
.andReturn();
assertEquals(404, mvcResult.getResponse().getStatus());
assertEquals(0, configServicesRepository.count());
@@ -300,7 +297,7 @@ public class ConfigApiServicesControllerTest {
service.setSvcInstanceId("service1");
configServicesRepository.save(service);
assertEquals(1, configServicesRepository.count());
- mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-data/").contentType(MediaType.APPLICATION_JSON).content(content))
+ mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_SERVICE_URL+"service1/service-data/").contentType(MediaType.APPLICATION_JSON).content(content))
.andReturn();
assertEquals(201, mvcResult.getResponse().getStatus());
assertEquals(1, configServicesRepository.count());
@@ -309,7 +306,7 @@ public class ConfigApiServicesControllerTest {
assertNotEquals(null, updatedService.get(0).getSvcData());
// Test with existing data - should return 409
- mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-data/").contentType(MediaType.APPLICATION_JSON).content(content))
+ mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_SERVICE_URL+"service1/service-data/").contentType(MediaType.APPLICATION_JSON).content(content))
.andReturn();
assertEquals(409, mvcResult.getResponse().getStatus());
@@ -325,7 +322,7 @@ public class ConfigApiServicesControllerTest {
String content = readFileContent("src/test/resources/service1-servicedata.json");
// Test with no data
- MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-data/").contentType(MediaType.APPLICATION_JSON).content(content))
+ MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_SERVICE_URL+"service1/service-data/").contentType(MediaType.APPLICATION_JSON).content(content))
.andReturn();
assertEquals(404, mvcResult.getResponse().getStatus());
assertEquals(0, configServicesRepository.count());
@@ -334,7 +331,7 @@ public class ConfigApiServicesControllerTest {
ConfigServices service = new ConfigServices();
service.setSvcInstanceId("service1");
configServicesRepository.save(service);
- mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-data/").contentType(MediaType.APPLICATION_JSON).content(content))
+ mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_SERVICE_URL+"service1/service-data/").contentType(MediaType.APPLICATION_JSON).content(content))
.andReturn();
assertEquals(201, mvcResult.getResponse().getStatus());
assertEquals(1, configServicesRepository.count());
@@ -343,7 +340,7 @@ public class ConfigApiServicesControllerTest {
assertNotEquals(null, updatedService.get(0).getSvcData());
// Test with existing data - should return 204
- mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-data/").contentType(MediaType.APPLICATION_JSON).content(content))
+ mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_SERVICE_URL+"service1/service-data/").contentType(MediaType.APPLICATION_JSON).content(content))
.andReturn();
assertEquals(204, mvcResult.getResponse().getStatus());
@@ -357,7 +354,7 @@ public class ConfigApiServicesControllerTest {
configServicesRepository.deleteAll();
// Test with no data
- MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-status/").contentType(MediaType.APPLICATION_JSON).content(""))
+ MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_SERVICES_SERVICE_URL+"service1/service-status/").contentType(MediaType.APPLICATION_JSON).content(""))
.andReturn();
assertEquals(404, mvcResult.getResponse().getStatus());
assertEquals(0, configServicesRepository.count());
@@ -367,7 +364,7 @@ public class ConfigApiServicesControllerTest {
assertEquals(1, configServicesRepository.count());
// Test with data
- mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-status/").contentType(MediaType.APPLICATION_JSON).content(""))
+ mvcResult = mvc.perform(MockMvcRequestBuilders.delete(CONFIG_SERVICES_SERVICE_URL+"service1/service-status/").contentType(MediaType.APPLICATION_JSON).content(""))
.andReturn();
assertEquals(204, mvcResult.getResponse().getStatus());
assertEquals(1, configServicesRepository.count());
@@ -385,13 +382,13 @@ public class ConfigApiServicesControllerTest {
loadServicesData("src/test/resources/service1.json");
assert(configServicesRepository.count() > 0);
- MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-status/").contentType(MediaType.APPLICATION_JSON).content(""))
+ MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_SERVICES_SERVICE_URL+"service1/service-status/").contentType(MediaType.APPLICATION_JSON).content(""))
.andReturn();
assertEquals(200, mvcResult.getResponse().getStatus());
// Test with no data
configServicesRepository.deleteAll();
- mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-status/").contentType(MediaType.APPLICATION_JSON).content(""))
+ mvcResult = mvc.perform(MockMvcRequestBuilders.get(CONFIG_SERVICES_SERVICE_URL+"service1/service-status/").contentType(MediaType.APPLICATION_JSON).content(""))
.andReturn();
assertEquals(404, mvcResult.getResponse().getStatus());
}
@@ -404,7 +401,7 @@ public class ConfigApiServicesControllerTest {
String content = readFileContent("src/test/resources/service1-servicestatus.json");
// Test with no data
- MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-status/").contentType(MediaType.APPLICATION_JSON).content(content))
+ MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_SERVICE_URL+"service1/service-status/").contentType(MediaType.APPLICATION_JSON).content(content))
.andReturn();
assertEquals(404, mvcResult.getResponse().getStatus());
assertEquals(0, configServicesRepository.count());
@@ -413,7 +410,7 @@ public class ConfigApiServicesControllerTest {
ConfigServices service = new ConfigServices();
service.setSvcInstanceId("service1");
configServicesRepository.save(service);
- mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-status/").contentType(MediaType.APPLICATION_JSON).content(content))
+ mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_SERVICE_URL+"service1/service-status/").contentType(MediaType.APPLICATION_JSON).content(content))
.andReturn();
assertEquals(201, mvcResult.getResponse().getStatus());
assertEquals(1, configServicesRepository.count());
@@ -422,7 +419,7 @@ public class ConfigApiServicesControllerTest {
assertNotEquals(null, updatedService.get(0).getServiceStatus());
// Test with existing data - should return 409
- mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-status/").contentType(MediaType.APPLICATION_JSON).content(content))
+ mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_SERVICE_URL+"service1/service-status/").contentType(MediaType.APPLICATION_JSON).content(content))
.andReturn();
assertEquals(409, mvcResult.getResponse().getStatus());
@@ -438,7 +435,7 @@ public class ConfigApiServicesControllerTest {
String content = readFileContent("src/test/resources/service1-servicestatus.json");
// Test with no data
- MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-status/").contentType(MediaType.APPLICATION_JSON).content(content))
+ MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_SERVICE_URL+"service1/service-status/").contentType(MediaType.APPLICATION_JSON).content(content))
.andReturn();
assertEquals(404, mvcResult.getResponse().getStatus());
assertEquals(0, configServicesRepository.count());
@@ -447,7 +444,7 @@ public class ConfigApiServicesControllerTest {
ConfigServices service = new ConfigServices();
service.setSvcInstanceId("service1");
configServicesRepository.save(service);
- mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-status/").contentType(MediaType.APPLICATION_JSON).content(content))
+ mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_SERVICE_URL+"service1/service-status/").contentType(MediaType.APPLICATION_JSON).content(content))
.andReturn();
assertEquals(201, mvcResult.getResponse().getStatus());
assertEquals(1, configServicesRepository.count());
@@ -456,7 +453,7 @@ public class ConfigApiServicesControllerTest {
assertNotEquals(null, updatedService.get(0).getServiceStatus());
// Test with existing data - should return 204
- mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_SERVICE_URL+"service1/GENERIC-RESOURCE-API:service-status/").contentType(MediaType.APPLICATION_JSON).content(content))
+ mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_SERVICE_URL+"service1/service-status/").contentType(MediaType.APPLICATION_JSON).content(content))
.andReturn();
assertEquals(204, mvcResult.getResponse().getStatus());
diff --git a/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiControllerTest.java b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiControllerTest.java
index b285d9e..0a5e8a8 100644
--- a/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiControllerTest.java
+++ b/ms/generic-resource-api/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/OperationsApiControllerTest.java
@@ -1,5 +1,13 @@
package org.onap.sdnc.apps.ms.gra.controllers;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -8,8 +16,7 @@ import org.onap.sdnc.apps.ms.gra.data.ConfigPreloadDataRepository;
import org.onap.sdnc.apps.ms.gra.data.ConfigServices;
import org.onap.sdnc.apps.ms.gra.data.ConfigServicesRepository;
import org.onap.sdnc.apps.ms.gra.data.OperationalServicesRepository;
-import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServiceModelInfrastructure;
-import org.onap.sdnc.apps.ms.gra.swagger.model.GenericResourceApiServicemodelinfrastructureService;
+import org.onap.sdnc.apps.ms.gra.swagger.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
@@ -20,14 +27,6 @@ import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.transaction.annotation.Transactional;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import static org.junit.Assert.*;
-
@RunWith(SpringRunner.class)
@SpringBootTest(classes={GenericResourceMsApp.class})
@AutoConfigureMockMvc