summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/services/execution-service/src
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/modules/services/execution-service/src')
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionService.kt46
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionServiceTest.java70
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/inputs/input.json18
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/requests/sample-execution-request.json20
4 files changed, 154 insertions, 0 deletions
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionService.kt
new file mode 100644
index 000000000..75b26bb55
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionService.kt
@@ -0,0 +1,46 @@
+/*
+ * 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.services.execution
+
+
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
+import org.springframework.stereotype.Service
+import com.fasterxml.jackson.databind.node.ObjectNode
+
+/**
+ * ExecutionService
+ * @author Brinda Santh
+ * 8/14/2018
+ */
+@Service
+class ExecutionService {
+
+ fun process(executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {
+ val executionServiceOutput = ExecutionServiceOutput()
+ executionServiceOutput.actionIdentifiers = executionServiceInput.actionIdentifiers
+ executionServiceOutput.commonHeader = executionServiceInput.commonHeader
+ executionServiceOutput.payload = JacksonUtils.jsonNode("{}") as ObjectNode
+ val status = Status()
+ status.code = 200
+ status.message = "Success"
+ executionServiceOutput.status = status
+ return executionServiceOutput
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionServiceTest.java b/ms/blueprintsprocessor/modules/services/execution-service/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionServiceTest.java
new file mode 100644
index 000000000..0df95d2d3
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionServiceTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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.services.execution;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.apache.commons.io.FileUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput;
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput;
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.io.File;
+import java.nio.charset.Charset;
+
+
+/**
+ * ExecutionServiceTest
+ *
+ * @author Brinda Santh
+ * DATE : 8/15/2018
+ */
+@RunWith(SpringRunner.class)
+@ContextConfiguration(classes = ExecutionService.class)
+public class ExecutionServiceTest {
+ private static Logger log = LoggerFactory.getLogger(ExecutionServiceTest.class);
+
+ @Autowired
+ private ExecutionService executionService;
+
+ @Test
+ public void testExecutionService() throws Exception {
+
+ Assert.assertNotNull("failed to create ResourceResolutionService", executionService);
+
+ String resourceResolutionInputContent = FileUtils.readFileToString(
+ new File("src/test/resources/payload/requests/sample-execution-request.json"), Charset.defaultCharset());
+
+ ExecutionServiceInput executionServiceInput = JacksonUtils.readValue(resourceResolutionInputContent, ExecutionServiceInput.class );
+ Assert.assertNotNull("failed to populate executionServiceInput request ",executionServiceInput);
+
+ ObjectNode inputContent = (ObjectNode)JacksonUtils.jsonNodeFromFile("src/test/resources/payload/inputs/input.json");
+ Assert.assertNotNull("failed to populate input payload ",inputContent);
+ executionServiceInput.setPayload(inputContent);
+
+ ExecutionServiceOutput executionServiceOutput = executionService.process(executionServiceInput);
+ Assert.assertNotNull("failed to populate output",executionServiceOutput);
+
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/inputs/input.json b/ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/inputs/input.json
new file mode 100644
index 000000000..cd6fac128
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/inputs/input.json
@@ -0,0 +1,18 @@
+{
+ "api-ver": "2.00",
+ "originator-id": "MSO",
+ "request-id": "123456",
+ "service-instance-id": "ibcx0001vm001",
+ "service-type": "AVPN",
+ "vnf-type": "vUSP - vDBE-IPX HUB",
+ "vnf-id": 123456,
+ "service-template-name": "VRR-baseconfiguration",
+ "service-template-version": "1.0.0",
+ "action-name": "resource-assignment-action",
+ "group-name": "sample group name",
+ "bundle-id": "sample bundle id",
+ "bundle-mac": [
+ "Sample bundle mac",
+ "Sample bundle mac"
+ ]
+}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/requests/sample-execution-request.json b/ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/requests/sample-execution-request.json
new file mode 100644
index 000000000..b28ac5a29
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/resources/payload/requests/sample-execution-request.json
@@ -0,0 +1,20 @@
+{
+ "actionIdentifiers": {
+ "actionName": "sample-action",
+ "blueprintName": "sample-blurprint",
+ "blueprintVersion": "1.0.0",
+ "mode": "sync"
+ },
+ "commonHeader": {
+ "flags": {
+ "force": true,
+ "ttl": 3600
+ },
+ "originatorId": "sdnc",
+ "requestId": "123456-1000",
+ "subRequestId": "sub-123456-1000",
+ "timestamp": "2012-04-23T18:25:43.511Z"
+ },
+ "payload": {
+ }
+}