aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2021-09-22 13:29:58 +0000
committerGerrit Code Review <gerrit@onap.org>2021-09-22 13:29:58 +0000
commit18a52fdb476285d33757879aa69e7a4f247f5e14 (patch)
tree7d00d318e41acd25060a64d25b174fe478c92f88
parent9272535549ab041d783c2ee21283f8d5b3f39c4c (diff)
parentf6755e34a8968756b59ca65bec50116530d40a48 (diff)
Merge "Add Junit coverage"
-rw-r--r--so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java4
-rw-r--r--so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/java/org/onap/so/monitoring/rest/api/Constants.java38
-rw-r--r--so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/java/org/onap/so/monitoring/rest/api/SoMonitoringTest.java311
-rw-r--r--so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/EmptyResponse.json1
-rw-r--r--so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/networkRecipeResponse.json5
-rw-r--r--so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceRecipeRequest.json7
-rw-r--r--so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceRecipeRequest_TypeNetwork.json7
-rw-r--r--so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceRecipeRequest_TypeVnf.json7
-rw-r--r--so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceRecipeResponse.json11
-rw-r--r--so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceRecipeResponse_complete.json224
-rw-r--r--so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceResponse.json4
-rw-r--r--so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/service_Model_Version_Not_Exist.json4
-rw-r--r--so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/service_ServiceActionConflict.json11
-rw-r--r--so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/service_Type_Network_Response.json4
-rw-r--r--so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/service_Type_Vnf_Response.json4
-rw-r--r--so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/vnfRecipeResponse.json5
16 files changed, 645 insertions, 2 deletions
diff --git a/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java
index 2f25da1..1069dd3 100644
--- a/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java
+++ b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java
@@ -552,7 +552,7 @@ public class SoMonitoringController {
@Produces({MediaType.APPLICATION_JSON})
public Response getServiceRecipes() {
try {
- LOGGER.info(" SoMonitoringController setServiceRecipes request recieved");
+ LOGGER.info(" SoMonitoringController getServiceRecipes request recieved");
List<ServiceRecipe> serviceRecipes = catalogDbClient.getServiceRecipes();
Map<String, List<Map<String, String>>> mapNetworkRecipes = new HashMap<String, List<Map<String, String>>>();
@@ -587,7 +587,7 @@ public class SoMonitoringController {
@Produces({MediaType.APPLICATION_JSON})
public Response getNetworkRecipes() {
try {
- LOGGER.info(" SoMonitoringController setNetworkRecipes request recieved");
+ LOGGER.info(" SoMonitoringController getNetworkRecipes request recieved");
List<NetworkRecipe> networkRecipes = catalogDbClient.getNetworkRecipes();
Map<String, List<Map<String, String>>> mapNetworkRecipes = new HashMap<String, List<Map<String, String>>>();
diff --git a/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/java/org/onap/so/monitoring/rest/api/Constants.java b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/java/org/onap/so/monitoring/rest/api/Constants.java
index aef8234..c237117 100644
--- a/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/java/org/onap/so/monitoring/rest/api/Constants.java
+++ b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/java/org/onap/so/monitoring/rest/api/Constants.java
@@ -39,6 +39,8 @@ public class Constants {
public static final String SOURCE_TEST_FOLDER = "src/test/resources/camundaResponses/";
+ public static final String SOURCE_CATALOG_FOLDER = "src/test/resources/catalogResponses/";
+
public static final Path PROCESS_DEF_RESPONSE_JSON_FILE = Paths.get(SOURCE_TEST_FOLDER + "processDefinition.json");
public static final Path ACTIVITY_INSTANCE_RESPONSE_JSON_FILE =
@@ -56,6 +58,42 @@ public class Constants {
public static final Path SEARCH_RESULT_RESPONSE_JSON_FILE =
Paths.get("src/test/resources/databaseResponses/searchResult.json");
+ public static final Path SERVICE_RECIPE_RESPONSE_JSON_FILE =
+ Paths.get(SOURCE_CATALOG_FOLDER + "serviceRecipeResponse.json");
+
+ public static final Path SERVICE_RECIPE_REQUEST_JSON_FILE =
+ Paths.get(SOURCE_CATALOG_FOLDER + "serviceRecipeRequest.json");
+
+ public static final Path NETWORK_RECIPE_RESPONSE_JSON_FILE =
+ Paths.get(SOURCE_CATALOG_FOLDER + "networkRecipeResponse.json");
+
+ public static final Path SERVICE_RESPONSE_JSON_FILE =
+ Paths.get(SOURCE_CATALOG_FOLDER + "serviceResponse.json");
+
+ public static final Path SERVICE_MODELVERSIONID_NOT_EXIST =
+ Paths.get(SOURCE_CATALOG_FOLDER + "service_Model_Version_Not_Exist.json");
+
+ public static final Path SERVICE_SERVICE_ACTION_CONFLICT =
+ Paths.get(SOURCE_CATALOG_FOLDER + "service_ServiceActionConflict.json");
+
+ public static final Path SERVICE_TYPE_NETWORK_REQUEST =
+ Paths.get(SOURCE_CATALOG_FOLDER + "serviceRecipeRequest_TypeNetwork.json");
+
+ public static final Path SERVICE_TYPE_NETWORK_RESPONSE =
+ Paths.get(SOURCE_CATALOG_FOLDER + "service_Type_Network_Response.json");
+
+ public static final Path SERVICE_TYPE_VNF_REQUEST =
+ Paths.get(SOURCE_CATALOG_FOLDER + "serviceRecipeRequest_TypeVnf.json");
+
+ public static final Path VNF_RECIPE_RESPONSE_JSON_FILE =
+ Paths.get(SOURCE_CATALOG_FOLDER + "vnfRecipeResponse.json");
+
+ public static final Path SERVICE_TYPE_VNF_RESPONSE =
+ Paths.get(SOURCE_CATALOG_FOLDER + "service_Type_Vnf_Response.json");
+
+ public static final Path EMPTY_RESPONSE_JSON_FILE =
+ Paths.get(SOURCE_CATALOG_FOLDER + "EmptyResponse.json");
+
public static final String ID = UUID.randomUUID().toString();
public static final long END_TIME_IN_MS = 1546351200000l;
diff --git a/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/java/org/onap/so/monitoring/rest/api/SoMonitoringTest.java b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/java/org/onap/so/monitoring/rest/api/SoMonitoringTest.java
new file mode 100644
index 0000000..d6facae
--- /dev/null
+++ b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/java/org/onap/so/monitoring/rest/api/SoMonitoringTest.java
@@ -0,0 +1,311 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright 2021 Huawei Technologies Co., Ltd.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.monitoring.rest.api;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.db.catalog.beans.*;
+import org.onap.so.db.catalog.beans.ServiceRecipe;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.rest.catalog.beans.Service;
+import org.onap.so.monitoring.db.service.DatabaseServiceProvider;
+import org.onap.so.monitoring.rest.service.CamundaProcessDataServiceProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doReturn;
+
+import static org.onap.so.monitoring.rest.api.Constants.SERVICE_RECIPE_REQUEST_JSON_FILE;
+import static org.onap.so.monitoring.rest.api.Constants.SERVICE_RECIPE_RESPONSE_JSON_FILE;
+import static org.onap.so.monitoring.rest.api.Constants.SERVICE_RESPONSE_JSON_FILE;
+import static org.onap.so.monitoring.rest.api.Constants.SERVICE_MODELVERSIONID_NOT_EXIST;
+import static org.onap.so.monitoring.rest.api.Constants.SERVICE_SERVICE_ACTION_CONFLICT;
+import static org.onap.so.monitoring.rest.api.Constants.SERVICE_TYPE_NETWORK_REQUEST;
+import static org.onap.so.monitoring.rest.api.Constants.SERVICE_TYPE_NETWORK_RESPONSE;
+import static org.onap.so.monitoring.rest.api.Constants.SERVICE_TYPE_VNF_REQUEST;
+import static org.onap.so.monitoring.rest.api.Constants.SERVICE_TYPE_VNF_RESPONSE;
+import static org.onap.so.monitoring.rest.api.Constants.NETWORK_RECIPE_RESPONSE_JSON_FILE;
+import static org.onap.so.monitoring.rest.api.Constants.VNF_RECIPE_RESPONSE_JSON_FILE;
+import static org.onap.so.monitoring.rest.api.Constants.EMPTY_RESPONSE_JSON_FILE;
+import static org.onap.so.monitoring.rest.api.Constants.EMPTY_STRING;
+import static org.onap.so.monitoring.rest.api.Constants.EMPTY_ARRAY_RESPONSE;
+
+/**
+ * @author md.irshad.sheikh@huawei.com
+ */
+@RunWith(MockitoJUnitRunner.class)
+public class SoMonitoringTest {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(SoMonitoringTest.class);
+
+ @Autowired
+ private DatabaseServiceProvider databaseServiceProvider;
+
+ @Autowired
+ private CamundaProcessDataServiceProvider camundaProcessDataServiceProvider;
+
+ @Mock
+ private CatalogDbClient catalogDbClient;
+
+ @InjectMocks
+ private SoMonitoringController injectSoMoni =
+ new SoMonitoringController(databaseServiceProvider, camundaProcessDataServiceProvider);
+
+ private final ObjectMapper mapper = new ObjectMapper();
+
+ @Test
+ public void test_getServiceRecipes() throws IOException {
+
+ ServiceRecipe serviceRecipe = mapper.readValue(new String(Files.readAllBytes(SERVICE_RECIPE_RESPONSE_JSON_FILE)),
+ ServiceRecipe.class);
+ List<ServiceRecipe> serviceRecipes = new ArrayList<ServiceRecipe>();
+ serviceRecipes.add(serviceRecipe);
+
+ doReturn(serviceRecipes).when(catalogDbClient).getServiceRecipes();
+
+ final Response response = injectSoMoni.getServiceRecipes();
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+
+ JSONObject obj = new JSONObject(response.getEntity().toString());
+ JSONArray actualServiceRecipe = obj.getJSONArray("serviceRecipes");
+ assertEquals("48cc36cc-a9fe-11e7-8b4b-0242ac120002", actualServiceRecipe.getJSONObject(0).getString("serviceModelUUID"));
+ }
+
+ @Test
+ public void test_getServiceRecipesWithEmpty() throws IOException {
+
+ doReturn(null).when(catalogDbClient).getServiceRecipes();
+
+ final Response response = injectSoMoni.getServiceRecipes();
+ JSONObject obj = new JSONObject(response.getEntity().toString());
+ assertEquals("Unable to process.", obj.getString("errMsg"));
+ }
+
+ @Test
+ public void test_getNetworkRecipes() throws IOException {
+
+ ObjectMapper mapper = new ObjectMapper();
+ NetworkRecipe networkRecipe = mapper.readValue(new String(Files.readAllBytes(NETWORK_RECIPE_RESPONSE_JSON_FILE)),
+ NetworkRecipe.class);
+ List<NetworkRecipe> networkRecipes = new ArrayList<NetworkRecipe>();
+ networkRecipes.add(networkRecipe);
+ doReturn(networkRecipes).when(catalogDbClient).getNetworkRecipes();
+
+ final Response response = injectSoMoni.getNetworkRecipes();
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+
+ JSONObject obj = new JSONObject(response.getEntity().toString());
+ JSONArray actualServiceRecipe = obj.getJSONArray("networkRecipes");
+ assertEquals("deleteInstance", actualServiceRecipe.getJSONObject(0).getString("action"));
+ }
+
+ @Test
+ public void test_getNetworkRecipesWithEmpty() throws IOException {
+
+ doReturn(null).when(catalogDbClient).getNetworkRecipes();
+
+ final Response response = injectSoMoni.getNetworkRecipes();
+ JSONObject obj = new JSONObject(response.getEntity().toString());
+ assertEquals("Unable to process.", obj.getString("errMsg"));
+ }
+
+ @Test
+ public void test_getVnfRecipes() throws IOException {
+
+ ObjectMapper mapper = new ObjectMapper();
+ VnfRecipe vnfRecipe = mapper.readValue(new String(Files.readAllBytes(VNF_RECIPE_RESPONSE_JSON_FILE)),
+ VnfRecipe.class);
+ List<VnfRecipe> vnfRecipes = new ArrayList<VnfRecipe>();
+ vnfRecipes.add(vnfRecipe);
+ doReturn(vnfRecipes).when(catalogDbClient).getVnfRecipes();
+
+ final Response response = injectSoMoni.getVnfRecipes();
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+ JSONObject obj = new JSONObject(response.getEntity().toString());
+ JSONArray actualServiceRecipe = obj.getJSONArray("vnfRecipes");
+ assertEquals("deleteInstance", actualServiceRecipe.getJSONObject(0).getString("action"));
+ }
+
+ @Test
+ public void test_getVnfRecipesWithEmpty() throws IOException {
+
+ doReturn(null).when(catalogDbClient).getVnfRecipes();
+
+ final Response response = injectSoMoni.getVnfRecipes();
+ JSONObject obj = new JSONObject(response.getEntity().toString());
+ assertEquals("Unable to process.", obj.getString("errMsg"));
+ }
+
+ @Test
+ public void test_setServiceRecipes_ServiceActionConflict() throws IOException {
+
+ final String jsonRequestString = new String(Files.readAllBytes(SERVICE_RECIPE_REQUEST_JSON_FILE));
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ ServiceRecipe serviceRecipe = mapper.readValue(new String(Files.readAllBytes(SERVICE_SERVICE_ACTION_CONFLICT)),
+ ServiceRecipe.class);
+ Service service = mapper.readValue(new String(Files.readAllBytes(SERVICE_RESPONSE_JSON_FILE)), Service.class);
+
+ List<ServiceRecipe> serviceRecipes = new ArrayList<ServiceRecipe>();
+ List<Service> services = new ArrayList<Service>();
+
+ serviceRecipes.add(serviceRecipe);
+ services.add(service);
+ doReturn(services).when(catalogDbClient).getServices();
+ doReturn(serviceRecipes).when(catalogDbClient).getServiceRecipes();
+
+ final Response response = injectSoMoni.setServiceRecipes(jsonRequestString);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+
+ JSONObject obj = new JSONObject(response.getEntity().toString());
+ assertEquals("The recipe for this action of the service template already exists.",
+ obj.getString("errMsg"));
+ }
+
+ @Test
+ public void test_setServiceRecipes_EmptyJson() throws IOException {
+
+ final String jsonRequestString = new String(Files.readAllBytes(EMPTY_RESPONSE_JSON_FILE));
+
+ final Response response = injectSoMoni.setServiceRecipes(jsonRequestString);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+ }
+
+ @Test
+ public void test_setServiceRecipes_EmptyString() throws IOException {
+
+ final String jsonRequestString = new String(EMPTY_STRING);
+
+ final Response response = injectSoMoni.setServiceRecipes(jsonRequestString);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+ }
+
+ @Test
+ public void test_setServiceRecipes_ServiceModelVersionIdNotExists() throws IOException {
+
+ final String jsonRequestString = new String(Files.readAllBytes(SERVICE_RECIPE_REQUEST_JSON_FILE));
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ Service service = mapper.readValue(new String(Files.readAllBytes(SERVICE_MODELVERSIONID_NOT_EXIST)), Service.class);
+
+ List<Service> services = new ArrayList<Service>();
+
+ services.add(service);
+ doReturn(services).when(catalogDbClient).getServices();
+
+ final Response response = injectSoMoni.setServiceRecipes(jsonRequestString);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+ JSONObject serviceRecipeObj = new JSONObject(response.getEntity().toString());
+ assertEquals("The service template does not exist.",
+ serviceRecipeObj.getString("errMsg"));
+ }
+
+ @Test
+ public void test_setServiceRecipes_Success() throws IOException {
+
+ final String jsonRequestString = new String(Files.readAllBytes(SERVICE_RECIPE_REQUEST_JSON_FILE));
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ ServiceRecipe serviceRecipe = mapper.readValue(new String(Files.readAllBytes(SERVICE_RECIPE_RESPONSE_JSON_FILE)),
+ ServiceRecipe.class);
+ Service service = mapper.readValue(new String(Files.readAllBytes(SERVICE_RESPONSE_JSON_FILE)), Service.class);
+
+ List<ServiceRecipe> serviceRecipes = new ArrayList<ServiceRecipe>();
+ List<Service> services = new ArrayList<Service>();
+
+ serviceRecipes.add(serviceRecipe);
+ services.add(service);
+ doReturn(services).when(catalogDbClient).getServices();
+ doReturn(serviceRecipes).when(catalogDbClient).getServiceRecipes();
+
+ final Response response = injectSoMoni.setServiceRecipes(jsonRequestString);
+ assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
+ JSONObject serviceRecipeObj = new JSONObject(response.getEntity().toString());
+ assertEquals("48cc36cc-a9fe-11e7-8b4b-0242ac120002", serviceRecipeObj.getString("modelVersionId"));
+ }
+
+ @Test
+ public void test_setServiceRecipes_TypeNetwork_Success() throws IOException {
+ final String jsonRequestString = new String(Files.readAllBytes(SERVICE_TYPE_NETWORK_REQUEST));
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ NetworkRecipe networkRecipe = mapper.readValue(new String(Files.readAllBytes(NETWORK_RECIPE_RESPONSE_JSON_FILE)),
+ NetworkRecipe.class);
+ List<NetworkRecipe> networkRecipes = new ArrayList<NetworkRecipe>();
+ networkRecipes.add(networkRecipe);
+ doReturn(networkRecipes).when(catalogDbClient).getNetworkRecipes();
+
+ NetworkResource networkResource = mapper.readValue(new String(Files.readAllBytes(SERVICE_TYPE_NETWORK_RESPONSE)),
+ NetworkResource.class);
+ List<NetworkResource> networkResources = new ArrayList<NetworkResource>();
+
+ networkResources.add(networkResource);
+ doReturn(networkResources).when(catalogDbClient).getNetworkResources();
+
+ final Response response = injectSoMoni.setServiceRecipes(jsonRequestString);
+ assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
+
+ JSONObject serviceRecipeObj = new JSONObject(response.getEntity().toString());
+ assertEquals("48cc36cc-a9fe-11e7-8b4b-0242ac120002", serviceRecipeObj.getString("modelVersionId"));
+ }
+
+ @Test
+ public void test_setServiceRecipes_TypeVnf_Success() throws IOException {
+ final String jsonRequestString = new String(Files.readAllBytes(SERVICE_TYPE_VNF_REQUEST));
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ VnfRecipe vnfRecipe = mapper.readValue(new String(Files.readAllBytes(VNF_RECIPE_RESPONSE_JSON_FILE)),
+ VnfRecipe.class);
+ List<VnfRecipe> vnfRecipes = new ArrayList<VnfRecipe>();
+ vnfRecipes.add(vnfRecipe);
+ doReturn(vnfRecipes).when(catalogDbClient).getVnfRecipes();
+
+ VnfResource vnfResource = mapper.readValue(new String(Files.readAllBytes(SERVICE_TYPE_VNF_RESPONSE)),
+ VnfResource.class);
+ List<VnfResource> vnfResources = new ArrayList<VnfResource>();
+
+ vnfResources.add(vnfResource);
+ doReturn(vnfResources).when(catalogDbClient).getVnfResources();
+
+ final Response response = injectSoMoni.setServiceRecipes(jsonRequestString);
+ assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
+
+ JSONObject serviceRecipeObj = new JSONObject(response.getEntity().toString());
+ assertEquals("48cc36cc-a9fe-11e7-8b4b-0242ac120002", serviceRecipeObj.getString("modelVersionId"));
+ }
+
+} \ No newline at end of file
diff --git a/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/EmptyResponse.json b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/EmptyResponse.json
new file mode 100644
index 0000000..9e26dfe
--- /dev/null
+++ b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/EmptyResponse.json
@@ -0,0 +1 @@
+{} \ No newline at end of file
diff --git a/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/networkRecipeResponse.json b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/networkRecipeResponse.json
new file mode 100644
index 0000000..0dfdabc
--- /dev/null
+++ b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/networkRecipeResponse.json
@@ -0,0 +1,5 @@
+{
+ "id": 1,
+ "versionStr": "cr",
+ "action": "deleteInstance"
+} \ No newline at end of file
diff --git a/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceRecipeRequest.json b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceRecipeRequest.json
new file mode 100644
index 0000000..9738003
--- /dev/null
+++ b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceRecipeRequest.json
@@ -0,0 +1,7 @@
+{
+ "modelName": "cr",
+ "modelVersionId": "48cc36cc-a9fe-11e7-8b4b-0242ac120002",
+ "operation": "createInstance",
+ "orchestrationFlow": "cr",
+ "modelType": "Service"
+} \ No newline at end of file
diff --git a/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceRecipeRequest_TypeNetwork.json b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceRecipeRequest_TypeNetwork.json
new file mode 100644
index 0000000..acdb0e9
--- /dev/null
+++ b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceRecipeRequest_TypeNetwork.json
@@ -0,0 +1,7 @@
+{
+ "modelName": "cr",
+ "modelVersionId": "48cc36cc-a9fe-11e7-8b4b-0242ac120002",
+ "operation": "createInstance",
+ "orchestrationFlow": "cr",
+ "modelType": "Network"
+} \ No newline at end of file
diff --git a/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceRecipeRequest_TypeVnf.json b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceRecipeRequest_TypeVnf.json
new file mode 100644
index 0000000..b5d3f5b
--- /dev/null
+++ b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceRecipeRequest_TypeVnf.json
@@ -0,0 +1,7 @@
+{
+ "modelName": "cr",
+ "modelVersionId": "48cc36cc-a9fe-11e7-8b4b-0242ac120002",
+ "operation": "createInstance",
+ "orchestrationFlow": "cr",
+ "modelType": "Vnf"
+} \ No newline at end of file
diff --git a/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceRecipeResponse.json b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceRecipeResponse.json
new file mode 100644
index 0000000..6c5f2f3
--- /dev/null
+++ b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceRecipeResponse.json
@@ -0,0 +1,11 @@
+{
+ "id": 1,
+ "serviceModelUUID": "48cc36cc-a9fe-11e7-8b4b-0242ac120002",
+ "action": "deleteInstance",
+ "description": "Vnf api recipe to create service-instance",
+ "orchestrationUri": "/mso/async/services/CreateGenericALaCarteServiceInstance",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2017-10-05T18:52:03.000+00:00"
+ }
diff --git a/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceRecipeResponse_complete.json b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceRecipeResponse_complete.json
new file mode 100644
index 0000000..c876a12
--- /dev/null
+++ b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceRecipeResponse_complete.json
@@ -0,0 +1,224 @@
+{
+ "serviceRecipe": [
+ {
+ "id": 1,
+ "serviceModelUUID": "48cc36cc-a9fe-11e7-8b4b-0242ac120002",
+ "action": "createInstance",
+ "description": "Vnf api recipe to create service-instance",
+ "orchestrationUri": "/mso/async/services/CreateGenericALaCarteServiceInstance",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2017-10-05T18:52:03.000+00:00"
+ },
+ {
+ "id": 2,
+ "serviceModelUUID": "48cc36cc-a9fe-11e7-8b4b-0242ac120002",
+ "action": "deleteInstance",
+ "description": "Vnf api recipe to delete service-instance",
+ "orchestrationUri": "/mso/async/services/DeleteGenericALaCarteServiceInstance",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2017-10-05T18:52:03.000+00:00"
+ },
+ {
+ "id": 3,
+ "serviceModelUUID": "48cc3acd-a9fe-11e7-8b4b-0242ac120002",
+ "action": "createInstance",
+ "description": "DEFAULT recipe to create service-instance if no custom BPMN flow is found",
+ "orchestrationUri": "/mso/async/services/CreateGenericALaCarteServiceInstance",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2017-10-05T18:52:03.000+00:00"
+ },
+ {
+ "id": 4,
+ "serviceModelUUID": "48cc3acd-a9fe-11e7-8b4b-0242ac120002",
+ "action": "deleteInstance",
+ "description": "DEFAULT recipe to delete service-instance if no custom BPMN flow is found",
+ "orchestrationUri": "/mso/async/services/DeleteGenericALaCarteServiceInstance",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2017-10-05T18:52:03.000+00:00"
+ },
+ {
+ "id": 11,
+ "serviceModelUUID": "dfcd7471-16c7-444e-8268-d4c50d90593a",
+ "action": "createInstance",
+ "description": "Custom recipe to create E2E service-instance if no custom BPMN flow is found",
+ "orchestrationUri": "/mso/async/services/CreateCustomE2EServiceInstance",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2017-10-05T18:52:03.000+00:00"
+ },
+ {
+ "id": 12,
+ "serviceModelUUID": "dfcd7471-16c7-444e-8268-d4c50d90593a",
+ "action": "deleteInstance",
+ "description": "Custom recipe to delete E2E service-instance if no custom BPMN flow is found",
+ "orchestrationUri": "/mso/async/services/DeleteCustomE2EServiceInstance",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2017-10-05T18:52:03.000+00:00"
+ },
+ {
+ "id": 15,
+ "serviceModelUUID": "dfcd7471-16c7-444e-8268-d4c50d90593a",
+ "action": "updateInstance",
+ "description": "Custom recipe to update E2E service-instance if no custom BPMN flow is found",
+ "orchestrationUri": "/mso/async/services/UpdateCustomE2EServiceInstance",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2018-03-05T10:52:03.000+00:00"
+ },
+ {
+ "id": 16,
+ "serviceModelUUID": "dfcd7471-16c7-444e-8268-d4c50d90593a",
+ "action": "scaleInstance",
+ "description": "Custom recipe to scale E2E service-instance if no custom BPMN flow is found",
+ "orchestrationUri": "/mso/async/services/ScaleCustomE2EServiceInstance",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2018-05-15T18:52:03.000+00:00"
+ },
+ {
+ "id": 17,
+ "serviceModelUUID": "3d30a774-e149-11ea-87d0-0242ac130003",
+ "action": "createInstance",
+ "description": "Custom recipe to allocate 3gpp service-instance if no custom BPMN flow is found",
+ "orchestrationUri": "/mso/async/services/AllocateSliceSubnet",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2020-08-18T17:40:03.000+00:00"
+ },
+ {
+ "id": 18,
+ "serviceModelUUID": "3d30a774-e149-11ea-87d0-0242ac130003",
+ "action": "deleteInstance",
+ "description": "Custom recipe to deallocate 3gpp service-instance if no custom BPMN flow is found",
+ "orchestrationUri": "/mso/async/services/DeAllocateSliceSubnet",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2020-08-18T18:40:03.000+00:00"
+ },
+ {
+ "id": 19,
+ "serviceModelUUID": "3d30a774-e149-11ea-87d0-0242ac130003",
+ "action": "updateInstance",
+ "description": "Custom recipe to modify 3gpp service-instance if no custom BPMN flow is found",
+ "orchestrationUri": "/mso/async/services/ModifySliceSubnet",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2020-08-18T18:40:03.000+00:00"
+ },
+ {
+ "id": 20,
+ "serviceModelUUID": "3d30a774-e149-11ea-87d0-0242ac130003",
+ "action": "activateInstance",
+ "description": "Custom recipe to activate/deactivate 3gpp service-instance if no custom BPMN flow is found",
+ "orchestrationUri": "/mso/async/services/ActivateSliceSubnet",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2020-08-18T18:40:03.000+00:00"
+ },
+ {
+ "id": 21,
+ "serviceModelUUID": "3d30a774-e149-11ea-87d0-0242ac130003",
+ "action": "deactivateInstance",
+ "description": "Custom recipe to activate/deactivate 3gpp service-instance if no custom BPMN flow is found",
+ "orchestrationUri": "/mso/async/services/ActivateSliceSubnet",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2020-08-18T18:40:03.000+00:00"
+ },
+ {
+ "id": 500,
+ "serviceModelUUID": "d88da85c-d9e8-4f73-b837-3a72a431622b",
+ "action": "updateInstance",
+ "description": "Gr api recipe to update service-instance",
+ "orchestrationUri": "/mso/async/services/WorkflowActionBB",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2017-10-05T18:52:03.000+00:00"
+ },
+ {
+ "id": 501,
+ "serviceModelUUID": "d88da85c-d9e8-4f73-b837-3a72a431622b",
+ "action": "activateInstance",
+ "description": "Gr api recipe to activate service-instance",
+ "orchestrationUri": "/mso/async/services/WorkflowActionBB",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2021-07-01T10:41:12.000+00:00"
+ },
+ {
+ "id": 502,
+ "serviceModelUUID": "d88da85c-d9e8-4f73-b837-3a72a431622b",
+ "action": "createInstance",
+ "description": "Gr api recipe to create service-instance",
+ "orchestrationUri": "/mso/async/services/WorkflowActionBB",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2021-07-01T10:41:12.000+00:00"
+ },
+ {
+ "id": 503,
+ "serviceModelUUID": "d88da85c-d9e8-4f73-b837-3a72a431622b",
+ "action": "deactivateInstance",
+ "description": "Gr api recipe to deactivate service-instance",
+ "orchestrationUri": "/mso/async/services/WorkflowActionBB",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2021-07-01T10:41:12.000+00:00"
+ },
+ {
+ "id": 504,
+ "serviceModelUUID": "d88da85c-d9e8-4f73-b837-3a72a431622b",
+ "action": "deleteInstance",
+ "description": "Gr api recipe to delete service-instance",
+ "orchestrationUri": "/mso/async/services/WorkflowActionBB",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2021-07-01T10:41:12.000+00:00"
+ },
+ {
+ "id": 505,
+ "serviceModelUUID": "d88da85c-d9e8-4f73-b837-3a72a431622b",
+ "action": "assignInstance",
+ "description": "Gr api recipe to assign service-instance",
+ "orchestrationUri": "/mso/async/services/WorkflowActionBB",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2021-07-01T10:41:12.000+00:00"
+ },
+ {
+ "id": 506,
+ "serviceModelUUID": "d88da85c-d9e8-4f73-b837-3a72a431622b",
+ "action": "unassignInstance",
+ "description": "Gr api recipe to unassign service-instance",
+ "orchestrationUri": "/mso/async/services/WorkflowActionBB",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2021-07-01T10:41:12.000+00:00"
+ }
+ ]
+} \ No newline at end of file
diff --git a/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceResponse.json b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceResponse.json
new file mode 100644
index 0000000..c7b102b
--- /dev/null
+++ b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/serviceResponse.json
@@ -0,0 +1,4 @@
+{
+ "modelName": "cr",
+ "modelVersionId": "48cc36cc-a9fe-11e7-8b4b-0242ac120002"
+} \ No newline at end of file
diff --git a/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/service_Model_Version_Not_Exist.json b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/service_Model_Version_Not_Exist.json
new file mode 100644
index 0000000..276eff4
--- /dev/null
+++ b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/service_Model_Version_Not_Exist.json
@@ -0,0 +1,4 @@
+{
+ "modelName": "cr",
+ "modelVersionId": "cr"
+} \ No newline at end of file
diff --git a/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/service_ServiceActionConflict.json b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/service_ServiceActionConflict.json
new file mode 100644
index 0000000..bf20424
--- /dev/null
+++ b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/service_ServiceActionConflict.json
@@ -0,0 +1,11 @@
+{
+ "id": 1,
+ "serviceModelUUID": "48cc36cc-a9fe-11e7-8b4b-0242ac120002",
+ "action": "createInstance",
+ "description": "Vnf api recipe to create service-instance",
+ "orchestrationUri": "/mso/async/services/CreateGenericALaCarteServiceInstance",
+ "paramXsd": null,
+ "recipeTimeout": 180,
+ "serviceTimeoutInterim": null,
+ "created": "2017-10-05T18:52:03.000+00:00"
+ }
diff --git a/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/service_Type_Network_Response.json b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/service_Type_Network_Response.json
new file mode 100644
index 0000000..1ab9c48
--- /dev/null
+++ b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/service_Type_Network_Response.json
@@ -0,0 +1,4 @@
+{
+ "modelName": "cr",
+ "modelVersion": "48cc36cc-a9fe-11e7-8b4b-0242ac120002"
+} \ No newline at end of file
diff --git a/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/service_Type_Vnf_Response.json b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/service_Type_Vnf_Response.json
new file mode 100644
index 0000000..1ab9c48
--- /dev/null
+++ b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/service_Type_Vnf_Response.json
@@ -0,0 +1,4 @@
+{
+ "modelName": "cr",
+ "modelVersion": "48cc36cc-a9fe-11e7-8b4b-0242ac120002"
+} \ No newline at end of file
diff --git a/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/vnfRecipeResponse.json b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/vnfRecipeResponse.json
new file mode 100644
index 0000000..0dfdabc
--- /dev/null
+++ b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/test/resources/catalogResponses/vnfRecipeResponse.json
@@ -0,0 +1,5 @@
+{
+ "id": 1,
+ "versionStr": "cr",
+ "action": "deleteInstance"
+} \ No newline at end of file