aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/parent/pom.xml9
-rwxr-xr-xms/blueprintsprocessor/parent/pom.xml5
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt13
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintVelocityTemplateService.kt15
-rw-r--r--ms/controllerblueprints/parent/pom.xml5
5 files changed, 28 insertions, 19 deletions
diff --git a/components/parent/pom.xml b/components/parent/pom.xml
index 0ecf94af1..4411b84f9 100644
--- a/components/parent/pom.xml
+++ b/components/parent/pom.xml
@@ -42,6 +42,8 @@
<h2database.version>1.4.197</h2database.version>
<onap.logger.slf4j>1.2.2</onap.logger.slf4j>
<mockk.version>1.9</mockk.version>
+ <velocity.version>1.7</velocity.version>
+ <jinja.version>2.5.1</jinja.version>
</properties>
<dependencyManagement>
<dependencies>
@@ -96,13 +98,18 @@
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
- <version>1.7</version>
+ <version>${velocity.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
+ <dependency>
+ <groupId>com.hubspot.jinjava</groupId>
+ <artifactId>jinjava</artifactId>
+ <version>${jinja.version}</version>
+ </dependency>
<!-- Kotlin Dependencies -->
<dependency>
diff --git a/ms/blueprintsprocessor/parent/pom.xml b/ms/blueprintsprocessor/parent/pom.xml
index 686be49fd..601fee30e 100755
--- a/ms/blueprintsprocessor/parent/pom.xml
+++ b/ms/blueprintsprocessor/parent/pom.xml
@@ -52,7 +52,8 @@
<powermock.version>1.7.4</powermock.version>
<mockk.version>1.9</mockk.version>
<dmaap.client.version>1.1.5</dmaap.client.version>
- <jinja.version>2.5.0</jinja.version>
+ <jinja.version>2.5.1</jinja.version>
+ <velocity.version>1.7</velocity.version>
<mockkserver.version>5.5.1</mockkserver.version>
</properties>
<dependencyManagement>
@@ -119,7 +120,7 @@
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
- <version>1.7</version>
+ <version>${velocity.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt
index baddd6a12..a06fb99ff 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintJinjaTemplateService.kt
@@ -19,22 +19,16 @@ package org.onap.ccsdk.cds.controllerblueprints.core.service
import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
-import com.google.common.io.Resources
import com.hubspot.jinjava.Jinjava
-import com.hubspot.jinjava.interpret.Context
+import com.hubspot.jinjava.JinjavaConfig
import com.hubspot.jinjava.interpret.JinjavaInterpreter
-import com.hubspot.jinjava.loader.ClasspathResourceLocator
import com.hubspot.jinjava.loader.ResourceLocator
import com.hubspot.jinjava.loader.ResourceNotFoundException
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
-import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintLoadConfiguration
import org.onap.ccsdk.cds.controllerblueprints.core.config.BluePrintPathConfiguration
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintJsonNodeFactory
-import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
import org.onap.ccsdk.cds.controllerblueprints.core.removeNullNode
-import org.springframework.context.annotation.Scope
-import org.springframework.stereotype.Service
import java.io.IOException
import java.nio.charset.Charset
import java.nio.file.Files.readAllBytes
@@ -70,8 +64,7 @@ object BluePrintJinjaTemplateService {
additionalContext: MutableMap<String, Any>,
bluePrintPathConfiguration: BluePrintPathConfiguration, artifactName: String,
artifactVersion: String): String {
-
-
+
return generateContent(template,
json,
ignoreJsonNull,
@@ -81,7 +74,7 @@ object BluePrintJinjaTemplateService {
fun generateContent(template: String, json: String, ignoreJsonNull: Boolean,
additionalContext: MutableMap<String, Any>, resourceLocator: ResourceLocator? = null): String {
- val jinJava = Jinjava()
+ val jinJava = Jinjava(JinjavaConfig())
if (resourceLocator != null) {
jinJava.resourceLocator = resourceLocator
}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintVelocityTemplateService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintVelocityTemplateService.kt
index 43e6d221f..2d3c35de7 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintVelocityTemplateService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BluePrintVelocityTemplateService.kt
@@ -23,7 +23,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
import org.apache.commons.lang3.BooleanUtils
import org.apache.commons.lang3.StringUtils
import org.apache.velocity.VelocityContext
-import org.apache.velocity.app.Velocity
+import org.apache.velocity.app.VelocityEngine
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintJsonNodeFactory
import org.onap.ccsdk.cds.controllerblueprints.core.removeNullNode
@@ -57,7 +57,15 @@ object BluePrintVelocityTemplateService {
fun generateContent(template: String, jsonNode: JsonNode?, ignoreJsonNull: Boolean = false,
additionalContext: MutableMap<String, Any> = mutableMapOf()): String {
- Velocity.init()
+ /*
+ * create a new instance of the velocity engine
+ */
+ val velocity = VelocityEngine()
+
+ /*
+ * initialize the engine
+ */
+ velocity.init()
val velocityContext = VelocityContext()
velocityContext.put("StringUtils", StringUtils::class.java)
@@ -76,9 +84,8 @@ object BluePrintVelocityTemplateService {
}
val stringWriter = StringWriter()
- Velocity.evaluate(velocityContext, stringWriter, "TemplateData", template)
+ velocity.evaluate(velocityContext, stringWriter, "TemplateData", template)
stringWriter.flush()
return stringWriter.toString()
-
}
}
diff --git a/ms/controllerblueprints/parent/pom.xml b/ms/controllerblueprints/parent/pom.xml
index 236dcc1dc..6f8405e9a 100644
--- a/ms/controllerblueprints/parent/pom.xml
+++ b/ms/controllerblueprints/parent/pom.xml
@@ -43,7 +43,8 @@
<onap.logger.slf4j>1.2.2</onap.logger.slf4j>
<powermock.version>1.7.4</powermock.version>
<mockk.version>1.9</mockk.version>
- <jinja.version>2.5.0</jinja.version>
+ <jinja.version>2.5.1</jinja.version>
+ <velocity.version>1.7</velocity.version>
</properties>
<dependencyManagement>
<dependencies>
@@ -103,7 +104,7 @@
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
- <version>1.7</version>
+ <version>${velocity.version}</version>
</dependency>
<dependency>
<groupId>com.hubspot.jinjava</groupId>