aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/inbounds
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/modules/inbounds')
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.java49
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt48
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt8
4 files changed, 57 insertions, 54 deletions
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.java b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.java
deleted file mode 100644
index 3b5dfabe..00000000
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * 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.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api;
-
-import io.swagger.annotations.ApiOperation;
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput;
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.*;
-import reactor.core.publisher.Mono;
-
-/**
- * ExecutionServiceController
- *
- * @author Brinda Santh 8/14/2018
- */
-@RestController
-@RequestMapping("/api/v1/execution-service")
-public class ExecutionServiceController {
-
-
- @RequestMapping(path = "/ping", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- Mono<String> ping() {
- return Mono.just("Success");
- }
-
- @RequestMapping(path = "/process", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
- @ApiOperation(value = "Resolve Resource Mappings",
- notes = "Takes the blueprint information and process as per the payload")
- public @ResponseBody
- Mono<ExecutionServiceOutput> process(@RequestBody ExecutionServiceInput executionServiceInput) {
- return Mono.just(new ExecutionServiceOutput());
- }
-}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt
index 2a5983d0..0668d3c9 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandler.kt
@@ -26,15 +26,15 @@ import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
@Service
-class BluePrintProcessingGRPCHandler(private val bluePrintCoreConfiguration: BluePrintCoreConfiguration)
+class BluePrintProcessingGRPCHandler(private val bluePrintCoreConfiguration: BluePrintCoreConfiguration,
+ private val executionServiceHandler: ExecutionServiceHandler)
: BluePrintProcessingServiceGrpc.BluePrintProcessingServiceImplBase() {
private val log = LoggerFactory.getLogger(BluePrintProcessingGRPCHandler::class.java)
override fun process(request: ExecutionServiceInput,
responseObserver: StreamObserver<ExecutionServiceOutput>) {
- val json = JsonFormat.printer().print(request)
-
+ //val json = JsonFormat.printer().print(request)
//log.info("Received GRPC request ${json}")
//TODO( Handle Processing Response")
val response = ExecutionServiceOutput.newBuilder().setCommonHeader(request.commonHeader).build()
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt
new file mode 100644
index 00000000..0a67e878
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt
@@ -0,0 +1,48 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * 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.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api
+
+import io.swagger.annotations.ApiOperation
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.http.MediaType
+import org.springframework.web.bind.annotation.*
+import reactor.core.publisher.Mono
+
+@RestController
+@RequestMapping("/api/v1/execution-service")
+class ExecutionServiceController {
+
+ @Autowired
+ lateinit var executionServiceHandler: ExecutionServiceHandler
+
+
+ @RequestMapping(path = arrayOf("/ping"), method = arrayOf(RequestMethod.GET), produces = arrayOf(MediaType.APPLICATION_JSON_VALUE))
+ @ResponseBody
+ fun ping(): Mono<String> {
+ return Mono.just("Success")
+ }
+
+ @RequestMapping(path = arrayOf("/process"), method = arrayOf(RequestMethod.POST), produces = arrayOf(MediaType.APPLICATION_JSON_VALUE))
+ @ApiOperation(value = "Resolve Resource Mappings", notes = "Takes the blueprint information and process as per the payload")
+ @ResponseBody
+ fun process(@RequestBody executionServiceInput: ExecutionServiceInput): Mono<ExecutionServiceOutput> {
+ val executionServiceOutput = executionServiceHandler.process(executionServiceInput)
+ return Mono.just(executionServiceOutput)
+ }
+}
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
index 6d5d633c..cd871b4a 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintProcessingGRPCHandlerTest.kt
@@ -23,9 +23,11 @@ import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintCoreConfiguration
+import org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.mock.MockBluePrintCatalogService
+import org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.mock.MockBlueprintDGExecutionService
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.apps.controllerblueprints.processing.api.CommonHeader
import org.onap.ccsdk.apps.controllerblueprints.processing.api.BluePrintProcessingServiceGrpc
+import org.onap.ccsdk.apps.controllerblueprints.processing.api.CommonHeader
import org.onap.ccsdk.apps.controllerblueprints.processing.api.ExecutionServiceInput
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
@@ -36,7 +38,9 @@ import kotlin.test.BeforeTest
import kotlin.test.assertNotNull
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [BluePrintProcessingGRPCHandler::class, BluePrintCoreConfiguration::class])
+@ContextConfiguration(classes = [BluePrintProcessingGRPCHandler::class, ExecutionServiceHandler::class,
+ MockBlueprintDGExecutionService::class, MockBluePrintCatalogService::class,
+ BluePrintCoreConfiguration::class])
@TestPropertySource(locations = ["classpath:application-test.properties"])
class BluePrintProcessingGRPCHandlerTest {