From cd95bfda8f81a9aa34e1986e352b19e57488e1ae Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Fri, 7 Sep 2018 19:20:59 +0000 Subject: Controller Blueprints Microservice Remove Resource Dictionary resource_type, resource_path, sample_values and valid_values parameters. Change-Id: I7ec899e30aaef64130f35eb754a79f9dfc54f71f Issue-ID: CCSDK-488 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../load/resource_dictionary/db-source.json | 26 ----------- .../load/resource_dictionary/input-source.json | 19 -------- .../load/resource_dictionary/v4-ip-type.json | 19 -------- .../service/DataBaseInitService.java | 34 +++++++-------- .../service/ResourceDictionaryService.java | 4 -- .../service/domain/ResourceDictionary.java | 51 ---------------------- .../validator/ResourceDictionaryValidator.java | 4 -- .../src/main/resources/sql/schema-local.sql | 4 -- .../service/src/main/resources/sql/schema.sql | 4 -- .../ResourceDictionaryReactRepositoryTest.java | 4 +- .../service/rs/ResourceDictionaryRestTest.java | 3 -- .../src/test/resources/application.properties | 43 +----------------- .../resourcedictionary/default_definition.json | 2 - 13 files changed, 18 insertions(+), 199 deletions(-) delete mode 100644 ms/controllerblueprints/modules/service/load/resource_dictionary/db-source.json delete mode 100644 ms/controllerblueprints/modules/service/load/resource_dictionary/input-source.json delete mode 100644 ms/controllerblueprints/modules/service/load/resource_dictionary/v4-ip-type.json (limited to 'ms/controllerblueprints/modules/service') diff --git a/ms/controllerblueprints/modules/service/load/resource_dictionary/db-source.json b/ms/controllerblueprints/modules/service/load/resource_dictionary/db-source.json deleted file mode 100644 index ba86b3c79..000000000 --- a/ms/controllerblueprints/modules/service/load/resource_dictionary/db-source.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "db-source", - "property" :{ - "description": "name of the ", - "type": "string" - }, - "resource-type": "ONAP", - "resource-path": "vnf/bundle-id", - "updated-by": "brindasanth@onap.com", - "tags": "db-source, brindasanth@onap.com", - "sources": { - "db": { - "type": "source-db", - "properties": { - "query": "SELECT db-country, db-state FROM DEVICE_PROFILE WHERE profile_name = :profile_name", - "input-key-mapping": { - "profile_name": "profile_name" - }, - "output-key-mapping": { - "db-country": "country", - "db-state": "state" - } - } - } - } -} \ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/load/resource_dictionary/input-source.json b/ms/controllerblueprints/modules/service/load/resource_dictionary/input-source.json deleted file mode 100644 index 7cd58d618..000000000 --- a/ms/controllerblueprints/modules/service/load/resource_dictionary/input-source.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "input-source", - "property" :{ - "description": "name of the ", - "type": "string" - }, - "resource-path": "action-name", - "resource-type": "ONAP", - "updated-by": "brindasanth@onap.com", - "tags": "action-name, brindasanth", - "sources": { - "input": { - "type": "source-input", - "properties": { - "key": "action-name" - } - } - } -} \ No newline at end of file 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 deleted file mode 100644 index e7e06000c..000000000 --- a/ms/controllerblueprints/modules/service/load/resource_dictionary/v4-ip-type.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "v4-ip-type", - "property": { - "description": "name of the ", - "type": "string" - }, - "resource-path": "vnf/v4-ip-type", - "resource-type": "ONAP", - "updated-by": "brindasanth@onap.com", - "tags": "v4-ip-type, source-input, brindasanth", - "sources": { - "input": { - "type": "source-input", - "properties": { - "key": "v4-ip-type" - } - } - } -} \ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java index c6d80cfb6..cfcf93d29 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java @@ -157,30 +157,28 @@ public class DataBaseInitService { fileName = file.getFilename(); log.trace("Loading : {}", fileName); String definitionContent = getResourceContent(file); - ResourceDefinition dictionaryDefinition = + ResourceDefinition resourceDefinition = JacksonUtils.readValue(definitionContent, ResourceDefinition.class); - if (dictionaryDefinition != null) { - Preconditions.checkNotNull(dictionaryDefinition.getProperty(), "Failed to get Property Definition"); + if (resourceDefinition != null) { + Preconditions.checkNotNull(resourceDefinition.getProperty(), "Failed to get Property Definition"); ResourceDictionary resourceDictionary = new ResourceDictionary(); - resourceDictionary.setResourcePath(dictionaryDefinition.getResourcePath()); - resourceDictionary.setName(dictionaryDefinition.getName()); - resourceDictionary.setDefinition(dictionaryDefinition); - - resourceDictionary.setResourceType(dictionaryDefinition.getResourceType()); - resourceDictionary.setDescription(dictionaryDefinition.getProperty().getDescription()); - resourceDictionary.setDataType(dictionaryDefinition.getProperty().getType()); - if(dictionaryDefinition.getProperty().getEntrySchema() != null){ - resourceDictionary.setEntrySchema(dictionaryDefinition.getProperty().getEntrySchema().getType()); + resourceDictionary.setName(resourceDefinition.getName()); + resourceDictionary.setDefinition(resourceDefinition); + + Preconditions.checkNotNull(resourceDefinition.getProperty(), "Property field is missing"); + resourceDictionary.setDescription(resourceDefinition.getProperty().getDescription()); + resourceDictionary.setDataType(resourceDefinition.getProperty().getType()); + if(resourceDefinition.getProperty().getEntrySchema() != null){ + resourceDictionary.setEntrySchema(resourceDefinition.getProperty().getEntrySchema().getType()); } - resourceDictionary.setUpdatedBy(dictionaryDefinition.getUpdatedBy()); - if (StringUtils.isBlank(dictionaryDefinition.getTags())) { + resourceDictionary.setUpdatedBy(resourceDefinition.getUpdatedBy()); + if (StringUtils.isBlank(resourceDefinition.getTags())) { resourceDictionary.setTags( - dictionaryDefinition.getName() + ", " + dictionaryDefinition.getUpdatedBy() - + ", " + dictionaryDefinition.getResourceType() + ", " - + dictionaryDefinition.getUpdatedBy()); + resourceDefinition.getName() + ", " + resourceDefinition.getUpdatedBy() + + ", " + resourceDefinition.getUpdatedBy()); } else { - resourceDictionary.setTags(dictionaryDefinition.getTags()); + resourceDictionary.setTags(resourceDefinition.getTags()); } resourceDictionaryService.saveResourceDictionary(resourceDictionary); diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java index 70e43d699..62aa0e29c 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ResourceDictionaryService.java @@ -112,8 +112,6 @@ public class ResourceDictionaryService { // Validate the Resource Definitions resourceDictionaryValidationService.validate(resourceDefinition); - resourceDictionary.setResourceType(resourceDefinition.getResourceType()); - resourceDictionary.setResourcePath(resourceDefinition.getResourcePath()); resourceDictionary.setTags(resourceDefinition.getTags()); resourceDefinition.setUpdatedBy(resourceDictionary.getUpdatedBy()); // Set the Property Definitions @@ -134,8 +132,6 @@ public class ResourceDictionaryService { dbResourceDictionary.setName(resourceDictionary.getName()); dbResourceDictionary.setDefinition(resourceDictionary.getDefinition()); dbResourceDictionary.setDescription(resourceDictionary.getDescription()); - dbResourceDictionary.setResourceType(resourceDictionary.getResourceType()); - dbResourceDictionary.setResourcePath(resourceDictionary.getResourcePath()); dbResourceDictionary.setTags(resourceDictionary.getTags()); dbResourceDictionary.setUpdatedBy(resourceDictionary.getUpdatedBy()); dbResourceDictionary.setDataType(resourceDictionary.getDataType()); 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 7af9972a6..42c8e83b2 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 @@ -43,14 +43,6 @@ public class ResourceDictionary implements Serializable { @ApiModelProperty(required=true) private String name; - @Column(name = "resource_path", nullable = false) - @ApiModelProperty(required=true) - private String resourcePath; - - @Column(name = "resource_type", nullable = false) - @ApiModelProperty(required=true) - private String resourceType; - @Column(name = "data_type", nullable = false) @ApiModelProperty(required=true) private String dataType; @@ -58,14 +50,6 @@ public class ResourceDictionary implements Serializable { @Column(name = "entry_schema") private String entrySchema; - @Lob - @Column(name = "valid_values") - private String validValues; - - @Lob - @Column(name = "sample_value") - private String sampleValue; - @Lob @Convert(converter = JpaResourceDefinitionConverter.class) @Column(name = "definition", nullable = false) @@ -95,11 +79,8 @@ public class ResourceDictionary implements Serializable { @Override public String toString() { String buffer = "[" + ", name = " + name + - ", resourcePath = " + resourcePath + - ", resourceType = " + resourceType + ", dataType = " + dataType + ", entrySchema = " + entrySchema + - ", validValues = " + validValues + ", definition =" + definition + ", description = " + description + ", updatedBy = " + updatedBy + @@ -109,14 +90,6 @@ public class ResourceDictionary implements Serializable { return buffer; } - public String getResourcePath() { - return resourcePath; - } - - public void setResourcePath(String resourcePath) { - this.resourcePath = resourcePath; - } - public String getName() { return name; } @@ -125,14 +98,6 @@ public class ResourceDictionary implements Serializable { this.name = name; } - public String getResourceType() { - return resourceType; - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - public String getDataType() { return dataType; } @@ -149,22 +114,6 @@ public class ResourceDictionary implements Serializable { this.entrySchema = entrySchema; } - public String getValidValues() { - return validValues; - } - - public void setValidValues(String validValues) { - this.validValues = validValues; - } - - public String getSampleValue() { - return sampleValue; - } - - public void setSampleValue(String sampleValue) { - this.sampleValue = sampleValue; - } - public ResourceDefinition getDefinition() { return definition; } diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ResourceDictionaryValidator.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ResourceDictionaryValidator.java index 1c2a7337b..57330d90f 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ResourceDictionaryValidator.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ResourceDictionaryValidator.java @@ -45,10 +45,6 @@ public class ResourceDictionaryValidator { Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getName()), "DataDictionary Alias Name Information is missing."); - Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getResourcePath()), - "DataDictionary Resource Name Information is missing."); - Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getResourceType()), - "DataDictionary Resource Type Information is missing."); Preconditions.checkNotNull( resourceDictionary.getDefinition(), "DataDictionary Definition Information is missing."); Preconditions.checkArgument( StringUtils.isNotBlank(resourceDictionary.getDescription()), diff --git a/ms/controllerblueprints/modules/service/src/main/resources/sql/schema-local.sql b/ms/controllerblueprints/modules/service/src/main/resources/sql/schema-local.sql index 1ba9c365a..47e0cce7a 100644 --- a/ms/controllerblueprints/modules/service/src/main/resources/sql/schema-local.sql +++ b/ms/controllerblueprints/modules/service/src/main/resources/sql/schema-local.sql @@ -71,12 +71,8 @@ CREATE TABLE IF NOT EXISTS sdnctl.MODEL_TYPE ( -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS sdnctl.RESOURCE_DICTIONARY ( name VARCHAR(100) NOT NULL, - resource_path VARCHAR(500) NOT NULL, - resource_type VARCHAR(100) NOT NULL, data_type VARCHAR(100) NOT NULL, entry_schema VARCHAR(100) NULL DEFAULT NULL, - valid_values LONGTEXT NULL DEFAULT NULL, - sample_value LONGTEXT NULL DEFAULT NULL, definition LONGTEXT NOT NULL, description LONGTEXT NOT NULL, tags LONGTEXT NOT NULL, diff --git a/ms/controllerblueprints/modules/service/src/main/resources/sql/schema.sql b/ms/controllerblueprints/modules/service/src/main/resources/sql/schema.sql index b884cf345..9c38bec0b 100644 --- a/ms/controllerblueprints/modules/service/src/main/resources/sql/schema.sql +++ b/ms/controllerblueprints/modules/service/src/main/resources/sql/schema.sql @@ -66,12 +66,8 @@ CREATE TABLE IF NOT EXISTS configurator.MODEL_TYPE ( -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS configurator.RESOURCE_DICTIONARY ( name VARCHAR(100) NOT NULL, - resource_path VARCHAR(500) NOT NULL, - resource_type VARCHAR(100) NOT NULL, data_type VARCHAR(100) NOT NULL, entry_schema VARCHAR(100) NULL DEFAULT NULL, - valid_values LONGTEXT NULL DEFAULT NULL, - sample_value LONGTEXT NULL DEFAULT NULL, definition LONGTEXT NOT NULL, description LONGTEXT NOT NULL, tags LONGTEXT NOT NULL, diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepositoryTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepositoryTest.java index 1e740ec33..7034b7e23 100644 --- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepositoryTest.java +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ResourceDictionaryReactRepositoryTest.java @@ -51,7 +51,7 @@ public class ResourceDictionaryReactRepositoryTest { @Before public void init() { - ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile("load/resource_dictionary/db-source" + + ResourceDefinition resourceDefinition = JacksonUtils.readValueFromFile("./../../application/load/resource_dictionary/db-source" + ".json", ResourceDefinition.class); ResourceDictionary resourceDictionary = transformResourceDictionary(resourceDefinition); @@ -84,8 +84,6 @@ public class ResourceDictionaryReactRepositoryTest { resourceDictionary.setName(resourceDefinition.getName()); resourceDictionary.setDataType(resourceDefinition.getProperty().getType()); resourceDictionary.setDescription(resourceDefinition.getProperty().getDescription()); - resourceDictionary.setResourcePath(resourceDefinition.getResourcePath()); - resourceDictionary.setResourceType(resourceDefinition.getResourceType()); resourceDictionary.setTags(resourceDefinition.getTags()); resourceDictionary.setUpdatedBy(resourceDefinition.getUpdatedBy()); resourceDictionary.setDefinition(resourceDefinition); 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 82346954c..5955ae191 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 @@ -58,11 +58,8 @@ public class ResourceDictionaryRestTest { Charset.defaultCharset()); ResourceDictionary dataDictionary = new ResourceDictionary(); - dataDictionary.setResourcePath("test/vnf/ipaddress"); dataDictionary.setName("test-name"); dataDictionary.setDefinition(JacksonUtils.readValue(definition, ResourceDefinition.class)); - dataDictionary.setValidValues("127.0.0.1"); - dataDictionary.setResourceType("ONAP"); dataDictionary.setDataType("string"); dataDictionary.setDescription("Sample Resource Mapping"); dataDictionary.setTags("test, ipaddress"); diff --git a/ms/controllerblueprints/modules/service/src/test/resources/application.properties b/ms/controllerblueprints/modules/service/src/test/resources/application.properties index b17663e9a..429588b31 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/application.properties +++ b/ms/controllerblueprints/modules/service/src/test/resources/application.properties @@ -15,47 +15,6 @@ # limitations under the License. # -info.build.artifact=@project.artifactId@ -info.build.name=@project.name@ -info.build.description=@project.description@ -info.build.version=@project.version@ -info.build.groupId=@project.groupId@ -logging.level.root=info - -server.contextPath=/ -server.servlet-path=/ -spring.jersey.application-path=/api/controller-blueprints/v1 -server.routingPath=/api - - -mots.application.acronym=MOTS_ID -platform.identifier=AJSC7_JERSEY -#spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration - -#logging.pattern.console=%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr($ threadId: {PID:- }){magenta} %clr(---){faint} %clr([ hostname: %X{hostname} serviceName: %X{serviceName} version: %X{version} transactionId: %X{transactionId} requestTimeStamp: %X{requestTimestamp} responseTimeStamp: %X{responseTimestamp} duration: %X{duration}]){yellow} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex - - -#The max number of active threads in this pool -server.tomcat.max-threads=200 -#The minimum number of threads always kept alive -server.tomcat.min-Spare-Threads=25 -#The number of milliseconds before an idle thread shutsdown, unless the number of active threads are less or equal to minSpareThreads -server.tomcat.max-idle-time=60000 - -#for changing the tomcat port... -#server.port=8081 - - - -#Servlet context parameters -server.context_parameters.p-name=value #context parameter with p-name as key and value as value. - -# make this true for AAF authentication and place cadi.properties into etc folder -aaf.enabled=true - -# set to true to enable version proxy -#ivp.enabled=false - spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS = false @@ -68,5 +27,5 @@ blueprints.load.initial-data=true load.dataTypePath=./../../application/load/model_type/data_type load.nodeTypePath=./../../application/load/model_type/node_type load.artifactTypePath=./../../application/load/model_type/artifact_type -load.resourceDictionaryPath=load/resource_dictionary +load.resourceDictionaryPath=./../../application/load/resource_dictionary load.blueprintsPath=./../../application/load/blueprints \ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/default_definition.json b/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/default_definition.json index 198823bb1..334fb24e8 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/default_definition.json +++ b/ms/controllerblueprints/modules/service/src/test/resources/resourcedictionary/default_definition.json @@ -8,8 +8,6 @@ } }, "updated-by": "Brinda Santh (bs2796)", - "resource-type": "ONAP", - "resource-path": "/v4-aggregat-list", "tags": "ipaddress", "sources": { "input": { -- cgit 1.2.3-korg