Controller Blueprints Microservice
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Tue, 21 Aug 2018 04:11:57 +0000 (04:11 +0000)
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Tue, 21 Aug 2018 04:11:57 +0000 (04:11 +0000)
Define Controllerblueprint API DataType and Error definitions for Config model, Service Template, Model Type and Resource Dictionary Services

Change-Id: I12d8d87292ec101601b0cfb7ba9670730973e318
Issue-ID: CCSDK-469
Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
44 files changed:
ms/controllerblueprints/README.md
ms/controllerblueprints/application/load/model_type/artifact_type/artifact-bpmn-camunda.json [new file with mode: 0644]
ms/controllerblueprints/application/load/model_type/artifact_type/artifact-directed-graph.json [new file with mode: 0644]
ms/controllerblueprints/application/opt/app/onap/config/application.properties
ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationExceptionHandler.java [new file with mode: 0644]
ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/CorsConfig.java
ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java
ms/controllerblueprints/application/src/test/resources/application.properties
ms/controllerblueprints/application/src/test/resources/logback.xml
ms/controllerblueprints/modules/core/load/model_type/artifact_type/artifact-bpmn-camunda.json [new file with mode: 0644]
ms/controllerblueprints/modules/core/load/model_type/artifact_type/artifact-directed-graph.json [new file with mode: 0644]
ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/ConfigModelConstant.kt
ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt
ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt
ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/db-source.json [new file with mode: 0644]
ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/default-source.json [new file with mode: 0644]
ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/input-source.json [moved from ms/controllerblueprints/modules/service/load/resource_dictionary/action-name.json with 83% similarity]
ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json [new file with mode: 0644]
ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceAssignment.java
ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.java [new file with mode: 0644]
ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/DictionaryDefinition.java
ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/ResourceSource.java [new file with mode: 0644]
ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDb.java
ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDefault.java
ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDeserializer.java [new file with mode: 0644]
ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceInput.java
ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceMdsal.java
ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/utils/ResourceDictionaryUtils.java
ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/DictionaryDefinitionTest.java [new file with mode: 0644]
ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/ResourceDictionaryUtilsTest.java
ms/controllerblueprints/modules/service/load/resource_dictionary/db-source.json [moved from ms/controllerblueprints/modules/service/load/resource_dictionary/bundle-id.json with 58% similarity]
ms/controllerblueprints/modules/service/load/resource_dictionary/input-source.json [new file with mode: 0644]
ms/controllerblueprints/modules/service/load/resource_dictionary/v4-ip-type.json
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ApplicationRegistrationService.java [new file with mode: 0644]
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ErrorMessage.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModel.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelContent.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java
ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java
ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java

index e69de29..070a541 100755 (executable)
@@ -0,0 +1,9 @@
+Application VM Arguments :\r
+\r
+-Dlogging.config=etc/logback.xml\r
+-Dspring.config.location=opt/app/onap/config/\r
+-Dspring.datasource.url=jdbc:mysql://127.0.0.1:3306/sdnctl\r
+-Dspring.datasource.username=sdnctl\r
+-Dspring.datasource.password=sdnctl\r
+-Dblueprints.load.initial-data=true\r
+\r
diff --git a/ms/controllerblueprints/application/load/model_type/artifact_type/artifact-bpmn-camunda.json b/ms/controllerblueprints/application/load/model_type/artifact_type/artifact-bpmn-camunda.json
new file mode 100644 (file)
index 0000000..ac76b4f
--- /dev/null
@@ -0,0 +1,8 @@
+{\r
+  "description": " Camunda BPM File",\r
+  "version": "1.0.0",\r
+  "file_ext": [\r
+    "bpmn"\r
+  ],\r
+  "derived_from": "tosca.artifacts.Implementation"\r
+}
\ No newline at end of file
diff --git a/ms/controllerblueprints/application/load/model_type/artifact_type/artifact-directed-graph.json b/ms/controllerblueprints/application/load/model_type/artifact_type/artifact-directed-graph.json
new file mode 100644 (file)
index 0000000..7ab3a54
--- /dev/null
@@ -0,0 +1,9 @@
+{\r
+  "description": "Directed Graph File",\r
+  "version": "1.0.0",\r
+  "file_ext": [\r
+    "json",\r
+    "xml"\r
+  ],\r
+  "derived_from": "tosca.artifacts.Implementation"\r
+}
\ No newline at end of file
index 9fa8e04..f075b57 100644 (file)
@@ -20,6 +20,9 @@ logging.level.org.springframework.web=INFO
 logging.level.org.hibernate.SQL=warn
 logging.level.org.hibernate.type.descriptor.sql=debug
 
+#To Remove Null in JSON API Response
+spring.jackson.default-property-inclusion=non_null
+
 spring.jpa.properties.hibernate.show_sql=true
 spring.jpa.properties.hibernate.use_sql_comments=true
 spring.jpa.properties.hibernate.format_sql=true
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationExceptionHandler.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationExceptionHandler.java
new file mode 100644 (file)
index 0000000..d02be5c
--- /dev/null
@@ -0,0 +1,42 @@
+/*\r
+ *  Copyright © 2017-2018 AT&T Intellectual Property.\r
+ *\r
+ *  Licensed under the Apache License, Version 2.0 (the "License");\r
+ *  you may not use this file except in compliance with the License.\r
+ *  You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *  Unless required by applicable law or agreed to in writing, software\r
+ *  distributed under the License is distributed on an "AS IS" BASIS,\r
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *  See the License for the specific language governing permissions and\r
+ *  limitations under the License.\r
+ */\r
+\r
+package org.onap.ccsdk.apps.controllerblueprints;\r
+\r
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
+import org.onap.ccsdk.apps.controllerblueprints.service.common.ErrorMessage;\r
+import org.springframework.http.HttpStatus;\r
+import org.springframework.http.ResponseEntity;\r
+import org.springframework.web.bind.annotation.ControllerAdvice;\r
+import org.springframework.web.bind.annotation.ExceptionHandler;\r
+import org.springframework.web.bind.annotation.RestController;\r
+import org.springframework.web.context.request.WebRequest;\r
+\r
+@ControllerAdvice\r
+@RestController\r
+public class ApplicationExceptionHandler {\r
+    @ExceptionHandler(Exception.class)\r
+    public final ResponseEntity<ErrorMessage> handleAllExceptions(Exception ex, WebRequest request) {\r
+        ErrorMessage exceptionResponse = new ErrorMessage( ex.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR.value(), ex.getLocalizedMessage());\r
+        return new ResponseEntity<>(exceptionResponse, HttpStatus.INTERNAL_SERVER_ERROR);\r
+    }\r
+\r
+    @ExceptionHandler(BluePrintException.class)\r
+    public final ResponseEntity<ErrorMessage> handleBlueprintException(BluePrintException ex, WebRequest request) {\r
+        ErrorMessage exceptionResponse = new ErrorMessage( ex.getMessage(), ex.getCode(), ex.getLocalizedMessage());\r
+        return new ResponseEntity<>(exceptionResponse, HttpStatus.INTERNAL_SERVER_ERROR);\r
+    }\r
+}\r
index 5d682ed..d00d2c8 100644 (file)
@@ -20,8 +20,9 @@ package org.onap.ccsdk.apps.controllerblueprints;
 import org.springframework.context.annotation.Bean;\r
 import org.springframework.context.annotation.Configuration;\r
 import org.springframework.web.cors.CorsConfiguration;\r
-import org.springframework.web.cors.UrlBasedCorsConfigurationSource;\r
-import org.springframework.web.filter.CorsFilter;\r
+import org.springframework.web.cors.reactive.CorsWebFilter;\r
+import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource;\r
+import java.util.Arrays;\r
 \r
 /**\r
  * CorsConfig.java Purpose: Provide Configuration Generator CorsConfig Information\r
@@ -29,7 +30,7 @@ import org.springframework.web.filter.CorsFilter;
  * @author Brinda Santh\r
  * @version 1.0\r
  */\r
-//@Configuration\r
+@Configuration\r
 public class CorsConfig {\r
     /**\r
      * This is a CORS Implementation for different Orgin GUI to access.\r
@@ -37,15 +38,17 @@ public class CorsConfig {
      * @return CorsFilter\r
      */\r
     @Bean\r
-    public CorsFilter corsFilter() {\r
-        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();\r
-        CorsConfiguration config = new CorsConfiguration();\r
-        config.setAllowCredentials(true);\r
-        config.addAllowedOrigin("*");\r
-        config.addAllowedHeader("*");\r
-        config.addAllowedMethod("*");\r
-        source.registerCorsConfiguration("/**", config);\r
-        return new CorsFilter(source);\r
+    CorsWebFilter corsWebFilter() {\r
+        CorsConfiguration corsConfig = new CorsConfiguration();\r
+        corsConfig.setAllowedOrigins(Arrays.asList("*"));\r
+        corsConfig.setMaxAge(8000L);\r
+        corsConfig.addAllowedMethod("*");\r
+\r
+        UrlBasedCorsConfigurationSource source =\r
+                new UrlBasedCorsConfigurationSource();\r
+        source.registerCorsConfiguration("/**", corsConfig);\r
+\r
+        return new CorsWebFilter(source);\r
     }\r
 \r
 \r
index 95639bd..26b943b 100644 (file)
 \r
 package org.onap.ccsdk.apps.controllerblueprints;\r
 \r
+import org.junit.Assert;\r
 import org.junit.Before;\r
 import org.junit.Test;\r
 import org.junit.runner.RunWith;\r
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;\r
 import org.slf4j.Logger;\r
 import org.slf4j.LoggerFactory;\r
 import org.springframework.beans.factory.annotation.Autowired;\r
 import org.springframework.boot.test.context.SpringBootTest;\r
 import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;\r
 import org.springframework.boot.test.web.client.TestRestTemplate;\r
-import org.springframework.http.HttpStatus;\r
-import org.springframework.http.ResponseEntity;\r
+import org.springframework.http.*;\r
 import org.springframework.test.context.junit4.SpringRunner;\r
 \r
 import static org.assertj.core.api.Assertions.assertThat;\r
@@ -46,8 +47,21 @@ public class ControllerBluprintsApplicationTest {
 \r
     @Test\r
     public void testConfigModel() {\r
-        ResponseEntity<String> entity = this.restTemplate\r
-                .getForEntity("/api/v1/config-model/1", String.class);\r
+        HttpHeaders headers = new HttpHeaders();\r
+        headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);\r
+        ResponseEntity<ConfigModel> entity = this.restTemplate\r
+                .exchange("/api/v1/config-model/1", HttpMethod.GET, new HttpEntity<>(headers),ConfigModel.class);\r
         assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);\r
+        Assert.assertNotNull("failed to get response Config model",entity.getBody());\r
+    }\r
+\r
+    @Test\r
+    public void testConfigModelFailure() {\r
+        HttpHeaders headers = new HttpHeaders();\r
+        headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);\r
+        ResponseEntity<ConfigModel> entity = this.restTemplate\r
+                .exchange("/api/v1/config-model-not-found/1", HttpMethod.GET, new HttpEntity<>(headers),ConfigModel.class);\r
+        assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);\r
+        Assert.assertNotNull("failed to get response Config model",entity.getBody());\r
     }\r
 }\r
index 55ffeaf..a147034 100644 (file)
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and\r
 # limitations under the License.\r
 #\r
-\r
+spring.jackson.default-property-inclusion=non_null\r
 #Load Blueprints\r
 # blueprints.load.initial-data may be overridden by ENV variables\r
 blueprints.load.initial-data=true\r
index b9b97dc..53388bc 100644 (file)
@@ -24,8 +24,7 @@
     </appender>\r
 \r
 \r
-    <logger name="org.springframework" level="info"/>\r
-    <logger name="org.springframework.web" level="debug"/>\r
+    <logger name="org.springframework" level="warn"/>\r
     <logger name="org.hibernate" level="info"/>\r
     <logger name="org.onap.ccsdk.apps.controllerblueprints" level="info"/>\r
 \r
diff --git a/ms/controllerblueprints/modules/core/load/model_type/artifact_type/artifact-bpmn-camunda.json b/ms/controllerblueprints/modules/core/load/model_type/artifact_type/artifact-bpmn-camunda.json
new file mode 100644 (file)
index 0000000..ac76b4f
--- /dev/null
@@ -0,0 +1,8 @@
+{\r
+  "description": " Camunda BPM File",\r
+  "version": "1.0.0",\r
+  "file_ext": [\r
+    "bpmn"\r
+  ],\r
+  "derived_from": "tosca.artifacts.Implementation"\r
+}
\ No newline at end of file
diff --git a/ms/controllerblueprints/modules/core/load/model_type/artifact_type/artifact-directed-graph.json b/ms/controllerblueprints/modules/core/load/model_type/artifact_type/artifact-directed-graph.json
new file mode 100644 (file)
index 0000000..7ab3a54
--- /dev/null
@@ -0,0 +1,9 @@
+{\r
+  "description": "Directed Graph File",\r
+  "version": "1.0.0",\r
+  "file_ext": [\r
+    "json",\r
+    "xml"\r
+  ],\r
+  "derived_from": "tosca.artifacts.Implementation"\r
+}
\ No newline at end of file
index bb5a78f..9782691 100644 (file)
@@ -42,11 +42,6 @@ object ConfigModelConstant {
 \r
     const val CAPABILITY_PROPERTY_MAPPING = "mapping"\r
 \r
-    const val SOURCE_INPUT = "input"\r
-    const val SOURCE_DEFAULT = "default"\r
-    const val SOURCE_MDSAL = "mdsal"\r
-    const val SOURCE_DB = "db"\r
-\r
     const val PROPERTY_RECIPE_NAMES = "action-names"\r
 \r
 }\r
index 6d677ff..a10f6d3 100644 (file)
@@ -155,7 +155,7 @@ class PropertyDefinition {
     var id: String? = null\r
     var description: String? = null\r
     var required: Boolean? = null\r
-    var type: String? = null\r
+    lateinit var type: String\r
     @get:JsonProperty("default")\r
     var defaultValue: Any? = null\r
     var status: String? = null\r
@@ -202,7 +202,7 @@ class OperationDefinition {
 }\r
 \r
 class Implementation {\r
-    var primary: String? = null\r
+    lateinit var primary: String\r
     var dependencies: MutableList<String>? = null\r
 }\r
 \r
@@ -240,6 +240,11 @@ class TriggerDefinition {
     var description: String? = null\r
     @get:JsonProperty("event_type")\r
     lateinit var eventType: String\r
+    @get:JsonProperty("target_filter")\r
+    var targetFilter: EventFilterDefinition? = null\r
+    var condition: ConditionClause? = null\r
+    var constraint: ConditionClause? = null\r
+    var method: String? = null\r
     lateinit var action: String\r
 }\r
 \r
index 95b2af7..9621382 100644 (file)
@@ -49,6 +49,13 @@ object JacksonUtils {
         return jacksonObjectMapper().readValue(content, valueType)\r
     }\r
 \r
+    @JvmStatic\r
+    fun <T> readValueFromFile(fileName: String, valueType: Class<T>): T? {\r
+        val content: String = FileUtils.readFileToString(File(fileName), Charset.defaultCharset())\r
+                ?: throw BluePrintException(format("Failed to read json file : {}", fileName))\r
+        return readValue(content, valueType)\r
+    }\r
+\r
     @JvmStatic\r
     fun jsonNodeFromObject(from: kotlin.Any): JsonNode = jacksonObjectMapper().convertValue(from, JsonNode::class.java)\r
 \r
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/db-source.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/db-source.json
new file mode 100644 (file)
index 0000000..8b97cde
--- /dev/null
@@ -0,0 +1,31 @@
+{\r
+  "name": "bundle-id",\r
+  "description": "name of the ",\r
+  "resource-type": "ONAP",\r
+  "resource-path": "vnf/bundle-id",\r
+  "updated-by": "brindasanth@onap.com",\r
+  "data-type": "String",\r
+  "tags": "bundle-id, brindasanth@onap.com",\r
+  "source": {\r
+    "db": {\r
+      "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name",\r
+      "input-key-mapping": {\r
+        "profile_name": "profile_name"\r
+      },\r
+      "output-key-mapping": {\r
+        "db-country": "country",\r
+        "db-state": "state"\r
+      }\r
+    }\r
+  },\r
+  "decryption-rules": [\r
+    {\r
+      "sources": [\r
+        "input"\r
+      ],\r
+      "path": "/.",\r
+      "rule": "LOCAL-Decrypt",\r
+      "decrypt-type": "AES128"\r
+    }\r
+  ]\r
+}
\ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/default-source.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/default-source.json
new file mode 100644 (file)
index 0000000..ac23292
--- /dev/null
@@ -0,0 +1,14 @@
+{\r
+       "tags": "v4-ip-type, tosca.datatypes.Root, data_type, brindasanth@onap.com",\r
+       "name": "v4-ip-type",\r
+       "description": "To be provided",\r
+       "updated-by": "brindasanth@onap.com",\r
+       "resource-type": "ONAP",\r
+       "resource-path": "vnf/v4-ip-type",\r
+       "data-type": "string",\r
+       "source": {\r
+               "default": {\r
+                       \r
+               }\r
+       }\r
+}
\ No newline at end of file
@@ -5,7 +5,7 @@
        "description": "To be provided",\r
        "valid-values": null,\r
        "sample-value": null,\r
-       "updated-by": "ym9479@onap.com",\r
+       "updated-by": "brindasanth@onap.com",\r
        "tags": null,\r
        "default": null,\r
        "data-type": "string",\r
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/mdsal-source.json
new file mode 100644 (file)
index 0000000..c103f94
--- /dev/null
@@ -0,0 +1,36 @@
+{\r
+  "tags": "oam-local-ipv4-address, tosca.datatypes.Root, data_type, st1848@att.com",\r
+  "name": "oam-local-ipv4-address",\r
+  "description": "based on service-instance-id,network-role,v4-ip-type and vm-type get the ipv4-gateway-prefix from the SDN-GC mdsal",\r
+  "updated-by": "st1848@att.com",\r
+  "resource-type": "ATT",\r
+  "resource-path": "vnf/oam-local-ipv4-address",\r
+  "data-type": "string",\r
+  "source": {\r
+    "mdsal": {\r
+      "base": "sdnc-gc",\r
+      "type": "JSON",\r
+      "url-path": "config/L3VNF-API:services/service-list/$service-instance-id/service-data/vnf-topology-information/vnf-assignments/vnf-vms/$vm-type/vm-networks/$network-role/v4-assigned-ip-list/$v4-ip-type",\r
+      "path": "/v4-assigned-ip-list/0/v4-ip-prefix",\r
+      "input-key-mapping": {\r
+        "service-instance-id": "service-instance-id",\r
+        "network-role": "network-role",\r
+        "v4-ip-type": "v4-ip-type",\r
+        "vm-type": "vm-type"\r
+      },\r
+      "output-key-mapping": {\r
+        "oam-local-ipv4-address": "v4-ip-prefix"\r
+      }\r
+    }\r
+  },\r
+  "candidate-dependency": {\r
+    "mdsal": {\r
+      "names": [\r
+        "service-instance-id",\r
+        "network-role",\r
+        "v4-ip-type",\r
+        "vm-type"\r
+      ]\r
+    }\r
+  }\r
+}
\ No newline at end of file
index 15576b9..f85e5eb 100644 (file)
@@ -30,10 +30,10 @@ import java.util.List;
  * @version 1.0\r
  */\r
 public class ResourceAssignment {\r
-\r
+    @JsonProperty(value = "name", required = true)\r
     private String name;\r
 \r
-    @JsonProperty("property")\r
+    @JsonProperty(value = "property", required = true)\r
     private PropertyDefinition property;\r
 \r
     @JsonProperty("input-param")\r
@@ -58,7 +58,7 @@ public class ResourceAssignment {
     private String message;\r
 \r
     @JsonProperty("updated-date")\r
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy hh:mm:ss")\r
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")\r
     private Date updatedDate;\r
 \r
     @JsonProperty("updated-by")\r
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/ResourceDictionaryConstants.java
new file mode 100644 (file)
index 0000000..1af42c5
--- /dev/null
@@ -0,0 +1,24 @@
+/*\r
+ *  Copyright © 2017-2018 AT&T Intellectual Property.\r
+ *\r
+ *  Licensed under the Apache License, Version 2.0 (the "License");\r
+ *  you may not use this file except in compliance with the License.\r
+ *  You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *  Unless required by applicable law or agreed to in writing, software\r
+ *  distributed under the License is distributed on an "AS IS" BASIS,\r
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *  See the License for the specific language governing permissions and\r
+ *  limitations under the License.\r
+ */\r
+\r
+package org.onap.ccsdk.apps.controllerblueprints.resource.dict;\r
+\r
+public class ResourceDictionaryConstants {\r
+    public static final String SOURCE_INPUT= "input";\r
+    public static final String SOURCE_DEFAULT = "default";\r
+    public static final String SOURCE_DB = "db";\r
+    public static final String SOURCE_MDSAL = "mdsal";\r
+}\r
index 4dc9c89..7c2d926 100644 (file)
@@ -17,7 +17,7 @@
 package org.onap.ccsdk.apps.controllerblueprints.resource.dict.data;\r
 \r
 import com.fasterxml.jackson.annotation.JsonProperty;\r
-import com.fasterxml.jackson.databind.JsonNode;\r
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;\r
 \r
 import java.util.List;\r
 import java.util.Map;\r
@@ -29,6 +29,7 @@ import java.util.Map;
 public class DictionaryDefinition {\r
     @JsonProperty(value = "name", required = true)\r
     private String name;\r
+\r
     @JsonProperty(value = "description")\r
     private String description;\r
 \r
@@ -39,6 +40,7 @@ public class DictionaryDefinition {
     private String sampleValue;\r
 \r
     private String tags;\r
+\r
     @JsonProperty(value = "updated-by")\r
     private String updatedBy;\r
 \r
@@ -58,7 +60,8 @@ public class DictionaryDefinition {
     private Object defaultValue;\r
 \r
     @JsonProperty(value = "source", required = true)\r
-    private Map<String, JsonNode> source;\r
+    @JsonDeserialize(using = SourceDeserializer.class, keyAs = String.class, contentAs = ResourceSource.class)\r
+    private Map<String, ResourceSource> source;\r
 \r
     @JsonProperty("candidate-dependency")\r
     private Map<String, DictionaryDependency> dependency;\r
@@ -154,11 +157,11 @@ public class DictionaryDefinition {
         this.defaultValue = defaultValue;\r
     }\r
 \r
-    public Map<String, JsonNode> getSource() {\r
+    public Map<String, ResourceSource> getSource() {\r
         return source;\r
     }\r
 \r
-    public void setSource(Map<String, JsonNode> source) {\r
+    public void setSource(Map<String, ResourceSource> source) {\r
         this.source = source;\r
     }\r
 \r
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/ResourceSource.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/ResourceSource.java
new file mode 100644 (file)
index 0000000..735832c
--- /dev/null
@@ -0,0 +1,22 @@
+/*\r
+ *  Copyright © 2017-2018 AT&T Intellectual Property.\r
+ *\r
+ *  Licensed under the Apache License, Version 2.0 (the "License");\r
+ *  you may not use this file except in compliance with the License.\r
+ *  You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *  Unless required by applicable law or agreed to in writing, software\r
+ *  distributed under the License is distributed on an "AS IS" BASIS,\r
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *  See the License for the specific language governing permissions and\r
+ *  limitations under the License.\r
+ */\r
+\r
+package org.onap.ccsdk.apps.controllerblueprints.resource.dict.data;\r
+\r
+import java.io.Serializable;\r
+\r
+public interface ResourceSource extends Serializable {\r
+}\r
index 23d4046..724d022 100644 (file)
@@ -24,7 +24,7 @@ import java.util.Map;
  * SourceDb\r
  * @author Brinda Santh\r
  */\r
-public class SourceDb {\r
+public class SourceDb  implements ResourceSource{\r
     @JsonProperty(value = "base", required = true)\r
     private String base;\r
     @JsonProperty(value = "type", required = true)\r
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDeserializer.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/data/SourceDeserializer.java
new file mode 100644 (file)
index 0000000..86476e1
--- /dev/null
@@ -0,0 +1,67 @@
+/*\r
+ *  Copyright © 2017-2018 AT&T Intellectual Property.\r
+ *\r
+ *  Licensed under the Apache License, Version 2.0 (the "License");\r
+ *  you may not use this file except in compliance with the License.\r
+ *  You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *  Unless required by applicable law or agreed to in writing, software\r
+ *  distributed under the License is distributed on an "AS IS" BASIS,\r
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *  See the License for the specific language governing permissions and\r
+ *  limitations under the License.\r
+ */\r
+\r
+package org.onap.ccsdk.apps.controllerblueprints.resource.dict.data;\r
+\r
+import com.fasterxml.jackson.core.JsonParser;\r
+import com.fasterxml.jackson.core.JsonProcessingException;\r
+import com.fasterxml.jackson.databind.*;\r
+import com.fasterxml.jackson.databind.node.ObjectNode;\r
+import com.google.common.base.Preconditions;\r
+import org.apache.commons.lang3.StringUtils;\r
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
+import java.io.IOException;\r
+import java.util.HashMap;\r
+import java.util.Map;\r
+\r
+public class SourceDeserializer extends JsonDeserializer<Map<String, ResourceSource>> {\r
+\r
+    private static final Logger log = LoggerFactory.getLogger(SourceDeserializer.class);\r
+\r
+    private Class<?> keyAs;\r
+\r
+    private Class<?> contentAs;\r
+\r
+    private static Map<String, Class<? extends ResourceSource>> registry = new HashMap<String, Class<? extends ResourceSource>>();\r
+\r
+    public static void registerSource(String uniqueAttribute, Class<? extends ResourceSource> sourceClass) {\r
+        registry.put(uniqueAttribute, sourceClass);\r
+    }\r
+\r
+    @Override\r
+    public Map<String, ResourceSource> deserialize(JsonParser p, DeserializationContext ctxt)\r
+            throws IOException, JsonProcessingException {\r
+\r
+        ObjectMapper mapper = (ObjectMapper) p.getCodec();\r
+        ObjectNode root = (ObjectNode) mapper.readTree(p);\r
+        Map<String, ResourceSource> sources = new HashMap();\r
+        root.fields().forEachRemaining((node) -> {\r
+            String key = node.getKey();\r
+            JsonNode valueNode = node.getValue();\r
+            Preconditions.checkArgument(StringUtils.isNotBlank(key), "missing source key");\r
+            Preconditions.checkArgument(registry.containsKey(key), key +" source not registered");\r
+            if (StringUtils.isNotBlank(key) && registry.containsKey(key)) {\r
+                Class<? extends ResourceSource> sourceClass = registry.get(key);\r
+                ResourceSource resourceSource = JacksonUtils.readValue(valueNode.toString(), sourceClass);\r
+                sources.put(key, resourceSource);\r
+            }\r
+        });\r
+        return sources;\r
+    }\r
+}\r
index 82cb769..87184f2 100644 (file)
@@ -20,7 +20,7 @@ package org.onap.ccsdk.apps.controllerblueprints.resource.dict.data;
  * SourceInput\r
  * @author Brinda Santh\r
  */\r
-public class SourceInput {\r
+public class SourceInput implements ResourceSource {\r
 \r
     private String key;\r
 \r
@@ -33,5 +33,4 @@ public class SourceInput {
     }\r
 \r
 \r
-\r
 }\r
index 9eb233e..8a066e9 100644 (file)
@@ -24,7 +24,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
 \r
 import java.util.Map;\r
 \r
-public class SourceMdsal {\r
+public class SourceMdsal implements ResourceSource {\r
 \r
     @JsonProperty(value = "base", required = true)\r
     private String base;\r
@@ -93,5 +93,4 @@ public class SourceMdsal {
     }\r
 \r
 \r
-\r
 }\r
index 9d51d82..4f9467f 100644 (file)
 \r
 package org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils;\r
 \r
-import com.fasterxml.jackson.databind.JsonNode;\r
 import org.apache.commons.collections.MapUtils;\r
 import org.apache.commons.lang3.StringUtils;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.ConfigModelConstant;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.data.EntrySchema;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition;\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants;\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.DictionaryDefinition;\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.DictionaryDependency;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.ResourceSource;\r
 import org.slf4j.Logger;\r
 import org.slf4j.LoggerFactory;\r
 \r
@@ -63,7 +63,7 @@ public class ResourceDictionaryUtils {
             // Overwrite the Property Definitions from Dictionary\r
             setProperty(resourceAssignment, dictionaryDefinition);\r
 \r
-            Map<String, JsonNode> dictionarySource = dictionaryDefinition.getSource();\r
+            Map<String, ResourceSource> dictionarySource = dictionaryDefinition.getSource();\r
             Map<String, DictionaryDependency> dictionaryDependencyMap = dictionaryDefinition.getDependency();\r
 \r
             if (MapUtils.isNotEmpty(dictionarySource)) {\r
@@ -82,7 +82,7 @@ public class ResourceDictionaryUtils {
                         }\r
                     }\r
                 } else {\r
-                    resourceAssignment.setDictionarySource(ConfigModelConstant.SOURCE_INPUT);\r
+                    resourceAssignment.setDictionarySource(ResourceDictionaryConstants.SOURCE_INPUT);\r
                 }\r
                 log.info("auto map resourceAssignment : {}", resourceAssignment);\r
             }\r
@@ -98,7 +98,7 @@ public class ResourceDictionaryUtils {
         }\r
     }\r
 \r
-    private static String findFirstSource(Map<String, JsonNode> dictionarySource) {\r
+    private static String findFirstSource(Map<String, ResourceSource> dictionarySource) {\r
         String source = null;\r
         if (MapUtils.isNotEmpty(dictionarySource)) {\r
             source = dictionarySource.keySet().stream().findFirst().get();\r
diff --git a/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/DictionaryDefinitionTest.java b/ms/controllerblueprints/modules/resource-dict/src/test/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/util/DictionaryDefinitionTest.java
new file mode 100644 (file)
index 0000000..851ba12
--- /dev/null
@@ -0,0 +1,70 @@
+/*\r
+ *  Copyright © 2017-2018 AT&T Intellectual Property.\r
+ *\r
+ *  Licensed under the Apache License, Version 2.0 (the "License");\r
+ *  you may not use this file except in compliance with the License.\r
+ *  You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *  Unless required by applicable law or agreed to in writing, software\r
+ *  distributed under the License is distributed on an "AS IS" BASIS,\r
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *  See the License for the specific language governing permissions and\r
+ *  limitations under the License.\r
+ */\r
+\r
+package org.onap.ccsdk.apps.controllerblueprints.resource.dict.util;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.*;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
+public class DictionaryDefinitionTest {\r
+    private Logger log = LoggerFactory.getLogger(DictionaryDefinitionTest.class);\r
+    String basePath = "load/resource_dictionary";\r
+\r
+    @Before\r
+    public void setup(){\r
+        SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_DB, SourceDb.class);\r
+        SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_INPUT, SourceInput.class);\r
+        SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_MDSAL, SourceMdsal.class);\r
+        SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_DEFAULT,SourceDefault.class);\r
+    }\r
+\r
+    @Test\r
+    public void testDictionaryDefinitionInputSource(){\r
+\r
+        String fileName = basePath + "/input-source.json";\r
+        DictionaryDefinition dictionaryDefinition = JacksonUtils.readValueFromFile(fileName, DictionaryDefinition.class);\r
+        Assert.assertNotNull("Failed to populate dictionaryDefinition for input type", dictionaryDefinition);\r
+    }\r
+\r
+    @Test\r
+    public void testDictionaryDefinitionDefaultSource(){\r
+\r
+        String fileName = basePath + "/default-source.json";\r
+        DictionaryDefinition dictionaryDefinition = JacksonUtils.readValueFromFile(fileName, DictionaryDefinition.class);\r
+        Assert.assertNotNull("Failed to populate dictionaryDefinition for default type", dictionaryDefinition);\r
+    }\r
+\r
+    @Test\r
+    public void testDictionaryDefinitionDBSource(){\r
+\r
+        String fileName = basePath + "/db-source.json";\r
+        DictionaryDefinition dictionaryDefinition = JacksonUtils.readValueFromFile(fileName, DictionaryDefinition.class);\r
+        Assert.assertNotNull("Failed to populate dictionaryDefinition for db type", dictionaryDefinition);\r
+    }\r
+\r
+    @Test\r
+    public void testDictionaryDefinitionMDSALSource(){\r
+        String fileName = basePath + "/mdsal-source.json";\r
+        DictionaryDefinition dictionaryDefinition = JacksonUtils.readValueFromFile(fileName, DictionaryDefinition.class);\r
+        Assert.assertNotNull("Failed to populate dictionaryDefinition for mdsal type", dictionaryDefinition);\r
+    }\r
+}\r
index 22b01c4..0c9a1c5 100644 (file)
 package org.onap.ccsdk.apps.controllerblueprints.resource.dict.util;\r
 \r
 \r
-import com.fasterxml.jackson.databind.JsonNode;\r
 import org.junit.Assert;\r
 import org.junit.Test;\r
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.ConfigModelConstant;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants;\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.*;\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.ResourceDictionaryUtils;\r
 import org.slf4j.Logger;\r
@@ -45,9 +43,9 @@ public class ResourceDictionaryUtilsTest {
             DictionaryDefinition dictionaryDefinition = new DictionaryDefinition();\r
             dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING);\r
 \r
-            Map<String, JsonNode> source = new HashMap<>();\r
+            Map<String, ResourceSource> source = new HashMap<>();\r
             SourceInput sourceInput = new SourceInput();\r
-            source.put(ConfigModelConstant.SOURCE_INPUT, JacksonUtils.jsonNodeFromObject(sourceInput));\r
+            source.put(ResourceDictionaryConstants.SOURCE_INPUT, sourceInput);\r
             dictionaryDefinition.setSource(source);\r
 \r
             ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, dictionaryDefinition);\r
@@ -72,15 +70,16 @@ public class ResourceDictionaryUtilsTest {
             DictionaryDefinition dictionaryDefinition = new DictionaryDefinition();\r
             dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING);\r
 \r
-            Map<String, JsonNode> source = new HashMap<>();\r
+            Map<String, ResourceSource> source = new HashMap<>();\r
             SourceDb sourceDb = new SourceDb();\r
-            source.put(ConfigModelConstant.SOURCE_DB, JacksonUtils.jsonNodeFromObject(sourceDb));\r
+            sourceDb.setBase("sdnc_connection");\r
+            source.put(ResourceDictionaryConstants.SOURCE_DB, sourceDb);\r
             dictionaryDefinition.setSource(source);\r
 \r
             Map<String, DictionaryDependency> dependency = new HashMap<>();\r
             DictionaryDependency dependencyDb = new DictionaryDependency();\r
             dependencyDb.setNames(Arrays.asList("vnf-id", "vnf-name"));\r
-            dependency.put(ConfigModelConstant.SOURCE_DB, dependencyDb);\r
+            dependency.put(ResourceDictionaryConstants.SOURCE_DB, dependencyDb);\r
             dictionaryDefinition.setDependency(dependency);\r
 \r
             DecryptionRule decryptionRule = new DecryptionRule();\r
@@ -115,15 +114,15 @@ public class ResourceDictionaryUtilsTest {
         DictionaryDefinition dictionaryDefinition = new DictionaryDefinition();\r
         dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING);\r
 \r
-        Map<String, JsonNode> source = new HashMap<>();\r
+        Map<String, ResourceSource> source = new HashMap<>();\r
         SourceDefault sourceDefault = new SourceDefault();\r
-        source.put(ConfigModelConstant.SOURCE_DEFAULT, JacksonUtils.jsonNodeFromObject(sourceDefault));\r
+        source.put(ResourceDictionaryConstants.SOURCE_DEFAULT, sourceDefault);\r
         dictionaryDefinition.setSource(source);\r
 \r
         Map<String, DictionaryDependency> dependency = new HashMap<>();\r
         DictionaryDependency dependencyDefault = new DictionaryDependency();\r
         dependencyDefault.setNames(Arrays.asList(new String[]{"vnf-id", "vnf-name"}));\r
-        dependency.put(ConfigModelConstant.SOURCE_DEFAULT, dependencyDefault);\r
+        dependency.put(ResourceDictionaryConstants.SOURCE_DEFAULT, dependencyDefault);\r
         dictionaryDefinition.setDependency(dependency);\r
 \r
         ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, dictionaryDefinition);\r
@@ -143,15 +142,15 @@ public class ResourceDictionaryUtilsTest {
         DictionaryDefinition dictionaryDefinition = new DictionaryDefinition();\r
         dictionaryDefinition.setDataType(BluePrintConstants.DATA_TYPE_STRING);\r
 \r
-        Map<String, JsonNode> source = new HashMap<>();\r
+        Map<String, ResourceSource> source = new HashMap<>();\r
         SourceMdsal sourceMdsal = new SourceMdsal();\r
-        source.put(ConfigModelConstant.SOURCE_MDSAL, JacksonUtils.jsonNodeFromObject(sourceMdsal));\r
+        source.put(ResourceDictionaryConstants.SOURCE_MDSAL,sourceMdsal);\r
         dictionaryDefinition.setSource(source);\r
 \r
         Map<String, DictionaryDependency> dependency = new HashMap<>();\r
         DictionaryDependency dependencyMdsal = new DictionaryDependency();\r
         dependencyMdsal.setNames(Arrays.asList(new String[]{"vnf-id", "vnf-name"}));\r
-        dependency.put(ConfigModelConstant.SOURCE_MDSAL, dependencyMdsal);\r
+        dependency.put(ResourceDictionaryConstants.SOURCE_MDSAL, dependencyMdsal);\r
         dictionaryDefinition.setDependency(dependency);\r
 \r
         ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, dictionaryDefinition);\r
@@ -3,20 +3,19 @@
   "description": "name of the ",\r
   "resource-type": "ONAP",\r
   "resource-path": "vnf/bundle-id",\r
-  "updated-by": "ym9479@onap.com",\r
+  "updated-by": "brindasanth@onap.com",\r
   "data-type": "String",\r
-  "tags": "bundle-id, ym9479@onap.com",\r
+  "tags": "bundle-id, brindasanth@onap.com",\r
   "source": {\r
     "db": {\r
-      "path": "$key-value",\r
+      "query": "SELECT bundle-id FROM DEVICE_PROFILE WHERE profile_name = :profile_name",\r
       "input-key-mapping": {\r
-        "key-value": "$resource-group-key"\r
+        "profile_name": "profile_name"\r
       },\r
       "output-key-mapping": {\r
-        "bundle-id": "bundle-id"\r
+        "db-country": "country",\r
+        "db-state": "state"\r
       }\r
-    },\r
-    "input": {\r
     }\r
   },\r
   "decryption-rules": [\r
diff --git a/ms/controllerblueprints/modules/service/load/resource_dictionary/input-source.json b/ms/controllerblueprints/modules/service/load/resource_dictionary/input-source.json
new file mode 100644 (file)
index 0000000..35736b6
--- /dev/null
@@ -0,0 +1,17 @@
+{\r
+       "name": "action-name",\r
+       "resource-path": "action-name",\r
+       "resource-type": "ONAP",\r
+       "description": "To be provided",\r
+       "valid-values": null,\r
+       "sample-value": null,\r
+       "updated-by": "brindasanth@onap.com",\r
+       "tags": null,\r
+       "default": null,\r
+       "data-type": "string",\r
+       "source": {\r
+               "input": {\r
+                       "key": "action-name"\r
+               }\r
+       }\r
+}
\ No newline at end of file
index 03254b7..c6c0f98 100644 (file)
@@ -1,8 +1,8 @@
 {\r
-       "tags": "v4-ip-type, tosca.datatypes.Root, data_type, ym9479@onap.com",\r
+       "tags": "v4-ip-type, tosca.datatypes.Root, data_type, brindasanth@onap.com",\r
        "name": "v4-ip-type",\r
        "description": "To be provided",\r
-       "updated-by": "ym9479@onap.com",\r
+       "updated-by": "brindasanth@onap.com",\r
        "resource-type": "ONAP",\r
        "resource-path": "vnf/v4-ip-type",\r
        "data-type": "string",\r
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ApplicationRegistrationService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ApplicationRegistrationService.java
new file mode 100644 (file)
index 0000000..074f18d
--- /dev/null
@@ -0,0 +1,39 @@
+/*\r
+ *  Copyright © 2017-2018 AT&T Intellectual Property.\r
+ *\r
+ *  Licensed under the Apache License, Version 2.0 (the "License");\r
+ *  you may not use this file except in compliance with the License.\r
+ *  You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *  Unless required by applicable law or agreed to in writing, software\r
+ *  distributed under the License is distributed on an "AS IS" BASIS,\r
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *  See the License for the specific language governing permissions and\r
+ *  limitations under the License.\r
+ */\r
+\r
+package org.onap.ccsdk.apps.controllerblueprints.service;\r
+\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.*;\r
+import org.springframework.stereotype.Component;\r
+\r
+import javax.annotation.PostConstruct;\r
+\r
+@Component\r
+public class ApplicationRegistrationService {\r
+\r
+    @PostConstruct\r
+    public void register(){\r
+        registerDictionarySources();\r
+    }\r
+\r
+    public void registerDictionarySources(){\r
+        SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_DB, SourceDb.class);\r
+        SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_INPUT, SourceInput.class);\r
+        SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_MDSAL, SourceMdsal.class);\r
+        SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_DEFAULT,SourceDefault.class);\r
+    }\r
+}\r
index f7a802e..4316412 100644 (file)
 \r
 package org.onap.ccsdk.apps.controllerblueprints.service.common;\r
 \r
+import com.fasterxml.jackson.annotation.JsonFormat;\r
 import com.fasterxml.jackson.annotation.JsonInclude;\r
 import com.fasterxml.jackson.annotation.JsonInclude.Include;\r
 \r
 import java.io.Serializable;\r
+import java.util.Date;\r
 \r
 @JsonInclude(Include.NON_NULL)\r
 public class ErrorMessage implements Serializable {\r
-    private Integer httpStatus;\r
     private String message;\r
     private Integer code;\r
-    private String developerMessage;\r
+    private String debugMessage;\r
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")\r
+    private Date timestamp = new Date();\r
 \r
-    public Integer getHttpStatus() {\r
-        return httpStatus;\r
-    }\r
-\r
-    public void setHttpStatus(Integer httpStatus) {\r
-        this.httpStatus = httpStatus;\r
+    public ErrorMessage(String message, Integer code, String debugMessage){\r
+        this.message = message;\r
+        this.code = code;\r
+        this.debugMessage = debugMessage;\r
     }\r
 \r
     public String getMessage() {\r
@@ -52,12 +53,19 @@ public class ErrorMessage implements Serializable {
         this.code = code;\r
     }\r
 \r
-    public String getDeveloperMessage() {\r
-        return developerMessage;\r
+    public String getDebugMessage() {\r
+        return debugMessage;\r
     }\r
 \r
-    public void setDeveloperMessage(String developerMessage) {\r
-        this.developerMessage = developerMessage;\r
+    public void setDebugMessage(String developerMessage) {\r
+        this.debugMessage = developerMessage;\r
     }\r
 \r
+    public Date getTimestamp() {\r
+        return timestamp;\r
+    }\r
+\r
+    public void setTimestamp(Date timestamp) {\r
+        this.timestamp = timestamp;\r
+    }\r
 }
\ No newline at end of file
index 224960f..4538281 100644 (file)
@@ -18,6 +18,7 @@ package org.onap.ccsdk.apps.controllerblueprints.service.domain;
 \r
 import com.fasterxml.jackson.annotation.JsonFormat;\r
 import com.fasterxml.jackson.annotation.JsonManagedReference;\r
+import io.swagger.annotations.ApiModelProperty;\r
 import org.hibernate.annotations.Proxy;\r
 import org.springframework.data.annotation.LastModifiedDate;\r
 import org.springframework.data.jpa.domain.support.AuditingEntityListener;\r
@@ -82,6 +83,7 @@ public class ConfigModel implements Serializable {
 \r
     @NotNull\r
     @Column(name = "artifact_version")\r
+    @ApiModelProperty(required=true)\r
     private String artifactVersion;\r
 \r
     @Lob\r
@@ -91,7 +93,7 @@ public class ConfigModel implements Serializable {
     @Column(name = "internal_version")\r
     private Integer internalVersion;\r
 \r
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "MM/dd/yyyy KK:mm:ss a Z")\r
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")\r
     @LastModifiedDate\r
     @Temporal(TemporalType.TIMESTAMP)\r
     @Column(name = "creation_date")\r
@@ -99,19 +101,23 @@ public class ConfigModel implements Serializable {
 \r
     @NotNull\r
     @Column(name = "artifact_name")\r
+    @ApiModelProperty(required=true)\r
     private String artifactName;\r
 \r
     @NotNull\r
     @Column(name = "published")\r
+    @ApiModelProperty(required=true)\r
     private String published;\r
 \r
     @NotNull\r
     @Column(name = "updated_by")\r
+    @ApiModelProperty(required=true)\r
     private String updatedBy;\r
 \r
     @NotNull\r
     @Lob\r
     @Column(name = "tags")\r
+    @ApiModelProperty(required=true)\r
     private String tags;\r
 \r
 \r
index f7bd554..0c05ef9 100644 (file)
@@ -18,6 +18,7 @@ package org.onap.ccsdk.apps.controllerblueprints.service.domain;
 \r
 import com.fasterxml.jackson.annotation.JsonBackReference;\r
 import com.fasterxml.jackson.annotation.JsonFormat;\r
+import io.swagger.annotations.ApiModelProperty;\r
 import org.springframework.data.annotation.LastModifiedDate;\r
 import org.springframework.data.jpa.domain.support.AuditingEntityListener;\r
 \r
@@ -46,10 +47,12 @@ public class ConfigModelContent {
 \r
     @NotNull\r
     @Column(name = "name")\r
+    @ApiModelProperty(required=true)\r
     private String name;\r
 \r
     @NotNull\r
     @Column(name = "content_type")\r
+    @ApiModelProperty(required=true)\r
     private String contentType;\r
 \r
 \r
@@ -65,10 +68,11 @@ public class ConfigModelContent {
     @NotNull\r
     @Lob\r
     @Column(name = "content")\r
+    @ApiModelProperty(required=true)\r
     private String content;\r
 \r
 \r
-    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "MM/dd/yyyy KK:mm:ss a Z")\r
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")\r
     @LastModifiedDate\r
     @Temporal(TemporalType.TIMESTAMP)\r
     @Column(name = "updated_date")\r
index ed6340a..61e4d11 100644 (file)
@@ -16,6 +16,8 @@
 \r
 package org.onap.ccsdk.apps.controllerblueprints.service.domain;\r
 \r
+import com.fasterxml.jackson.annotation.JsonFormat;\r
+import io.swagger.annotations.ApiModelProperty;\r
 import org.springframework.data.annotation.LastModifiedDate;\r
 import org.springframework.data.jpa.domain.support.AuditingEntityListener;\r
 \r
@@ -40,36 +42,43 @@ public class ModelType implements Serializable {
     @Id\r
     @NotNull\r
     @Column(name = "model_name", nullable = false)\r
+    @ApiModelProperty(required=true)\r
     private String modelName;\r
 \r
     @NotNull\r
     @Column(name = "derived_from")\r
+    @ApiModelProperty(required=true)\r
     private String derivedFrom;\r
 \r
     @NotNull\r
     @Column(name = "definition_type")\r
+    @ApiModelProperty(required=true)\r
     private String definitionType;\r
 \r
     @NotNull\r
     @Lob\r
     @Column(name = "definition")\r
+    @ApiModelProperty(required=true)\r
     private String definition;\r
 \r
     @NotNull\r
     @Lob\r
     @Column(name = "description")\r
+    @ApiModelProperty(required=true)\r
     private String description;\r
 \r
     @NotNull\r
     @Column(name = "version")\r
+    @ApiModelProperty(required=true)\r
     private String version;\r
 \r
     @NotNull\r
     @Lob\r
     @Column(name = "tags")\r
+    @ApiModelProperty(required=true)\r
     private String tags;\r
 \r
-    // @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "MM/dd/yyyy KK:mm:ss a Z")\r
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")\r
     @LastModifiedDate\r
     @Temporal(TemporalType.TIMESTAMP)\r
     @Column(name = "creation_date")\r
@@ -77,6 +86,7 @@ public class ModelType implements Serializable {
 \r
     @NotNull\r
     @Column(name = "updated_by")\r
+    @ApiModelProperty(required=true)\r
     private String updatedBy;\r
 \r
     @Override\r
index adb0188..0d5879d 100644 (file)
@@ -16,6 +16,8 @@
 \r
 package org.onap.ccsdk.apps.controllerblueprints.service.domain;\r
 \r
+import com.fasterxml.jackson.annotation.JsonFormat;\r
+import io.swagger.annotations.ApiModelProperty;\r
 import org.springframework.data.annotation.LastModifiedDate;\r
 import org.springframework.data.jpa.domain.support.AuditingEntityListener;\r
 \r
@@ -39,18 +41,22 @@ public class ResourceDictionary implements Serializable {
     @Id\r
     @NotNull\r
     @Column(name = "name")\r
+    @ApiModelProperty(required=true)\r
     private String name;\r
 \r
     @NotNull\r
     @Column(name = "resource_path")\r
+    @ApiModelProperty(required=true)\r
     private String resourcePath;\r
 \r
     @NotNull\r
     @Column(name = "resource_type")\r
+    @ApiModelProperty(required=true)\r
     private String resourceType;\r
 \r
     @NotNull\r
     @Column(name = "data_type")\r
+    @ApiModelProperty(required=true)\r
     private String dataType;\r
 \r
     @Column(name = "entry_schema")\r
@@ -67,18 +73,22 @@ public class ResourceDictionary implements Serializable {
     @NotNull\r
     @Lob\r
     @Column(name = "definition")\r
+    @ApiModelProperty(required=true)\r
     private String definition;\r
 \r
     @NotNull\r
     @Lob\r
     @Column(name = "description")\r
+    @ApiModelProperty(required=true)\r
     private String description;\r
 \r
     @NotNull\r
     @Lob\r
     @Column(name = "tags")\r
+    @ApiModelProperty(required=true)\r
     private String tags;\r
 \r
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")\r
     @LastModifiedDate\r
     @Temporal(TemporalType.TIMESTAMP)\r
     @Column(name = "creation_date")\r
@@ -86,6 +96,7 @@ public class ResourceDictionary implements Serializable {
 \r
     @NotNull\r
     @Column(name = "updated_by")\r
+    @ApiModelProperty(required=true)\r
     private String updatedBy;\r
 \r
     @Override\r
index 94324a8..62b6830 100644 (file)
@@ -19,8 +19,7 @@ package org.onap.ccsdk.apps.controllerblueprints.service.rs;
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.ConfigModelService;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;\r
-import org.springframework.stereotype.Component;\r
-import org.springframework.stereotype.Service;\r
+import org.springframework.http.MediaType;\r
 import org.springframework.web.bind.annotation.*;\r
 \r
 import java.util.List;\r
@@ -29,7 +28,7 @@ import java.util.List;
  * {@inheritDoc}\r
  */\r
 @RestController\r
-@RequestMapping("/api/v1/config-model")\r
+@RequestMapping(value = "/api/v1/config-model")\r
 public class ConfigModelRest {\r
 \r
     private ConfigModelService configModelService;\r
@@ -44,7 +43,7 @@ public class ConfigModelRest {
 \r
     }\r
 \r
-    @GetMapping(path = "/initial/{name}")\r
+    @GetMapping(path = "/initial/{name}", produces = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
     ConfigModel getInitialConfigModel(@PathVariable(value = "name") String name) throws BluePrintException {\r
         try {\r
@@ -54,7 +53,7 @@ public class ConfigModelRest {
         }\r
     }\r
 \r
-    @PostMapping(path = "/")\r
+    @PostMapping(path = "/", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
     ConfigModel saveConfigModel(@RequestBody ConfigModel configModel) throws BluePrintException {\r
         try {\r
@@ -69,11 +68,11 @@ public class ConfigModelRest {
         try {\r
             this.configModelService.deleteConfigModel(id);\r
         } catch (Exception e) {\r
-            throw new BluePrintException(4000, e.getMessage(), e);\r
+            throw new BluePrintException(2400, e.getMessage(), e);\r
         }\r
     }\r
 \r
-    @GetMapping(path = "/publish/{id}")\r
+    @GetMapping(path = "/publish/{id}", produces = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
     ConfigModel publishConfigModel(@PathVariable(value = "id") Long id) throws BluePrintException {\r
         try {\r
@@ -83,7 +82,7 @@ public class ConfigModelRest {
         }\r
     }\r
 \r
-    @GetMapping(path = "/{id}")\r
+    @GetMapping(path = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
     ConfigModel getConfigModel(@PathVariable(value = "id") Long id) throws BluePrintException {\r
         try {\r
@@ -93,7 +92,7 @@ public class ConfigModelRest {
         }\r
     }\r
 \r
-    @GetMapping(path = "/by-name/{name}/version/{version}")\r
+    @GetMapping(path = "/by-name/{name}/version/{version}", produces = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
     ConfigModel getConfigModelByNameAndVersion(@PathVariable(value = "name") String name,\r
                                                @PathVariable(value = "version") String version) throws BluePrintException {\r
@@ -104,7 +103,7 @@ public class ConfigModelRest {
         }\r
     }\r
 \r
-    @GetMapping(path = "/search/{tags}")\r
+    @GetMapping(path = "/search/{tags}", produces = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
     List<ConfigModel> searchConfigModels(@PathVariable(value = "tags") String tags) throws BluePrintException {\r
         try {\r
@@ -114,7 +113,7 @@ public class ConfigModelRest {
         }\r
     }\r
 \r
-    @GetMapping(path = "/clone/{id}")\r
+    @GetMapping(path = "/clone/{id}", produces = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
     ConfigModel getCloneConfigModel(@PathVariable(value = "id") Long id) throws BluePrintException {\r
         try {\r
index 2fa6431..f6e5c27 100644 (file)
@@ -19,6 +19,7 @@ package org.onap.ccsdk.apps.controllerblueprints.service.rs;
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.ModelTypeService;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;\r
+import org.springframework.http.MediaType;\r
 import org.springframework.stereotype.Component;\r
 import org.springframework.stereotype.Service;\r
 import org.springframework.web.bind.annotation.*;\r
@@ -29,7 +30,7 @@ import java.util.List;
  * {@inheritDoc}\r
  */\r
 @RestController\r
-@RequestMapping("/api/v1/model-type")\r
+@RequestMapping(value = "/api/v1/model-type")\r
 public class ModelTypeRest {\r
 \r
     private ModelTypeService modelTypeService;\r
@@ -43,7 +44,7 @@ public class ModelTypeRest {
         this.modelTypeService = modelTypeService;\r
     }\r
 \r
-    @GetMapping(path = "/{name}")\r
+    @GetMapping(path = "/{name}", produces = MediaType.APPLICATION_JSON_VALUE)\r
     public ModelType getModelTypeByName(@PathVariable(value = "name") String name) throws BluePrintException {\r
         try {\r
             return modelTypeService.getModelTypeByName(name);\r
@@ -52,7 +53,7 @@ public class ModelTypeRest {
         }\r
     }\r
 \r
-    @GetMapping(path = "/search/{tags}")\r
+    @GetMapping(path = "/search/{tags}", produces = MediaType.APPLICATION_JSON_VALUE)\r
     public List<ModelType> searchModelTypes(@PathVariable(value = "tags") String tags) throws BluePrintException {\r
         try {\r
             return modelTypeService.searchModelTypes(tags);\r
@@ -61,7 +62,7 @@ public class ModelTypeRest {
         }\r
     }\r
 \r
-    @GetMapping(path = "/by-definition/{definitionType}")\r
+    @GetMapping(path = "/by-definition/{definitionType}", produces = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
     List<ModelType> getModelTypeByDefinitionType(@PathVariable(value = "definitionType") String definitionType) throws BluePrintException {\r
         try {\r
@@ -71,7 +72,7 @@ public class ModelTypeRest {
         }\r
     }\r
 \r
-    @PostMapping(path = "/")\r
+    @PostMapping(path = "/", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
     ModelType saveModelType(@RequestBody ModelType modelType) throws BluePrintException {\r
         try {\r
index dfb06bb..795738c 100644 (file)
@@ -19,8 +19,7 @@ package org.onap.ccsdk.apps.controllerblueprints.service.rs;
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.ResourceDictionaryService;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;\r
-import org.springframework.stereotype.Component;\r
-import org.springframework.stereotype.Service;\r
+import org.springframework.http.MediaType;\r
 import org.springframework.web.bind.annotation.*;\r
 \r
 import java.util.List;\r
@@ -44,7 +43,7 @@ public class ResourceDictionaryRest {
         this.resourceDictionaryService = dataDictionaryService;\r
     }\r
 \r
-    @PostMapping(path = "/")\r
+    @PostMapping(path = "/", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
     ResourceDictionary saveResourceDictionary(@RequestBody ResourceDictionary dataDictionary)\r
             throws BluePrintException {\r
@@ -64,7 +63,7 @@ public class ResourceDictionaryRest {
         }\r
     }\r
 \r
-    @GetMapping(path = "/{name}")\r
+    @GetMapping(path = "/{name}", produces = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
     ResourceDictionary getResourceDictionaryByName(@PathVariable(value = "name") String name) throws BluePrintException {\r
         try {\r
@@ -74,7 +73,7 @@ public class ResourceDictionaryRest {
         }\r
     }\r
 \r
-    @PostMapping(path = "/by-names")\r
+    @PostMapping(path = "/by-names", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
     List<ResourceDictionary> searchResourceDictionaryByNames(@RequestBody List<String> names)\r
             throws BluePrintException {\r
@@ -85,7 +84,7 @@ public class ResourceDictionaryRest {
         }\r
     }\r
 \r
-    @GetMapping(path = "/search/{tags}")\r
+    @GetMapping(path = "/search/{tags}", produces = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
     List<ResourceDictionary> searchResourceDictionaryByTags(@PathVariable(value = "tags") String tags) throws BluePrintException {\r
         try {\r
index d8ea194..a22285b 100644 (file)
@@ -23,8 +23,7 @@ import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
 import org.onap.ccsdk.apps.controllerblueprints.service.ServiceTemplateService;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelContent;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.model.AutoMapResponse;\r
-import org.springframework.stereotype.Component;\r
-import org.springframework.stereotype.Service;\r
+import org.springframework.http.MediaType;\r
 import org.springframework.web.bind.annotation.*;\r
 \r
 import java.util.List;\r
@@ -47,7 +46,7 @@ public class ServiceTemplateRest {
         this.serviceTemplateService = serviceTemplateService;\r
     }\r
 \r
-    @PostMapping(path = "/enrich")\r
+    @PostMapping(path = "/enrich", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
     ServiceTemplate enrichServiceTemplate(@RequestBody ServiceTemplate serviceTemplate) throws BluePrintException {\r
         try {\r
@@ -57,7 +56,7 @@ public class ServiceTemplateRest {
         }\r
     }\r
 \r
-    @PostMapping(path = "/validate")\r
+    @PostMapping(path = "/validate", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
     ServiceTemplate validateServiceTemplate(@RequestBody ServiceTemplate serviceTemplate) throws BluePrintException {\r
         try {\r
@@ -67,7 +66,7 @@ public class ServiceTemplateRest {
         }\r
     }\r
 \r
-    @PostMapping(path = "/resource-assignment/auto-map")\r
+    @PostMapping(path = "/resource-assignment/auto-map", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
     AutoMapResponse autoMap(@RequestBody List<ResourceAssignment> resourceAssignments) throws BluePrintException {\r
         try {\r
@@ -77,7 +76,7 @@ public class ServiceTemplateRest {
         }\r
     }\r
 \r
-    @PostMapping(path = "/resource-assignment/validate")\r
+    @PostMapping(path = "/resource-assignment/validate", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
     List<ResourceAssignment> validateResourceAssignments(@RequestBody List<ResourceAssignment> resourceAssignments)\r
             throws BluePrintException {\r
@@ -88,7 +87,7 @@ public class ServiceTemplateRest {
         }\r
     }\r
 \r
-    @PostMapping(path = "/resource-assignment/generate")\r
+    @PostMapping(path = "/resource-assignment/generate", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
     List<ResourceAssignment> generateResourceAssignments(@RequestBody ConfigModelContent templateContent)\r
             throws BluePrintException {\r
index afe9b42..73d6eca 100644 (file)
@@ -24,6 +24,7 @@ import org.junit.Test;
 import org.junit.runner.RunWith;\r
 import org.junit.runners.MethodSorters;\r
 import org.onap.ccsdk.apps.controllerblueprints.TestApplication;\r
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.*;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;\r
 import org.slf4j.Logger;\r
 import org.slf4j.LoggerFactory;\r
@@ -51,7 +52,10 @@ public class ResourceDictionaryRestTest {
 \r
     @Before\r
     public void setUp() {\r
-\r
+        SourceDeserializer.registerSource("db", SourceDb.class);\r
+        SourceDeserializer.registerSource("input", SourceInput.class);\r
+        SourceDeserializer.registerSource("mdsal", SourceMdsal.class);\r
+        SourceDeserializer.registerSource("default", SourceDefault.class);\r
     }\r
 \r
     @Test\r