diff options
Diffstat (limited to 'ms/blueprintsprocessor/functions/restful-executor')
-rw-r--r-- | ms/blueprintsprocessor/functions/restful-executor/pom.xml | 4 | ||||
-rw-r--r-- | ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/RestfulCMComponentFunction.kt | 25 | ||||
-rw-r--r-- | ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/function/RestfulServiceClient.kt (renamed from ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/nrmfunction/RestfulNRMServiceClient.kt) | 6 | ||||
-rw-r--r-- | ms/blueprintsprocessor/functions/restful-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/restful/executor/function/RestfulServiceClientTest.kt (renamed from ms/blueprintsprocessor/functions/restful-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/restful/executor/nrmfunction/RestfulNRMServiceClientTest.kt) | 22 |
4 files changed, 28 insertions, 29 deletions
diff --git a/ms/blueprintsprocessor/functions/restful-executor/pom.xml b/ms/blueprintsprocessor/functions/restful-executor/pom.xml index a522f5804..42915e4cb 100644 --- a/ms/blueprintsprocessor/functions/restful-executor/pom.xml +++ b/ms/blueprintsprocessor/functions/restful-executor/pom.xml @@ -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> diff --git a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/RestfulCMComponentFunction.kt b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/RestfulCMComponentFunction.kt index 9cd6f57a4..6b5af807e 100644 --- a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/RestfulCMComponentFunction.kt +++ b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/RestfulCMComponentFunction.kt @@ -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" } } diff --git a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/nrmfunction/RestfulNRMServiceClient.kt b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/function/RestfulServiceClient.kt index 259670d47..8b3fd2a5f 100644 --- a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/nrmfunction/RestfulNRMServiceClient.kt +++ b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/function/RestfulServiceClient.kt @@ -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("\"", "") diff --git a/ms/blueprintsprocessor/functions/restful-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/restful/executor/nrmfunction/RestfulNRMServiceClientTest.kt b/ms/blueprintsprocessor/functions/restful-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/restful/executor/function/RestfulServiceClientTest.kt index 6f76c9b40..e450d1150 100644 --- a/ms/blueprintsprocessor/functions/restful-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/restful/executor/nrmfunction/RestfulNRMServiceClientTest.kt +++ b/ms/blueprintsprocessor/functions/restful-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/restful/executor/function/RestfulServiceClientTest.kt @@ -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") } |