diff options
Diffstat (limited to 'ms/gra/gra-app/src/test/java')
2 files changed, 6 insertions, 23 deletions
diff --git a/ms/gra/gra-app/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiPreloadControllerTest.java b/ms/gra/gra-app/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiPreloadControllerTest.java index 95226f7..8c311fb 100644 --- a/ms/gra/gra-app/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiPreloadControllerTest.java +++ b/ms/gra/gra-app/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiPreloadControllerTest.java @@ -131,7 +131,7 @@ public class ConfigApiPreloadControllerTest { // Clean up data configPreloadDataRepository.deleteAll(); - String content = readFileContent("src/test/resources/preload1-net-model-info.json"); + String content = readFileContent("src/test/resources/preload1-net-list-item.json"); MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_PRELOAD_LIST_URL).contentType(MediaType.APPLICATION_JSON).content(content)) .andReturn(); @@ -220,17 +220,11 @@ public class ConfigApiPreloadControllerTest { // Clean up data configPreloadDataRepository.deleteAll(); - String badContent = readFileContent("src/test/resources/preload1-net-model-info.json"); String goodContent = readFileContent("src/test/resources/preload1-net-list-item.json"); - // Test with bad file content - MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_PRELOAD_LIST_URL+"preload1/network/").contentType(MediaType.APPLICATION_JSON).content(badContent)) - .andReturn(); - assertEquals(400, mvcResult.getResponse().getStatus()); - assertEquals(0, configPreloadDataRepository.count()); // Test with no data - mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_PRELOAD_LIST_URL+"preload1/network/").contentType(MediaType.APPLICATION_JSON).content(goodContent)) + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_PRELOAD_LIST_URL+"preload1/network/").contentType(MediaType.APPLICATION_JSON).content(goodContent)) .andReturn(); assertEquals(201, mvcResult.getResponse().getStatus()); assertEquals(1, configPreloadDataRepository.count()); @@ -318,11 +312,6 @@ public class ConfigApiPreloadControllerTest { preloadData.setPreloadData(null); configPreloadDataRepository.save(preloadData); - // Test with bad file content - 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()); } @@ -399,12 +388,6 @@ public class ConfigApiPreloadControllerTest { preloadData.setPreloadData(null); configPreloadDataRepository.save(preloadData); - // Test with bad file content - 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()); - } @Test diff --git a/ms/gra/gra-app/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiServicesControllerTest.java b/ms/gra/gra-app/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiServicesControllerTest.java index 603ff20..dd5a6a4 100644 --- a/ms/gra/gra-app/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiServicesControllerTest.java +++ b/ms/gra/gra-app/src/test/java/org/onap/sdnc/apps/ms/gra/controllers/ConfigApiServicesControllerTest.java @@ -182,7 +182,7 @@ public class ConfigApiServicesControllerTest { // Clean up data clearServicesData(); - String content = readFileContent("src/test/resources/service1.json"); + String content = readFileContent("src/test/resources/service1-services.json"); // Test with no data MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.post(CONFIG_SERVICES_URL).contentType(MediaType.APPLICATION_JSON).content(content)) @@ -206,7 +206,7 @@ public class ConfigApiServicesControllerTest { // Clean up data clearServicesData(); - String content = readFileContent("src/test/resources/service1.json"); + String content = readFileContent("src/test/resources/service1-services.json"); // Test with no data MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put(CONFIG_SERVICES_URL).contentType(MediaType.APPLICATION_JSON).content(content)) @@ -643,12 +643,12 @@ public class ConfigApiServicesControllerTest { clearServicesData(); assertEquals(0, configServicesRepository.count()); assertEquals(0, configVnfsRepository.count()); - MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put("/config/GENERIC-RESOURCE-API:services/service/"+TEST_SVC_INSTANCE_ID+"/service-data/vnfs/vnf/"+TEST_VNF_ID+"/").contentType(MediaType.APPLICATION_JSON).content(readFileContent("src/test/resources/vnf-data.json"))) + MvcResult mvcResult = mvc.perform(MockMvcRequestBuilders.put("/config/GENERIC-RESOURCE-API:services/service/"+TEST_SVC_INSTANCE_ID+"/service-data/vnfs/vnf/"+TEST_VNF_ID+"/").contentType(MediaType.APPLICATION_JSON).content(readFileContent("src/test/resources/vnf.json"))) .andReturn(); assertEquals(201, mvcResult.getResponse().getStatus()); assertEquals(1, configVnfsRepository.count()); - mvcResult = mvc.perform(MockMvcRequestBuilders.put("/config/GENERIC-RESOURCE-API:services/service/"+TEST_SVC_INSTANCE_ID+"/service-data/vnfs/vnf/"+TEST_VNF_ID+"/").contentType(MediaType.APPLICATION_JSON).content(readFileContent("src/test/resources/vnf-data.json"))) + mvcResult = mvc.perform(MockMvcRequestBuilders.put("/config/GENERIC-RESOURCE-API:services/service/"+TEST_SVC_INSTANCE_ID+"/service-data/vnfs/vnf/"+TEST_VNF_ID+"/").contentType(MediaType.APPLICATION_JSON).content(readFileContent("src/test/resources/vnf.json"))) .andReturn(); assertEquals(204, mvcResult.getResponse().getStatus()); assertEquals(1, configVnfsRepository.count()); |