aboutsummaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints
diff options
context:
space:
mode:
Diffstat (limited to 'ms/controllerblueprints')
-rwxr-xr-x[-rw-r--r--]ms/controllerblueprints/application/etc/run.source5
-rwxr-xr-xms/controllerblueprints/application/opt/app/onap/config/application-dev.properties7
-rwxr-xr-xms/controllerblueprints/application/opt/app/onap/config/application.properties24
-rwxr-xr-xms/controllerblueprints/application/opt/app/onap/config/logback.xml44
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationConstants.java2
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplication.java (renamed from ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplication.java)6
-rwxr-xr-xms/controllerblueprints/application/src/main/resources/application-dev.properties70
-rwxr-xr-xms/controllerblueprints/application/src/main/resources/application.properties74
-rw-r--r--ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplicationTest.java (renamed from ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java)2
-rwxr-xr-xms/controllerblueprints/application/src/test/resources/application.properties7
-rwxr-xr-x[-rw-r--r--]ms/controllerblueprints/distribution/pom.xml89
-rwxr-xr-x[-rw-r--r--]ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml70
-rwxr-xr-x[-rw-r--r--]ms/controllerblueprints/distribution/src/main/docker/Dockerfile3
-rwxr-xr-x[-rw-r--r--]ms/controllerblueprints/distribution/src/main/docker/distribution.xml6
-rwxr-xr-x[-rw-r--r--]ms/controllerblueprints/distribution/src/main/docker/startService.sh1
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/pom.xml59
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompiledScript.kt56
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompilerProxy.kt150
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintScriptConfiguration.kt61
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BlueprintScriptingHost.kt92
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BlueprintScriptingHostTest.kt88
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts1/simple.cba.kts55
-rw-r--r--ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts2/simple.cba.kts55
-rw-r--r--ms/controllerblueprints/modules/pom.xml1
-rw-r--r--ms/controllerblueprints/modules/service/pom.xml6
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelService.java293
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/BlueprintModelRest.java97
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelRest.kt100
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt2
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/BluePrintModelHandler.kt283
-rwxr-xr-xms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt2
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelServiceTest.java30
-rw-r--r--ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelRestTest.kt192
-rwxr-xr-xms/controllerblueprints/modules/service/src/test/resources/application.properties2
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json2
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json4
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json4
-rw-r--r--ms/controllerblueprints/parent/pom.xml45
38 files changed, 1540 insertions, 549 deletions
diff --git a/ms/controllerblueprints/application/etc/run.source b/ms/controllerblueprints/application/etc/run.source
index fc1b4e55..1d0ac070 100644..100755
--- a/ms/controllerblueprints/application/etc/run.source
+++ b/ms/controllerblueprints/application/etc/run.source
@@ -9,8 +9,5 @@ java -classpath "/etc:${APP_HOME}/lib/*:/lib/*:/src:/schema:/generated-sources:$
-Djava.security.egd=file:/dev/./urandom \
-DAPPNAME=${APP_NAME} -DAPPENV=${APP_ENV} -DAPPVERSION=${APP_VERSION} -DNAMESPACE=${NAMESPACE} \
-Dspring.config.location=${APP_CONFIG_HOME}/ \
--Dspring.datasource.url=${DB_URL} \
--Dspring.datasource.username=${DB_USER} \
--Dspring.datasource.password=${DB_PASSWORD} \
-Dblueprints.load.initial-data=${INIT_DATA_LOAD} \
-org.onap.ccsdk.apps.controllerblueprints.ControllerBluprintsApplication
+org.onap.ccsdk.apps.controllerblueprints.ControllerBlueprintsApplication
diff --git a/ms/controllerblueprints/application/opt/app/onap/config/application-dev.properties b/ms/controllerblueprints/application/opt/app/onap/config/application-dev.properties
index e574778e..81b3061a 100755
--- a/ms/controllerblueprints/application/opt/app/onap/config/application-dev.properties
+++ b/ms/controllerblueprints/application/opt/app/onap/config/application-dev.properties
@@ -49,7 +49,7 @@ spring.jpa.hibernate.ddl-auto=none
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
# Load Resource Source Mappings
-resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability
+resourceSourceMappings=primary-db=source-primary-db,input=source-input,default=source-default,primary-config-data=source-rest,capability=source-capability
# Controller Blueprints Core Configuration
controllerblueprints.blueprintDeployPath=/etc/blueprints/deploy
controllerblueprints.blueprintArchivePath=/etc/blueprints/archive
@@ -64,4 +64,7 @@ controllerblueprints.loadResourceDictionary=true
controllerblueprints.loadResourceDictionaryPaths=./../../../components/model-catalog/resource-dictionary/starter-dictionary
# CBA file extension
-controllerblueprints.loadCbaExtension=zip \ No newline at end of file
+controllerblueprints.loadCbaExtension=zip
+
+# Web server config
+server.port=8080 \ No newline at end of file
diff --git a/ms/controllerblueprints/application/opt/app/onap/config/application.properties b/ms/controllerblueprints/application/opt/app/onap/config/application.properties
index 91792394..5b651e66 100755
--- a/ms/controllerblueprints/application/opt/app/onap/config/application.properties
+++ b/ms/controllerblueprints/application/opt/app/onap/config/application.properties
@@ -1,6 +1,7 @@
#
# Copyright © 2017-2018 AT&T Intellectual Property.
# Modifications Copyright © 2018 IBM.
+# Modifications Copyright © 2019 Bell Canada.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -41,17 +42,17 @@ spring.jpa.properties.hibernate.use_sql_comments=true
spring.jpa.properties.hibernate.format_sql=true
# spring.datasource.url, spring.datasource.username,spring.datasource.password may be overridden by ENV variables
-spring.datasource.url=jdbc:mysql://localhost:3306/sdnctl
+spring.datasource.url=jdbc:mysql://db:3306/sdnctl
spring.datasource.username=sdnctl
spring.datasource.password=sdnctl
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
-spring.jpa.show-sql = true
-spring.jpa.hibernate.ddl-auto = none
-spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
-spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
+spring.jpa.show-sql=true
+spring.jpa.hibernate.ddl-auto=none
+spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
+spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
# Load Resource Source Mappings
-resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability
+resourceSourceMappings=primary-db=source-primary-db,input=source-input,default=source-default,primary-config-data=source-rest,capability=source-capability
# Controller Blueprints Core Configuration
controllerblueprints.blueprintDeployPath=/etc/blueprints/deploy
@@ -61,11 +62,14 @@ controllerblueprints.blueprintEnrichmentPath=/etc/blueprints/enrichment
# blueprints.load.initial-data may be overridden by ENV variables
controllerblueprints.loadInitialData=true
controllerblueprints.loadBluePrint=false
-controllerblueprints.loadBluePrintPaths=model-catalog/blueprint-model/starter-blueprint
+controllerblueprints.loadBluePrintPaths=/model-catalog/blueprint-model/starter-blueprint
controllerblueprints.loadModelType=true
-controllerblueprints.loadModeTypePaths=model-catalog/definition-type/starter-type
+controllerblueprints.loadModeTypePaths=/model-catalog/definition-type/starter-type
controllerblueprints.loadResourceDictionary=true
-controllerblueprints.loadResourceDictionaryPaths=model-catalog/resource-dictionary/starter-dictionary
+controllerblueprints.loadResourceDictionaryPaths=/model-catalog/resource-dictionary/starter-dictionary
# CBA file extension
-controllerblueprints.loadCbaExtension=zip \ No newline at end of file
+controllerblueprints.loadCbaExtension=zip
+
+# Web server config
+server.port=8080 \ No newline at end of file
diff --git a/ms/controllerblueprints/application/opt/app/onap/config/logback.xml b/ms/controllerblueprints/application/opt/app/onap/config/logback.xml
new file mode 100755
index 00000000..01ae4f6c
--- /dev/null
+++ b/ms/controllerblueprints/application/opt/app/onap/config/logback.xml
@@ -0,0 +1,44 @@
+<!--
+ ~ 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.
+ -->
+
+<configuration>
+
+ <property name="localPattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{100} - %msg%n" />
+
+ <property name="defaultPattern" value="%date{ISO8601,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Timer}| %msg%n" />
+
+ <property name="debugLoggerPattern" value="%date{ISO8601,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Timer}|[%caller{3}]| %msg%n" />
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <!-- encoders are assigned the type
+ ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+ <encoder>
+ <pattern>${defaultPattern}</pattern>
+ </encoder>
+ </appender>
+
+
+ <logger name="org.springframework" level="info"/>
+ <logger name="org.springframework.web" level="info"/>
+ <logger name="org.springframework.security.web.authentication" level="warn"/>
+ <logger name="org.hibernate" level="error"/>
+ <logger name="org.onap.ccsdk.apps" level="info"/>
+
+ <root level="warn">
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+</configuration>
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationConstants.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationConstants.java
index 2471bd5b..c4759b56 100644
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationConstants.java
+++ b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationConstants.java
@@ -17,7 +17,7 @@
package org.onap.ccsdk.apps.controllerblueprints;
/**
- * ApplicationConstants.java Purpose: Provide ControllerBluprintsApplication Constant Information
+ * ApplicationConstants.java Purpose: Provide ControllerBlueprintsApplication Constant Information
*
* @author Brinda Santh
* @version 1.0
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplication.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplication.java
index 6b0efd87..e925c69c 100644
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplication.java
+++ b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplication.java
@@ -31,12 +31,12 @@ import org.springframework.web.reactive.config.EnableWebFlux;
@EnableWebFlux
@ComponentScan(basePackages = {"org.onap.ccsdk.apps.controllerblueprints"})
@EnableAutoConfiguration
-public class ControllerBluprintsApplication {
- private static EELFLogger log = EELFManager.getInstance().getLogger(ControllerBluprintsApplication.class);
+public class ControllerBlueprintsApplication {
+ private static EELFLogger log = EELFManager.getInstance().getLogger(ControllerBlueprintsApplication.class);
public static void main(String[] args) {
log.info("****** Starting Controlled Blueprints Application ******");
- SpringApplication.run(ControllerBluprintsApplication.class, args);
+ SpringApplication.run(ControllerBlueprintsApplication.class, args);
}
} \ No newline at end of file
diff --git a/ms/controllerblueprints/application/src/main/resources/application-dev.properties b/ms/controllerblueprints/application/src/main/resources/application-dev.properties
new file mode 100755
index 00000000..30b71fb4
--- /dev/null
+++ b/ms/controllerblueprints/application/src/main/resources/application-dev.properties
@@ -0,0 +1,70 @@
+#
+# Copyright © 2017-2018 AT&T Intellectual Property.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+appName=ControllerBluePrints
+ms_name=org.onap.ccsdk.apps.controllerblueprints
+appVersion=1.0.0
+
+# Basic Authentication
+basic-auth.user-name=ccsdkapps
+basic-auth.hashed-pwd={bcrypt}$2a$10$MJxhNiOAffxbyrV9.rrOUewP9Q/ASg5Nit2cmP.yBaXGsVXo8BW3y
+
+#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
+
+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
+
+#Swagger Configuration
+swagger.contact.name=Brinda Santh Muthuramalingam
+swagger.contact.url=www.onap.com
+swagger.contact.email=brindasanth@onap.com
+
+spring.jpa.properties.hibernate.show_sql=true
+spring.jpa.properties.hibernate.use_sql_comments=true
+spring.jpa.properties.hibernate.format_sql=true
+
+# spring.datasource.url, spring.datasource.username,spring.datasource.password may be overridden by ENV variables
+spring.datasource.url=jdbc:mysql://localhost:3306/sdnctl
+spring.datasource.username=sdnctl
+spring.datasource.password=sdnctl
+spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
+spring.jpa.show-sql=true
+spring.jpa.hibernate.ddl-auto=none
+spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
+spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
+# Load Resource Source Mappings
+resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability
+# Controller Blueprints Core Configuration
+controllerblueprints.blueprintDeployPath=/etc/blueprints/deploy
+controllerblueprints.blueprintArchivePath=/etc/blueprints/archive
+controllerblueprints.blueprintEnrichmentPath=/etc/blueprints/enrichment
+# Controller Blueprint Load Configurations
+controllerblueprints.loadInitialData=true
+controllerblueprints.loadBluePrint=false
+controllerblueprints.loadBluePrintPaths=./../../../components/model-catalog/blueprint-model/starter-blueprint
+controllerblueprints.loadModelType=true
+controllerblueprints.loadModeTypePaths=./../../../components/model-catalog/definition-type/starter-type
+controllerblueprints.loadResourceDictionary=true
+controllerblueprints.loadResourceDictionaryPaths=./../../../components/model-catalog/resource-dictionary/starter-dictionary
+
+# CBA file extension
+controllerblueprints.loadCbaExtension=zip
+
+# Web server config
+server.port=8080 \ No newline at end of file
diff --git a/ms/controllerblueprints/application/src/main/resources/application.properties b/ms/controllerblueprints/application/src/main/resources/application.properties
new file mode 100755
index 00000000..ec61be48
--- /dev/null
+++ b/ms/controllerblueprints/application/src/main/resources/application.properties
@@ -0,0 +1,74 @@
+#
+# Copyright © 2017-2018 AT&T Intellectual Property.
+# Modifications Copyright © 2019 Bell Canada.
+#
+# 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.
+#
+appName=ControllerBluePrints
+ms_name=org.onap.ccsdk.apps.controllerblueprints
+appVersion=1.0.0
+
+# Basic Authentication
+basic-auth.user-name=ccsdkapps
+basic-auth.hashed-pwd={bcrypt}$2a$10$MJxhNiOAffxbyrV9.rrOUewP9Q/ASg5Nit2cmP.yBaXGsVXo8BW3y
+
+#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
+
+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
+
+#Swagger Configuration
+swagger.contact.name=Brinda Santh Muthuramalingam
+swagger.contact.url=www.onap.com
+swagger.contact.email=brindasanth@onap.com
+
+spring.jpa.properties.hibernate.show_sql=true
+spring.jpa.properties.hibernate.use_sql_comments=true
+spring.jpa.properties.hibernate.format_sql=true
+
+# spring.datasource.url, spring.datasource.username,spring.datasource.password may be overridden by ENV variables
+spring.datasource.url=jdbc:mysql://localhost:3306/sdnctl
+spring.datasource.username=sdnctl
+spring.datasource.password=sdnctl
+spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
+spring.jpa.show-sql=true
+spring.jpa.hibernate.ddl-auto=none
+spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
+spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
+
+# Load Resource Source Mappings
+resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability
+
+# Controller Blueprints Core Configuration
+controllerblueprints.blueprintDeployPath=/etc/blueprints/deploy
+controllerblueprints.blueprintArchivePath=/etc/blueprints/archive
+controllerblueprints.blueprintEnrichmentPath=/etc/blueprints/enrichment
+# Controller Blueprint Load Configurations
+# blueprints.load.initial-data may be overridden by ENV variables
+controllerblueprints.loadInitialData=true
+controllerblueprints.loadBluePrint=false
+controllerblueprints.loadBluePrintPaths=/model-catalog/blueprint-model/starter-blueprint
+controllerblueprints.loadModelType=true
+controllerblueprints.loadModeTypePaths=/model-catalog/definition-type/starter-type
+controllerblueprints.loadResourceDictionary=true
+controllerblueprints.loadResourceDictionaryPaths=/model-catalog/resource-dictionary/starter-dictionary
+
+# CBA file extension
+controllerblueprints.loadCbaExtension=zip
+
+# Web server config
+server.port=8080 \ No newline at end of file
diff --git a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplicationTest.java
index 969f8042..cf9b3e71 100644
--- a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java
+++ b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBlueprintsApplicationTest.java
@@ -30,7 +30,7 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-public class ControllerBluprintsApplicationTest {
+public class ControllerBlueprintsApplicationTest {
@Autowired
private TestRestTemplate restTemplate;
diff --git a/ms/controllerblueprints/application/src/test/resources/application.properties b/ms/controllerblueprints/application/src/test/resources/application.properties
index 1fafd8bc..9aebd793 100755
--- a/ms/controllerblueprints/application/src/test/resources/application.properties
+++ b/ms/controllerblueprints/application/src/test/resources/application.properties
@@ -33,7 +33,7 @@ swagger.contact.url=www.onap.com
swagger.contact.email=brindasanth@onap.com
# Load Resource Source Mappings
-resourceSourceMappings=db=source-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability
+resourceSourceMappings=primary-db=source-primary-db,input=source-input,default=source-default,primary-config-data=source-rest,capability=source-capability
# Controller Blueprints Core Configuration
controllerblueprints.blueprintDeployPath=./target/blueprints/deploy
@@ -52,4 +52,7 @@ controllerblueprints.loadResourceDictionaryPaths=./../../../../components/model-
controllerblueprints.loadCbaExtension=zip
# CBA examples for tests cases
-controllerblueprints.loadBlueprintsExamplesPath=./../../../../components/model-catalog/blueprint-model/test-blueprints \ No newline at end of file
+controllerblueprints.loadBlueprintsExamplesPath=./../../../../components/model-catalog/blueprint-model/test-blueprints
+
+# Web server config
+server.port=8080 \ No newline at end of file
diff --git a/ms/controllerblueprints/distribution/pom.xml b/ms/controllerblueprints/distribution/pom.xml
index 30571293..91d4bbca 100644..100755
--- a/ms/controllerblueprints/distribution/pom.xml
+++ b/ms/controllerblueprints/distribution/pom.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright © 2017-2018 AT&T Intellectual Property.
+ ~ Modifications Copyright © 2019 Bell Canada.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -30,10 +31,10 @@
<name.space>org.onap.ccsdk.apps</name.space> <!-- <name.space>${namespace}</name.space> -->
<serviceArtifactName>controllerblueprints</serviceArtifactName>
<image.name>onap/ccsdk-controllerblueprints</image.name>
- <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>
- <docker.push.phase>deploy</docker.push.phase>
- <docker.verbose>true</docker.verbose>
- </properties>
+ <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy>
+ <docker.push.phase>deploy</docker.push.phase>
+ <docker.verbose>true</docker.verbose>
+ </properties>
<dependencies>
<dependency>
@@ -120,20 +121,20 @@
</goals>
<configuration>
<source>
- println project.properties['ccsdk.project.version'];
- def versionArray;
+ println project.properties['ccsdk.project.version']
+ def versionArray
if (project.properties['ccsdk.project.version'] != null ) {
- versionArray = project.properties['ccsdk.project.version'].split('\\.');
+ versionArray = project.properties['ccsdk.project.version'].split('\\.')
}
if (project.properties['ccsdk.project.version'].endsWith("-SNAPSHOT"))
{
- project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest";
+ project.properties['project.docker.latesttag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest"
} else {
- project.properties['project.docker.latesttag.version']=versionArray[0]+'.' + versionArray[1]+"-STAGING-latest";
+ project.properties['project.docker.latesttag.version']=versionArray[0]+'.' + versionArray[1]+"-STAGING-latest"
}
- println 'New Tag for docker:' + project.properties['project.docker.latesttag.version'];
+ println 'New Tag for docker:' + project.properties['project.docker.latesttag.version']
</source>
</configuration>
</execution>
@@ -143,34 +144,34 @@
</plugins>
</build>
- <profiles>
- <profile>
- <id>docker</id>
- <build>
- <plugins>
- <plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <version>0.26.1</version>
- <inherited>false</inherited>
- <configuration>
- <images>
- <image>
- <name>${image.name}</name>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
- <tags>
- <tag>${project.version}</tag>
- <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
- <tag>${project.docker.latesttag.version}</tag>
- </tags>
- </build>
- </image>
- </images>
- <verbose>true</verbose>
- </configuration>
- <executions>
+ <profiles>
+ <profile>
+ <id>docker</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.26.1</version>
+ <inherited>false</inherited>
+ <configuration>
+ <images>
+ <image>
+ <name>${image.name}</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir>
+ <tags>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-STAGING-${maven.build.timestamp}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ </build>
+ </image>
+ </images>
+ <verbose>true</verbose>
+ </configuration>
+ <executions>
<execution>
<id>generate-images</id>
<phase>package</phase>
@@ -186,11 +187,11 @@
<goal>push</goal>
</goals>
</execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
- </profiles>
+ </profiles>
</project>
diff --git a/ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml b/ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml
index eae24703..232bfc01 100644..100755
--- a/ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml
+++ b/ms/controllerblueprints/distribution/src/main/dc/docker-compose.yaml
@@ -1,37 +1,33 @@
-version: '3.3'
-
-services:
- db:
- image: mariadb:latest
- container_name: cb-mariadb
- ports:
- - "3306:3306"
- volumes:
- - ~/vm_mysql:/var/lib/mysql
- restart: always
- environment:
- MYSQL_ROOT_PASSWORD: sdnctl
- MYSQL_DATABASE: sdnctl
- MYSQL_USER: sdnctl
- MYSQL_PASSWORD: sdnctl
- controller-blueprints:
- depends_on:
- - db
- image: onap/ccsdk-controllerblueprints:latest
- container_name: cb-rest
- ports:
- - "8080:8080"
- restart: always
- volumes:
- - ~/share/vm_ms/controllerblueprints/config:/opt/app/onap/config
- - ~/share/vm_ms/controllerblueprints/logs:/logs
- environment:
- APPLICATIONNAME : ControllerBluePrints
- BUNDLEVERSION: 1.0.0
- APP_CONFIG_HOME: /opt/app/onap/config
- DB_URL: jdbc:mysql://db:3306/sdnctl
- DB_USER: sdnctl
- DB_PASSWORD: sdnctl
- INIT_DATA_LOAD: "true"
- STICKYSELECTORKEY:
- ENVCONTEXT: DEV \ No newline at end of file
+version: '3.3'
+
+services:
+ db:
+ image: mariadb:latest
+ container_name: ccsdk-mariadb
+ ports:
+ - "3306:3306"
+ volumes:
+ - ~/vm_mysql:/var/lib/mysql
+ restart: always
+ environment:
+ MYSQL_ROOT_PASSWORD: sdnctl
+ MYSQL_DATABASE: sdnctl
+ MYSQL_USER: sdnctl
+ MYSQL_PASSWORD: sdnctl
+ controller-blueprints:
+ depends_on:
+ - db
+ image: onap/ccsdk-controllerblueprints:latest
+ container_name: cb-rest
+ ports:
+ - "8080:8080"
+ restart: always
+ volumes:
+ - ~/share/vm_ms/controllerblueprints/config:/opt/app/onap/config
+ - ~/share/vm_ms/controllerblueprints/logs:/logs
+ environment:
+ APPLICATIONNAME: ControllerBluePrints
+ BUNDLEVERSION: 1.0.0
+ APP_CONFIG_HOME: /opt/app/onap/config
+ STICKYSELECTORKEY:
+ ENVCONTEXT: dev \ No newline at end of file
diff --git a/ms/controllerblueprints/distribution/src/main/docker/Dockerfile b/ms/controllerblueprints/distribution/src/main/docker/Dockerfile
index 6de589da..88577f5a 100644..100755
--- a/ms/controllerblueprints/distribution/src/main/docker/Dockerfile
+++ b/ms/controllerblueprints/distribution/src/main/docker/Dockerfile
@@ -15,6 +15,7 @@ RUN (mkdir -p /source /opt/app/onap) && (tar -xzf /source.tar.gz -C /source) \
&& (cp -rf /source/app/opt/app/onap/lib /opt/app/onap/) \
&& (cp -rf /source/app/etc /) \
&& (cp -rf /source/app/model-catalog /) \
+&& (cp -rf /source/app/config /) \
&& (rm -rf /source)
-ENTRYPOINT /startService.sh
+ENTRYPOINT /startService.sh \ No newline at end of file
diff --git a/ms/controllerblueprints/distribution/src/main/docker/distribution.xml b/ms/controllerblueprints/distribution/src/main/docker/distribution.xml
index c929f98e..1555b43e 100644..100755
--- a/ms/controllerblueprints/distribution/src/main/docker/distribution.xml
+++ b/ms/controllerblueprints/distribution/src/main/docker/distribution.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright © 2017-2018 AT&T Intellectual Property.
+ ~ Modifications Copyright © 2019 Bell Canada.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -59,6 +60,11 @@
<useDefaultExcludes>true</useDefaultExcludes>
</fileSet>
<fileSet>
+ <directory>${project.basedir}/../application/opt/app/onap/config</directory>
+ <outputDirectory>./config</outputDirectory>
+ <useDefaultExcludes>true</useDefaultExcludes>
+ </fileSet>
+ <fileSet>
<directory>${project.basedir}/../../../components/model-catalog</directory>
<outputDirectory>./model-catalog</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
diff --git a/ms/controllerblueprints/distribution/src/main/docker/startService.sh b/ms/controllerblueprints/distribution/src/main/docker/startService.sh
index 7077c224..84b2e5ac 100644..100755
--- a/ms/controllerblueprints/distribution/src/main/docker/startService.sh
+++ b/ms/controllerblueprints/distribution/src/main/docker/startService.sh
@@ -5,4 +5,5 @@ nodeName=ControllerBlueprints_1.0.0_$(cat /proc/self/cgroup | grep docker | sed
echo "APP Config HOME : ${APP_CONFIG_HOME}"
export APP_HOME=/opt/app/onap
+cp -rf /config /opt/app/onap/
source /etc/run.source
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/pom.xml b/ms/controllerblueprints/modules/blueprint-scripts/pom.xml
new file mode 100644
index 00000000..46c88b4c
--- /dev/null
+++ b/ms/controllerblueprints/modules/blueprint-scripts/pom.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>modules</artifactId>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <version>0.4.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>blueprint-scripts</artifactId>
+ <name>Controller Blueprints Scripts</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>resource-dict</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-compiler-embeddable</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-scripting-jvm-host</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-compiler</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-script-util</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-script-runtime</artifactId>
+ </dependency>
+ </dependencies>
+
+</project> \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompiledScript.kt b/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompiledScript.kt
new file mode 100644
index 00000000..8ac915bd
--- /dev/null
+++ b/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompiledScript.kt
@@ -0,0 +1,56 @@
+/*
+ * 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.scripts
+
+import java.io.File
+import java.io.Serializable
+import java.net.URL
+import java.net.URLClassLoader
+import kotlin.reflect.KClass
+import kotlin.script.experimental.api.*
+
+open class BluePrintCompiledScript<out JarFile : File>(
+ private val scriptCompilationConfiguration: ScriptCompilationConfiguration,
+ private val compiledJar: File) :
+ CompiledScript<JarFile>, Serializable {
+
+ lateinit var scriptClassFQName: String
+
+ override val compilationConfiguration: ScriptCompilationConfiguration
+ get() = scriptCompilationConfiguration
+
+ override suspend fun getClass(scriptEvaluationConfiguration: ScriptEvaluationConfiguration?): ResultWithDiagnostics<KClass<*>> = try {
+
+ val baseClassLoader = Thread.currentThread().contextClassLoader
+
+ val urls = arrayListOf<URL>()
+ urls.add(compiledJar.toURI().toURL())
+ val classLoaderWithDependencies = URLClassLoader(urls.toTypedArray(), baseClassLoader)
+
+ val clazz = classLoaderWithDependencies.loadClass(scriptClassFQName).kotlin
+ clazz.asSuccess()
+ } catch (e: Throwable) {
+ ResultWithDiagnostics.Failure(
+ ScriptDiagnostic(
+ "Unable to instantiate class $scriptClassFQName",
+ exception = e
+ )
+ )
+ }
+
+}
+
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompilerProxy.kt b/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompilerProxy.kt
new file mode 100644
index 00000000..7e9e8688
--- /dev/null
+++ b/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintCompilerProxy.kt
@@ -0,0 +1,150 @@
+/*
+ * 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.scripts
+
+import org.jetbrains.kotlin.com.intellij.openapi.util.Disposer
+import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
+import org.jetbrains.kotlin.cli.common.config.addKotlinSourceRoots
+import org.jetbrains.kotlin.cli.common.environment.setIdeaIoUseFallback
+import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport
+import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
+import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
+import org.jetbrains.kotlin.cli.common.messages.MessageCollector
+import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
+import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
+import org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler
+import org.jetbrains.kotlin.cli.jvm.config.JvmClasspathRoot
+import org.jetbrains.kotlin.config.*
+import org.slf4j.LoggerFactory
+import java.io.File
+import kotlin.script.experimental.api.*
+import kotlin.script.experimental.host.ScriptingHostConfiguration
+import kotlin.script.experimental.jvm.util.classpathFromClasspathProperty
+import kotlin.script.experimental.jvmhost.KJvmCompilerProxy
+
+open class BluePrintsCompilerProxy(private val hostConfiguration: ScriptingHostConfiguration) : KJvmCompilerProxy {
+
+ private val log = LoggerFactory.getLogger(BluePrintsCompilerProxy::class.java)!!
+
+ override fun compile(script: SourceCode, scriptCompilationConfiguration: ScriptCompilationConfiguration)
+ : ResultWithDiagnostics<CompiledScript<*>> {
+
+ val messageCollector = ScriptDiagnosticsMessageCollector()
+
+ fun failure(vararg diagnostics: ScriptDiagnostic): ResultWithDiagnostics.Failure =
+ ResultWithDiagnostics.Failure(*messageCollector.diagnostics.toTypedArray(), *diagnostics)
+
+ // Compile the Code
+ try {
+
+ log.trace("Scripting Host Configuration : $hostConfiguration")
+
+ setIdeaIoUseFallback()
+
+ val blueprintSourceCode = script as BluePrintSourceCode
+
+ val compiledJarFile = blueprintSourceCode.targetJarFile
+
+ if (!compiledJarFile.exists() || blueprintSourceCode.regenerate) {
+
+ var environment: KotlinCoreEnvironment? = null
+
+ val rootDisposable = Disposer.newDisposable()
+
+ val compilerConfiguration = CompilerConfiguration().apply {
+
+ put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, messageCollector)
+ put(CommonConfigurationKeys.MODULE_NAME, blueprintSourceCode.moduleName)
+ put(JVMConfigurationKeys.OUTPUT_JAR, compiledJarFile)
+ put(JVMConfigurationKeys.RETAIN_OUTPUT_IN_MEMORY, false)
+
+ // Load Current Class loader to Compilation Class loader
+ val currentClassLoader = classpathFromClasspathProperty()
+ currentClassLoader?.forEach {
+ add(CLIConfigurationKeys.CONTENT_ROOTS, JvmClasspathRoot(it))
+ }
+
+ // Add all Kotlin Sources
+ addKotlinSourceRoots(blueprintSourceCode.blueprintKotlinSources)
+
+ languageVersionSettings = LanguageVersionSettingsImpl(
+ LanguageVersion.LATEST_STABLE, ApiVersion.LATEST_STABLE, mapOf(AnalysisFlags.skipMetadataVersionCheck to true)
+ )
+ }
+
+ //log.info("Executing with compiler configuration : $compilerConfiguration")
+
+ environment = KotlinCoreEnvironment.createForProduction(rootDisposable, compilerConfiguration,
+ EnvironmentConfigFiles.JVM_CONFIG_FILES)
+
+ // Compile Kotlin Sources
+ val compiled = KotlinToJVMBytecodeCompiler.compileBunchOfSources(environment)
+
+ log.info("Generated jar(${compiledJarFile.absolutePath}) status : $compiled}")
+
+ val analyzerWithCompilerReport = AnalyzerWithCompilerReport(messageCollector,
+ environment.configuration.languageVersionSettings)
+
+ if (analyzerWithCompilerReport.hasErrors()) {
+ return failure()
+ }
+ }
+
+ val res = BluePrintCompiledScript<File>(scriptCompilationConfiguration, compiledJarFile)
+
+ return ResultWithDiagnostics.Success(res, messageCollector.diagnostics)
+
+ } catch (ex: Throwable) {
+ return failure(ex.asDiagnostics())
+ }
+ }
+}
+
+class ScriptDiagnosticsMessageCollector : MessageCollector {
+
+ private val _diagnostics = arrayListOf<ScriptDiagnostic>()
+
+ val diagnostics: List<ScriptDiagnostic> get() = _diagnostics
+
+ override fun clear() {
+ _diagnostics.clear()
+ }
+
+ override fun hasErrors(): Boolean =
+ _diagnostics.any { it.severity == ScriptDiagnostic.Severity.ERROR }
+
+
+ override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
+ val mappedSeverity = when (severity) {
+ CompilerMessageSeverity.EXCEPTION,
+ CompilerMessageSeverity.ERROR -> ScriptDiagnostic.Severity.ERROR
+ CompilerMessageSeverity.STRONG_WARNING,
+ CompilerMessageSeverity.WARNING -> ScriptDiagnostic.Severity.WARNING
+ CompilerMessageSeverity.INFO -> ScriptDiagnostic.Severity.INFO
+ CompilerMessageSeverity.LOGGING -> ScriptDiagnostic.Severity.DEBUG
+ else -> null
+ }
+ if (mappedSeverity != null) {
+ val mappedLocation = location?.let {
+ if (it.line < 0 && it.column < 0) null // special location created by CompilerMessageLocation.create
+ else SourceCode.Location(SourceCode.Position(it.line, it.column))
+ }
+ _diagnostics.add(ScriptDiagnostic(message, mappedSeverity, location?.path, mappedLocation))
+ }
+ }
+}
+
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintScriptConfiguration.kt b/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintScriptConfiguration.kt
new file mode 100644
index 00000000..3b3a5907
--- /dev/null
+++ b/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BluePrintScriptConfiguration.kt
@@ -0,0 +1,61 @@
+/*
+ * 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.scripts
+
+import java.io.File
+import kotlin.script.experimental.annotations.KotlinScript
+import kotlin.script.experimental.api.ScriptCompilationConfiguration
+import kotlin.script.experimental.api.SourceCode
+import kotlin.script.experimental.api.defaultImports
+import kotlin.script.experimental.jvm.jvm
+import kotlin.script.experimental.jvm.util.classpathFromClassloader
+
+@KotlinScript(
+ fileExtension = "cba.kts",
+ compilationConfiguration = BluePrintScripCompilationConfiguration::class,
+ displayName = "Controller Blueprint Archive Kotlin Scripts"
+)
+abstract class BluePrintKotlinScript
+
+object BluePrintScripCompilationConfiguration : ScriptCompilationConfiguration(
+ {
+ defaultImports(
+ "org.onap.ccsdk.apps.controllerblueprints.core.*",
+ "org.onap.ccsdk.apps.controllerblueprints.core.data.*",
+ "org.onap.ccsdk.apps.controllerblueprints.core.interfaces.*",
+ "org.onap.ccsdk.apps.controllerblueprints.core.services.*",
+ "org.onap.ccsdk.apps.controllerblueprints.core.utils.*")
+ jvm {
+ classpathFromClassloader(BluePrintScripCompilationConfiguration::class.java.classLoader)
+ }
+ }
+)
+
+open class BluePrintSourceCode : SourceCode {
+ lateinit var blueprintKotlinSources: MutableList<String>
+ lateinit var moduleName: String
+ lateinit var targetJarFile: File
+ var regenerate: Boolean = false
+
+ override val text: String
+ get() = ""
+
+ override val locationId: String? = null
+
+ override val name: String?
+ get() = moduleName
+}
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BlueprintScriptingHost.kt b/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BlueprintScriptingHost.kt
new file mode 100644
index 00000000..59ce4abb
--- /dev/null
+++ b/ms/controllerblueprints/modules/blueprint-scripts/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BlueprintScriptingHost.kt
@@ -0,0 +1,92 @@
+/*
+ * 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.scripts
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
+import org.slf4j.LoggerFactory
+import java.util.*
+import kotlin.script.experimental.api.*
+import kotlin.script.experimental.host.BasicScriptingHost
+import kotlin.script.experimental.jvm.defaultJvmScriptingHostConfiguration
+import kotlin.script.experimental.jvmhost.JvmScriptCompiler
+import kotlin.script.experimental.jvmhost.impl.withDefaults
+
+val blueprintScriptCompiler = JvmScriptCompiler(defaultJvmScriptingHostConfiguration,
+ BluePrintsCompilerProxy(defaultJvmScriptingHostConfiguration.withDefaults()))
+
+open class BlueprintScriptingHost(evaluator: ScriptEvaluator) : BasicScriptingHost(blueprintScriptCompiler, evaluator) {
+
+ override fun eval(
+ script: SourceCode,
+ scriptCompilationConfiguration: ScriptCompilationConfiguration,
+ configuration: ScriptEvaluationConfiguration?
+ ): ResultWithDiagnostics<EvaluationResult> =
+
+ runInCoroutineContext {
+
+ compiler(script, scriptCompilationConfiguration)
+ .onSuccess {
+ evaluator(it, configuration)
+ }
+ }
+}
+
+
+open class BluePrintScriptEvaluator<T>(private val scriptClassName: String) : ScriptEvaluator {
+
+ private val log = LoggerFactory.getLogger(BluePrintScriptEvaluator::class.java)!!
+
+ override suspend operator fun invoke(
+ compiledScript: CompiledScript<*>,
+ scriptEvaluationConfiguration: ScriptEvaluationConfiguration?
+ ): ResultWithDiagnostics<EvaluationResult> =
+ try {
+ log.info("Getting class name($scriptClassName) of type() from the compiled sources ")
+ val bluePrintCompiledScript = compiledScript as BluePrintCompiledScript
+ bluePrintCompiledScript.scriptClassFQName = scriptClassName
+
+ val res = compiledScript.getClass(scriptEvaluationConfiguration)
+ when (res) {
+ is ResultWithDiagnostics.Failure -> res
+ is ResultWithDiagnostics.Success -> {
+
+ val scriptClass = res.value
+ val args = ArrayList<Any?>()
+ scriptEvaluationConfiguration?.get(ScriptEvaluationConfiguration.providedProperties)?.forEach {
+ args.add(it.value)
+ }
+ scriptEvaluationConfiguration?.get(ScriptEvaluationConfiguration.implicitReceivers)?.let {
+ args.addAll(it)
+ }
+ scriptEvaluationConfiguration?.get(ScriptEvaluationConfiguration.constructorArgs)?.let {
+ args.addAll(it)
+ }
+
+ val instance = scriptClass.java.newInstance() as? T
+ ?: throw BluePrintProcessorException("failed to create instance from the script")
+
+ log.info("Created script instance successfully....")
+
+ ResultWithDiagnostics.Success(EvaluationResult(ResultValue.Value(scriptClass.qualifiedName!!,
+ instance, "", instance),
+ scriptEvaluationConfiguration))
+ }
+ }
+ } catch (e: Throwable) {
+ ResultWithDiagnostics.Failure(e.asDiagnostics("Error evaluating script"))
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BlueprintScriptingHostTest.kt b/ms/controllerblueprints/modules/blueprint-scripts/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BlueprintScriptingHostTest.kt
new file mode 100644
index 00000000..4b6f2a47
--- /dev/null
+++ b/ms/controllerblueprints/modules/blueprint-scripts/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/scripts/BlueprintScriptingHostTest.kt
@@ -0,0 +1,88 @@
+/*
+ * 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.scripts
+
+
+import org.apache.commons.io.FileUtils
+import org.junit.Ignore
+import org.junit.Test
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode
+import java.io.File
+import kotlin.script.experimental.jvm.util.classpathFromClass
+import kotlin.script.experimental.jvm.util.classpathFromClassloader
+import kotlin.script.experimental.jvm.util.classpathFromClasspathProperty
+import kotlin.script.experimental.jvmhost.createJvmCompilationConfigurationFromTemplate
+
+class BlueprintScriptingHostTest {
+
+ @Test
+ @Ignore
+ fun `test classpaths`() {
+
+ println(" *********** classpathFromClass *********** ")
+ classpathFromClass(BlueprintScriptingHostTest::class.java.classLoader,
+ BlueprintScriptingHostTest::class)!!
+ .forEach(::println)
+
+ println(" *********** classpathFromClassloader *********** ")
+ classpathFromClassloader(BlueprintScriptingHostTest::class.java.classLoader)!!
+ .forEach(::println)
+
+ println(" *********** classpathFromClasspathProperty *********** ")
+ classpathFromClasspathProperty()!!
+ .forEach(::println)
+ }
+
+ @Test
+ fun `test same script two folders`() {
+
+ FileUtils.forceMkdir(File("target/scripts1/"))
+ FileUtils.forceMkdir(File("target/scripts2/"))
+
+ val scriptSource1 = BluePrintSourceCode()
+ scriptSource1.moduleName = "blueprint-test-script"
+
+ scriptSource1.targetJarFile = File("target/scripts1/blueprint-script-generated.jar")
+ val sources1: MutableList<String> = arrayListOf()
+ sources1.add("src/test/resources/scripts1")
+ scriptSource1.blueprintKotlinSources = sources1
+
+ val scriptClassName = "Simple_cba\$SampleComponentFunction"
+
+ val compilationConfiguration = createJvmCompilationConfigurationFromTemplate<BluePrintKotlinScript>()
+
+ val scriptEvaluator = BluePrintScriptEvaluator<BlueprintFunctionNode<String, String>>(scriptClassName)
+
+ val scriptSource2 = BluePrintSourceCode()
+ scriptSource2.moduleName = "blueprint-test-script"
+
+ scriptSource2.targetJarFile = File("target/scripts2/blueprint-script-generated.jar")
+ val sources2: MutableList<String> = arrayListOf()
+ sources2.add("src/test/resources/scripts2")
+ scriptSource2.blueprintKotlinSources = sources2
+
+ for (i in 1..2) {
+ val evalResponse = BlueprintScriptingHost(scriptEvaluator).eval(scriptSource1, compilationConfiguration,
+ null)
+ }
+
+ for (i in 1..2) {
+ val evalResponse = BlueprintScriptingHost(scriptEvaluator).eval(scriptSource2, compilationConfiguration,
+ null)
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts1/simple.cba.kts b/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts1/simple.cba.kts
new file mode 100644
index 00000000..9f61c649
--- /dev/null
+++ b/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts1/simple.cba.kts
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode
+import org.springframework.stereotype.Service
+
+@Service
+open class SampleComponentFunction : BlueprintFunctionNode<String, String> {
+
+ override fun getName(): String {
+ println("Printing Name....." + "sample".asJsonPrimitive())
+ return "my Name"
+ }
+
+ override fun prepareRequest(executionRequest: String): String {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun process(executionRequest: String) {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun recover(runtimeException: RuntimeException, executionRequest: String) {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun prepareResponse(): String {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun apply(t: String): String {
+ return "Script 1 response - $t"
+ }
+}
+
+val blueprintFunction = SampleComponentFunction()
+
+val serviceTemplate = ServiceTemplate()
+
+println("Simple script printing....")
diff --git a/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts2/simple.cba.kts b/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts2/simple.cba.kts
new file mode 100644
index 00000000..84517254
--- /dev/null
+++ b/ms/controllerblueprints/modules/blueprint-scripts/src/test/resources/scripts2/simple.cba.kts
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode
+import org.springframework.stereotype.Service
+
+@Service
+open class SampleComponentFunction : BlueprintFunctionNode<String, String> {
+
+ override fun getName(): String {
+ println("Printing Name....." + "sample".asJsonPrimitive())
+ return "my Name"
+ }
+
+ override fun prepareRequest(executionRequest: String): String {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun process(executionRequest: String) {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun recover(runtimeException: RuntimeException, executionRequest: String) {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun prepareResponse(): String {
+ TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
+ }
+
+ override fun apply(t: String): String {
+ return "Script 2 response - $t"
+ }
+}
+
+val blueprintFunction = SampleComponentFunction()
+
+val serviceTemplate = ServiceTemplate()
+
+println("Simple script printing....")
diff --git a/ms/controllerblueprints/modules/pom.xml b/ms/controllerblueprints/modules/pom.xml
index 3857ef5d..834db24e 100644
--- a/ms/controllerblueprints/modules/pom.xml
+++ b/ms/controllerblueprints/modules/pom.xml
@@ -30,6 +30,7 @@
<module>service</module>
<module>blueprint-validation</module>
<module>db-resources</module>
+ <module>blueprint-scripts</module>
</modules>
<build>
diff --git a/ms/controllerblueprints/modules/service/pom.xml b/ms/controllerblueprints/modules/service/pom.xml
index 9868b17b..73fe0739 100644
--- a/ms/controllerblueprints/modules/service/pom.xml
+++ b/ms/controllerblueprints/modules/service/pom.xml
@@ -32,10 +32,6 @@
<dependencies>
<dependency>
<groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
<artifactId>db-resources</artifactId>
</dependency>
<dependency>
@@ -44,7 +40,7 @@
</dependency>
<dependency>
<groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>resource-dict</artifactId>
+ <artifactId>blueprint-scripts</artifactId>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelService.java
deleted file mode 100644
index 3cf144f1..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelService.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * 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 java.io.IOException;
-import java.nio.file.Path;
-import java.util.List;
-import java.util.Optional;
-import org.jetbrains.annotations.NotNull;
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.onap.ccsdk.apps.controllerblueprints.core.common.ApplicationConstants;
-import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration;
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ErrorCode;
-import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintCatalogService;
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintFileUtils;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModel;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModelSearch;
-import org.onap.ccsdk.apps.controllerblueprints.service.repository.ControllerBlueprintModelContentRepository;
-import org.onap.ccsdk.apps.controllerblueprints.service.repository.ControllerBlueprintModelRepository;
-import org.onap.ccsdk.apps.controllerblueprints.service.repository.ControllerBlueprintModelSearchRepository;
-import org.onap.ccsdk.apps.controllerblueprints.service.utils.BluePrintEnhancerUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.io.ByteArrayResource;
-import org.springframework.core.io.Resource;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.http.codec.multipart.FilePart;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import reactor.core.publisher.Mono;
-
-/**
- * BlueprintModelService.java Purpose: Provide Service Template Service processing BlueprintModelService
- *
- * @author Brinda Santh
- * @version 1.0
- */
-
-@Service
-public class BlueprintModelService {
-
- @Autowired
- private BluePrintLoadConfiguration bluePrintLoadConfiguration;
-
- @Autowired
- private BluePrintCatalogService bluePrintCatalogService;
-
- @Autowired
- private ControllerBlueprintModelSearchRepository blueprintModelSearchRepository;
-
- @Autowired
- private ControllerBlueprintModelRepository blueprintModelRepository;
-
- @Autowired
- private ControllerBlueprintModelContentRepository blueprintModelContentRepository;
-
- private static final String BLUEPRINT_MODEL_ID_FAILURE_MSG = "failed to get blueprint model id(%s) from repo";
- private static final String BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG = "failed to get blueprint model by name(%s)" +
- " and version(%s) from repo";
-
- /**
- * This is a saveBlueprintModel method
- *
- * @param filePart filePart
- * @return Mono<BlueprintModelSearch>
- * @throws BluePrintException BluePrintException
- */
- public Mono<BlueprintModelSearch> saveBlueprintModel(FilePart filePart) throws BluePrintException {
- try {
- Path cbaLocation = BluePrintFileUtils.Companion
- .getCbaStorageDirectory(bluePrintLoadConfiguration.blueprintArchivePath);
- return BluePrintEnhancerUtils.Companion.saveCBAFile(filePart, cbaLocation).map(fileName -> {
- String blueprintId = null;
- try {
- blueprintId = bluePrintCatalogService
- .saveToDatabase(cbaLocation.toFile(), false);
- } catch (BluePrintException e) {
- // FIXME handle expection
- }
- return blueprintModelSearchRepository.findById(blueprintId).get();
- });
- } catch (IOException e) {
- throw new BluePrintException(ErrorCode.IO_FILE_INTERRUPT.getValue(),
- String.format("I/O Error while uploading the CBA file: %s", e.getMessage()), e);
- }
- }
-
- /**
- * This is a publishBlueprintModel method to change the status published to YES
- *
- * @param id id
- * @return BlueprintModelSearch
- * @throws BluePrintException BluePrintException
- */
- public BlueprintModelSearch publishBlueprintModel(String id) throws BluePrintException {
- BlueprintModelSearch blueprintModelSearch;
- Optional<BlueprintModelSearch> dbBlueprintModel = blueprintModelSearchRepository.findById(id);
- if (dbBlueprintModel.isPresent()) {
- blueprintModelSearch = dbBlueprintModel.get();
- } else {
- String msg = String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id);
- throw new BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.getValue(), msg);
- }
- blueprintModelSearch.setPublished(ApplicationConstants.ACTIVE_Y);
- return blueprintModelSearchRepository.saveAndFlush(blueprintModelSearch);
- }
-
- /**
- * This is a searchBlueprintModels method
- *
- * @param tags tags
- * @return List<BlueprintModelSearch>
- */
- public List<BlueprintModelSearch> searchBlueprintModels(String tags) {
- return blueprintModelSearchRepository.findByTagsContainingIgnoreCase(tags);
- }
-
- /**
- * This is a getBlueprintModelSearchByNameAndVersion method
- *
- * @param name name
- * @param version version
- * @return BlueprintModelSearch
- * @throws BluePrintException BluePrintException
- */
- public BlueprintModelSearch getBlueprintModelSearchByNameAndVersion(@NotNull String name, @NotNull String version)
- throws BluePrintException {
- BlueprintModelSearch blueprintModelSearch;
- Optional<BlueprintModelSearch> dbBlueprintModel = blueprintModelSearchRepository
- .findByArtifactNameAndArtifactVersion(name, version);
- if (dbBlueprintModel.isPresent()) {
- blueprintModelSearch = dbBlueprintModel.get();
- } else {
- throw new BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.getValue(),
- String.format(BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG, name, version));
- }
- return blueprintModelSearch;
- }
-
- /**
- * This is a downloadBlueprintModelFileByNameAndVersion method to download a Blueprint by Name and Version
- *
- * @param name name
- * @param version version
- * @return ResponseEntity<Resource>
- * @throws BluePrintException BluePrintException
- */
- public ResponseEntity<Resource> downloadBlueprintModelFileByNameAndVersion(@NotNull String name,
- @NotNull String version)
- throws BluePrintException {
- BlueprintModel blueprintModel;
- try {
- blueprintModel = getBlueprintModelByNameAndVersion(name, version);
- } catch (BluePrintException e) {
- throw new BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.getValue(), String.format("Error while " +
- "downloading the CBA file: %s", e.getMessage()), e);
- }
- String fileName = blueprintModel.getId() + ".zip";
- byte[] file = blueprintModel.getBlueprintModelContent().getContent();
- return prepareResourceEntity(fileName, file);
- }
-
- /**
- * This is a downloadBlueprintModelFile method to find the target file to download and return a file resource
- *
- * @return ResponseEntity<Resource>
- * @throws BluePrintException BluePrintException
- */
- public ResponseEntity<Resource> downloadBlueprintModelFile(@NotNull String id) throws BluePrintException {
- BlueprintModel blueprintModel;
- try {
- blueprintModel = getBlueprintModel(id);
- } catch (BluePrintException e) {
- throw new BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.getValue(), String.format("Error while " +
- "downloading the CBA file: %s", e.getMessage()), e);
- }
- String fileName = blueprintModel.getId() + ".zip";
- byte[] file = blueprintModel.getBlueprintModelContent().getContent();
- return prepareResourceEntity(fileName, file);
- }
-
- /**
- * @return ResponseEntity<Resource>
- */
- private ResponseEntity<Resource> prepareResourceEntity(String fileName, byte[] file) {
- return ResponseEntity.ok()
- .contentType(MediaType.parseMediaType("text/plain"))
- .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + fileName + "\"")
- .body(new ByteArrayResource(file));
- }
-
- /**
- * This is a getBlueprintModel method
- *
- * @param id id
- * @return BlueprintModel
- * @throws BluePrintException BluePrintException
- */
- private BlueprintModel getBlueprintModel(@NotNull String id) throws BluePrintException {
- BlueprintModel blueprintModel;
- Optional<BlueprintModel> dbBlueprintModel = blueprintModelRepository.findById(id);
- if (dbBlueprintModel.isPresent()) {
- blueprintModel = dbBlueprintModel.get();
- } else {
- String msg = String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id);
- throw new BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.getValue(), msg);
- }
- return blueprintModel;
- }
-
- /**
- * This is a getBlueprintModelByNameAndVersion method
- *
- * @param name name
- * @param version version
- * @return BlueprintModel
- * @throws BluePrintException BluePrintException
- */
- private BlueprintModel getBlueprintModelByNameAndVersion(@NotNull String name, @NotNull String version)
- throws BluePrintException {
- BlueprintModel blueprintModel = blueprintModelRepository
- .findByArtifactNameAndArtifactVersion(name, version);
- if (blueprintModel != null) {
- return blueprintModel;
- } else {
- String msg = String.format(BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG, name, version);
- throw new BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.getValue(), msg);
- }
- }
-
- /**
- * This is a getBlueprintModelSearch method
- *
- * @param id id
- * @return BlueprintModelSearch
- * @throws BluePrintException BluePrintException
- */
- public BlueprintModelSearch getBlueprintModelSearch(@NotNull String id) throws BluePrintException {
- BlueprintModelSearch blueprintModelSearch;
- Optional<BlueprintModelSearch> dbBlueprintModel = blueprintModelSearchRepository.findById(id);
- if (dbBlueprintModel.isPresent()) {
- blueprintModelSearch = dbBlueprintModel.get();
- } else {
- String msg = String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id);
- throw new BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.getValue(), msg);
- }
-
- return blueprintModelSearch;
- }
-
- /**
- * This is a deleteBlueprintModel method
- *
- * @param id id
- * @throws BluePrintException BluePrintException
- */
- @Transactional
- public void deleteBlueprintModel(@NotNull String id) throws BluePrintException {
- Optional<BlueprintModel> dbBlueprintModel = blueprintModelRepository.findById(id);
- if (dbBlueprintModel.isPresent()) {
- blueprintModelContentRepository.deleteByBlueprintModel(dbBlueprintModel.get());
- blueprintModelRepository.delete(dbBlueprintModel.get());
- } else {
- String msg = String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id);
- throw new BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.getValue(), msg);
- }
- }
-
- /**
- * This is a getAllBlueprintModel method to retrieve all the BlueprintModel in Database
- *
- * @return List<BlueprintModelSearch> list of the controller blueprint archives
- */
- public List<BlueprintModelSearch> getAllBlueprintModel() {
- return blueprintModelSearchRepository.findAll();
- }
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/BlueprintModelRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/BlueprintModelRest.java
deleted file mode 100644
index 255137bf..00000000
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/BlueprintModelRest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2019 Bell Canada.
- *
- * 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.rs;
-
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.onap.ccsdk.apps.controllerblueprints.service.BlueprintModelService;
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModelSearch;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.io.Resource;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.http.codec.multipart.FilePart;
-import org.springframework.web.bind.annotation.*;
-import reactor.core.publisher.Mono;
-
-import java.util.List;
-
-/**
- * {@inheritDoc}
- */
-@RestController
-@RequestMapping(value = "/api/v1/blueprint-model")
-public class BlueprintModelRest {
-
- @Autowired
- private BlueprintModelService blueprintModelService;
-
- @PostMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
- public @ResponseBody
- Mono<BlueprintModelSearch> saveBlueprint(@RequestPart("file") FilePart file) throws BluePrintException{
- return blueprintModelService.saveBlueprintModel(file);
- }
-
- @DeleteMapping(path = "/{id}")
- public void deleteBlueprint(@PathVariable(value = "id") String id) throws BluePrintException {
- this.blueprintModelService.deleteBlueprintModel(id);
- }
-
- @GetMapping(path = "/by-name/{name}/version/{version}", produces = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- BlueprintModelSearch getBlueprintByNameAndVersion(@PathVariable(value = "name") String name,
- @PathVariable(value = "version") String version) throws BluePrintException {
- return this.blueprintModelService.getBlueprintModelSearchByNameAndVersion(name, version);
- }
-
- @GetMapping(path = "/download/by-name/{name}/version/{version}", produces = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- ResponseEntity<Resource> downloadBlueprintByNameAndVersion(@PathVariable(value = "name") String name,
- @PathVariable(value = "version") String version) throws BluePrintException {
- return this.blueprintModelService.downloadBlueprintModelFileByNameAndVersion(name, version);
- }
-
- @GetMapping(path = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- BlueprintModelSearch getBlueprintModel(@PathVariable(value = "id") String id) throws BluePrintException {
- return this.blueprintModelService.getBlueprintModelSearch(id);
- }
-
- @GetMapping(path = "", produces = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- List<BlueprintModelSearch> getAllBlueprintModel() {
- return this.blueprintModelService.getAllBlueprintModel();
- }
-
- @GetMapping(path = "/download/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- ResponseEntity<Resource> downloadBluePrint(@PathVariable(value = "id") String id) throws BluePrintException {
- return this.blueprintModelService.downloadBlueprintModelFile(id);
- }
-
- @PutMapping(path = "/publish/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- BlueprintModelSearch publishBlueprintModel(@PathVariable(value = "id") String id) throws BluePrintException {
- return this.blueprintModelService.publishBlueprintModel(id);
- }
-
- @GetMapping(path = "/search/{tags}", produces = MediaType.APPLICATION_JSON_VALUE)
- public @ResponseBody
- List<BlueprintModelSearch> searchBlueprintModels(@PathVariable(value = "tags") String tags) {
- return this.blueprintModelService.searchBlueprintModels(tags);
- }
-}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelRest.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelRest.kt
new file mode 100644
index 00000000..0fca07b0
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelRest.kt
@@ -0,0 +1,100 @@
+/*
+ * Copyright © 2019 Bell Canada 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.controller
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModelSearch
+import org.onap.ccsdk.apps.controllerblueprints.service.handler.BluePrintModelHandler
+import org.springframework.core.io.Resource
+import org.springframework.http.MediaType
+import org.springframework.http.ResponseEntity
+import org.springframework.http.codec.multipart.FilePart
+import org.springframework.web.bind.annotation.*
+import reactor.core.publisher.Mono
+
+/**
+ * BlueprintModelRest Purpose: Handle controllerBlueprint API request
+ *
+ * @author Vinal Patel
+ * @version 1.0
+ */
+@RestController
+@RequestMapping("/api/v1/blueprint-model")
+open class BlueprintModelRest(private val bluePrintModelHandler: BluePrintModelHandler) {
+
+ @PostMapping("", produces = [MediaType.APPLICATION_JSON_VALUE], consumes = [MediaType.MULTIPART_FORM_DATA_VALUE])
+ @ResponseBody
+ @Throws(BluePrintException::class)
+ fun saveBlueprint(@RequestPart("file") file: FilePart): Mono<BlueprintModelSearch> {
+ return bluePrintModelHandler.saveBlueprintModel(file)
+ }
+
+ @GetMapping("", produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ResponseBody
+ fun allBlueprintModel(): List<BlueprintModelSearch> {
+ return this.bluePrintModelHandler.allBlueprintModel()
+ }
+
+ @DeleteMapping("/{id}")
+ @Throws(BluePrintException::class)
+ fun deleteBlueprint(@PathVariable(value = "id") id: String) {
+ this.bluePrintModelHandler.deleteBlueprintModel(id)
+ }
+
+ @GetMapping("/by-name/{name}/version/{version}", produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ResponseBody
+ @Throws(BluePrintException::class)
+ fun getBlueprintByNameAndVersion(@PathVariable(value = "name") name: String,
+ @PathVariable(value = "version") version: String): BlueprintModelSearch {
+ return this.bluePrintModelHandler.getBlueprintModelSearchByNameAndVersion(name, version)
+ }
+
+ @GetMapping("/download/by-name/{name}/version/{version}", produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ResponseBody
+ @Throws(BluePrintException::class)
+ fun downloadBlueprintByNameAndVersion(@PathVariable(value = "name") name: String,
+ @PathVariable(value = "version") version: String): ResponseEntity<Resource> {
+ return this.bluePrintModelHandler.downloadBlueprintModelFileByNameAndVersion(name, version)
+ }
+
+ @GetMapping("/{id}", produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ResponseBody
+ @Throws(BluePrintException::class)
+ fun getBlueprintModel(@PathVariable(value = "id") id: String): BlueprintModelSearch {
+ return this.bluePrintModelHandler.getBlueprintModelSearch(id)
+ }
+
+ @GetMapping("/download/{id}", produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ResponseBody
+ @Throws(BluePrintException::class)
+ fun downloadBluePrint(@PathVariable(value = "id") id: String): ResponseEntity<Resource> {
+ return this.bluePrintModelHandler.downloadBlueprintModelFile(id)
+ }
+
+ @PutMapping("/publish/{id}", produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ResponseBody
+ @Throws(BluePrintException::class)
+ fun publishBlueprintModel(@PathVariable(value = "id") id: String): BlueprintModelSearch {
+ return this.bluePrintModelHandler.publishBlueprintModel(id)
+ }
+
+ @GetMapping("/search/{tags}", produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ResponseBody
+ fun searchBlueprintModels(@PathVariable(value = "tags") tags: String): List<BlueprintModelSearch> {
+ return this.bluePrintModelHandler.searchBlueprintModels(tags)
+ }
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt
index a0e47d72..04753391 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/ControllerBlueprintExeptionHandler.kt
@@ -25,7 +25,7 @@ import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.ExceptionHandler
/**
- * ControllerBlueprintExceptionHandler.java Purpose: Handle exceptions in controllerBlueprint API and provide the wright
+ * ControllerBlueprintExceptionHandler Purpose: Handle exceptions in controllerBlueprint API and provide the right
* HTTP code status
*
* @author Vinal Patel
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/BluePrintModelHandler.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/BluePrintModelHandler.kt
new file mode 100644
index 00000000..907566c3
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/handler/BluePrintModelHandler.kt
@@ -0,0 +1,283 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2019 Bell Canada.
+ *
+ * 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.handler
+
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
+import org.onap.ccsdk.apps.controllerblueprints.core.common.ApplicationConstants
+import org.onap.ccsdk.apps.controllerblueprints.core.config.BluePrintLoadConfiguration
+import org.onap.ccsdk.apps.controllerblueprints.core.data.ErrorCode
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintCatalogService
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintFileUtils
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModel
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModelSearch
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ControllerBlueprintModelContentRepository
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ControllerBlueprintModelRepository
+import org.onap.ccsdk.apps.controllerblueprints.service.repository.ControllerBlueprintModelSearchRepository
+import org.onap.ccsdk.apps.controllerblueprints.service.utils.BluePrintEnhancerUtils
+import org.springframework.core.io.ByteArrayResource
+import org.springframework.core.io.Resource
+import org.springframework.http.HttpHeaders
+import org.springframework.http.MediaType
+import org.springframework.http.ResponseEntity
+import org.springframework.http.codec.multipart.FilePart
+import org.springframework.stereotype.Service
+import org.springframework.transaction.annotation.Transactional
+import reactor.core.publisher.Mono
+import java.io.IOException
+
+/**
+ * BlueprintModelHandler Purpose: Handler service to handle the request from BlurPrintModelRest
+ *
+ * @author Brinda Santh
+ * @version 1.0
+ */
+
+@Service
+open class BluePrintModelHandler(private val bluePrintCatalogService: BluePrintCatalogService, private val bluePrintLoadConfiguration: BluePrintLoadConfiguration,
+ private val blueprintModelSearchRepository: ControllerBlueprintModelSearchRepository,
+ private val blueprintModelRepository: ControllerBlueprintModelRepository,
+ private val blueprintModelContentRepository: ControllerBlueprintModelContentRepository) {
+
+ /**
+ * This is a getAllBlueprintModel method to retrieve all the BlueprintModel in Database
+ *
+ * @return List<BlueprintModelSearch> list of the controller blueprint archives
+ </BlueprintModelSearch> */
+ open fun allBlueprintModel(): List<BlueprintModelSearch> {
+ return blueprintModelSearchRepository.findAll()
+ }
+
+ /**
+ * This is a saveBlueprintModel method
+ *
+ * @param filePart filePart
+ * @return Mono<BlueprintModelSearch>
+ * @throws BluePrintException BluePrintException
+ </BlueprintModelSearch> */
+ @Throws(BluePrintException::class)
+ open fun saveBlueprintModel(filePart: FilePart): Mono<BlueprintModelSearch> {
+ try {
+ val cbaLocation = BluePrintFileUtils.getCbaStorageDirectory(bluePrintLoadConfiguration.blueprintArchivePath)
+ return BluePrintEnhancerUtils.saveCBAFile(filePart, cbaLocation).map { fileName ->
+ var blueprintId: String? = null
+ try {
+ blueprintId = bluePrintCatalogService.saveToDatabase(cbaLocation.resolve(fileName).toFile(), false)
+ } catch (e: BluePrintException) {
+ // FIXME handle expection
+ }
+ blueprintModelSearchRepository.findById(blueprintId!!).get()
+ }
+ } catch (e: IOException) {
+ throw BluePrintException(ErrorCode.IO_FILE_INTERRUPT.value,
+ String.format("I/O Error while uploading the CBA file: %s", e.message), e)
+ }
+
+ }
+
+ /**
+ * This is a publishBlueprintModel method to change the status published to YES
+ *
+ * @param id id
+ * @return BlueprintModelSearch
+ * @throws BluePrintException BluePrintException
+ */
+ @Throws(BluePrintException::class)
+ open fun publishBlueprintModel(id: String): BlueprintModelSearch {
+ val blueprintModelSearch: BlueprintModelSearch
+ val dbBlueprintModel = blueprintModelSearchRepository.findById(id)
+ if (dbBlueprintModel.isPresent) {
+ blueprintModelSearch = dbBlueprintModel.get()
+ } else {
+ val msg = String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id)
+ throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, msg)
+ }
+ blueprintModelSearch.published = ApplicationConstants.ACTIVE_Y
+ return blueprintModelSearchRepository.saveAndFlush(blueprintModelSearch)
+ }
+
+ /**
+ * This is a searchBlueprintModels method
+ *
+ * @param tags tags
+ * @return List<BlueprintModelSearch>
+ </BlueprintModelSearch> */
+ open fun searchBlueprintModels(tags: String): List<BlueprintModelSearch> {
+ return blueprintModelSearchRepository.findByTagsContainingIgnoreCase(tags)
+ }
+
+ /**
+ * This is a getBlueprintModelSearchByNameAndVersion method
+ *
+ * @param name name
+ * @param version version
+ * @return BlueprintModelSearch
+ * @throws BluePrintException BluePrintException
+ */
+ @Throws(BluePrintException::class)
+ open fun getBlueprintModelSearchByNameAndVersion(name: String, version: String): BlueprintModelSearch {
+ val blueprintModelSearch: BlueprintModelSearch
+ val dbBlueprintModel = blueprintModelSearchRepository
+ .findByArtifactNameAndArtifactVersion(name, version)
+ if (dbBlueprintModel.isPresent) {
+ blueprintModelSearch = dbBlueprintModel.get()
+ } else {
+ throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value,
+ String.format(BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG, name, version))
+ }
+ return blueprintModelSearch
+ }
+
+ /**
+ * This is a downloadBlueprintModelFileByNameAndVersion method to download a Blueprint by Name and Version
+ *
+ * @param name name
+ * @param version version
+ * @return ResponseEntity<Resource>
+ * @throws BluePrintException BluePrintException
+ </Resource> */
+ @Throws(BluePrintException::class)
+ open fun downloadBlueprintModelFileByNameAndVersion(name: String,
+ version: String): ResponseEntity<Resource> {
+ val blueprintModel: BlueprintModel
+ try {
+ blueprintModel = getBlueprintModelByNameAndVersion(name, version)
+ } catch (e: BluePrintException) {
+ throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, String.format("Error while " + "downloading the CBA file: %s", e.message), e)
+ }
+
+ val fileName = blueprintModel.id + ".zip"
+ val file = blueprintModel.blueprintModelContent.content
+ return prepareResourceEntity(fileName, file)
+ }
+
+ /**
+ * This is a downloadBlueprintModelFile method to find the target file to download and return a file resource
+ *
+ * @return ResponseEntity<Resource>
+ * @throws BluePrintException BluePrintException
+ </Resource> */
+ @Throws(BluePrintException::class)
+ open fun downloadBlueprintModelFile(id: String): ResponseEntity<Resource> {
+ val blueprintModel: BlueprintModel
+ try {
+ blueprintModel = getBlueprintModel(id)
+ } catch (e: BluePrintException) {
+ throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, String.format("Error while " + "downloading the CBA file: %s", e.message), e)
+ }
+
+ val fileName = blueprintModel.id + ".zip"
+ val file = blueprintModel.blueprintModelContent.content
+ return prepareResourceEntity(fileName, file)
+ }
+
+ /**
+ * @return ResponseEntity<Resource>
+ </Resource> */
+ private fun prepareResourceEntity(fileName: String, file: ByteArray): ResponseEntity<Resource> {
+ return ResponseEntity.ok()
+ .contentType(MediaType.parseMediaType("text/plain"))
+ .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"$fileName\"")
+ .body(ByteArrayResource(file))
+ }
+
+ /**
+ * This is a getBlueprintModel method
+ *
+ * @param id id
+ * @return BlueprintModel
+ * @throws BluePrintException BluePrintException
+ */
+ @Throws(BluePrintException::class)
+ open fun getBlueprintModel(id: String): BlueprintModel {
+ val blueprintModel: BlueprintModel
+ val dbBlueprintModel = blueprintModelRepository.findById(id)
+ if (dbBlueprintModel.isPresent) {
+ blueprintModel = dbBlueprintModel.get()
+ } else {
+ val msg = String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id)
+ throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, msg)
+ }
+ return blueprintModel
+ }
+
+ /**
+ * This is a getBlueprintModelByNameAndVersion method
+ *
+ * @param name name
+ * @param version version
+ * @return BlueprintModel
+ * @throws BluePrintException BluePrintException
+ */
+ @Throws(BluePrintException::class)
+ open fun getBlueprintModelByNameAndVersion(name: String, version: String): BlueprintModel {
+ val blueprintModel = blueprintModelRepository
+ .findByArtifactNameAndArtifactVersion(name, version)
+ if (blueprintModel != null) {
+ return blueprintModel
+ } else {
+ val msg = String.format(BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG, name, version)
+ throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, msg)
+ }
+ }
+
+ /**
+ * This is a getBlueprintModelSearch method
+ *
+ * @param id id
+ * @return BlueprintModelSearch
+ * @throws BluePrintException BluePrintException
+ */
+ @Throws(BluePrintException::class)
+ open fun getBlueprintModelSearch(id: String): BlueprintModelSearch {
+ val blueprintModelSearch: BlueprintModelSearch
+ val dbBlueprintModel = blueprintModelSearchRepository.findById(id)
+ if (dbBlueprintModel.isPresent) {
+ blueprintModelSearch = dbBlueprintModel.get()
+ } else {
+ val msg = String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id)
+ throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, msg)
+ }
+
+ return blueprintModelSearch
+ }
+
+ /**
+ * This is a deleteBlueprintModel method
+ *
+ * @param id id
+ * @throws BluePrintException BluePrintException
+ */
+ @Transactional
+ @Throws(BluePrintException::class)
+ open fun deleteBlueprintModel(id: String) {
+ val dbBlueprintModel = blueprintModelRepository.findById(id)
+ if (dbBlueprintModel.isPresent) {
+ blueprintModelContentRepository.deleteByBlueprintModel(dbBlueprintModel.get())
+ blueprintModelRepository.delete(dbBlueprintModel.get())
+ } else {
+ val msg = String.format(BLUEPRINT_MODEL_ID_FAILURE_MSG, id)
+ throw BluePrintException(ErrorCode.RESOURCE_NOT_FOUND.value, msg)
+ }
+ }
+
+ companion object {
+
+ private const val BLUEPRINT_MODEL_ID_FAILURE_MSG = "failed to get blueprint model id(%s) from repo"
+ private const val BLUEPRINT_MODEL_NAME_VERSION_FAILURE_MSG = "failed to get blueprint model by name(%s)" + " and version(%s) from repo"
+ }
+}
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt
index 04071dd2..779be65d 100755
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/load/ControllerBlueprintCatalogServiceImpl.kt
@@ -97,6 +97,8 @@ class ControllerBlueprintCatalogServiceImpl(bluePrintValidatorService: BluePrint
blueprintModelContent.description = "$artifactName:$artifactVersion CBA Zip Content"
blueprintModelContent.content = Files.readAllBytes(archiveFile.toPath())
blueprintModelContent.blueprintModel = blueprintModel
+ // Set the Blueprint Model Content into blueprintModel
+ blueprintModel.blueprintModelContent = blueprintModelContent
try {
blueprintModelRepository.saveAndFlush(blueprintModel)
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelServiceTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelServiceTest.java
deleted file mode 100644
index 0ce93b18..00000000
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/BlueprintModelServiceTest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- *
- * 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.junit.Test;
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
-import org.springframework.beans.factory.annotation.Autowired;
-
-public class BlueprintModelServiceTest {
- @Autowired
- private BlueprintModelService blueprintModelService;
-
- @Test
- public void testGetInitialConfigModel() throws BluePrintException {
- }
-}
diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelRestTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelRestTest.kt
new file mode 100644
index 00000000..f82aace4
--- /dev/null
+++ b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/controller/BlueprintModelRestTest.kt
@@ -0,0 +1,192 @@
+/*
+ * Copyright © 2019 Bell Canada 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.controller
+
+import com.google.gson.Gson
+import org.json.JSONException
+import org.json.JSONObject
+import org.junit.After
+import org.junit.Before
+import org.junit.FixMethodOrder
+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.core.utils.BluePrintArchiveUtils
+import org.onap.ccsdk.apps.controllerblueprints.service.domain.BlueprintModelSearch
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.beans.factory.annotation.Value
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration
+import org.springframework.boot.test.context.SpringBootTest
+import org.springframework.context.annotation.ComponentScan
+import org.springframework.core.io.ByteArrayResource
+import org.springframework.http.HttpMethod
+import org.springframework.http.HttpStatus
+import org.springframework.test.context.ContextConfiguration
+import org.springframework.test.context.junit4.SpringRunner
+import org.springframework.test.web.reactive.server.WebTestClient
+import org.springframework.util.Base64Utils
+import org.springframework.web.reactive.function.BodyInserters
+import java.io.File
+import java.io.IOException
+import java.nio.charset.StandardCharsets.UTF_8
+import java.nio.file.Files
+import java.nio.file.Paths
+
+/**
+ * BlueprintModelRestTest Purpose: Integration test at API level
+ *
+ * @author Vinal Patel
+ * @version 1.0
+ */
+
+@RunWith(SpringRunner::class)
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ContextConfiguration(classes = [TestApplication::class])
+@ComponentScan(basePackages = ["org.onap.ccsdk.apps.controllerblueprints"])
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+@EnableAutoConfiguration
+class BlueprintModelRestTest {
+
+ companion object {
+
+ private var id: String? = null
+ private var name: String? = null
+ private var version: String? = null
+ private var tag: String? = null
+ private var result: String? = null
+ }
+
+ @Value("\${controllerblueprints.loadBluePrintPaths}")
+ private val loadBluePrintPaths: String? = null
+
+ @Autowired
+ private val webTestClient: WebTestClient? = null
+
+ @Value("\${controllerblueprints.loadBlueprintsExamplesPath}")
+ private val blueprintArchivePath: String? = null
+
+ private val filename = "test.zip"
+ private var blueprintFile: File? = null
+ private var zipBlueprintFile: File? = null
+
+ @Before
+ @Throws(Exception::class)
+ fun setUp() {
+ blueprintFile = File(loadBluePrintPaths+"/baseconfiguration")
+ if (blueprintFile!!.isDirectory) {
+ zipBlueprintFile = File(Paths.get(blueprintArchivePath).resolve(filename).toString())
+ BluePrintArchiveUtils.compress(blueprintFile!!, zipBlueprintFile!!, true)
+ }
+ }
+
+ @After
+ @Throws(Exception::class)
+ fun tearDown() {
+ zipBlueprintFile!!.delete()
+ }
+
+ @Test
+ @Throws(IOException::class, JSONException::class)
+ fun test1_saveBluePrint() {
+ webTestClient(HttpMethod.POST,
+ BodyInserters.fromMultipartData("file", object : ByteArrayResource(Files.readAllBytes(zipBlueprintFile!!.toPath())) {
+ override fun getFilename(): String? {
+ return "test.zip"
+ }
+ }),
+ "/api/v1/blueprint-model",
+ HttpStatus.OK, true)
+ }
+
+ @Test
+ @Throws(JSONException::class)
+ fun test2_getBluePrintByNameAndVersion() {
+ webTestClient(HttpMethod.GET, null, "/api/v1/blueprint-model/by-name/$name/version/$version", HttpStatus.OK, false)
+ }
+
+
+ @Test
+ @Throws(JSONException::class)
+ fun test3_getBlueprintModel() {
+ webTestClient(HttpMethod.GET, null, "/api/v1/blueprint-model/$id", HttpStatus.OK, false)
+ }
+
+ @Test
+ @Throws(JSONException::class)
+ fun test4_getAllBlueprintModel() {
+ webTestClient(HttpMethod.GET, null, "/api/v1/blueprint-model", HttpStatus.OK, false)
+ }
+
+ @Test
+ @Throws(JSONException::class)
+ fun test5_downloadBluePrint() {
+ webTestClient(HttpMethod.GET, null, "/api/v1/blueprint-model/download/$id", HttpStatus.OK, false)
+ }
+
+ @Test
+ fun test6_publishBlueprintModel() {
+ }
+
+ @Test
+ @Throws(JSONException::class)
+ fun test7_searchBlueprintModels() {
+ webTestClient(HttpMethod.GET, null, "/api/v1/blueprint-model/search/$name", HttpStatus.OK, false)
+ }
+
+ @Test
+ @Throws(JSONException::class)
+ fun test8_downloadBlueprintByNameAndVersion() {
+ webTestClient(HttpMethod.GET, null, "/api/v1/blueprint-model/download/by-name/$name/version/$version", HttpStatus.OK, false)
+ }
+
+ @Test
+ fun test9_deleteBluePrint() {
+ //TODO: Use webTestClient function
+ //webTestClient(HttpMethod.DELETE, null, "/api/v1/blueprint-model/" + id, HttpStatus.OK, false);
+ webTestClient!!.delete().uri("/api/v1/blueprint-model/$id")
+ .header("Authorization", "Basic " + Base64Utils
+ .encodeToString(("ccsdkapps" + ":" + "ccsdkapps").toByteArray(UTF_8)))
+ .exchange()
+ .expectStatus().is2xxSuccessful
+ }
+
+ @Throws(JSONException::class)
+ private fun webTestClient(requestMethod: HttpMethod, body: BodyInserters.MultipartInserter?, uri: String, expectedResponceStatus: HttpStatus, setParam: Boolean) {
+
+ result = String(webTestClient!!.method(requestMethod).uri(uri)
+ .header("Authorization", "Basic " + Base64Utils
+ .encodeToString(("ccsdkapps" + ":" + "ccsdkapps").toByteArray(UTF_8)))
+ .body(body)
+ .exchange()
+ .expectStatus().isEqualTo(expectedResponceStatus)
+ .expectBody()
+ .returnResult().responseBody!!)
+
+ if (setParam) {
+ val jsonResponse = JSONObject(result)
+ val blueprintModelSearchJSON = jsonResponse.getJSONObject("blueprintModel")
+ val gson = Gson()
+ val blueprintModelSearch = gson.fromJson(blueprintModelSearchJSON.toString(), BlueprintModelSearch::class.java)
+ id = blueprintModelSearch.id
+ name = blueprintModelSearch.artifactName
+ version = blueprintModelSearch.artifactVersion
+ tag = blueprintModelSearch.tags
+ }
+ }
+
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/application.properties b/ms/controllerblueprints/modules/service/src/test/resources/application.properties
index 24cb23a1..1c2c1c08 100755
--- a/ms/controllerblueprints/modules/service/src/test/resources/application.properties
+++ b/ms/controllerblueprints/modules/service/src/test/resources/application.properties
@@ -20,7 +20,7 @@ logging.level.org.springframework.web=INFO
logging.level.org.hibernate.SQL=warn
logging.level.org.hibernate.type.descriptor.sql=debug
# Load Resource Source Mappings
-resourceSourceMappings=primary-db=source-primary-db,input=source-input,default=source-default,mdsal=source-rest,capability=source-capability
+resourceSourceMappings=primary-db=source-primary-db,input=source-input,default=source-default,primary-config-data=source-rest,capability=source-capability
# Controller Blueprints Core Configuration
controllerblueprints.blueprintDeployPath=./target/blueprints/deploy
controllerblueprints.blueprintArchivePath=./target/blueprints/archive
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json
index 1c81b74d..3ed188b9 100644
--- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json
+++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-resource-assignment.json
@@ -56,7 +56,7 @@
"required": true
},
"dictionary-name": "sample-mdsal-source",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": []
}
]
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json
index 42978f84..2e48b6d8 100644
--- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json
+++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json
@@ -243,7 +243,7 @@
},
"input-param": false,
"dictionary-name": "sample-mdsal-source",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id"
],
@@ -314,7 +314,7 @@
},
"input-param": false,
"dictionary-name": "sample-licenses",
- "dictionary-source": "mdsal",
+ "dictionary-source": "primary-config-data",
"dependencies": [
"service-instance-id"
],
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json
index 66f18f89..6937c719 100644
--- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json
+++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json
@@ -242,7 +242,7 @@
},
"input-param" : false,
"dictionary-name" : "sample-mdsal-source",
- "dictionary-source" : "mdsal",
+ "dictionary-source" : "primary-config-data",
"dependencies" : [ "service-instance-id" ],
"version" : 0
}, {
@@ -304,7 +304,7 @@
},
"input-param" : false,
"dictionary-name" : "sample-licenses",
- "dictionary-source" : "mdsal",
+ "dictionary-source" : "primary-config-data",
"dependencies" : [ "service-instance-id" ],
"version" : 0
}, {
diff --git a/ms/controllerblueprints/parent/pom.xml b/ms/controllerblueprints/parent/pom.xml
index 9042318d..8cbc98e0 100644
--- a/ms/controllerblueprints/parent/pom.xml
+++ b/ms/controllerblueprints/parent/pom.xml
@@ -28,12 +28,12 @@
<name>Controller Blueprints Parent</name>
<packaging>pom</packaging>
<properties>
- <spring.boot.version>2.1.1.RELEASE</spring.boot.version>
- <spring.version>5.1.3.RELEASE</spring.version>
- <kotlin.version>1.3.11</kotlin.version>
- <kotlin.maven.version>1.3.11</kotlin.maven.version>
- <kotlin.couroutines.version>1.1.0</kotlin.couroutines.version>
- <grpc.version>1.17.1</grpc.version>
+ <spring.boot.version>2.1.2.RELEASE</spring.boot.version>
+ <spring.version>5.1.4.RELEASE</spring.version>
+ <kotlin.version>1.3.20</kotlin.version>
+ <kotlin.maven.version>1.3.20</kotlin.maven.version>
+ <kotlin.couroutines.version>1.1.1</kotlin.couroutines.version>
+ <grpc.version>1.18.0</grpc.version>
<protobuff.java.utils.version>3.6.1</protobuff.java.utils.version>
<eelf.version>1.0.0</eelf.version>
<guava.version>27.0.1-jre</guava.version>
@@ -110,14 +110,26 @@
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-stdlib-common</artifactId>
+ <version>${kotlin.version}</version>
+ </dependency>
+ <!--Use kotlin-compiler-embeddable instead koltin-compiler wrap-->
+ <!--guava dependency inside kotlin-compiler creating classpath issues at runtime-->
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-scripting-jvm-host</artifactId>
<version>${kotlin.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-compile</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-compiler-embeddable</artifactId>
<version>${kotlin.version}</version>
- <scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
@@ -198,27 +210,32 @@
</dependency>
<dependency>
<groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>service</artifactId>
+ <artifactId>resource-dict</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>application</artifactId>
+ <artifactId>db-resources</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>resource-dict</artifactId>
+ <artifactId>blueprint-validation</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>db-resources</artifactId>
+ <artifactId>blueprint-scripts</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
- <artifactId>blueprint-validation</artifactId>
+ <artifactId>service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps.controllerblueprints</groupId>
+ <artifactId>application</artifactId>
<version>${project.version}</version>
</dependency>
@@ -270,6 +287,10 @@
<artifactId>json-path</artifactId>
</dependency>
<dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+ <dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</dependency>