summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSkip Wonnell <kw5258@att.com>2017-08-15 18:07:13 -0500
committerPatrick Brady <pb071s@att.com>2017-08-17 06:16:06 +0000
commitdbf27a48318ba76644d6e2b095358db60bf5c9b6 (patch)
tree14e1663177802203eb7cfdc18bfd0036eadb31fe
parent9296b7674ea71cb86fe2ea99e80d9d055267ae5b (diff)
Initial commit for config-generator bundle
This bundle contains logic for creating the configuration, reading templates, and merging the data together Issue-ID: APPC-59 Change-Id: Ifd745964f659f075250d6acaf1b5f033da28e1c4 Signed-off-by: Skip Wonnell <kw5258@att.com>
-rw-r--r--appc-config/appc-config-generator/.gitignore1
-rw-r--r--appc-config/appc-config-generator/features/.gitignore1
-rw-r--r--appc-config/appc-config-generator/features/pom.xml115
-rw-r--r--appc-config/appc-config-generator/features/src/main/resources/features.xml49
-rw-r--r--appc-config/appc-config-generator/installer/pom.xml148
-rw-r--r--appc-config/appc-config-generator/installer/src/assembly/assemble_installer_zip.xml59
-rw-r--r--appc-config/appc-config-generator/installer/src/assembly/assemble_mvnrepo_zip.xml47
-rw-r--r--appc-config/appc-config-generator/installer/src/main/resources/scripts/install-feature.sh40
-rw-r--r--appc-config/appc-config-generator/pom.xml48
-rw-r--r--appc-config/appc-config-generator/provider/.gitignore1
-rw-r--r--appc-config/appc-config-generator/provider/pom.xml129
-rw-r--r--appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/ConfigGeneratorActivator.java86
-rw-r--r--appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/ConfigGeneratorConstant.java68
-rw-r--r--appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/convert/ConvertNode.java189
-rw-r--r--appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/merge/MergeNode.java128
-rw-r--r--appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/pattern/PatternNode.java81
-rw-r--r--appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/reader/ReaderNode.java62
-rw-r--r--appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/CheckDataTool.java84
-rw-r--r--appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/Constants.java32
-rw-r--r--appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/CustomJsonNodeFactory.java32
-rw-r--r--appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/CustomTextNode.java50
-rw-r--r--appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/DbServiceUtil.java75
-rw-r--r--appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/EscapeUtils.java91
-rw-r--r--appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/JSONTool.java157
-rw-r--r--appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/LogParserTool.java94
-rw-r--r--appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/MergeTool.java109
-rw-r--r--appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/transform/XSLTTransformerNode.java96
-rw-r--r--appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/writer/FileWriterNode.java70
-rw-r--r--appc-config/appc-config-generator/provider/src/main/resources/adaptor.properties25
-rw-r--r--appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/convert/TestConvertNode.java149
-rw-r--r--appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/merge/TestMergeNode.java98
-rw-r--r--appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/pattern/TestPatternNode.java111
-rw-r--r--appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/transform/TestXSLTTransformerNode.java60
-rw-r--r--appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/writer/TestFileWriterNode.java55
-rw-r--r--appc-config/appc-config-generator/provider/src/test/resources/convert/escape/config_msc.txt0
-rw-r--r--appc-config/appc-config-generator/provider/src/test/resources/convert/escape/config_ssc.txt0
-rw-r--r--appc-config/appc-config-generator/provider/src/test/resources/convert/escape/config_vdbe.xml19
-rw-r--r--appc-config/appc-config-generator/provider/src/test/resources/convert/payload_cli_config.json19
-rw-r--r--appc-config/appc-config-generator/provider/src/test/resources/convert/payload_json_config.json19
-rw-r--r--appc-config/appc-config-generator/provider/src/test/resources/convert/payload_parameters_config.json19
-rw-r--r--appc-config/appc-config-generator/provider/src/test/resources/convert/payload_template_config.json19
-rw-r--r--appc-config/appc-config-generator/provider/src/test/resources/convert/payload_xml_config.json19
-rw-r--r--appc-config/appc-config-generator/provider/src/test/resources/merge/complex/vdbe_data.json19
-rw-r--r--appc-config/appc-config-generator/provider/src/test/resources/merge/complex/vdbe_template.xml19
-rw-r--r--appc-config/appc-config-generator/provider/src/test/resources/merge/vdbe_data.json19
-rw-r--r--appc-config/appc-config-generator/provider/src/test/resources/merge/vdbe_template.xml19
-rw-r--r--appc-config/appc-config-generator/provider/src/test/resources/pattern/errorlog.txt0
-rw-r--r--appc-config/appc-config-generator/provider/src/test/resources/pattern/json_data.json19
-rw-r--r--appc-config/appc-config-generator/provider/src/test/resources/pattern/text_data.txt1
-rw-r--r--appc-config/appc-config-generator/provider/src/test/resources/pattern/xml_data.xml19
-rw-r--r--appc-config/appc-config-generator/provider/src/test/resources/transform/request.xml31
-rw-r--r--appc-config/appc-config-generator/provider/src/test/resources/transform/template.xsl64
-rw-r--r--appc-config/pom.xml1
53 files changed, 2965 insertions, 0 deletions
diff --git a/appc-config/appc-config-generator/.gitignore b/appc-config/appc-config-generator/.gitignore
new file mode 100644
index 000000000..b83d22266
--- /dev/null
+++ b/appc-config/appc-config-generator/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/appc-config/appc-config-generator/features/.gitignore b/appc-config/appc-config-generator/features/.gitignore
new file mode 100644
index 000000000..b83d22266
--- /dev/null
+++ b/appc-config/appc-config-generator/features/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/appc-config/appc-config-generator/features/pom.xml b/appc-config/appc-config-generator/features/pom.xml
new file mode 100644
index 000000000..d9a9dda91
--- /dev/null
+++ b/appc-config/appc-config-generator/features/pom.xml
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-generator</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>appc-config-generator-features</artifactId>
+ <name>Config Generator Plugin - Features</name>
+
+ <packaging>jar</packaging>
+
+ <dependencies>
+
+
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-generator-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>features-mdsal</artifactId>
+ <version>${odl.mdsal.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+
+ <scope>runtime</scope>
+ </dependency>
+
+
+ <!-- dependency for opendaylight-karaf-empty for use by testing -->
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>opendaylight-karaf-empty</artifactId>
+ <version>${odl.karaf.empty.distro.version}</version>
+ <type>zip</type>
+ </dependency>
+
+
+ <dependency>
+ <!-- Required for launching the feature tests -->
+ <groupId>org.opendaylight.odlparent</groupId>
+ <artifactId>features-test</artifactId>
+ <version>${odl.commons.opendaylight.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <filtering>true</filtering>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>filter</id>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ <phase>generate-resources</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- launches the feature test, which validates that your karaf feature
+ can be installed inside of a karaf container. It doesn't validate that your
+ functionality works correctly, just that you have all of the dependent bundles
+ defined correctly. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.16</version> <configuration> <systemPropertyVariables> <karaf.distro.groupId>org.opendaylight.controller</karaf.distro.groupId>
+ <karaf.distro.artifactId>opendaylight-karaf-empty</karaf.distro.artifactId>
+ <karaf.distro.version>${odl.karaf.empty.distro.version}</karaf.distro.version>
+ </systemPropertyVariables> <dependenciesToScan> <dependency>org.opendaylight.yangtools:features-test</dependency>
+ </dependenciesToScan> </configuration> </plugin> -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/classes/${features.file}</file>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/appc-config/appc-config-generator/features/src/main/resources/features.xml b/appc-config/appc-config-generator/features/src/main/resources/features.xml
new file mode 100644
index 000000000..5d8f9ae98
--- /dev/null
+++ b/appc-config/appc-config-generator/features/src/main/resources/features.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APP-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ 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.
+ ============LICENSE_END=========================================================
+ -->
+
+
+<features name="appc-config-generator-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+
+ <repository>mvn:org.opendaylight.mdsal/features-mdsal/${odl.mdsal.version}/xml/features</repository>
+
+ <feature name='appc-config-generator' description="Application Controller Config Generator"
+ version='${project.version}'>
+ <!-- Most applications will have a dependency on the ODL MD-SAL Broker -->
+ <feature version="${broker-mdsal.version}">odl-mdsal-broker</feature>
+ <feature version='${sdnc.sli.version}'>sdnc-sli</feature>
+
+ <bundle>wrap:mvn:org.codehaus.jettison/jettison/${jettison.version}</bundle>
+ <bundle>mvn:commons-lang/commons-lang/2.6</bundle>
+ <bundle>wrap:mvn:commons-io/commons-io/${common.io.version}</bundle>
+ <bundle>wrap:mvn:org.apache.velocity/velocity/${velocity.version}</bundle>
+ <bundle>wrap:mvn:commons-collections/commons-collections/${common.collections.version}</bundle>
+ <bundle>wrap:mvn:com.att.eelf/eelf-core/${eelf.version}</bundle>
+ <!-- bundle>wrap:mvn:com.fasterxml.jackson.dataformat/jackson-dataformat-properties/${jackson.version}</bundle-->
+ <bundle>wrap:mvn:com.fasterxml.jackson.core/jackson-annotations/${jackson.version}</bundle>
+ <bundle>wrap:mvn:com.fasterxml.jackson.core/jackson-core/${jackson.version}</bundle>
+ <bundle>wrap:mvn:com.fasterxml.jackson.core/jackson-databind/${jackson.version}</bundle>
+ <bundle>mvn:ch.qos.logback/logback-core/${logback.version}</bundle>
+ <bundle>mvn:ch.qos.logback/logback-classic/${logback.version}</bundle>
+ <bundle>mvn:org.openecomp.appc/config-generator-provider/${project.version}</bundle>
+ </feature>
+</features>
diff --git a/appc-config/appc-config-generator/installer/pom.xml b/appc-config/appc-config-generator/installer/pom.xml
new file mode 100644
index 000000000..1412b9bf3
--- /dev/null
+++ b/appc-config/appc-config-generator/installer/pom.xml
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ APPC
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2017 Amdocs
+ ================================================================================
+ 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.
+ ============LICENSE_END=========================================================
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ -->
+<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">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-generator</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>appc-config-generator-installer</artifactId>
+ <name>Config Component Generator - Installer</name>
+ <packaging>pom</packaging>
+ <properties>
+ <application.name>appc-config-generator</application.name>
+ <features.boot>appc-config-generator</features.boot>
+ <features.repositories>mvn:org.openecomp.appc/appc-config-generator-features/${project.version}/xml/features</features.repositories>
+ <include.transitive.dependencies>false</include.transitive.dependencies>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-generator-features</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-generator-provider</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>maven-repo-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <appendAssemblyId>false</appendAssemblyId>
+ <attach>false</attach>
+ <finalName>stage/${application.name}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ <execution>
+ <id>installer-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <appendAssemblyId>false</appendAssemblyId>
+ <attach>true</attach>
+ <finalName>${application.name}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_installer_zip.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <phase>prepare-package</phase>
+ <configuration>
+ <transitive>false</transitive>
+ <outputDirectory>${project.build.directory}/assembly/system</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ <useRepositoryLayout>true</useRepositoryLayout>
+ <addParentPoms>false</addParentPoms>
+ <copyPom>false</copyPom>
+ <excludeGroupIds>org.opendaylight</excludeGroupIds>
+ <scope>provided</scope>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-version</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <!-- here the phase you need -->
+ <phase>validate</phase>
+ <configuration>
+ <outputDirectory>${basedir}/target/stage</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources/scripts</directory>
+ <includes>
+ <include>install-feature.sh</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/appc-config/appc-config-generator/installer/src/assembly/assemble_installer_zip.xml b/appc-config/appc-config-generator/installer/src/assembly/assemble_installer_zip.xml
new file mode 100644
index 000000000..23323aba8
--- /dev/null
+++ b/appc-config/appc-config-generator/installer/src/assembly/assemble_installer_zip.xml
@@ -0,0 +1,59 @@
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APP-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ 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.
+ ============LICENSE_END=========================================================
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ -->
+
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>generator</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <!-- we want "system" and related files right at the root level
+ as this file is suppose to be unzip on top of a karaf
+ distro. -->
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>target/stage/</directory>
+ <outputDirectory>${application.name}</outputDirectory>
+ <fileMode>755</fileMode>
+ <includes>
+ <include>*.sh</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target/stage/</directory>
+ <outputDirectory>${application.name}</outputDirectory>
+ <fileMode>644</fileMode>
+ <excludes>
+ <exclude>*.sh</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+
+
+
+</assembly>
diff --git a/appc-config/appc-config-generator/installer/src/assembly/assemble_mvnrepo_zip.xml b/appc-config/appc-config-generator/installer/src/assembly/assemble_mvnrepo_zip.xml
new file mode 100644
index 000000000..9a1eaf475
--- /dev/null
+++ b/appc-config/appc-config-generator/installer/src/assembly/assemble_mvnrepo_zip.xml
@@ -0,0 +1,47 @@
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APP-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ 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.
+ ============LICENSE_END=========================================================
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ -->
+
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>generator</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <!-- we want "system" and related files right at the root level
+ as this file is suppose to be unzip on top of a karaf
+ distro. -->
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>target/assembly/</directory>
+ <outputDirectory>.</outputDirectory>
+ <excludes>
+ </excludes>
+ </fileSet>
+ </fileSets>
+
+</assembly>
diff --git a/appc-config/appc-config-generator/installer/src/main/resources/scripts/install-feature.sh b/appc-config/appc-config-generator/installer/src/main/resources/scripts/install-feature.sh
new file mode 100644
index 000000000..d3d2ea6e7
--- /dev/null
+++ b/appc-config/appc-config-generator/installer/src/main/resources/scripts/install-feature.sh
@@ -0,0 +1,40 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP : APP-C
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# 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.
+# ============LICENSE_END=========================================================
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+###
+
+#!/bin/bash
+
+ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}
+ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client}
+ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"}
+INSTALLERDIR=$(dirname $0)
+
+REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip
+
+if [ -f ${REPOZIP} ]
+then
+ unzip -n -d ${ODL_HOME} ${REPOZIP}
+else
+ echo "ERROR : repo zip ($REPOZIP) not found"
+ exit 1
+fi
+
+${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories}
+${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot}
diff --git a/appc-config/appc-config-generator/pom.xml b/appc-config/appc-config-generator/pom.xml
new file mode 100644
index 000000000..370bb32ba
--- /dev/null
+++ b/appc-config/appc-config-generator/pom.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>pom</packaging>
+ <artifactId>appc-config-generator</artifactId>
+
+ <name>Config Generator Node</name>
+ <description>Common Utilities for DG</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+
+ <dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-generator-features</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-generator-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+
+ </dependencyManagement>
+
+
+ <modules>
+ <module>provider</module>
+ <module>features</module>
+ <module>installer</module>
+ </modules>
+</project>
diff --git a/appc-config/appc-config-generator/provider/.gitignore b/appc-config/appc-config-generator/provider/.gitignore
new file mode 100644
index 000000000..b83d22266
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/appc-config/appc-config-generator/provider/pom.xml b/appc-config/appc-config-generator/provider/pom.xml
new file mode 100644
index 000000000..7a614de0e
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/pom.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-generator</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>appc-config-generator-provider</artifactId>
+ <packaging>bundle</packaging>
+ <name>Config Generator - Provider</name>
+ <url>http://maven.apache.org</url>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>equinoxSDK381</groupId>
+ <artifactId>org.eclipse.osgi</artifactId>
+ <version>${equinox.osgi.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>sli-provider</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ </dependency>
+ <!-- >dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-properties</artifactId>
+ </dependency-->
+
+ <dependency>
+ <groupId>org.codehaus.jettison</groupId>
+ <artifactId>jettison</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.velocity</groupId>
+ <artifactId>velocity</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.att.eelf</groupId>
+ <artifactId>eelf-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>${bundle.plugin.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>org.openecomp.sdnc.config.generator</Bundle-SymbolicName>
+ <Bundle-Activator>org.openecomp.sdnc.config.generator.ConfigGeneratorActivator</Bundle-Activator>
+ <Export-Package>org.openecomp.sdnc.config.generator,org.openecomp.sdnc.config.generator.compare,org.openecomp.sdnc.config.generator.convert,
+ org.openecomp.sdnc.config.generator.merge,org.openecomp.sdnc.config.generator.pattern,org.openecomp.sdnc.config.generator.tool,
+ org.openecomp.sdnc.config.generator.transform</Export-Package>
+ <Import-Package>*</Import-Package>
+ <DynamicImport-Package>*</DynamicImport-Package>
+ </instructions>
+ <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings
+ only. It has no influence on the Maven build itself. -->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>
+ com.brocade.developer
+ </groupId>
+ <artifactId>
+ providermodule-plugin
+ </artifactId>
+ <versionRange>
+ [1.2.0.100-SNAPSHOT,)
+ </versionRange>
+ <goals>
+ <goal>process</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore />
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/ConfigGeneratorActivator.java b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/ConfigGeneratorActivator.java
new file mode 100644
index 000000000..f2987d2f4
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/ConfigGeneratorActivator.java
@@ -0,0 +1,86 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.openecomp.sdnc.config.generator.convert.ConvertNode;
+import org.openecomp.sdnc.config.generator.merge.MergeNode;
+import org.openecomp.sdnc.config.generator.pattern.PatternNode;
+import org.openecomp.sdnc.config.generator.reader.ReaderNode;
+import org.openecomp.sdnc.config.generator.writer.FileWriterNode;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+public class ConfigGeneratorActivator implements BundleActivator{
+
+ private List<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>();
+
+
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(ConfigGeneratorActivator.class);
+
+ @Override
+ public void start(BundleContext ctx) throws Exception
+ {
+
+ ConvertNode convertNode = new ConvertNode();
+ log.info("Registering service "+ convertNode.getClass().getName());
+ registrations.add(ctx.registerService(convertNode.getClass().getName(), convertNode, null));
+ log.info("Registering service sccessful for "+ convertNode.getClass().getName());
+
+ MergeNode mergeNode = new MergeNode();
+ log.info("Registering service "+ mergeNode.getClass().getName());
+ registrations.add(ctx.registerService(mergeNode.getClass().getName(), mergeNode, null));
+ log.info("Registering service sccessful for "+ mergeNode.getClass().getName());
+
+ PatternNode patternNode = new PatternNode();
+ log.info("Registering service "+ patternNode.getClass().getName());
+ registrations.add(ctx.registerService(patternNode.getClass().getName(), patternNode, null));
+ log.info("Registering service sccessful for "+ patternNode.getClass().getName());
+
+ ReaderNode readerNode = new ReaderNode();
+ log.info("Registering service "+ readerNode.getClass().getName());
+ registrations.add(ctx.registerService(readerNode.getClass().getName(), readerNode, null));
+ log.info("Registering service sccessful for "+ readerNode.getClass().getName());
+
+ FileWriterNode writerNode = new FileWriterNode();
+ log.info("Registering service "+ writerNode.getClass().getName());
+ registrations.add(ctx.registerService(writerNode.getClass().getName(), writerNode, null));
+ log.info("Registering service sccessful for "+ writerNode.getClass().getName());
+
+ }
+ @Override
+ public void stop(BundleContext arg0) throws Exception
+ {
+ for (ServiceRegistration registration: registrations)
+ {
+ registration.unregister();
+ registration = null;
+ }
+
+ }
+
+}
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/ConfigGeneratorConstant.java b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/ConfigGeneratorConstant.java
new file mode 100644
index 000000000..cdfc34229
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/ConfigGeneratorConstant.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator;
+
+public class ConfigGeneratorConstant {
+
+
+ public static String STRING_ENCODING = "utf-8";
+ public static String Y = "Y";
+ public static String N = "N";
+ public static String DATA_TYPE_TEXT = "TEXT";
+ public static String DATA_TYPE_JSON = "JSON";
+ public static String DATA_TYPE_XML = "XML";
+ public static String DATA_TYPE_SQL = "SQL";
+
+ public static String INPUT_PARAM_JSON_DATA = "jsonData";
+ public static String INPUT_PARAM_IS_ESCAPED = "isEscaped";
+ public static String INPUT_PARAM_BLOCK_KEYS = "blockKeys";
+ public static String INPUT_PARAM_LOG_DATA = "logData";
+ public static String INPUT_PARAM_CHECK_DATA = "checkData";
+ public static String INPUT_PARAM_ESCAPE_DATA = "escapeData";
+ public static String INPUT_PARAM_UNESCAPE_DATA = "unEscapeData";
+ public static String INPUT_PARAM_DATA_TYPE = "dataType";
+ public static String INPUT_PARAM_FILE_NAME = "fileName";
+
+ public static String INPUT_PARAM_TEMPLATE_DATA = "templateData";
+ public static String INPUT_PARAM_TEMPLATE_FILE = "templateFile";
+ public static String INPUT_PARAM_TEMPLATE_TYPE = "templateType";
+ public static String INPUT_PARAM_DO_PRETTY_OUTPUT = "doPrettyOutput";
+ public static String INPUT_PARAM_REQUEST_DATA = "requestData";
+ public static String INPUT_PARAM_RESPONSE_PRIFIX = "responsePrefix";
+
+
+ public static String OUTPUT_PARAM_MERGED_DATA = "mergedData";
+ public static String OUTPUT_PARAM_TRANSFORMED_DATA = "transformedData";
+ public static String OUTPUT_PARAM_FILE_DATA = "fileData";
+ public static String OUTPUT_PARAM_PARSED_ERROR = "parsedError";
+ public static String OUTPUT_PARAM_DATA_TYPE = "dataType";
+ public static String OUTPUT_PARAM_STATUS = "status";
+ public static String OUTPUT_PARAM_ERROR_MESSAGE = "error-message";
+ public static String OUTPUT_PARAM_ESCAPE_DATA = "escapeData";
+ public static String OUTPUT_PARAM_UNESCAPE_DATA = "unEscapeData";
+
+ public static String OUTPUT_STATUS_SUCCESS = "success";
+ public static String OUTPUT_STATUS_FAILURE = "failure";
+
+ public static final Object INPUT_PARAM_CONTEXT_KEY = "contextKey";
+ public static final Object INPUT_PARAM_JSON_CONTENT = "jsonContent";
+
+}
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/convert/ConvertNode.java b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/convert/ConvertNode.java
new file mode 100644
index 000000000..60566a40d
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/convert/ConvertNode.java
@@ -0,0 +1,189 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator.convert;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.openecomp.sdnc.config.generator.ConfigGeneratorConstant;
+import org.openecomp.sdnc.config.generator.tool.EscapeUtils;
+import org.openecomp.sdnc.config.generator.tool.JSONTool;
+import org.openecomp.sdnc.sli.SvcLogicJavaPlugin;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+import org.openecomp.sdnc.sli.SvcLogicContext;
+import org.openecomp.sdnc.sli.SvcLogicException;
+
+public class ConvertNode implements SvcLogicJavaPlugin {
+
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(ConvertNode.class);
+
+ public void convertJson2DGContext( Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+ log.trace("Received convertJson2DGContext call with params : " + inParams);
+ String responsePrefix = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+ try {
+ String jsonData = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_JSON_DATA);
+ String isEscaped = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_IS_ESCAPED);
+ String blockKey = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_BLOCK_KEYS);
+ responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+
+ if(StringUtils.isNotBlank(jsonData)){
+ if(StringUtils.isNotBlank(isEscaped) && isEscaped.equalsIgnoreCase("Y")){
+ jsonData = StringEscapeUtils.unescapeJavaScript(jsonData);
+ }
+
+ List<String> blockKeys = new ArrayList<String>();
+ if(blockKey != null){
+ blockKeys = Arrays.asList(blockKey.split(","));
+ }
+
+ Map<String, String> dgContext = JSONTool.convertToProperties(jsonData, blockKeys);
+ log.trace("DG Context Populated:"+dgContext);
+
+ for (Map.Entry<String, String> entry : dgContext.entrySet()) {
+ if(entry != null && entry.getKey() != null){
+ ctx.setAttribute(entry.getKey(), entry.getValue());
+ }
+ }
+ }
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
+
+ } catch (Exception e) {
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_FAILURE);
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
+ log.error("Failed in JSON to DGContext Conversion" + e.getMessage());
+ throw new SvcLogicException(e.getMessage());
+ }
+ }
+
+
+ public void escapeData( Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+ log.trace("Received escapeData call with params : " + inParams);
+ String responsePrefix = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+ try {
+ responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+ String unEscapeData = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_UNESCAPE_DATA);
+ String dataType = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_DATA_TYPE);
+
+ if(StringUtils.isBlank(unEscapeData)){
+ throw new Exception("Unescape ("+ConfigGeneratorConstant.INPUT_PARAM_UNESCAPE_DATA +") param is missing for escapeData conversion." + unEscapeData);
+ }
+
+ if(StringUtils.isBlank(dataType)){
+ throw new Exception(" Datatype ("+ConfigGeneratorConstant.INPUT_PARAM_DATA_TYPE+")param is missing for escapeData conversion.");
+ }
+
+ String escapedData = null;
+ if(ConfigGeneratorConstant.DATA_TYPE_JSON.equalsIgnoreCase(dataType)){
+ escapedData = StringEscapeUtils.escapeJavaScript(unEscapeData);
+ }else if(ConfigGeneratorConstant.DATA_TYPE_XML.equalsIgnoreCase(dataType)){
+ escapedData = StringEscapeUtils.escapeXml(unEscapeData);
+ }else if(ConfigGeneratorConstant.DATA_TYPE_SQL.equalsIgnoreCase(dataType)){
+ escapedData = EscapeUtils.escapeSql(unEscapeData);
+ }else{
+ throw new Exception(" Datatype ("+ConfigGeneratorConstant.INPUT_PARAM_DATA_TYPE+") param value ("+dataType+")is not supported for escapeData conversion.");
+ }
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_ESCAPE_DATA, escapedData);
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
+ log.trace("Data escapeData Successfully :" + ctx.getAttributeKeySet());
+ } catch (Exception e) {
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_FAILURE);
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
+ log.error("Failed in escapeData Conversion" + e.getMessage());
+ throw new SvcLogicException(e.getMessage());
+ }
+ }
+
+ public void unEscapeData( Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+ log.trace("Received unEscapeData call with params : " + inParams);
+ String responsePrefix = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+ try {
+ responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+ String escapeData = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_ESCAPE_DATA);
+ String dataType = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_DATA_TYPE);
+
+ if(StringUtils.isBlank(escapeData)){
+ throw new Exception("Escape ("+ConfigGeneratorConstant.INPUT_PARAM_ESCAPE_DATA +") param is missing for escapeData conversion.");
+ }
+
+ if(StringUtils.isBlank(dataType)){
+ throw new Exception(" Datatype ("+ConfigGeneratorConstant.INPUT_PARAM_DATA_TYPE+")param is missing for escapeData conversion.");
+ }
+
+ String unEscapedData = null;
+ if(ConfigGeneratorConstant.DATA_TYPE_JSON.equalsIgnoreCase(dataType)){
+ unEscapedData = StringEscapeUtils.unescapeJavaScript(escapeData);
+ }else if(ConfigGeneratorConstant.DATA_TYPE_XML.equalsIgnoreCase(dataType)){
+ unEscapedData = StringEscapeUtils.unescapeXml(escapeData);
+ }else{
+ throw new Exception(" Datatype ("+ConfigGeneratorConstant.INPUT_PARAM_DATA_TYPE+") param value ("+dataType+")is not supported for unEscapeData conversion.");
+ }
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_UNESCAPE_DATA, unEscapedData);
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
+ log.trace("Converted unEscapeData Successfully :" + ctx.getAttributeKeySet());
+ } catch (Exception e) {
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_FAILURE);
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
+ log.error("Failed in unEscapeData Conversion" + e.getMessage());
+ throw new SvcLogicException(e.getMessage());
+ }
+ }
+
+
+ public void convertContextToJson(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException{
+ log.trace("Received convertContextToJson call with params : " + inParams);
+ String responsePrefix = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+ String contextKey = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_CONTEXT_KEY);
+ try {
+ responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+
+ ObjectMapper mapper = new ObjectMapper();
+ ObjectNode objectNode = mapper.createObjectNode();
+
+ Set<String> keys = ctx.getAttributeKeySet();
+ for (String key : keys) {
+ if(key.startsWith(contextKey +".")){
+ String objkey= key.replaceFirst(contextKey + ".", "");
+ objectNode.put(objkey, ctx.getAttribute(key));
+
+ }
+ }
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.INPUT_PARAM_JSON_CONTENT, objectNode.toString());
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
+ log.trace("convertContextToJson Successful" );
+ } catch (Exception e) {
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_FAILURE);
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
+ log.error("Failed in convertContextToJson" + e.getMessage());
+ throw new SvcLogicException(e.getMessage());
+ }
+ }
+
+}
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/merge/MergeNode.java b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/merge/MergeNode.java
new file mode 100644
index 000000000..67b21ae5f
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/merge/MergeNode.java
@@ -0,0 +1,128 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator.merge;
+
+import java.nio.charset.Charset;
+import java.util.Map;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.openecomp.sdnc.config.generator.ConfigGeneratorConstant;
+import org.openecomp.sdnc.config.generator.tool.JSONTool;
+import org.openecomp.sdnc.config.generator.tool.MergeTool;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.openecomp.sdnc.sli.SvcLogicContext;
+import org.openecomp.sdnc.sli.SvcLogicException;
+import org.openecomp.sdnc.sli.SvcLogicJavaPlugin;
+
+public class MergeNode implements SvcLogicJavaPlugin {
+
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(MergeNode.class);
+
+ public void mergeDataOnTemplate(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+
+ }
+
+ public void mergeJsonDataOnTemplate(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+ log.info("Received mergeJsonDataOnTemplate call with params : " + inParams);
+ String responsePrefix = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+ try{
+ responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+ String jsonData = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_JSON_DATA);
+ if(StringUtils.isBlank(jsonData)){
+ throw new Exception("JSON Data is missing");
+ }
+
+ String templateData = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_DATA);
+ String templateFile = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_FILE);
+
+ if(StringUtils.isBlank(templateData) && StringUtils.isBlank(templateFile)){
+ throw new Exception("Template data or Template file is missing");
+ }
+ if(StringUtils.isBlank(templateData)){
+ String path = MergeNode.class.getClassLoader().getResource(".").toString();
+ templateData = IOUtils.toString(MergeNode.class.getClassLoader().getResourceAsStream(templateFile));
+ }
+
+ String templateType = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_TYPE);
+
+ Map<String, String> dataMap = JSONTool.convertToProperties(jsonData);
+ log.info("Data Maps created :" + dataMap);
+ if(dataMap != null){
+ String mergedData = MergeTool.mergeMap2TemplateData(templateData, dataMap);
+ if(mergedData != null){
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_MERGED_DATA,mergedData);
+ }
+ }
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
+ log.info("Data Merge Successful :" + ctx);
+ } catch (Exception e) {
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_FAILURE);
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
+ log.error("Failed in merging data to template " + e.getMessage());
+ throw new SvcLogicException(e.getMessage());
+ }
+ }
+
+ public void mergeComplexJsonDataOnTemplate(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+ //log.info("Received mergeJsonComplexDataOnTemplate call with params : " + inParams);
+ String responsePrefix = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+ try{
+ responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+ String jsonData = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_JSON_DATA);
+ if(StringUtils.isBlank(jsonData)){
+ throw new Exception("JSON Data is missing");
+ }
+
+ String templateData = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_DATA);
+ String templateFile = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_FILE);
+
+ if(StringUtils.isBlank(templateData) && StringUtils.isBlank(templateFile)){
+ throw new Exception("Template data or Template file is missing");
+ }
+ if(StringUtils.isBlank(templateData)){
+ //String path = MergeNode.class.getClassLoader().getResource(".").toString();
+ templateData = IOUtils.toString(MergeNode.class.getClassLoader().getResourceAsStream(templateFile), Charset.defaultCharset());
+ }
+
+ String templateType = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_TYPE);
+ String doPrettyOutput = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_DO_PRETTY_OUTPUT);
+
+ String mergedData = MergeTool.mergeJson2TemplateData(templateData, jsonData, templateType, doPrettyOutput);
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_MERGED_DATA,mergedData);
+
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
+ //log.info("Data Merge Successful :" + ctx);
+ } catch (Exception e) {
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_FAILURE);
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
+ log.error("Failed in merging data to template " + e.getMessage());
+ throw new SvcLogicException(e.getMessage());
+ }
+ }
+
+ public void mergeYamlDataOnTemplate(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+
+ }
+
+}
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/pattern/PatternNode.java b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/pattern/PatternNode.java
new file mode 100644
index 000000000..04b62687f
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/pattern/PatternNode.java
@@ -0,0 +1,81 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator.pattern;
+
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.openecomp.sdnc.config.generator.ConfigGeneratorConstant;
+import org.openecomp.sdnc.config.generator.tool.CheckDataTool;
+import org.openecomp.sdnc.config.generator.tool.LogParserTool;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.openecomp.sdnc.sli.SvcLogicContext;
+import org.openecomp.sdnc.sli.SvcLogicException;
+import org.openecomp.sdnc.sli.SvcLogicJavaPlugin;
+
+public class PatternNode implements SvcLogicJavaPlugin {
+
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(PatternNode.class);
+
+ public void parseErrorLog(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+ log.info("Received parseErroLog call with params : " + inParams);
+ String responsePrefix = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+ try{
+ responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+ String logData = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_LOG_DATA);
+ if(StringUtils.isBlank(logData)){
+ throw new Exception("Log Data is missing");
+ }
+ LogParserTool logParserTool = new LogParserTool();
+ String parsedError = logParserTool.parseErrorLog(logData);
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_PARSED_ERROR, parsedError);
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
+ } catch (Exception e) {
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_FAILURE);
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
+ log.error("Failed in parsing error log " + e.getMessage());
+ throw new SvcLogicException(e.getMessage());
+ }
+ }
+
+ public void checkDataType(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+ log.info("Received checkDataType call with params : " + inParams);
+ String responsePrefix = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+ try{
+ responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+ String checkData = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_CHECK_DATA);
+ if(StringUtils.isBlank(checkData)){
+ throw new Exception("Check Data is missing");
+ }
+ String dataType = CheckDataTool.checkData(checkData);
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_DATA_TYPE, dataType);
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
+ } catch (Exception e) {
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_FAILURE);
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
+ log.error("Failed in checkDataType " + e.getMessage());
+ throw new SvcLogicException(e.getMessage());
+ }
+ }
+
+}
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/reader/ReaderNode.java b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/reader/ReaderNode.java
new file mode 100644
index 000000000..301e5d701
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/reader/ReaderNode.java
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator.reader;
+
+import java.io.File;
+import java.util.Map;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.openecomp.sdnc.config.generator.ConfigGeneratorConstant;
+import org.openecomp.sdnc.config.generator.merge.MergeNode;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.openecomp.sdnc.sli.SvcLogicContext;
+import org.openecomp.sdnc.sli.SvcLogicException;
+import org.openecomp.sdnc.sli.SvcLogicJavaPlugin;
+
+public class ReaderNode implements SvcLogicJavaPlugin {
+
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(MergeNode.class);
+
+
+ public void getFileData(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+ log.info("Received getFileData call with params : " + inParams);
+ String responsePrefix = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+ try{
+ responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+ String fileName = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_FILE_NAME);
+
+ String fileData = FileUtils.readFileToString(new File(fileName), ConfigGeneratorConstant.STRING_ENCODING);
+
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_FILE_DATA,fileData);
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
+ } catch (Exception e) {
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_FAILURE);
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
+ log.error("Failed in merging data to template " + e.getMessage());
+ throw new SvcLogicException(e.getMessage());
+ }
+ }
+
+
+}
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/CheckDataTool.java b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/CheckDataTool.java
new file mode 100644
index 000000000..316e821df
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/CheckDataTool.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator.tool;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.codehaus.jettison.json.JSONArray;
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+import org.openecomp.sdnc.config.generator.ConfigGeneratorConstant;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+public class CheckDataTool {
+
+ public static String checkData(String data){
+ boolean isJSON = isJSON(data);
+ if(isJSON){
+ return ConfigGeneratorConstant.DATA_TYPE_JSON;
+ }
+
+ boolean isXML = isXML(data);
+ if(isXML){
+ return ConfigGeneratorConstant.DATA_TYPE_XML;
+ }
+
+ return ConfigGeneratorConstant.DATA_TYPE_TEXT;
+ }
+
+ public static boolean isJSON(String data) {
+ try {
+ new JSONObject(data);
+ } catch (JSONException ex) {
+ try {
+ new JSONArray(data);
+ } catch (JSONException ex1) {
+ return false;
+ }
+ }
+ return true;
+
+ // try {
+ // final ObjectMapper mapper = new ObjectMapper();
+ // mapper.readTree(data);
+ // return true;
+ // } catch (IOException e) {
+ // return false;
+ // }
+ }
+
+ public static boolean isXML(String data) {
+ try {
+ DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
+ Document doc = dBuilder.parse(new InputSource(new StringReader(data)));
+ return true;
+ } catch (Exception ex) {
+ return false;
+ }
+
+ }
+
+}
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/Constants.java b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/Constants.java
new file mode 100644
index 000000000..d8af571e8
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/Constants.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator.tool;
+
+public class Constants
+{
+
+ public static final String DBLIB_SERVICE = "org.openecomp.sdnc.sli.resource.dblib.DBResourceManager";
+ public static final String DEVICE_AUTHENTICATION="DEVICE_AUTHENTICATION";
+ public static final String SCHEMA_SDNCTL="SDNCTL";
+
+ public static final String APPC_CONFIG_DIR="/opt/app/bvc/properties";
+
+}
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/CustomJsonNodeFactory.java b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/CustomJsonNodeFactory.java
new file mode 100644
index 000000000..5820cea7a
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/CustomJsonNodeFactory.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator.tool;
+
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.TextNode;
+
+public class CustomJsonNodeFactory extends JsonNodeFactory {
+
+ public TextNode textNode(String text) {
+ return new CustomTextNode(text);
+ }
+
+}
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/CustomTextNode.java b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/CustomTextNode.java
new file mode 100644
index 000000000..93e252a6d
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/CustomTextNode.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator.tool;
+
+
+import com.fasterxml.jackson.core.io.CharTypes;
+import com.fasterxml.jackson.databind.node.TextNode;
+
+public class CustomTextNode extends TextNode{
+
+ public CustomTextNode(String v) {
+ super(v);
+ }
+
+ @Override
+ public String toString()
+ {
+ int len = textValue().length();
+ len = len + 2 + (len >> 4);
+ StringBuilder sb = new StringBuilder(len);
+ appendQuoted(sb, textValue());
+ return sb.toString();
+ }
+
+ protected static void appendQuoted(StringBuilder sb, String content)
+ {
+ // sb.append('"');
+ CharTypes.appendQuoted(sb, content);
+ // sb.append('"');
+ }
+
+}
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/DbServiceUtil.java b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/DbServiceUtil.java
new file mode 100644
index 000000000..80db36816
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/DbServiceUtil.java
@@ -0,0 +1,75 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator.tool;
+
+import java.io.File;
+import java.net.URL;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Properties;
+
+import javax.sql.rowset.CachedRowSet;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.openecomp.sdnc.sli.resource.dblib.DBResourceManager;
+import org.openecomp.sdnc.sli.resource.dblib.DbLibService;
+
+public class DbServiceUtil
+{
+ private static final Logger log = LoggerFactory
+ .getLogger(DbServiceUtil.class);
+
+ private static Properties props;
+ private static DBResourceManager jdbcDataSource = null;
+
+
+ public static boolean updateDB(String tableName, ArrayList inputArgs, String scema, String whereClause, String setCluase) throws SQLException
+ {
+ String updatePasswordString = "update " + tableName + " set " + setCluase + " where " + whereClause ;
+ boolean result = jdbcDataSource.writeData(updatePasswordString, inputArgs,Constants.SCHEMA_SDNCTL);
+ return result;
+ }
+
+
+ public static CachedRowSet getData(String tableName, ArrayList argList, String schema, String getselectData, String getDataClasue ) throws SQLException
+ {
+ String selectQuery = "select " + getselectData + "from " + tableName + " where " + getDataClasue ;
+ CachedRowSet data = jdbcDataSource.getData(selectQuery, argList, schema);
+ return data;
+ }
+
+
+ public static DBResourceManager initDbLibService() throws Exception
+ {
+ props = new Properties();
+ File file = new File("/opt/app/bvc/properties/dblib.properties");
+ URL propURL = file.toURI().toURL();
+ props.load(propURL.openStream());
+ jdbcDataSource = DBResourceManager.create(props);
+ return jdbcDataSource;
+
+ }
+
+
+
+}
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/EscapeUtils.java b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/EscapeUtils.java
new file mode 100644
index 000000000..f783d4c69
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/EscapeUtils.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator.tool;
+
+import org.apache.commons.lang3.StringUtils;
+
+public class EscapeUtils {
+
+ public EscapeUtils() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public static String escapeSql(String str) {
+ if (str == null) {
+ return null;
+ }
+ String searchList[] = new String[]{"'","\\"};
+ String replacementList[] = new String[]{ "''","\\\\"};
+ return StringUtils.replaceEach(str,searchList, replacementList);
+ }
+
+ // For Generic Purpose
+ public static String escapeSQL(String s) {
+ if (s == null) {
+ return null;
+ }
+
+ int length = s.length();
+ int newLength = length;
+ for (int i = 0; i < length; i++) {
+ char c = s.charAt(i);
+ switch (c) {
+ case '\\':
+ case '\"':
+ case '\'':
+ case '\0': {
+ newLength += 1;
+ }
+ break;
+ }
+ }
+ if (length == newLength) {
+ // nothing to escape in the string
+ return s;
+ }
+ StringBuffer sb = new StringBuffer(newLength);
+ for (int i = 0; i < length; i++) {
+ char c = s.charAt(i);
+ switch (c) {
+ case '\\': {
+ sb.append("\\\\");
+ }
+ break;
+ case '\"': {
+ sb.append("\\\"");
+ }
+ break;
+ case '\'': {
+ sb.append("\\\'");
+ }
+ break;
+ case '\0': {
+ sb.append("\\0");
+ }
+ break;
+ default: {
+ sb.append(c);
+ }
+ }
+ }
+ return sb.toString();
+ }
+}
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/JSONTool.java b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/JSONTool.java
new file mode 100644
index 000000000..63fd7006e
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/JSONTool.java
@@ -0,0 +1,157 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator.tool;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.codehaus.jettison.json.JSONArray;
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+
+
+public class JSONTool {
+
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(JSONTool.class);
+
+ public static Map<String, String> convertToProperties(String s) throws JSONException {
+ return convertToProperties(s, null);
+ }
+
+ public static Map<String, String> convertToProperties(String s,List<String> blockKeys) throws JSONException {
+ JSONObject json = new JSONObject(s);
+ Map<String, String> mm = new HashMap<String, String>();
+
+ Map<String, Object> wm = new HashMap<String, Object>();
+ Iterator<String> ii = json.keys();
+ while (ii.hasNext()) {
+ String key1 = ii.next();
+ wm.put(key1, json.get(key1));
+
+
+ }
+
+ while (!wm.isEmpty())
+ for (String key : new ArrayList<>(wm.keySet())) {
+ Object o = wm.get(key);
+ wm.remove(key);
+
+
+ if(blockKeys != null && blockKeys.contains(key) && o != null){
+ //log.info("Adding JSON Block Keys : " + key + "=" + o.toString());
+ mm.put("block_" +key,o.toString());
+ }
+
+ if (o instanceof Boolean || o instanceof Number || o instanceof String) {
+ mm.put(key, o.toString());
+ //log.info("Added property: " + key + ": " + o.toString());
+ }
+
+ else if (o instanceof JSONObject) {
+ JSONObject jo = (JSONObject) o;
+ Iterator<String> i = jo.keys();
+ while (i.hasNext()) {
+ String key1 = i.next();
+ wm.put(key + "." + key1, jo.get(key1));
+ }
+ }
+
+ else if (o instanceof JSONArray) {
+ JSONArray ja = (JSONArray) o;
+ mm.put("size_"+key, String.valueOf(ja.length()));
+
+ //log.info("Added property: " + key + "_length" + ": " + String.valueOf(ja.length()));
+
+ for (int i = 0; i < ja.length(); i++)
+ wm.put(key + '[' + i + ']', ja.get(i));
+ }
+ }
+
+ return mm;
+ }
+
+ /*
+ public static Map<String, String> convertToProperties1(String s,List<String> blockKeys) throws Exception {
+ ObjectMapper objectMapper = new ObjectMapper();
+
+ JsonNode rootNode = objectMapper.readTree(s);
+
+ Map<String, String> mm = new HashMap<String, String>();
+
+ Map<String, Object> wm = new HashMap<String, Object>();
+ Iterator<String> ii = rootNode.fieldNames();
+ while (ii.hasNext()) {
+ String key1 = ii.next();
+ wm.put(key1, rootNode.get(key1));
+
+
+ }
+
+ while (!wm.isEmpty())
+ for (String key : new ArrayList<>(wm.keySet())) {
+ Object o = wm.get(key);
+ wm.remove(key);
+
+
+ if(blockKeys != null && blockKeys.contains(key) && o != null){
+ //log.info("Adding JSON Block Keys : " + key + "=" + o.toString());
+ mm.put("block_" +key,o.toString());
+ }
+
+ if (o instanceof Boolean || o instanceof Number || o instanceof String) {
+ mm.put(key, o.toString());
+ //log.info("Added property: " + key + ": " + o.toString());
+ }
+
+ else if (o instanceof JSONObject) {
+ JSONObject jo = (JSONObject) o;
+ Iterator<String> i = jo.keys();
+ while (i.hasNext()) {
+ String key1 = i.next();
+ wm.put(key + "." + key1, jo.get(key1));
+ }
+ }
+
+ else if (o instanceof JSONArray) {
+ JSONArray ja = (JSONArray) o;
+ mm.put("size_"+key, String.valueOf(ja.length()));
+
+ //log.info("Added property: " + key + "_length" + ": " + String.valueOf(ja.length()));
+
+ for (int i = 0; i < ja.length(); i++)
+ wm.put(key + '[' + i + ']', ja.get(i));
+ }
+ }
+
+ return mm;
+ }
+*/
+
+}
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/LogParserTool.java b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/LogParserTool.java
new file mode 100644
index 000000000..54823bc17
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/LogParserTool.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator.tool;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+public class LogParserTool {
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(JSONTool.class);
+
+ private String[] singleLines;
+ private List<String> recentErrors = new ArrayList<String> ();;
+ private Date todaysDate = new Date();
+ private SimpleDateFormat dFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
+ private final int minMilli = 60000;
+ private final int IN_TIME = 0;
+ private final int NOT_IN_TIME = 1;
+ private final int NO_DATE = 2;
+
+ public String parseErrorLog(String data){
+ singleLines = data.split("\\r?\\n");
+ try {
+ getNearestDates();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ if(recentErrors.size() == 0){
+ recentErrors.clear();
+ return "Did not find the string 'Starting orchestration of file backed up to /var/opt/MetaSwitch/orch/orch_conf.json' in the log file with timestamp within the last 5 minutes";
+ }else if(recentErrors.size() == 1){
+ recentErrors.clear();
+ return "Did not find the string ‘Error parsing orchestration file’ in the log file with timestamp within the last 5 minutes";
+ }else{
+ String error = recentErrors.get(0);
+ recentErrors.clear();
+ return "Error: "+ error.substring(error.indexOf("Error parsing orchestration file:")+34);
+ }
+ }
+
+ public void getNearestDates() throws ParseException{
+ int result;
+ for( int i = singleLines.length-1; i >= 0 ; i--){
+ if(singleLines[i].contains("Starting orchestration of file backed up to") || singleLines[i].contains("Error parsing orchestration file:")){
+ result = checkDateTime(singleLines[i]);
+ if( result == IN_TIME)
+ recentErrors.add(singleLines[i]);
+ else if(result == NOT_IN_TIME){
+ return;
+ }
+ }
+ }
+ }
+
+ private int checkDateTime(String line){
+ Date newDate;
+ try {
+ newDate = dFormat.parse(line.substring(0, 19));
+ if((todaysDate.getTime() - newDate.getTime()) <= 5*minMilli){
+ return IN_TIME;
+ }else
+ return NOT_IN_TIME;
+ } catch (ParseException e) {
+ e.printStackTrace();
+ return NO_DATE;
+ }
+ }
+
+
+}
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/MergeTool.java b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/MergeTool.java
new file mode 100644
index 000000000..0958deebb
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/tool/MergeTool.java
@@ -0,0 +1,109 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator.tool;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.Velocity;
+import org.apache.velocity.app.VelocityEngine;
+import org.apache.velocity.runtime.RuntimeConstants;
+import org.apache.velocity.runtime.resource.loader.StringResourceLoader;
+import org.apache.velocity.runtime.resource.util.StringResourceRepository;
+import org.openecomp.sdnc.config.generator.ConfigGeneratorConstant;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+
+public class MergeTool {
+
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(MergeTool.class);
+
+ public static String mergeMap2TemplateData(String template, Map< String, String> dataMap ){
+ log.info("MergeMap2TemplateData Template :"+ template + " Maps :"+ dataMap);
+ StringWriter writer = new StringWriter();
+ VelocityEngine ve = new VelocityEngine();
+ ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "string");
+ ve.addProperty("string.resource.loader.class", StringResourceLoader.class.getName());
+ ve.addProperty("string.resource.loader.repository.static", "false");
+ ve.init();
+
+ StringResourceRepository repo = (StringResourceRepository)ve.getApplicationAttribute(StringResourceLoader.REPOSITORY_NAME_DEFAULT);
+ repo.putStringResource("TemplateResource", template);
+
+ Template t = ve.getTemplate("TemplateResource");
+ VelocityContext context = new VelocityContext();
+ Iterator<Map.Entry<String, String>> entries = dataMap.entrySet().iterator();
+ while (entries.hasNext()) {
+ Map.Entry<String, String> entry = entries.next();
+ context.put(entry.getKey(), entry.getValue());
+ }
+ t.merge(context, writer);
+ return writer.toString();
+ }
+
+
+ public static String mergeJson2TemplateData(String template, String jsonData, String templateType, String doPrettyOutput) throws JsonParseException, JsonMappingException, IOException{
+ String mergedData = template;
+ if( StringUtils.isNotBlank(template) && StringUtils.isNotBlank(jsonData)){
+ Velocity.init();
+
+ ObjectMapper mapper = new ObjectMapper();
+ CustomJsonNodeFactory f = new CustomJsonNodeFactory();
+ mapper.setNodeFactory(f);
+
+ JsonNode jsonObj = mapper.readValue(jsonData, JsonNode.class);
+
+ VelocityContext context = new VelocityContext();
+ Iterator<String> ii = jsonObj.fieldNames();
+ while (ii.hasNext()) {
+ String key = ii.next();
+ context.put(key, jsonObj.get(key));
+ }
+
+ StringWriter writer = new StringWriter();
+ Velocity.evaluate(context, writer, "TemplateData", template);
+ writer.flush();
+ mergedData = writer.toString();
+
+ if(StringUtils.isNotBlank(templateType) && StringUtils.isNotBlank(doPrettyOutput)
+ && ConfigGeneratorConstant.Y.equalsIgnoreCase(doPrettyOutput)
+ && ( ConfigGeneratorConstant.DATA_TYPE_JSON.equalsIgnoreCase(templateType)
+ || ConfigGeneratorConstant.DATA_TYPE_XML.equalsIgnoreCase(templateType)) ){
+ // Perform Prettying
+
+ }
+ }
+ return mergedData;
+
+ }
+
+}
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/transform/XSLTTransformerNode.java b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/transform/XSLTTransformerNode.java
new file mode 100644
index 000000000..bdcf37339
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/transform/XSLTTransformerNode.java
@@ -0,0 +1,96 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator.transform;
+
+import java.io.File;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.nio.charset.Charset;
+import java.util.Map;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.openecomp.sdnc.config.generator.ConfigGeneratorConstant;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.openecomp.sdnc.sli.SvcLogicContext;
+import org.openecomp.sdnc.sli.SvcLogicException;
+import org.openecomp.sdnc.sli.SvcLogicJavaPlugin;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+
+public class XSLTTransformerNode implements SvcLogicJavaPlugin {
+
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(XSLTTransformerNode.class);
+
+ public void transformData(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+ log.trace("Received convertJson2DGContext call with params : " + inParams);
+ String responsePrefix = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+ try {
+ responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : "";
+
+ String templateData = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_DATA);
+
+ if (StringUtils.isNotBlank(templateData)) {
+ String templateFile = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_FILE);
+ if (StringUtils.isNotBlank(templateFile)) {
+ templateData = FileUtils.readFileToString(new File(templateFile), Charset.defaultCharset());
+ }
+ }
+ if (StringUtils.isBlank(templateData)) {
+ throw new Exception("In-param templateFile/templateData value is missing");
+ }
+
+ String requestData = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_REQUEST_DATA);
+ if (StringUtils.isBlank(requestData)) {
+ throw new Exception("In-param requestData value is missing");
+ }
+
+ String transformedData = transform(requestData, templateData);
+ log.trace("Transformed Data : "+ transformedData);
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_TRANSFORMED_DATA, transformedData);
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
+ } catch (Exception e) {
+ e.printStackTrace();
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS,
+ ConfigGeneratorConstant.OUTPUT_STATUS_FAILURE);
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
+ log.error("Failed in XSLTTransformerNode : " + e.getMessage());
+ throw new SvcLogicException(e.getMessage());
+ }
+ }
+
+ public String transform(String requestData, String templateData)
+ throws TransformerConfigurationException, TransformerException {
+ StringWriter xmlResultResource = new StringWriter();
+ Transformer xmlTransformer = TransformerFactory.newInstance().newTransformer(new StreamSource(new StringReader(templateData)));
+ xmlTransformer.transform(new StreamSource(new StringReader(requestData)), new StreamResult(xmlResultResource));
+ return xmlResultResource.getBuffer().toString();
+ }
+
+}
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/writer/FileWriterNode.java b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/writer/FileWriterNode.java
new file mode 100644
index 000000000..81202777c
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/main/java/org/openecomp/sdnc/config/generator/writer/FileWriterNode.java
@@ -0,0 +1,70 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator.writer;
+
+import java.io.File;
+import java.util.Map;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.openecomp.sdnc.config.generator.ConfigGeneratorConstant;
+
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.openecomp.sdnc.sli.SvcLogicContext;
+import org.openecomp.sdnc.sli.SvcLogicException;
+import org.openecomp.sdnc.sli.SvcLogicJavaPlugin;
+
+public class FileWriterNode implements SvcLogicJavaPlugin {
+
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(FileWriterNode.class);
+
+
+
+ public void writeFile(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+ log.info("Received writeFile call with params : " + inParams);
+ String responsePrefix = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+ try{
+ responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+ String fileName = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_FILE_NAME);
+ String fileContents = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_REQUEST_DATA);
+
+
+ File file = new File(fileName);
+ File filePath = file.getParentFile();
+ FileUtils.forceMkdir(filePath);
+
+ FileUtils.writeStringToFile(file, fileContents, ConfigGeneratorConstant.STRING_ENCODING);
+
+
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
+ } catch (Exception e) {
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_FAILURE);
+ ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
+ log.error("Failed in writeFile " + e.getMessage());
+ throw new SvcLogicException(e.getMessage());
+ }
+ }
+
+
+
+}
diff --git a/appc-config/appc-config-generator/provider/src/main/resources/adaptor.properties b/appc-config/appc-config-generator/provider/src/main/resources/adaptor.properties
new file mode 100644
index 000000000..b6261a303
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/main/resources/adaptor.properties
@@ -0,0 +1,25 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP : APP-C
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# 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.
+# ============LICENSE_END=========================================================
+###
+
+adaptorName=
+vSphere.url=
+vSphere.user=
+vSphere.passwd=
+org.xml.sax.driver=
diff --git a/appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/convert/TestConvertNode.java b/appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/convert/TestConvertNode.java
new file mode 100644
index 000000000..985f295cc
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/convert/TestConvertNode.java
@@ -0,0 +1,149 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator.convert;
+
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.Test;
+import org.openecomp.sdnc.config.generator.ConfigGeneratorConstant;
+import org.openecomp.sdnc.config.generator.convert.ConvertNode;
+import org.openecomp.sdnc.config.generator.merge.TestMergeNode;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.openecomp.sdnc.sli.SvcLogicContext;
+import org.openecomp.sdnc.sli.SvcLogicException;
+
+public class TestConvertNode {
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(TestConvertNode.class);
+
+// @Test
+ public void testPayloadParametersConfig() throws Exception {
+ SvcLogicContext ctx = new SvcLogicContext();
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_IS_ESCAPED, "N");
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_BLOCK_KEYS, "configuration-parameters,configuration.configuration-json,configuration.configuration-string");
+ convertJson2Context("convert/payload_parameters_config.json", inParams, ctx);
+ log.info("testPayloadParametersConfig Result: " + ctx.getAttribute("block_configuration-parameters"));
+
+ }
+
+//@Test
+ public void testPayloadCliConfig() throws Exception {
+ SvcLogicContext ctx = new SvcLogicContext();
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_IS_ESCAPED, "N");
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_BLOCK_KEYS, "configuration-parameters,configuration.configuration-json,configuration.configuration-string");
+ convertJson2Context("convert/payload_cli_config.json", inParams, ctx);
+
+ log.info("testPayloadCliConfig Result: " + ctx.getAttribute("block_configuration-parameters"));
+ log.info("testPayloadCliConfig Result: " + ctx.getAttribute("block_configuration.configuration-string"));
+ }
+
+ //@Test
+ public void testPayloadXMLConfig() throws Exception {
+ SvcLogicContext ctx = new SvcLogicContext();
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_IS_ESCAPED, "N");
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_BLOCK_KEYS, "configuration-parameters,configuration.configuration-json,configuration.configuration-string");
+ convertJson2Context("convert/payload_xml_config.json", inParams, ctx);
+
+ log.info("testPayloadXMLConfig Result: " + ctx.getAttribute("block_configuration-parameters"));
+ log.info("testPayloadXMLConfig Result: " + ctx.getAttribute("block_configuration.configuration-string"));
+ }
+ //@Test
+ public void testPayloadJsonConfig() throws Exception {
+ SvcLogicContext ctx = new SvcLogicContext();
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_IS_ESCAPED, "N");
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_BLOCK_KEYS, "configuration-parameters,configuration.configuration-json,configuration.configuration-string");
+ convertJson2Context("convert/payload_json_config.json", inParams, ctx);
+ log.info("testPayloadJsonConfig Result: " + ctx.getAttribute("block_configuration-parameters"));
+ log.info("testPayloadJsonConfig Result: " + ctx.getAttribute("block_configuration.configuration-json"));
+ }
+ //@Test
+ private void convertJson2Context(String jsonFile, Map<String, String> inParams, SvcLogicContext ctx) throws IOException, SvcLogicException {
+ ConvertNode convertNode = new ConvertNode();
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+
+ String jsonData = IOUtils.toString(TestMergeNode.class.getClassLoader().getResourceAsStream(jsonFile));
+ log.info("TestConvertNode.testConvertJson2DGContext()" + jsonData);
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_JSON_DATA, jsonData);
+ convertNode.convertJson2DGContext(inParams, ctx);
+ assertEquals(ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_STATUS), ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
+ }
+
+// @Test
+ public void testEscapeData() throws Exception {
+ SvcLogicContext ctx = new SvcLogicContext();
+ Map<String, String> inParams = new HashMap<String, String>();
+ //String unescapeData = IOUtils.toString(TestMergeNode.class.getClassLoader().getResourceAsStream("convert/escape/config_msc.txt"));
+ String unescapeData = IOUtils.toString(TestMergeNode.class.getClassLoader().getResourceAsStream("convert/escape/config_ssc.txt"));
+ //String unescapeData = IOUtils.toString(TestMergeNode.class.getClassLoader().getResourceAsStream("convert/escape/config_vdbe.xml"));
+ log.info("TestConvertNode.testEscapeData() unescapeData :"+unescapeData);
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_UNESCAPE_DATA, unescapeData);
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_DATA_TYPE, ConfigGeneratorConstant.DATA_TYPE_SQL);
+ ConvertNode convertNode = new ConvertNode();
+ convertNode.escapeData(inParams, ctx);
+ log.info("testEscapeData Result: " + ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_ESCAPE_DATA));
+ }
+
+
+
+// @Test
+ public void testConvertContextToJson() throws Exception {
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute("tmp.uploadConfigInfo.UPLOAD-CONFIG-ID", "200");
+ ctx.setAttribute("tmp.uploadConfigInfo.VNF-ID", "00000");
+ ctx.setAttribute("tmp.uploadConfigInfo.test[0]", "test0");
+ ctx.setAttribute("tmp.uploadConfigInfo.test[1]", "test1");
+ ctx.setAttribute("tmp.uploadConfigInfo.test[2]", "test2");
+
+
+ ConvertNode convertNode = new ConvertNode();
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+ inParams.put("contextKey", "tmp.uploadConfigInfo");
+
+
+ convertNode.convertContextToJson(inParams, ctx);
+
+ log.info("JSON CONTENT " + ctx.getAttribute("test.jsonContent"));
+ assertEquals(ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_STATUS), ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
+
+
+
+ }
+
+
+
+
+}
diff --git a/appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/merge/TestMergeNode.java b/appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/merge/TestMergeNode.java
new file mode 100644
index 000000000..191dfa3b5
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/merge/TestMergeNode.java
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator.merge;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.Test;
+import org.junit.Ignore;
+import org.openecomp.sdnc.config.generator.ConfigGeneratorConstant;
+import org.openecomp.sdnc.config.generator.merge.MergeNode;
+
+import org.openecomp.sdnc.sli.SvcLogicContext;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class TestMergeNode {
+
+ //@Test
+ public void testMergeJsonDataOnTemplate() throws Exception {
+ MergeNode mergeNode = new MergeNode();
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+
+ String jsonData = IOUtils.toString(TestMergeNode.class.getClassLoader().getResourceAsStream("merge/vdbe_data.json"));
+ System.out.println("TestMergeNode.testMergeJsonDataOnTemplate()" + jsonData);
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_JSON_DATA, jsonData);
+
+ String templateData = IOUtils.toString(TestMergeNode.class.getClassLoader().getResourceAsStream("merge/vdbe_template.xml"));
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_DATA, templateData);
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ mergeNode.mergeJsonDataOnTemplate(inParams, ctx);
+ assertEquals(ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_STATUS), ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
+
+ System.out.println("Result: " + ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_MERGED_DATA));
+
+ }
+
+ //@Ignore
+ public void testMergeComplexJsonDataOnTemplate() throws Exception {
+ MergeNode mergeNode = new MergeNode();
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+
+ String jsonData = IOUtils.toString(TestMergeNode.class.getClassLoader().getResourceAsStream("merge/complex/vdbe_data.json"));
+ System.out.println("TestMergeNode.testMergeJsonComplexDataOnTemplate()" + jsonData);
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_JSON_DATA, jsonData);
+
+ String templateData = IOUtils.toString(TestMergeNode.class.getClassLoader().getResourceAsStream("merge/complex/vdbe_template.xml"));
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_DATA, templateData);
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ mergeNode.mergeComplexJsonDataOnTemplate(inParams, ctx);
+ assertEquals(ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_STATUS), ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
+
+ System.out.println("Result: " + ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_MERGED_DATA));
+
+ }
+
+ //@Test
+ public void testMergeJsonDataOnTemplateFile() throws Exception {
+ MergeNode mergeNode = new MergeNode();
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+
+ String jsonData = IOUtils.toString(TestMergeNode.class.getClassLoader().getResourceAsStream("merge/vdbe_data.json"));
+ System.out.println("TestMergeNode.testMergeJsonDataOnTemplate()" + jsonData);
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_JSON_DATA, jsonData);
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_FILE, "merge/vdbe_template.xml");
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ mergeNode.mergeJsonDataOnTemplate(inParams, ctx);
+ assertEquals(ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_STATUS), ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
+ System.out.println("Result: " + ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_MERGED_DATA));
+
+ }
+}
diff --git a/appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/pattern/TestPatternNode.java b/appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/pattern/TestPatternNode.java
new file mode 100644
index 000000000..41d8945c2
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/pattern/TestPatternNode.java
@@ -0,0 +1,111 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator.pattern;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.Test;
+import org.openecomp.sdnc.config.generator.ConfigGeneratorConstant;
+import org.openecomp.sdnc.config.generator.pattern.PatternNode;
+
+import org.openecomp.sdnc.sli.SvcLogicContext;
+
+public class TestPatternNode {
+
+
+ public void parseErrorLog() throws Exception {
+ PatternNode patternNode = new PatternNode();
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+
+ String logData = IOUtils.toString(TestPatternNode.class.getClassLoader().getResourceAsStream("pattern/errorlog.txt"),ConfigGeneratorConstant.STRING_ENCODING);
+ //System.out.println("TestMergeNode.testMergeJsonDataOnTemplate()" + jsonData);
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_LOG_DATA, logData);
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ patternNode.parseErrorLog(inParams, ctx);
+ assertEquals(ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_STATUS), ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
+
+ System.out.println("Result: " + ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_PARSED_ERROR));
+
+ }
+
+ //@Test
+ public void checkXMLData() throws Exception {
+ PatternNode patternNode = new PatternNode();
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+
+ String xmlData = IOUtils.toString(TestPatternNode.class.getClassLoader().getResourceAsStream("pattern/xml_data.xml"),ConfigGeneratorConstant.STRING_ENCODING);
+ //System.out.println("TestMergeNode.testMergeJsonDataOnTemplate()" + jsonData);
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_CHECK_DATA, xmlData);
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ patternNode.checkDataType(inParams, ctx);
+ assertEquals(ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_STATUS), ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
+
+ System.out.println("Result: " + ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_DATA_TYPE));
+
+ }
+
+ //@Test
+ public void checkJsonData() throws Exception {
+ PatternNode patternNode = new PatternNode();
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+
+ String xmlData = IOUtils.toString(TestPatternNode.class.getClassLoader().getResourceAsStream("pattern/json_data.json"),ConfigGeneratorConstant.STRING_ENCODING);
+ //System.out.println("TestMergeNode.testMergeJsonDataOnTemplate()" + jsonData);
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_CHECK_DATA, xmlData);
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ patternNode.checkDataType(inParams, ctx);
+ assertEquals(ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_STATUS), ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
+
+ System.out.println("Result: " + ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_DATA_TYPE));
+
+ }
+
+ //@Test
+ public void checStringData() throws Exception {
+ PatternNode patternNode = new PatternNode();
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+
+ String stringData = IOUtils.toString(TestPatternNode.class.getClassLoader().getResourceAsStream("pattern/text_data.txt"),ConfigGeneratorConstant.STRING_ENCODING);
+ //System.out.println("TestMergeNode.testMergeJsonDataOnTemplate()" + jsonData);
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_CHECK_DATA, stringData);
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ patternNode.checkDataType(inParams, ctx);
+ assertEquals(ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_STATUS), ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
+
+ System.out.println("Result: " + ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_DATA_TYPE));
+
+ }
+
+
+
+}
diff --git a/appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/transform/TestXSLTTransformerNode.java b/appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/transform/TestXSLTTransformerNode.java
new file mode 100644
index 000000000..a8460dadc
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/transform/TestXSLTTransformerNode.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator.transform;
+
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertEquals;
+
+import java.nio.charset.Charset;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.Test;
+import org.openecomp.sdnc.config.generator.ConfigGeneratorConstant;
+import org.openecomp.sdnc.config.generator.merge.TestMergeNode;
+import org.openecomp.sdnc.config.generator.transform.XSLTTransformerNode;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.openecomp.sdnc.sli.SvcLogicContext;
+
+public class TestXSLTTransformerNode {
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(TestXSLTTransformerNode.class);
+
+ //@Test
+ public void transformData() throws Exception {
+ SvcLogicContext ctx = new SvcLogicContext();
+
+ String templateData = IOUtils.toString(TestMergeNode.class.getClassLoader().getResourceAsStream("transform/template.xsl"), Charset.defaultCharset());
+ String requestData = IOUtils.toString(TestMergeNode.class.getClassLoader().getResourceAsStream("transform/request.xml"), Charset.defaultCharset());
+
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_DATA, templateData );
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_REQUEST_DATA, requestData );
+ XSLTTransformerNode transformerNode = new XSLTTransformerNode();
+ transformerNode.transformData(inParams, ctx);
+ log.info("transformData Result: " + ctx.getAttribute(ConfigGeneratorConstant.OUTPUT_PARAM_TRANSFORMED_DATA));
+
+ }
+
+
+}
diff --git a/appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/writer/TestFileWriterNode.java b/appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/writer/TestFileWriterNode.java
new file mode 100644
index 000000000..2a526cd78
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/java/org/openecomp/sdnc/config/generator/writer/TestFileWriterNode.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.generator.writer;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+import org.junit.Test;
+import org.openecomp.sdnc.config.generator.ConfigGeneratorConstant;
+import org.openecomp.sdnc.config.generator.writer.FileWriterNode;
+
+import org.openecomp.sdnc.sli.SvcLogicContext;
+
+public class TestFileWriterNode {
+
+
+ //@Test
+ public void writeFile() throws Exception {
+ FileWriterNode FileWriterNode = new FileWriterNode();
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_FILE_NAME, "src/test/resources/writer/testcvaas.json");
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_REQUEST_DATA,"{'name':'Name','role':'admin'}");
+ inParams.put(ConfigGeneratorConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+
+
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ FileWriterNode.writeFile(inParams, ctx);
+ assertEquals(ctx.getAttribute("test."+ConfigGeneratorConstant.OUTPUT_PARAM_STATUS), ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS);
+
+
+
+ }
+}
diff --git a/appc-config/appc-config-generator/provider/src/test/resources/convert/escape/config_msc.txt b/appc-config/appc-config-generator/provider/src/test/resources/convert/escape/config_msc.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/resources/convert/escape/config_msc.txt
diff --git a/appc-config/appc-config-generator/provider/src/test/resources/convert/escape/config_ssc.txt b/appc-config/appc-config-generator/provider/src/test/resources/convert/escape/config_ssc.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/resources/convert/escape/config_ssc.txt
diff --git a/appc-config/appc-config-generator/provider/src/test/resources/convert/escape/config_vdbe.xml b/appc-config/appc-config-generator/provider/src/test/resources/convert/escape/config_vdbe.xml
new file mode 100644
index 000000000..787796704
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/resources/convert/escape/config_vdbe.xml
@@ -0,0 +1,19 @@
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APP-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ 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.
+ ============LICENSE_END=========================================================
+ -->
diff --git a/appc-config/appc-config-generator/provider/src/test/resources/convert/payload_cli_config.json b/appc-config/appc-config-generator/provider/src/test/resources/convert/payload_cli_config.json
new file mode 100644
index 000000000..a82eaf0f1
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/resources/convert/payload_cli_config.json
@@ -0,0 +1,19 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
diff --git a/appc-config/appc-config-generator/provider/src/test/resources/convert/payload_json_config.json b/appc-config/appc-config-generator/provider/src/test/resources/convert/payload_json_config.json
new file mode 100644
index 000000000..a82eaf0f1
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/resources/convert/payload_json_config.json
@@ -0,0 +1,19 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
diff --git a/appc-config/appc-config-generator/provider/src/test/resources/convert/payload_parameters_config.json b/appc-config/appc-config-generator/provider/src/test/resources/convert/payload_parameters_config.json
new file mode 100644
index 000000000..a82eaf0f1
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/resources/convert/payload_parameters_config.json
@@ -0,0 +1,19 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
diff --git a/appc-config/appc-config-generator/provider/src/test/resources/convert/payload_template_config.json b/appc-config/appc-config-generator/provider/src/test/resources/convert/payload_template_config.json
new file mode 100644
index 000000000..a82eaf0f1
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/resources/convert/payload_template_config.json
@@ -0,0 +1,19 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
diff --git a/appc-config/appc-config-generator/provider/src/test/resources/convert/payload_xml_config.json b/appc-config/appc-config-generator/provider/src/test/resources/convert/payload_xml_config.json
new file mode 100644
index 000000000..a82eaf0f1
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/resources/convert/payload_xml_config.json
@@ -0,0 +1,19 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
diff --git a/appc-config/appc-config-generator/provider/src/test/resources/merge/complex/vdbe_data.json b/appc-config/appc-config-generator/provider/src/test/resources/merge/complex/vdbe_data.json
new file mode 100644
index 000000000..a82eaf0f1
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/resources/merge/complex/vdbe_data.json
@@ -0,0 +1,19 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
diff --git a/appc-config/appc-config-generator/provider/src/test/resources/merge/complex/vdbe_template.xml b/appc-config/appc-config-generator/provider/src/test/resources/merge/complex/vdbe_template.xml
new file mode 100644
index 000000000..787796704
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/resources/merge/complex/vdbe_template.xml
@@ -0,0 +1,19 @@
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APP-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ 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.
+ ============LICENSE_END=========================================================
+ -->
diff --git a/appc-config/appc-config-generator/provider/src/test/resources/merge/vdbe_data.json b/appc-config/appc-config-generator/provider/src/test/resources/merge/vdbe_data.json
new file mode 100644
index 000000000..a82eaf0f1
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/resources/merge/vdbe_data.json
@@ -0,0 +1,19 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
diff --git a/appc-config/appc-config-generator/provider/src/test/resources/merge/vdbe_template.xml b/appc-config/appc-config-generator/provider/src/test/resources/merge/vdbe_template.xml
new file mode 100644
index 000000000..787796704
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/resources/merge/vdbe_template.xml
@@ -0,0 +1,19 @@
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APP-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ 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.
+ ============LICENSE_END=========================================================
+ -->
diff --git a/appc-config/appc-config-generator/provider/src/test/resources/pattern/errorlog.txt b/appc-config/appc-config-generator/provider/src/test/resources/pattern/errorlog.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/resources/pattern/errorlog.txt
diff --git a/appc-config/appc-config-generator/provider/src/test/resources/pattern/json_data.json b/appc-config/appc-config-generator/provider/src/test/resources/pattern/json_data.json
new file mode 100644
index 000000000..a82eaf0f1
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/resources/pattern/json_data.json
@@ -0,0 +1,19 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
diff --git a/appc-config/appc-config-generator/provider/src/test/resources/pattern/text_data.txt b/appc-config/appc-config-generator/provider/src/test/resources/pattern/text_data.txt
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/resources/pattern/text_data.txt
@@ -0,0 +1 @@
+
diff --git a/appc-config/appc-config-generator/provider/src/test/resources/pattern/xml_data.xml b/appc-config/appc-config-generator/provider/src/test/resources/pattern/xml_data.xml
new file mode 100644
index 000000000..787796704
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/resources/pattern/xml_data.xml
@@ -0,0 +1,19 @@
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APP-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ 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.
+ ============LICENSE_END=========================================================
+ -->
diff --git a/appc-config/appc-config-generator/provider/src/test/resources/transform/request.xml b/appc-config/appc-config-generator/provider/src/test/resources/transform/request.xml
new file mode 100644
index 000000000..9980d2035
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/resources/transform/request.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APP-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ 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.
+ ============LICENSE_END=========================================================
+ -->
+
+<ARTICLE>
+ <TITLE>A Sample Article</TITLE>
+ <SECT>The First Major Section
+ <PARA>This section will introduce a subsection.</PARA>
+ <SECT>The Subsection Heading
+ <PARA>This is the text of the subsection.
+ </PARA>
+ </SECT>
+ </SECT>
+</ARTICLE>
diff --git a/appc-config/appc-config-generator/provider/src/test/resources/transform/template.xsl b/appc-config/appc-config-generator/provider/src/test/resources/transform/template.xsl
new file mode 100644
index 000000000..0ce46dfea
--- /dev/null
+++ b/appc-config/appc-config-generator/provider/src/test/resources/transform/template.xsl
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APP-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ 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.
+ ============LICENSE_END=========================================================
+ -->
+
+
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0"
+ >
+ <xsl:output method="html"/>
+ <xsl:strip-space elements="SECT"/>
+
+ <xsl:template match="/">
+ <html><body>
+ <xsl:apply-templates/>
+ </body></html>
+ </xsl:template>
+
+ <xsl:template match="/ARTICLE/TITLE">
+ <h1 align="center"> <xsl:apply-templates/> </h1>
+ </xsl:template>
+
+ <!-- Top Level Heading -->
+ <xsl:template match="/ARTICLE/SECT">
+ <h2> <xsl:apply-templates select="text()|B|I|U|DEF|LINK"/> </h2>
+ <xsl:apply-templates select="SECT|PARA|LIST|NOTE"/>
+ </xsl:template>
+
+ <!-- Second-Level Heading -->
+ <xsl:template match="/ARTICLE/SECT/SECT">
+ <h3> <xsl:apply-templates select="text()|B|I|U|DEF|LINK"/> </h3>
+ <xsl:apply-templates select="SECT|PARA|LIST|NOTE"/>
+ </xsl:template>
+
+ <!-- Third-Level Heading -->
+ <xsl:template match="/ARTICLE/SECT/SECT/SECT">
+ <xsl:message terminate="yes">Error: Sections can only be nested 2 deep.</xsl:message>
+ </xsl:template>
+
+ <!-- Paragraph -->
+ <xsl:template match="PARA">
+ <p><xsl:apply-templates/></p>
+ </xsl:template>
+
+</xsl:stylesheet>
+
+
diff --git a/appc-config/pom.xml b/appc-config/pom.xml
index d90a3c8b4..17a90f715 100644
--- a/appc-config/pom.xml
+++ b/appc-config/pom.xml
@@ -92,6 +92,7 @@
<module>appc-encryption-tool</module>
<module>appc-data-services</module>
<module>appc-flow-controller</module>
+ <module>appc-config-generator</module>
</modules>
</project>