diff options
author | Dan Timoney <dt5972@att.com> | 2018-08-22 14:44:11 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-08-22 14:44:11 +0000 |
commit | fca267a0f5185bc85ea42ee67ed15e5a20525a06 (patch) | |
tree | fc39ffa851c836470ff99672c869ee21a3be8add /ms/controllerblueprints/modules/service | |
parent | 653f403e13d4014b3f80fc8bf5302866110e2202 (diff) | |
parent | 42b670cfd17dab61dbd6632080c95572ea3b83c8 (diff) |
Merge "Controller Blueprints Microservice"
Diffstat (limited to 'ms/controllerblueprints/modules/service')
14 files changed, 134 insertions, 55 deletions
diff --git a/ms/controllerblueprints/modules/service/load/resource_dictionary/bundle-id.json b/ms/controllerblueprints/modules/service/load/resource_dictionary/db-source.json index f9678f5f..86252354 100644 --- a/ms/controllerblueprints/modules/service/load/resource_dictionary/bundle-id.json +++ b/ms/controllerblueprints/modules/service/load/resource_dictionary/db-source.json @@ -3,20 +3,19 @@ "description": "name of the ",
"resource-type": "ONAP",
"resource-path": "vnf/bundle-id",
- "updated-by": "ym9479@onap.com",
+ "updated-by": "brindasanth@onap.com",
"data-type": "String",
- "tags": "bundle-id, ym9479@onap.com",
+ "tags": "bundle-id, brindasanth@onap.com",
"source": {
"db": {
- "path": "$key-value",
+ "query": "SELECT bundle-id FROM DEVICE_PROFILE WHERE profile_name = :profile_name",
"input-key-mapping": {
- "key-value": "$resource-group-key"
+ "profile_name": "profile_name"
},
"output-key-mapping": {
- "bundle-id": "bundle-id"
+ "db-country": "country",
+ "db-state": "state"
}
- },
- "input": {
}
},
"decryption-rules": [
diff --git a/ms/controllerblueprints/modules/service/load/resource_dictionary/action-name.json b/ms/controllerblueprints/modules/service/load/resource_dictionary/input-source.json index 92b64e62..35736b66 100644 --- a/ms/controllerblueprints/modules/service/load/resource_dictionary/action-name.json +++ b/ms/controllerblueprints/modules/service/load/resource_dictionary/input-source.json @@ -5,7 +5,7 @@ "description": "To be provided",
"valid-values": null,
"sample-value": null,
- "updated-by": "ym9479@onap.com",
+ "updated-by": "brindasanth@onap.com",
"tags": null,
"default": null,
"data-type": "string",
diff --git a/ms/controllerblueprints/modules/service/load/resource_dictionary/v4-ip-type.json b/ms/controllerblueprints/modules/service/load/resource_dictionary/v4-ip-type.json index 03254b78..c6c0f985 100644 --- a/ms/controllerblueprints/modules/service/load/resource_dictionary/v4-ip-type.json +++ b/ms/controllerblueprints/modules/service/load/resource_dictionary/v4-ip-type.json @@ -1,8 +1,8 @@ {
- "tags": "v4-ip-type, tosca.datatypes.Root, data_type, ym9479@onap.com",
+ "tags": "v4-ip-type, tosca.datatypes.Root, data_type, brindasanth@onap.com",
"name": "v4-ip-type",
"description": "To be provided",
- "updated-by": "ym9479@onap.com",
+ "updated-by": "brindasanth@onap.com",
"resource-type": "ONAP",
"resource-path": "vnf/v4-ip-type",
"data-type": "string",
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 index 00000000..074f18d0 --- /dev/null +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ApplicationRegistrationService.java @@ -0,0 +1,39 @@ +/*
+ * 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.controllerblueprints.service;
+
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceDictionaryConstants;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.*;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+
+@Component
+public class ApplicationRegistrationService {
+
+ @PostConstruct
+ public void register(){
+ registerDictionarySources();
+ }
+
+ public void registerDictionarySources(){
+ SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_DB, SourceDb.class);
+ SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_INPUT, SourceInput.class);
+ SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_MDSAL, SourceMdsal.class);
+ SourceDeserializer.registerSource(ResourceDictionaryConstants.SOURCE_DEFAULT,SourceDefault.class);
+ }
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ErrorMessage.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ErrorMessage.java index f7a802e4..43164126 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ErrorMessage.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/ErrorMessage.java @@ -16,24 +16,25 @@ package org.onap.ccsdk.apps.controllerblueprints.service.common;
+import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import java.io.Serializable;
+import java.util.Date;
@JsonInclude(Include.NON_NULL)
public class ErrorMessage implements Serializable {
- private Integer httpStatus;
private String message;
private Integer code;
- private String developerMessage;
+ private String debugMessage;
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
+ private Date timestamp = new Date();
- public Integer getHttpStatus() {
- return httpStatus;
- }
-
- public void setHttpStatus(Integer httpStatus) {
- this.httpStatus = httpStatus;
+ public ErrorMessage(String message, Integer code, String debugMessage){
+ this.message = message;
+ this.code = code;
+ this.debugMessage = debugMessage;
}
public String getMessage() {
@@ -52,12 +53,19 @@ public class ErrorMessage implements Serializable { this.code = code;
}
- public String getDeveloperMessage() {
- return developerMessage;
+ public String getDebugMessage() {
+ return debugMessage;
}
- public void setDeveloperMessage(String developerMessage) {
- this.developerMessage = developerMessage;
+ public void setDebugMessage(String developerMessage) {
+ this.debugMessage = developerMessage;
}
+ public Date getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(Date timestamp) {
+ this.timestamp = timestamp;
+ }
}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModel.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModel.java index 224960fa..45382815 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModel.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModel.java @@ -18,6 +18,7 @@ package org.onap.ccsdk.apps.controllerblueprints.service.domain; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonManagedReference;
+import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.Proxy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
@@ -82,6 +83,7 @@ public class ConfigModel implements Serializable { @NotNull
@Column(name = "artifact_version")
+ @ApiModelProperty(required=true)
private String artifactVersion;
@Lob
@@ -91,7 +93,7 @@ public class ConfigModel implements Serializable { @Column(name = "internal_version")
private Integer internalVersion;
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "MM/dd/yyyy KK:mm:ss a Z")
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
@LastModifiedDate
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "creation_date")
@@ -99,19 +101,23 @@ public class ConfigModel implements Serializable { @NotNull
@Column(name = "artifact_name")
+ @ApiModelProperty(required=true)
private String artifactName;
@NotNull
@Column(name = "published")
+ @ApiModelProperty(required=true)
private String published;
@NotNull
@Column(name = "updated_by")
+ @ApiModelProperty(required=true)
private String updatedBy;
@NotNull
@Lob
@Column(name = "tags")
+ @ApiModelProperty(required=true)
private String tags;
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelContent.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelContent.java index f7bd554d..0c05ef95 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelContent.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelContent.java @@ -18,6 +18,7 @@ package org.onap.ccsdk.apps.controllerblueprints.service.domain; import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
@@ -46,10 +47,12 @@ public class ConfigModelContent { @NotNull
@Column(name = "name")
+ @ApiModelProperty(required=true)
private String name;
@NotNull
@Column(name = "content_type")
+ @ApiModelProperty(required=true)
private String contentType;
@@ -65,10 +68,11 @@ public class ConfigModelContent { @NotNull
@Lob
@Column(name = "content")
+ @ApiModelProperty(required=true)
private String content;
- @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "MM/dd/yyyy KK:mm:ss a Z")
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
@LastModifiedDate
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "updated_date")
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java index ed6340a6..61e4d118 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java @@ -16,6 +16,8 @@ package org.onap.ccsdk.apps.controllerblueprints.service.domain;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
@@ -40,36 +42,43 @@ public class ModelType implements Serializable { @Id
@NotNull
@Column(name = "model_name", nullable = false)
+ @ApiModelProperty(required=true)
private String modelName;
@NotNull
@Column(name = "derived_from")
+ @ApiModelProperty(required=true)
private String derivedFrom;
@NotNull
@Column(name = "definition_type")
+ @ApiModelProperty(required=true)
private String definitionType;
@NotNull
@Lob
@Column(name = "definition")
+ @ApiModelProperty(required=true)
private String definition;
@NotNull
@Lob
@Column(name = "description")
+ @ApiModelProperty(required=true)
private String description;
@NotNull
@Column(name = "version")
+ @ApiModelProperty(required=true)
private String version;
@NotNull
@Lob
@Column(name = "tags")
+ @ApiModelProperty(required=true)
private String tags;
- // @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "MM/dd/yyyy KK:mm:ss a Z")
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
@LastModifiedDate
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "creation_date")
@@ -77,6 +86,7 @@ public class ModelType implements Serializable { @NotNull
@Column(name = "updated_by")
+ @ApiModelProperty(required=true)
private String updatedBy;
@Override
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java index adb01884..0d5879db 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java @@ -16,6 +16,8 @@ package org.onap.ccsdk.apps.controllerblueprints.service.domain;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
@@ -39,18 +41,22 @@ public class ResourceDictionary implements Serializable { @Id
@NotNull
@Column(name = "name")
+ @ApiModelProperty(required=true)
private String name;
@NotNull
@Column(name = "resource_path")
+ @ApiModelProperty(required=true)
private String resourcePath;
@NotNull
@Column(name = "resource_type")
+ @ApiModelProperty(required=true)
private String resourceType;
@NotNull
@Column(name = "data_type")
+ @ApiModelProperty(required=true)
private String dataType;
@Column(name = "entry_schema")
@@ -67,18 +73,22 @@ public class ResourceDictionary implements Serializable { @NotNull
@Lob
@Column(name = "definition")
+ @ApiModelProperty(required=true)
private String definition;
@NotNull
@Lob
@Column(name = "description")
+ @ApiModelProperty(required=true)
private String description;
@NotNull
@Lob
@Column(name = "tags")
+ @ApiModelProperty(required=true)
private String tags;
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
@LastModifiedDate
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "creation_date")
@@ -86,6 +96,7 @@ public class ResourceDictionary implements Serializable { @NotNull
@Column(name = "updated_by")
+ @ApiModelProperty(required=true)
private String updatedBy;
@Override
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java index 94324a80..62b68303 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ConfigModelRest.java @@ -19,8 +19,7 @@ package org.onap.ccsdk.apps.controllerblueprints.service.rs; import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
import org.onap.ccsdk.apps.controllerblueprints.service.ConfigModelService;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
-import org.springframework.stereotype.Component;
-import org.springframework.stereotype.Service;
+import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@@ -29,7 +28,7 @@ import java.util.List; * {@inheritDoc}
*/
@RestController
-@RequestMapping("/api/v1/config-model")
+@RequestMapping(value = "/api/v1/config-model")
public class ConfigModelRest {
private ConfigModelService configModelService;
@@ -44,7 +43,7 @@ public class ConfigModelRest { }
- @GetMapping(path = "/initial/{name}")
+ @GetMapping(path = "/initial/{name}", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
ConfigModel getInitialConfigModel(@PathVariable(value = "name") String name) throws BluePrintException {
try {
@@ -54,7 +53,7 @@ public class ConfigModelRest { }
}
- @PostMapping(path = "/")
+ @PostMapping(path = "/", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
ConfigModel saveConfigModel(@RequestBody ConfigModel configModel) throws BluePrintException {
try {
@@ -69,11 +68,11 @@ public class ConfigModelRest { try {
this.configModelService.deleteConfigModel(id);
} catch (Exception e) {
- throw new BluePrintException(4000, e.getMessage(), e);
+ throw new BluePrintException(2400, e.getMessage(), e);
}
}
- @GetMapping(path = "/publish/{id}")
+ @GetMapping(path = "/publish/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
ConfigModel publishConfigModel(@PathVariable(value = "id") Long id) throws BluePrintException {
try {
@@ -83,7 +82,7 @@ public class ConfigModelRest { }
}
- @GetMapping(path = "/{id}")
+ @GetMapping(path = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
ConfigModel getConfigModel(@PathVariable(value = "id") Long id) throws BluePrintException {
try {
@@ -93,7 +92,7 @@ public class ConfigModelRest { }
}
- @GetMapping(path = "/by-name/{name}/version/{version}")
+ @GetMapping(path = "/by-name/{name}/version/{version}", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
ConfigModel getConfigModelByNameAndVersion(@PathVariable(value = "name") String name,
@PathVariable(value = "version") String version) throws BluePrintException {
@@ -104,7 +103,7 @@ public class ConfigModelRest { }
}
- @GetMapping(path = "/search/{tags}")
+ @GetMapping(path = "/search/{tags}", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
List<ConfigModel> searchConfigModels(@PathVariable(value = "tags") String tags) throws BluePrintException {
try {
@@ -114,7 +113,7 @@ public class ConfigModelRest { }
}
- @GetMapping(path = "/clone/{id}")
+ @GetMapping(path = "/clone/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
ConfigModel getCloneConfigModel(@PathVariable(value = "id") Long id) throws BluePrintException {
try {
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java index 2fa64316..f6e5c274 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java @@ -19,6 +19,7 @@ package org.onap.ccsdk.apps.controllerblueprints.service.rs; import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
import org.onap.ccsdk.apps.controllerblueprints.service.ModelTypeService;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
+import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;
@@ -29,7 +30,7 @@ import java.util.List; * {@inheritDoc}
*/
@RestController
-@RequestMapping("/api/v1/model-type")
+@RequestMapping(value = "/api/v1/model-type")
public class ModelTypeRest {
private ModelTypeService modelTypeService;
@@ -43,7 +44,7 @@ public class ModelTypeRest { this.modelTypeService = modelTypeService;
}
- @GetMapping(path = "/{name}")
+ @GetMapping(path = "/{name}", produces = MediaType.APPLICATION_JSON_VALUE)
public ModelType getModelTypeByName(@PathVariable(value = "name") String name) throws BluePrintException {
try {
return modelTypeService.getModelTypeByName(name);
@@ -52,7 +53,7 @@ public class ModelTypeRest { }
}
- @GetMapping(path = "/search/{tags}")
+ @GetMapping(path = "/search/{tags}", produces = MediaType.APPLICATION_JSON_VALUE)
public List<ModelType> searchModelTypes(@PathVariable(value = "tags") String tags) throws BluePrintException {
try {
return modelTypeService.searchModelTypes(tags);
@@ -61,7 +62,7 @@ public class ModelTypeRest { }
}
- @GetMapping(path = "/by-definition/{definitionType}")
+ @GetMapping(path = "/by-definition/{definitionType}", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
List<ModelType> getModelTypeByDefinitionType(@PathVariable(value = "definitionType") String definitionType) throws BluePrintException {
try {
@@ -71,7 +72,7 @@ public class ModelTypeRest { }
}
- @PostMapping(path = "/")
+ @PostMapping(path = "/", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
ModelType saveModelType(@RequestBody ModelType modelType) throws BluePrintException {
try {
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java index dfb06bba..795738cb 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRest.java @@ -19,8 +19,7 @@ package org.onap.ccsdk.apps.controllerblueprints.service.rs; import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
import org.onap.ccsdk.apps.controllerblueprints.service.ResourceDictionaryService;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
-import org.springframework.stereotype.Component;
-import org.springframework.stereotype.Service;
+import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@@ -44,7 +43,7 @@ public class ResourceDictionaryRest { this.resourceDictionaryService = dataDictionaryService;
}
- @PostMapping(path = "/")
+ @PostMapping(path = "/", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
ResourceDictionary saveResourceDictionary(@RequestBody ResourceDictionary dataDictionary)
throws BluePrintException {
@@ -64,7 +63,7 @@ public class ResourceDictionaryRest { }
}
- @GetMapping(path = "/{name}")
+ @GetMapping(path = "/{name}", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
ResourceDictionary getResourceDictionaryByName(@PathVariable(value = "name") String name) throws BluePrintException {
try {
@@ -74,7 +73,7 @@ public class ResourceDictionaryRest { }
}
- @PostMapping(path = "/by-names")
+ @PostMapping(path = "/by-names", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
List<ResourceDictionary> searchResourceDictionaryByNames(@RequestBody List<String> names)
throws BluePrintException {
@@ -85,7 +84,7 @@ public class ResourceDictionaryRest { }
}
- @GetMapping(path = "/search/{tags}")
+ @GetMapping(path = "/search/{tags}", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
List<ResourceDictionary> searchResourceDictionaryByTags(@PathVariable(value = "tags") String tags) throws BluePrintException {
try {
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java index d8ea1941..a22285b8 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ServiceTemplateRest.java @@ -23,8 +23,7 @@ import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment import org.onap.ccsdk.apps.controllerblueprints.service.ServiceTemplateService;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelContent;
import org.onap.ccsdk.apps.controllerblueprints.service.model.AutoMapResponse;
-import org.springframework.stereotype.Component;
-import org.springframework.stereotype.Service;
+import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@@ -47,7 +46,7 @@ public class ServiceTemplateRest { this.serviceTemplateService = serviceTemplateService;
}
- @PostMapping(path = "/enrich")
+ @PostMapping(path = "/enrich", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
ServiceTemplate enrichServiceTemplate(@RequestBody ServiceTemplate serviceTemplate) throws BluePrintException {
try {
@@ -57,7 +56,7 @@ public class ServiceTemplateRest { }
}
- @PostMapping(path = "/validate")
+ @PostMapping(path = "/validate", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
ServiceTemplate validateServiceTemplate(@RequestBody ServiceTemplate serviceTemplate) throws BluePrintException {
try {
@@ -67,7 +66,7 @@ public class ServiceTemplateRest { }
}
- @PostMapping(path = "/resource-assignment/auto-map")
+ @PostMapping(path = "/resource-assignment/auto-map", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
AutoMapResponse autoMap(@RequestBody List<ResourceAssignment> resourceAssignments) throws BluePrintException {
try {
@@ -77,7 +76,7 @@ public class ServiceTemplateRest { }
}
- @PostMapping(path = "/resource-assignment/validate")
+ @PostMapping(path = "/resource-assignment/validate", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
List<ResourceAssignment> validateResourceAssignments(@RequestBody List<ResourceAssignment> resourceAssignments)
throws BluePrintException {
@@ -88,7 +87,7 @@ public class ServiceTemplateRest { }
}
- @PostMapping(path = "/resource-assignment/generate")
+ @PostMapping(path = "/resource-assignment/generate", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody
List<ResourceAssignment> generateResourceAssignments(@RequestBody ConfigModelContent templateContent)
throws BluePrintException {
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java index afe9b426..73d6eca9 100644 --- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ResourceDictionaryRestTest.java @@ -24,6 +24,7 @@ import org.junit.Test; import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
+import org.onap.ccsdk.apps.controllerblueprints.resource.dict.data.*;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,7 +52,10 @@ public class ResourceDictionaryRestTest { @Before
public void setUp() {
-
+ SourceDeserializer.registerSource("db", SourceDb.class);
+ SourceDeserializer.registerSource("input", SourceInput.class);
+ SourceDeserializer.registerSource("mdsal", SourceMdsal.class);
+ SourceDeserializer.registerSource("default", SourceDefault.class);
}
@Test
|