diff options
author | Dan Timoney <dtimoney@att.com> | 2020-09-22 19:05:47 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-09-22 19:05:47 +0000 |
commit | e515a85125e5487ecd3f7127b6af0b192d4a0993 (patch) | |
tree | 1fe08a7d54c28419a44845634037d77f8c434a4b /ms/blueprintsprocessor/functions/restful-executor | |
parent | 85d8f7f7701570fb745c3d6360d500f97bdf1b25 (diff) | |
parent | 1072867dfac0df993cbd3e44bcc11a5cac7465fd (diff) |
Merge "Enabling Code Formatter"
Diffstat (limited to 'ms/blueprintsprocessor/functions/restful-executor')
4 files changed, 44 insertions, 35 deletions
diff --git a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt index e1643b576..a8e02f391 100644 --- a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt +++ b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt @@ -32,6 +32,7 @@ open class ComponentRestfulExecutor(private var componentFunctionScriptingServic lateinit var scriptComponent: RestfulCMComponentFunction companion object { + const val SCRIPT_TYPE = "script-type" const val SCRIPT_CLASS_REFERENCE = "script-class-reference" const val INSTANCE_DEPENDENCIES = "instance-dependencies" @@ -53,8 +54,10 @@ open class ComponentRestfulExecutor(private var componentFunctionScriptingServic * Populate the Script Instance based on the Type */ scriptComponent = componentFunctionScriptingService - .scriptInstance<RestfulCMComponentFunction>(this, scriptType, - scriptClassReference, scriptDependencies) + .scriptInstance<RestfulCMComponentFunction>( + this, scriptType, + scriptClassReference, scriptDependencies + ) checkNotNull(scriptComponent) { "failed to get restfulCM script component" } @@ -64,6 +67,6 @@ open class ComponentRestfulExecutor(private var componentFunctionScriptingServic override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { bluePrintRuntimeService.getBluePrintError() - .addError("Failed in ComponentRestfulExecutor : ${runtimeException.message}") + .addError("Failed in ComponentRestfulExecutor : ${runtimeException.message}") } } 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 46fec3126..9cd6f57a4 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 @@ -15,18 +15,18 @@ */ package org.onap.ccsdk.cds.blueprintsprocessor.functions.restful.executor -import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput -import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction -import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.ObjectMapper -import com.fasterxml.jackson.databind.node.ObjectNode import com.fasterxml.jackson.databind.node.ArrayNode -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils +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.rest.RestLibConstants import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService -import org.onap.ccsdk.cds.blueprintsprocessor.functions.restful.executor.nrmfunction.RestfulNRMServiceClient +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractScriptComponentFunction +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException +import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.slf4j.LoggerFactory abstract class RestfulCMComponentFunction : AbstractScriptComponentFunction() { @@ -41,7 +41,7 @@ abstract class RestfulCMComponentFunction : AbstractScriptComponentFunction() { } open fun bluePrintRestLibPropertyService(): BluePrintRestLibPropertyService = - functionDependencyInstanceAsType(RestLibConstants.SERVICE_BLUEPRINT_REST_LIB_PROPERTY) + functionDependencyInstanceAsType(RestLibConstants.SERVICE_BLUEPRINT_REST_LIB_PROPERTY) fun restClientService(clientInfo: JsonNode): BlueprintWebClientService { return bluePrintRestLibPropertyService().blueprintWebClientService(clientInfo) @@ -105,7 +105,7 @@ abstract class RestfulCMComponentFunction : AbstractScriptComponentFunction() { } } "config-delete" -> { - for (managed_object_instance in managed_object_instances) { + 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() 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/nrmfunction/RestfulNRMServiceClient.kt index 31ad377c9..259670d47 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/nrmfunction/RestfulNRMServiceClient.kt @@ -19,12 +19,12 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.restful.executor.nrmfun import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.node.ObjectNode -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService -import org.springframework.http.HttpMethod import org.onap.ccsdk.cds.controllerblueprints.core.logger -import java.util.UUID +import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils +import org.springframework.http.HttpMethod import org.springframework.web.util.UriComponentsBuilder +import java.util.UUID class RestfulNRMServiceClient() { 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/nrmfunction/RestfulNRMServiceClientTest.kt index e7f04a5d4..6f76c9b40 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/nrmfunction/RestfulNRMServiceClientTest.kt @@ -17,40 +17,42 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.restful.executor.nrmfunction import com.fasterxml.jackson.databind.node.ObjectNode -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils -import org.junit.Test import org.junit.Ignore -import org.springframework.beans.factory.annotation.Autowired +import org.junit.Test import org.junit.runner.RunWith -import org.springframework.test.context.junit4.SpringRunner +import org.onap.ccsdk.cds.blueprintsprocessor.rest.BluePrintRestLibConfiguration +import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService +import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils +import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.autoconfigure.EnableAutoConfiguration import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration import org.springframework.boot.test.context.SpringBootTest +import org.springframework.http.HttpStatus +import org.springframework.http.ResponseEntity import org.springframework.test.context.ContextConfiguration -import org.onap.ccsdk.cds.blueprintsprocessor.rest.BluePrintRestLibConfiguration import org.springframework.test.context.TestPropertySource -import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService -import kotlin.test.assertNotNull -import kotlin.test.assertEquals -import org.springframework.web.bind.annotation.RestController -import org.springframework.web.bind.annotation.RequestMapping -import org.springframework.web.bind.annotation.PutMapping +import org.springframework.test.context.junit4.SpringRunner +import org.springframework.web.bind.annotation.DeleteMapping import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.PatchMapping -import org.springframework.web.bind.annotation.DeleteMapping -import org.springframework.http.ResponseEntity -import org.springframework.http.HttpStatus +import org.springframework.web.bind.annotation.PutMapping +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController +import kotlin.test.assertEquals +import kotlin.test.assertNotNull @RunWith(SpringRunner::class) @EnableAutoConfiguration(exclude = [DataSourceAutoConfiguration::class]) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) @ContextConfiguration(classes = [BluePrintRestLibConfiguration::class, NrmTestController::class]) -@TestPropertySource(properties = [ - "blueprintsprocessor.restclient.nrm.type=basic-auth", - "blueprintsprocessor.restclient.nrm.url=http://127.0.0.1:8080", - "blueprintsprocessor.restclient.nrm.username=admin", - "blueprintsprocessor.restclient.nrm.password=admin" -]) +@TestPropertySource( + properties = [ + "blueprintsprocessor.restclient.nrm.type=basic-auth", + "blueprintsprocessor.restclient.nrm.url=http://127.0.0.1:8080", + "blueprintsprocessor.restclient.nrm.username=admin", + "blueprintsprocessor.restclient.nrm.password=admin" + ] +) @Ignore class RestfulNRMServiceClientTest { @@ -100,7 +102,11 @@ class RestfulNRMServiceClientTest { test_moi_data.put("data", test_attributes_data) val response = restfulNRMServiceClient.modifyMOIAttributes(restClientService, idStr, test_moi_data) assertNotNull(response, "failed to get modifyMOIAttributes response") - assertEquals("Modify MOI object attributes successfully", response.get("body").get("data").toString(), "failed to get modifyMOIAttributes response") + assertEquals( + "Modify MOI object attributes successfully", + response.get("body").get("data").toString(), + "failed to get modifyMOIAttributes response" + ) } @Test |