Refactoring Code to remove NRM 07/130107/2
authorSingal, Kapil (ks220y) <ks220y@att.com>
Mon, 8 Aug 2022 03:01:52 +0000 (23:01 -0400)
committerKAPIL SINGAL <ks220y@att.com>
Mon, 22 Aug 2022 21:14:05 +0000 (21:14 +0000)
Renaming Classes, API's, variabled and removing NRM word from codebase

Issue-ID: CCSDK-3741
Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com>
Change-Id: I8150eec7e8fb0bc1d33e80991215e745e9aa79d0
(cherry picked from commit cc2dbf6d08840ba0e105e44022568d9afd130273)

ms/blueprintsprocessor/functions/restful-executor/pom.xml
ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/RestfulCMComponentFunction.kt
ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/function/RestfulServiceClient.kt [moved from ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/nrmfunction/RestfulNRMServiceClient.kt with 98% similarity]
ms/blueprintsprocessor/functions/restful-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/restful/executor/function/RestfulServiceClientTest.kt [moved from ms/blueprintsprocessor/functions/restful-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/restful/executor/nrmfunction/RestfulNRMServiceClientTest.kt with 90% similarity]

index ed0fdc9..9c154f1 100644 (file)
@@ -26,8 +26,8 @@
     <groupId>org.onap.ccsdk.cds.blueprintsprocessor.functions</groupId>
     <artifactId>restful-executor</artifactId>
 
-    <name>MS Blueprints Processor Functions - NRM Restful executor</name>
-    <description>Blueprints Processor Function - NRM Restful executor</description>
+    <name>MS Blueprints Processor Functions - Restful executor</name>
+    <description>Blueprints Processor Function - Restful executor</description>
 
     <dependencies>
         <dependency>
index 9cd6f57..6b5af80 100644 (file)
@@ -20,7 +20,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
 import com.fasterxml.jackson.databind.node.ArrayNode
 import com.fasterxml.jackson.databind.node.ObjectNode
 import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.cds.blueprintsprocessor.functions.restful.executor.nrmfunction.RestfulNRMServiceClient
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.restful.executor.function.RestfulServiceClient
 import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestLibConstants
 import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService
 import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService
@@ -49,7 +49,7 @@ abstract class RestfulCMComponentFunction : AbstractScriptComponentFunction() {
 
     fun processNRM(executionRequest: ExecutionServiceInput, input_params: ArrayNode): String {
         // process the managed object instances
-        log.info("Processing NRM Object")
+        log.info("Processing Object")
         operationInputs = executionServiceInput.stepData!!.properties
         val dynamic_properties = operationInputs.get("dynamic-properties")
         // instantiate one restClientService instance
@@ -75,9 +75,9 @@ abstract class RestfulCMComponentFunction : AbstractScriptComponentFunction() {
                 for (managed_object_instance in managed_object_instances) {
                     // invoke createMOI for each managed-object-instance
                     log.info("invoke createMOI for each managed-object-instance")
-                    var NRM_Restful_client = RestfulNRMServiceClient()
-                    val MOI_id = NRM_Restful_client.generateMOIid()
-                    var httpresponse = NRM_Restful_client.createMOI(web_client_service, MOI_id, managed_object_instance)
+                    var Restful_client = RestfulServiceClient()
+                    val MOI_id = Restful_client.generateMOIid()
+                    var httpresponse = Restful_client.createMOI(web_client_service, MOI_id, managed_object_instance)
                     var MOIname = managed_object_instance.get("className").toString().replace("\"", "")
                     response.put("/$MOIname/$MOI_id", httpresponse)
                 }
@@ -86,9 +86,9 @@ abstract class RestfulCMComponentFunction : AbstractScriptComponentFunction() {
                 for (managed_object_instance in managed_object_instances) {
                     // invoke getMOIAttributes for each managed-object-instance
                     log.info("invoke getMOIAttributes for each managed-object-instance")
-                    var NRM_Restful_client = RestfulNRMServiceClient()
+                    var Restful_client = RestfulServiceClient()
                     val MOI_id = managed_object_instance.get("id").toString().replace("\"", "")
-                    var httpresponse = NRM_Restful_client.getMOIAttributes(web_client_service, MOI_id, managed_object_instance)
+                    var httpresponse = Restful_client.getMOIAttributes(web_client_service, MOI_id, managed_object_instance)
                     var MOIname = managed_object_instance.get("className").toString().replace("\"", "")
                     response.put("/$MOIname/$MOI_id", httpresponse)
                 }
@@ -97,9 +97,9 @@ abstract class RestfulCMComponentFunction : AbstractScriptComponentFunction() {
                 for (managed_object_instance in managed_object_instances) {
                     // invoke modifyMOIAttributes for each managed-object-instance
                     log.info("invoke modifyMOIAttributes for each managed-object-instance")
-                    var NRM_Restful_client = RestfulNRMServiceClient()
+                    var Restful_client = RestfulServiceClient()
                     val MOI_id = managed_object_instance.get("id").toString().replace("\"", "")
-                    var httpresponse = NRM_Restful_client.modifyMOIAttributes(web_client_service, MOI_id, managed_object_instance)
+                    var httpresponse = Restful_client.modifyMOIAttributes(web_client_service, MOI_id, managed_object_instance)
                     var MOIname = managed_object_instance.get("className").toString().replace("\"", "")
                     response.put("/$MOIname/$MOI_id", httpresponse)
                 }
@@ -108,9 +108,9 @@ abstract class RestfulCMComponentFunction : AbstractScriptComponentFunction() {
                 for (managed_object_instance in managed_object_instances) {
                     // invoke deleteMOI for each managed-object-instance
                     log.info("invoke deleteMOI for each managed-object-instance")
-                    var NRM_Restful_client = RestfulNRMServiceClient()
+                    var Restful_client = RestfulServiceClient()
                     val MOI_id = managed_object_instance.get("id").toString().replace("\"", "")
-                    var httpresponse = NRM_Restful_client.deleteMOI(web_client_service, MOI_id, managed_object_instance)
+                    var httpresponse = Restful_client.deleteMOI(web_client_service, MOI_id, managed_object_instance)
                     var MOIname = managed_object_instance.get("className").toString().replace("\"", "")
                     response.put("/$MOIname/$MOI_id", httpresponse)
                 }
@@ -120,7 +120,6 @@ abstract class RestfulCMComponentFunction : AbstractScriptComponentFunction() {
                 response.put(this.workflowName, "Not Implemented")
             }
         }
-        val strresponse = "$response"
-        return strresponse
+        return "$response"
     }
 }
@@ -14,7 +14,7 @@
  *  limitations under the License.
  */
 
-package org.onap.ccsdk.cds.blueprintsprocessor.functions.restful.executor.nrmfunction
+package org.onap.ccsdk.cds.blueprintsprocessor.functions.restful.executor.function
 
 import com.fasterxml.jackson.databind.JsonNode
 import com.fasterxml.jackson.databind.ObjectMapper
@@ -26,9 +26,9 @@ import org.springframework.http.HttpMethod
 import org.springframework.web.util.UriComponentsBuilder
 import java.util.UUID
 
-class RestfulNRMServiceClient() {
+class RestfulServiceClient() {
 
-    private val log = logger(RestfulNRMServiceClient::class.java)
+    private val log = logger(RestfulServiceClient::class.java)
 
     fun createMOI(web_client_service: BlueprintWebClientService, idStr: String, managed_object_instance: JsonNode): ObjectNode {
         val classNameStr = managed_object_instance.get("className").toString().replace("\"", "")
@@ -14,7 +14,7 @@
  *  limitations under the License.
  */
 
-package org.onap.ccsdk.cds.blueprintsprocessor.functions.restful.executor.nrmfunction
+package org.onap.ccsdk.cds.blueprintsprocessor.functions.restful.executor.function
 
 import com.fasterxml.jackson.databind.node.ObjectNode
 import org.junit.Ignore
@@ -55,22 +55,22 @@ import kotlin.test.assertNotNull
 )
 
 @Ignore
-class RestfulNRMServiceClientTest {
+class RestfulServiceClientTest {
 
     @Autowired
-    lateinit var restfulNRMServiceClient: RestfulNRMServiceClient
+    lateinit var restfulServiceClient: RestfulServiceClient
     lateinit var bluePrintRestLibPropertyService: BluePrintRestLibPropertyService
 
     @Test
     fun testCreateMOI() {
         val restClientService = bluePrintRestLibPropertyService.blueprintWebClientService("nrm")
-        val idStr = restfulNRMServiceClient.generateMOIid()
+        val idStr = restfulServiceClient.generateMOIid()
         var test_moi_data = JacksonUtils.jsonNode("{}") as ObjectNode
         test_moi_data.put("className", "TestMangedObjectInstance")
         var test_attributes_data = JacksonUtils.jsonNode("{}") as ObjectNode
         test_attributes_data.put("test_attribute_key", "test_attribute_value")
         test_moi_data.put("data", test_attributes_data)
-        val response = restfulNRMServiceClient.createMOI(restClientService, idStr, test_moi_data)
+        val response = restfulServiceClient.createMOI(restClientService, idStr, test_moi_data)
         assertNotNull(response, "failed to get createMOI response")
         assertEquals("Create MOI object successfully", response.get("body").get("data").toString(), "failed to get createMOI response")
     }
@@ -78,13 +78,13 @@ class RestfulNRMServiceClientTest {
     @Test
     fun testGetMOIAttributes() {
         val restClientService = bluePrintRestLibPropertyService.blueprintWebClientService("nrm")
-        val idStr = restfulNRMServiceClient.generateMOIid()
+        val idStr = restfulServiceClient.generateMOIid()
         var test_moi_data = JacksonUtils.jsonNode("{}") as ObjectNode
         test_moi_data.put("className", "TestMangedObjectInstance")
         test_moi_data.put("scope", "BASE_ONLY")
         test_moi_data.put("filter", "TestMangedObjectInstance")
         test_moi_data.put("fields", "test_attribute_key")
-        val response = restfulNRMServiceClient.getMOIAttributes(restClientService, idStr, test_moi_data)
+        val response = restfulServiceClient.getMOIAttributes(restClientService, idStr, test_moi_data)
         assertNotNull(response, "failed to get getMOIAttributes response")
         assertEquals("Get MOI object attributes successfully", response.get("body").get("data").toString(), "failed to get getMOIAttributes response")
     }
@@ -92,7 +92,7 @@ class RestfulNRMServiceClientTest {
     @Test
     fun testModifyMOIAttributes() {
         val restClientService = bluePrintRestLibPropertyService.blueprintWebClientService("nrm")
-        val idStr = restfulNRMServiceClient.generateMOIid()
+        val idStr = restfulServiceClient.generateMOIid()
         var test_moi_data = JacksonUtils.jsonNode("{}") as ObjectNode
         test_moi_data.put("className", "TestMangedObjectInstance")
         test_moi_data.put("scope", "BASE_ONLY")
@@ -100,7 +100,7 @@ class RestfulNRMServiceClientTest {
         var test_attributes_data = JacksonUtils.jsonNode("{}") as ObjectNode
         test_attributes_data.put("test_attribute_key", "modified_attribute_value")
         test_moi_data.put("data", test_attributes_data)
-        val response = restfulNRMServiceClient.modifyMOIAttributes(restClientService, idStr, test_moi_data)
+        val response = restfulServiceClient.modifyMOIAttributes(restClientService, idStr, test_moi_data)
         assertNotNull(response, "failed to get modifyMOIAttributes response")
         assertEquals(
             "Modify MOI object attributes successfully",
@@ -112,12 +112,12 @@ class RestfulNRMServiceClientTest {
     @Test
     fun testDeleteMOI() {
         val restClientService = bluePrintRestLibPropertyService.blueprintWebClientService("nrm")
-        val idStr = restfulNRMServiceClient.generateMOIid()
+        val idStr = restfulServiceClient.generateMOIid()
         var test_moi_data = JacksonUtils.jsonNode("{}") as ObjectNode
         test_moi_data.put("className", "TestMangedObjectInstance")
         test_moi_data.put("scope", "BASE_ONLY")
         test_moi_data.put("filter", "TestMangedObjectInstance")
-        val response = restfulNRMServiceClient.deleteMOI(restClientService, idStr, test_moi_data)
+        val response = restfulServiceClient.deleteMOI(restClientService, idStr, test_moi_data)
         assertNotNull(response, "failed to get delete response")
         assertEquals("Delete MOI object attributes successfully", response.get("body").get("data").toString(), "failed to get delete response")
     }