Update appc-config-parms to use onap packaging 85/26485/3
authorTakamune Cho <tc012c@att.com>
Tue, 19 Dec 2017 01:20:35 +0000 (19:20 -0600)
committerPatrick Brady <pb071s@att.com>
Tue, 19 Dec 2017 15:47:04 +0000 (15:47 +0000)
Issue-ID: APPC-13
Change-Id: I490847faabfed2e977ee21c0157adf8a790cea65
Signed-off-by: Takamune Cho <tc012c@att.com>
44 files changed:
appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/pom.xml
appc-config/appc-config-adaptor/features/.gitignore
appc-config/appc-config-adaptor/installer/src/assembly/assemble_installer_zip.xml
appc-config/appc-config-adaptor/installer/src/assembly/assemble_mvnrepo_zip.xml
appc-config/appc-config-adaptor/installer/src/main/resources/scripts/install-feature.sh
appc-config/appc-config-adaptor/provider/.gitignore
appc-config/appc-config-adaptor/provider/src/main/java/org/onap/appc/ccadaptor/CCAActivator.java
appc-config/appc-config-audit/features/.gitignore
appc-config/appc-config-audit/provider/.gitignore
appc-config/appc-config-generator/features/.gitignore
appc-config/appc-config-generator/provider/.gitignore
appc-config/appc-config-params/features/.gitignore
appc-config/appc-config-params/provider/.gitignore
appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/ParamsHandlerActivator.java
appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/ParamsHandlerConstant.java
appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/data/Parameter.java
appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/data/PropertyDefinition.java
appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/data/RequestKey.java
appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/data/ResponseKey.java
appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/parser/PropertyDefinitionNode.java
appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/ArtificatTransformer.java
appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/tosca/ArtifactProcessor.java
appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/tosca/ArtifactProcessorFactory.java
appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/tosca/ArtifactProcessorImpl.java
appc-config/appc-config-params/provider/src/main/java/org/onap/sdnc/config/params/transformer/tosca/exceptions/ArtifactProcessorException.java
appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/parser/TestPropertyDefinitionNode.java
appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestArtifactProcessor.java
appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestGenerateArtifactObject.java
appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestGenerateArtifactString.java
appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestPropertyQueryString.java
appc-config/appc-config-params/provider/src/test/java/org/onap/sdnc/config/params/transformer/tosca/TestReadArtifact.java
appc-config/appc-config-params/provider/src/test/resources/parser/pd.yaml
appc-config/appc-data-services/features/.gitignore
appc-config/appc-data-services/provider/.gitignore
appc-config/appc-encryption-tool/features/.gitignore
appc-config/appc-encryption-tool/provider/.gitignore
appc-config/appc-flow-controller/features/.gitignore
appc-config/appc-flow-controller/provider/.gitignore
appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNode.java
appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaceImpl/InstarResponseHandlerImpl.java
appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/interfaceImpl/InterfaceIpAddressImpl.java
appc-outbound/appc-network-inventory-client/provider/src/main/java/org/onap/appc/instar/node/InstarClientNode.java
appc-outbound/appc-network-inventory-client/provider/src/test/java/org/onap/appc/instar/interfaceImpl/TestInstarResponseHandlerImpl.java
appc-outbound/appc-network-inventory-client/provider/src/test/java/org/onap/appc/instar/interfaceImpl/TestInterfaceIpAddressImpl.java

index e0fd14b..b91dfdc 100644 (file)
             <scope>compile</scope>
         </dependency>
 
+<dependency>
+<groupId>org.mockito</groupId>
+<artifactId>mockito-core</artifactId>
+<scope>test</scope>
+</dependency>
 
         <dependency>
             <groupId>org.glassfish.jersey.core</groupId>
index 31a71f7..b9e8d08 100644 (file)
@@ -1,9 +1,11 @@
 <!--
   ============LICENSE_START=======================================================
-  ONAP : APP-C
+  ONAP : APPC
   ================================================================================
-  Copyright (C) 2017 AT&T Intellectual Property.  All rights reserved.
+  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
@@ -15,6 +17,8 @@
   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.
+  
+  ECOMP is a trademark and service mark of AT&T Intellectual Property.
   ============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>adapter</id>
-       <formats>
-               <format>zip</format>
-       </formats>
+    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>adapter</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>
+    <!--  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>
+    <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>
 
 
 
index c7fd287..238d4a2 100644 (file)
@@ -1,9 +1,11 @@
 <!--
   ============LICENSE_START=======================================================
-  ONAP : APP-C
+  ONAP : APPC
   ================================================================================
-  Copyright (C) 2017 AT&T Intellectual Property.  All rights reserved.
+  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
@@ -15,6 +17,8 @@
   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.
+  
+  ECOMP is a trademark and service mark of AT&T Intellectual Property.
   ============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>adapter</id>
-       <formats>
-               <format>zip</format>
-       </formats>
+    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>adapter</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>
+    <!--  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>
+    <fileSets>
+        <fileSet>
+            <directory>target/assembly/</directory>
+            <outputDirectory>.</outputDirectory>
+            <excludes>
+            </excludes>
+        </fileSet>
+    </fileSets>
 
 </assembly>
index d3d2ea6..0d25deb 100644 (file)
@@ -1,9 +1,11 @@
 ###
 # ============LICENSE_START=======================================================
-# ONAP : APP-C
+# ONAP : APPC
 # ================================================================================
-# Copyright (C) 2017 AT&T Intellectual Property.  All rights reserved.
+# 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
@@ -15,6 +17,8 @@
 # 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.
+# 
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
 # ============LICENSE_END=========================================================
 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
 ###
index d9d2b11..ba22753 100644 (file)
@@ -1,20 +1,24 @@
 /*-
  * ============LICENSE_START=======================================================
- * ONAP : APP-C
+ * ONAP : APPC
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property.    All rights reserved.
+ * 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
+ *      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.
+ * 
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
  * ============LICENSE_END=========================================================
  */
 
@@ -38,14 +42,14 @@ import com.att.eelf.configuration.EELFManager;
 public class CCAActivator implements BundleActivator
 {
 
-    private static final String CCA_PROP_FILE_VAR = "SDNC_CCA_PROPERTIES";
-    private static final String SDNC_CONFIG_DIR_VAR = "APPC_CONFIG_DIR";
+  private static final String CCA_PROP_FILE_VAR = "SDNC_CCA_PROPERTIES";
+  private static final String SDNC_CONFIG_DIR_VAR = "SDNC_CONFIG_DIR";
 
-    @SuppressWarnings("rawtypes")
-    private ServiceRegistration registration = null;
+  @SuppressWarnings("rawtypes")
+  private ServiceRegistration registration = null;
 
-    //private static final Logger log = LoggerFactory.getLogger(CCAActivator.class);
-    private static final EELFLogger log = EELFManager.getInstance().getLogger(CCAActivator.class);
+  //private static final Logger log = LoggerFactory.getLogger(CCAActivator.class);
+  private static final EELFLogger log = EELFManager.getInstance().getLogger(CCAActivator.class);
 
     @Override
     public void start(BundleContext ctx) throws Exception
index dd4515c..17b56cd 100644 (file)
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params;
+package org.onap.sdnc.config.params;
 
 import java.util.LinkedList;
 import java.util.List;
-
-import org.openecomp.sdnc.config.params.parser.PropertyDefinitionNode;
+import org.onap.sdnc.config.params.parser.PropertyDefinitionNode;
 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 ParamsHandlerActivator implements BundleActivator{
+public class ParamsHandlerActivator implements BundleActivator {
+
+    private List<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>();
 
-       private List<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>();
 
+    private static final EELFLogger log =
+            EELFManager.getInstance().getLogger(ParamsHandlerActivator.class);
 
-       private static final EELFLogger log = EELFManager.getInstance().getLogger(ParamsHandlerActivator.class);
+    @Override
+    public void start(BundleContext ctx) throws Exception {
 
-       @Override
-       public void start(BundleContext ctx) throws Exception
-       {
+        try {
+            PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
+            log.info("Registering service " + propertyDefinitionNode.getClass().getName());
+            registrations.add(ctx.registerService(propertyDefinitionNode.getClass().getName(),
+                    propertyDefinitionNode, null));
+            log.info("Registering service sccessful for  "
+                    + propertyDefinitionNode.getClass().getName());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
 
-               try {
-                       PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
-                       log.info("Registering service "+ propertyDefinitionNode.getClass().getName());
-                       registrations.add(ctx.registerService(propertyDefinitionNode.getClass().getName(), propertyDefinitionNode, null));
-                       log.info("Registering service sccessful for  "+ propertyDefinitionNode.getClass().getName());
-               } catch (Exception e) {
-                       e.printStackTrace();
-               }
+    }
 
-       }
-       @Override
-       public void stop(BundleContext arg0) throws Exception
-       {
-               for (ServiceRegistration registration: registrations)
-               {
-                       registration.unregister();
-                       registration = null;
-               }
+    @Override
+    public void stop(BundleContext arg0) throws Exception {
+        for (ServiceRegistration registration : registrations) {
+            registration.unregister();
+            registration = null;
+        }
 
-       }
+    }
 
 }
index 65b93d7..483429f 100644 (file)
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params;
+package org.onap.sdnc.config.params;
 
 public class ParamsHandlerConstant {
 
-       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 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_PD_CONTENT = "pdContent";
-       public static String INPUT_PARAM_SYSTEM_NAME = "systemName";
-       public static String INPUT_PARAM_JSON_DATA = "jsonData";        
-       public static String INPUT_PARAM_MERGE__JSON_DATA = "mergeJsonData";
 
+    public static String INPUT_PARAM_PD_CONTENT = "pdContent";
+    public static String INPUT_PARAM_SYSTEM_NAME = "systemName";
+    public static String INPUT_PARAM_JSON_DATA = "jsonData";
+    public static String INPUT_PARAM_MERGE__JSON_DATA = "mergeJsonData";
 
-       public static String INPUT_PARAM_REQUEST_DATA = "requestData";
-       public static String INPUT_PARAM_RESPONSE_PRIFIX = "responsePrefix";
-       public static String OUTPUT_PARAM_CONFIGURATION_PARAMETER = "configuration-parameters";
-       
 
+    public static String INPUT_PARAM_REQUEST_DATA = "requestData";
+    public static String INPUT_PARAM_RESPONSE_PRIFIX = "responsePrefix";
+    public static String OUTPUT_PARAM_CONFIGURATION_PARAMETER = "configuration-parameters";
 
-       public static String OUTPUT_PARAM_STATUS = "status";
-       public static String OUTPUT_PARAM_ERROR_MESSAGE = "error-message";
-       public static String OUTPUT_STATUS_SUCCESS = "success";
-       public static String OUTPUT_STATUS_FAILURE = "failure";
+
+
+    public static String OUTPUT_PARAM_STATUS = "status";
+    public static String OUTPUT_PARAM_ERROR_MESSAGE = "error-message";
+    public static String OUTPUT_STATUS_SUCCESS = "success";
+    public static String OUTPUT_STATUS_FAILURE = "failure";
 
 }
index aaa4576..5ab33b5 100644 (file)
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.data;
+package org.onap.sdnc.config.params.data;
 
 import java.util.List;
-
 import com.fasterxml.jackson.annotation.JsonProperty;
 
 public class Parameter {
-       private String name;
-       private String description;
-       private String type;
-       private boolean required;
-       private String source;
-
-       @JsonProperty("rule-type")
-       private String ruleType;
-
-       @JsonProperty("default")
-       private String defaultValue;
+    private String name;
+    private String description;
+    private String type;
+    private boolean required;
+    private String source;
 
-       @JsonProperty("request-keys")
-       private List<RequestKey> requestKeys;
+    @JsonProperty("rule-type")
+    private String ruleType;
 
-       @JsonProperty("response-keys")
-       private List<ResponseKey> responseKeys;
+    @JsonProperty("default")
+    private String defaultValue;
 
-       public String getName() {
-               return name;
-       }
+    @JsonProperty("request-keys")
+    private List<RequestKey> requestKeys;
 
-       public void setName(String name) {
-               this.name = name;
-       }
+    @JsonProperty("response-keys")
+    private List<ResponseKey> responseKeys;
 
-       public String getDescription() {
-               return description;
-       }
+    public String getName() {
+        return name;
+    }
 
-       public void setDescription(String description) {
-               this.description = description;
-       }
+    public void setName(String name) {
+        this.name = name;
+    }
 
-       public String getType() {
-               return type;
-       }
+    public String getDescription() {
+        return description;
+    }
 
-       public void setType(String type) {
-               this.type = type;
-       }
+    public void setDescription(String description) {
+        this.description = description;
+    }
 
-       public boolean isRequired() {
-               return required;
-       }
+    public String getType() {
+        return type;
+    }
 
-       public void setRequired(boolean required) {
-               this.required = required;
-       }
+    public void setType(String type) {
+        this.type = type;
+    }
 
-       public String getSource() {
-               return source;
-       }
+    public boolean isRequired() {
+        return required;
+    }
 
-       public void setSource(String source) {
-               this.source = source;
-       }
+    public void setRequired(boolean required) {
+        this.required = required;
+    }
 
-       public String getRuleType() {
-               return ruleType;
-       }
+    public String getSource() {
+        return source;
+    }
 
-       public void setRuleType(String ruleType) {
-               this.ruleType = ruleType;
-       }
+    public void setSource(String source) {
+        this.source = source;
+    }
 
-       public String getDefaultValue() {
-               return defaultValue;
-       }
+    public String getRuleType() {
+        return ruleType;
+    }
 
-       public void setDefaultValue(String defaultValue) {
-               this.defaultValue = defaultValue;
-       }
+    public void setRuleType(String ruleType) {
+        this.ruleType = ruleType;
+    }
 
-       public List<RequestKey> getRequestKeys() {
-               return requestKeys;
-       }
+    public String getDefaultValue() {
+        return defaultValue;
+    }
 
-       public void setRequestKeys(List<RequestKey> requestKeys) {
-               this.requestKeys = requestKeys;
-       }
+    public void setDefaultValue(String defaultValue) {
+        this.defaultValue = defaultValue;
+    }
 
-       public List<ResponseKey> getResponseKeys() {
-               return responseKeys;
-       }
+    public List<RequestKey> getRequestKeys() {
+        return requestKeys;
+    }
 
-       public void setResponseKeys(List<ResponseKey> responseKeys) {
-               this.responseKeys = responseKeys;
-       }
+    public void setRequestKeys(List<RequestKey> requestKeys) {
+        this.requestKeys = requestKeys;
+    }
 
+    public List<ResponseKey> getResponseKeys() {
+        return responseKeys;
+    }
 
+    public void setResponseKeys(List<ResponseKey> responseKeys) {
+        this.responseKeys = responseKeys;
+    }
 
 
 
index d33fd95..7b84a5f 100644 (file)
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.data;
+package org.onap.sdnc.config.params.data;
 
 import java.util.List;
-
 import com.fasterxml.jackson.annotation.JsonProperty;
 
 public class PropertyDefinition {
-       public String kind = "Property Definition";
-       public String version = "V1";
-       
-       @JsonProperty("vnf-parameter-list")
-       public List<Parameter> parameters;
-       public String getKind() {
-               return kind;
-       }
-       public void setKind(String kind) {
-               this.kind = kind;
-       }
-       public String getVersion() {
-               return version;
-       }
-       public void setVersion(String version) {
-               this.version = version;
-       }
-       public List<Parameter> getParameters() {
-               return parameters;
-       }
-       public void setParameters(List<Parameter> parameters) {
-               this.parameters = parameters;
-       }       
-       
+    public String kind = "Property Definition";
+    public String version = "V1";
+
+    @JsonProperty("vnf-parameter-list")
+    public List<Parameter> parameters;
+
+    public String getKind() {
+        return kind;
+    }
+
+    public void setKind(String kind) {
+        this.kind = kind;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public List<Parameter> getParameters() {
+        return parameters;
+    }
+
+    public void setParameters(List<Parameter> parameters) {
+        this.parameters = parameters;
+    }
+
 }
index 0589afc..5670d9e 100644 (file)
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.data;
+package org.onap.sdnc.config.params.data;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
 
-public class RequestKey{
-       @JsonProperty("key-name")
-       private String keyName;
-       @JsonProperty("key-value")
-       private String keyValue;        
+public class RequestKey {
+    @JsonProperty("key-name")
+    private String keyName;
+    @JsonProperty("key-value")
+    private String keyValue;
 
-       public String getKeyName() {
-               return keyName;
-       }
-       public void setKeyName(String keyName) {
-               this.keyName = keyName;
-       }
-       public String getKeyValue() {
-               return keyValue;
-       }
-       public void setKeyValue(String keyValue) {
-               this.keyValue = keyValue;
-       }
-       
-       
-       
+    public String getKeyName() {
+        return keyName;
+    }
 
+    public void setKeyName(String keyName) {
+        this.keyName = keyName;
+    }
+
+    public String getKeyValue() {
+        return keyValue;
+    }
+
+    public void setKeyValue(String keyValue) {
+        this.keyValue = keyValue;
+    }
 }
index 5277699..d4ae0e4 100644 (file)
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.data;
+package org.onap.sdnc.config.params.data;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
 
-public class ResponseKey{
-       @JsonProperty("unique-key-name")
-       private String uniqueKeyName;
-       @JsonProperty("unique-key-value")
-       private String uniqueKeyValue;
-       @JsonProperty("field-key-name")
-       private String fieldKeyName;
-       
-       public String getUniqueKeyName() {
-               return uniqueKeyName;
-       }
-       public void setUniqueKeyName(String uniqueKeyName) {
-               this.uniqueKeyName = uniqueKeyName;
-       }
-       public String getUniqueKeyValue() {
-               return uniqueKeyValue;
-       }
-       public void setUniqueKeyValue(String uniqueKeyValue) {
-               this.uniqueKeyValue = uniqueKeyValue;
-       }
-       public String getFieldKeyName() {
-               return fieldKeyName;
-       }
-       public void setFieldKeyName(String fieldKeyName) {
-               this.fieldKeyName = fieldKeyName;
-       }
-       
-       
+public class ResponseKey {
+    @JsonProperty("unique-key-name")
+    private String uniqueKeyName;
+    @JsonProperty("unique-key-value")
+    private String uniqueKeyValue;
+    @JsonProperty("field-key-name")
+    private String fieldKeyName;
+    @JsonProperty("filter-by-field")
+    private String filterByField;
+    @JsonProperty("filter-by-value")
+    private String filterByValue;
+
+    public String getUniqueKeyName() {
+        return uniqueKeyName;
+    }
+
+    public void setUniqueKeyName(String uniqueKeyName) {
+        this.uniqueKeyName = uniqueKeyName;
+    }
+
+    public String getUniqueKeyValue() {
+        return uniqueKeyValue;
+    }
+
+    public void setUniqueKeyValue(String uniqueKeyValue) {
+        this.uniqueKeyValue = uniqueKeyValue;
+    }
+
+    public String getFieldKeyName() {
+        return fieldKeyName;
+    }
+
+    public void setFieldKeyName(String fieldKeyName) {
+        this.fieldKeyName = fieldKeyName;
+    }
+
+    public String getFilterByField() {
+        return filterByField;
+    }
+
+    public void setFilterByField(String filterByField) {
+        this.filterByField = filterByField;
+    }
+
+    public String getFilterByValue() {
+        return filterByValue;
+    }
+
+    public void setFilterByValue(String filterByValue) {
+        this.filterByValue = filterByValue;
+    }
 }
index 4916c46..aafebda 100644 (file)
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.parser;
+package org.onap.sdnc.config.params.parser;
 
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
 import org.apache.commons.lang3.StringUtils;
-import org.openecomp.sdnc.config.params.ParamsHandlerConstant;
-import org.openecomp.sdnc.config.params.data.Parameter;
-import org.openecomp.sdnc.config.params.data.PropertyDefinition;
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
 import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-
+import org.onap.sdnc.config.params.ParamsHandlerConstant;
+import org.onap.sdnc.config.params.data.Parameter;
+import org.onap.sdnc.config.params.data.PropertyDefinition;
 import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;
 import com.fasterxml.jackson.core.JsonParseException;
@@ -45,104 +43,124 @@ import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
 
-public class PropertyDefinitionNode implements SvcLogicJavaPlugin{
+public class PropertyDefinitionNode implements SvcLogicJavaPlugin {
 
 
-    private static final  EELFLogger log = EELFManager.getInstance().getLogger(PropertyDefinitionNode.class);
+    private static final EELFLogger log =
+            EELFManager.getInstance().getLogger(PropertyDefinitionNode.class);
 
-    public void processMissingParamKeys(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    public void processMissingParamKeys(Map<String, String> inParams, SvcLogicContext ctx)
+            throws SvcLogicException {
         log.info("Received processParamKeys call with params : " + inParams);
-        String responsePrefix = inParams.get(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX);        
-        try{
-            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+        String responsePrefix = inParams.get(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+        try {
+            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : "";
 
-            String requestParamJson = inParams.get(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA);    
-            String pdContent = inParams.get(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT);    
+            String requestParamJson = inParams.get(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA);
+            String pdContent = inParams.get(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT);
 
-            if(StringUtils.isBlank(pdContent)){
+            if (StringUtils.isBlank(pdContent)) {
                 throw new Exception("Request Param (pdContent) is Missing ..");
             }
 
-            if(StringUtils.isBlank(requestParamJson)){
+            if (StringUtils.isBlank(requestParamJson)) {
                 throw new Exception("Request Param (jsonData) is Missing ..");
             }
 
             PropertyDefinition propertyDefinition = parsePDContent(pdContent);
-            if(propertyDefinition != null){
-                requestParamJson = mergeMissingRequestParamFromPD(propertyDefinition, requestParamJson);
-                ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_CONFIGURATION_PARAMETER, requestParamJson);
+            if (propertyDefinition != null) {
+                requestParamJson =
+                        mergeMissingRequestParamFromPD(propertyDefinition, requestParamJson);
+                ctx.setAttribute(
+                        responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_CONFIGURATION_PARAMETER,
+                        requestParamJson);
             }
-            
-            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS, ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                    ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
         } catch (Exception e) {
-            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS, ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
-            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                    ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_ERROR_MESSAGE,
+                    e.getMessage());
             log.error("Failed in merging data to template " + e.getMessage());
             throw new SvcLogicException(e.getMessage());
         }
     }
 
-    public void processExternalSystemParamKeys(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    public void processExternalSystemParamKeys(Map<String, String> inParams, SvcLogicContext ctx)
+            throws SvcLogicException {
         log.info("Received processExternalSystemParamKeys call with params : " + inParams);
-        String responsePrefix = inParams.get(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX);        
-        try{
-            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+        log.debug(
+                "Source sytem name passed in inParams will be ignored!!Source will be obtained from PD block!");
+        String responsePrefix = inParams.get(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+        try {
+            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : "";
 
-            String requestParamJson = inParams.get(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA);    
-            String pdContent = inParams.get(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT);    
-            String systemName = inParams.get(ParamsHandlerConstant.INPUT_PARAM_SYSTEM_NAME);    
+            String requestParamJson = inParams.get(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA);
+            String pdContent = inParams.get(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT);
+            String systemName = inParams.get(ParamsHandlerConstant.INPUT_PARAM_SYSTEM_NAME);
 
 
-            if(StringUtils.isBlank(pdContent)){
+            if (StringUtils.isBlank(pdContent)) {
                 throw new Exception("Request Param (pdContent) is Missing ..");
             }
 
-            if(StringUtils.isBlank(requestParamJson)){
+            if (StringUtils.isBlank(requestParamJson)) {
                 throw new Exception("Request Param (jsonData) is Missing ..");
             }
 
-            if(StringUtils.isBlank(systemName)){
+            if (StringUtils.isBlank(systemName)) {
                 throw new Exception("Request Param (systemName) is Missing ..");
             }
 
             PropertyDefinition propertyDefinition = parsePDContent(pdContent);
-            if(propertyDefinition != null){
-                getSystemRequestParamInfoFromPD(propertyDefinition, requestParamJson, systemName, ctx);
+            if (propertyDefinition != null) {
+                getSystemRequestParamInfoFromPD(propertyDefinition, requestParamJson, ctx);
             }
 
-            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS, ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                    ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
         } catch (Exception e) {
-            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS, ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
-            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                    ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_ERROR_MESSAGE,
+                    e.getMessage());
             log.error("Failed in merging data to template " + e.getMessage());
             throw new SvcLogicException(e.getMessage());
         }
     }
 
 
-    public void mergeJsonData(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+    public void mergeJsonData(Map<String, String> inParams, SvcLogicContext ctx)
+            throws SvcLogicException {
         log.info("Received mergeJsonData call with params : " + inParams);
-        String responsePrefix = inParams.get(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX);        
-        try{
-            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+        String responsePrefix = inParams.get(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+        try {
+            responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : "";
 
-            String requestParamJson = inParams.get(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA);    
-            String mergeJsonData = inParams.get(ParamsHandlerConstant.INPUT_PARAM_MERGE__JSON_DATA);            
+            String requestParamJson = inParams.get(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA);
+            String mergeJsonData = inParams.get(ParamsHandlerConstant.INPUT_PARAM_MERGE__JSON_DATA);
 
-            if(StringUtils.isBlank(requestParamJson)){
+            if (StringUtils.isBlank(requestParamJson)) {
                 throw new Exception("Request Param (jsonData) is Missing ..");
             }
 
-            if(StringUtils.isBlank(mergeJsonData)){
+            if (StringUtils.isBlank(mergeJsonData)) {
                 throw new Exception("Request Param (mergeJsonData) is Missing ..");
             }
 
             requestParamJson = mergeJson(requestParamJson, mergeJsonData);
-            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_CONFIGURATION_PARAMETER, requestParamJson);
-            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS, ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+            ctx.setAttribute(
+                    responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_CONFIGURATION_PARAMETER,
+                    requestParamJson);
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                    ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
         } catch (Exception e) {
-            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS, ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
-            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                    ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_ERROR_MESSAGE,
+                    e.getMessage());
             log.error("Failed in merging data to template " + e.getMessage());
             throw new SvcLogicException(e.getMessage());
         }
@@ -151,9 +169,10 @@ public class PropertyDefinitionNode implements SvcLogicJavaPlugin{
 
     /* */
 
-    private PropertyDefinition parsePDContent(String pdContent) throws JsonParseException, JsonMappingException, IOException{
+    private PropertyDefinition parsePDContent(String pdContent)
+            throws JsonParseException, JsonMappingException, IOException {
         PropertyDefinition propertyDefinition = null;
-        if(StringUtils.isNotBlank(pdContent)){
+        if (StringUtils.isNotBlank(pdContent)) {
             ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
             propertyDefinition = mapper.readValue(pdContent, PropertyDefinition.class);
         }
@@ -161,68 +180,101 @@ public class PropertyDefinitionNode implements SvcLogicJavaPlugin{
     }
 
 
-    private String mergeMissingRequestParamFromPD(PropertyDefinition propertyDefinition, String requestParamJson) throws Exception{
+    private String mergeMissingRequestParamFromPD(PropertyDefinition propertyDefinition,
+            String requestParamJson) throws Exception {
 
-        if(propertyDefinition == null){
+        if (propertyDefinition == null) {
             throw new Exception("PropertyDefinition is Missing ..");
         }
 
-        if(StringUtils.isBlank(requestParamJson)){
+        if (StringUtils.isBlank(requestParamJson)) {
             throw new Exception("Request Param is Missing ..");
         }
 
         ObjectMapper mapper = new ObjectMapper();
         Map<String, String> requestParamMap = mapper.readValue(requestParamJson, HashMap.class);
-        if(requestParamMap != null){
+        if (requestParamMap != null) {
             List<Parameter> parameters = propertyDefinition.getParameters();
             for (Parameter parameter : parameters) {
-                if(parameter != null){
-                    
-                    log.info("Checking Key " + parameter.getName() + ":: Source :" +parameter.getSource());    
+                if (parameter != null) {
+
+                    log.info("Checking Key " + parameter.getName() + ":: Source :"
+                            + parameter.getSource());
                     // Add Only non external system keys,If it is not present in request Params
-                    if( !requestParamMap.containsKey(parameter.getName()) 
-                            && StringUtils.isBlank(parameter.getSource())
-                            ){
-                        log.info("Adding New Key " + parameter.getName());    
+                    if (!requestParamMap.containsKey(parameter.getName())
+                            && StringUtils.isBlank(parameter.getSource())) {
+                        log.info("Adding New Key " + parameter.getName());
                         requestParamMap.put(parameter.getName(), parameter.getDefaultValue());
-                    }                    
-                }                
-            }            
+                    }
+                }
+            }
             requestParamJson = mapper.writeValueAsString(requestParamMap);
-            log.info("Processed Request Param " + requestParamJson);    
+            log.info("Processed Request Param " + requestParamJson);
         }
 
         return requestParamJson;
     }
 
-    private void getSystemRequestParamInfoFromPD(PropertyDefinition propertyDefinition, String requestParamJson, String systemName, SvcLogicContext ctx) throws Exception{
+    private void getSystemRequestParamInfoFromPD(PropertyDefinition propertyDefinition,
+            String requestParamJson, SvcLogicContext ctx) throws Exception {
 
-        if(propertyDefinition == null){
+        if (propertyDefinition == null) {
             throw new Exception("PropertyDefinition is Missing ..");
         }
 
-        if(StringUtils.isBlank(requestParamJson)){
+        if (StringUtils.isBlank(requestParamJson)) {
             throw new Exception("Request Param is Missing ..");
         }
 
         ObjectMapper mapper = new ObjectMapper();
         Map<String, String> requestParamMap = mapper.readValue(requestParamJson, HashMap.class);
-        if(requestParamMap != null){
+        Map<String, List<String>> systemKeysMap = new HashMap<String, List<String>>();
+        if (requestParamMap != null) {
             List<Parameter> parameters = propertyDefinition.getParameters();
 
             List<String> externalSystemKeys = new ArrayList<String>();
             for (Parameter parameter : parameters) {
-                if(parameter != null){
-                    if( !requestParamMap.containsKey(parameter.getName()) && StringUtils.isNotBlank(parameter.getSource())  && !StringUtils.equalsIgnoreCase(parameter.getSource(),"Manual") ){
-                        log.info("Adding New System Key " + parameter.getName() + ":"+ mapper.writeValueAsString(parameter));
+                if (parameter != null) {
+                    if (!requestParamMap.containsKey(parameter.getName())
+                            && StringUtils.isNotBlank(parameter.getSource())
+                            && !StringUtils.equalsIgnoreCase(parameter.getSource(), "Manual")) {
+                        String source = parameter.getSource();
+                        if (StringUtils.equalsIgnoreCase(source, "A&AI"))
+                            source = "AAI";
+                        source = StringUtils.upperCase(source);
+                        if (systemKeysMap.containsKey(source)) {
+                            log.info("Adding New System Key " + parameter.getName() + ":"
+                                    + mapper.writeValueAsString(parameter));
+                            List l = systemKeysMap.get(source);
+                            if (null != l) {
+                                l.add(parameter.getName());
+                                systemKeysMap.put(source, l);
+                            }
+                        } else {
+                            log.info("Creating/Adding New System Key " + parameter.getName() + ":"
+                                    + mapper.writeValueAsString(parameter));
+                            List<String> l = new ArrayList<String>();
+                            if (null != l) {
+                                l.add(parameter.getName());
+                                systemKeysMap.put(source, l);
+                            }
+                        }
+
                         externalSystemKeys.add(parameter.getName());
-                        ctx.setAttribute(systemName +"."+parameter.getName(), mapper.writeValueAsString(parameter));
-                    }                    
-                }                
-            }    
+                        ctx.setAttribute(source + "." + parameter.getName(),
+                                mapper.writeValueAsString(parameter));
+                    }
+                }
+            }
+            for (String sysName : systemKeysMap.keySet()) {
+                String systemKeys = sysName + ".keys";
+                ctx.setAttribute(systemKeys, mapper.writeValueAsString(systemKeysMap.get(sysName)));
+            }
+            /*
+             * String systemKeys = systemName+".keys"; ctx.setAttribute(systemKeys,
+             * mapper.writeValueAsString(externalSystemKeys));
+             */
 
-            String systemKeys = systemName+".keys";
-            ctx.setAttribute(systemKeys, mapper.writeValueAsString(externalSystemKeys));
         }
     }
 
@@ -230,22 +282,105 @@ public class PropertyDefinitionNode implements SvcLogicJavaPlugin{
     private String mergeJson(String requestParamJson, String systemParamJson) throws Exception {
         ObjectMapper mapper = new ObjectMapper();
         Map<String, String> requestParamMap = mapper.readValue(requestParamJson, HashMap.class);
-        if(requestParamMap != null){
+        if (requestParamMap != null) {
             Map<String, String> systemParamMap = mapper.readValue(systemParamJson, HashMap.class);
-            if(systemParamMap != null){
+            if (systemParamMap != null) {
                 for (String systemParamKey : systemParamMap.keySet()) {
-                    log.trace("Megging System Key Values " + systemParamKey);    
-                    requestParamMap.put( systemParamKey , systemParamMap.get(systemParamKey));        
-                }    
+                    log.trace("Megging System Key Values " + systemParamKey);
+                    requestParamMap.put(systemParamKey, systemParamMap.get(systemParamKey));
+                }
             }
             requestParamJson = mapper.writeValueAsString(requestParamMap);
-            log.info("Processed Request Param " + requestParamJson);    
+            log.info("Processed Request Param " + requestParamJson);
         }
 
         return requestParamJson;
     }
 
 
+    public void validateParams(Map<String, String> inParams, SvcLogicContext ctx)
+            throws SvcLogicException
+
+    {
+        String responsePrefix = inParams.get(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+        String pdContent = inParams.get(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT);
+        String configParams =
+                inParams.get(ParamsHandlerConstant.OUTPUT_PARAM_CONFIGURATION_PARAMETER);
+        responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : "";
+        log.info("Processed pdContent Param " + pdContent);
+        log.info("Processed config Param " + configParams);
+
+        try {
+            if (StringUtils.isBlank(pdContent)) {
+                throw new Exception("Request Param (pdContent) is Missing ..");
+            }
+
+            if (StringUtils.isBlank(configParams)) {
+                throw new Exception("Request Param (configParams) is Missing ..");
+            }
+            PropertyDefinition propertyDefinition = parsePDContent(pdContent);
+            ObjectMapper mapper = new ObjectMapper();
+            Map<String, String> requestParamMap = mapper.readValue(configParams, HashMap.class);
+            List<Parameter> parameters = propertyDefinition.getParameters();
+            Map<String, String> missingKeys = new HashMap<String, String>();
+            for (Parameter parameter : parameters) {
+                if (parameter != null) {
+                    if (parameter.isRequired()) {
+                        if (!requestParamMap.containsKey(parameter.getName())) {
+                            missingKeys.put(parameter.getName(), parameter.getSource());
+                        } else {
+                            if ((requestParamMap.get(parameter.getName()) == null)
+                                    || (requestParamMap.get(parameter.getName()).equals("")))
+
+                            {
+                                missingKeys.put(parameter.getName(), parameter.getSource());
+                            }
+
+                        }
+
+                    }
+
+                }
+
+            }
+
+            if (missingKeys != null && missingKeys.size() > 0) {
+
+                String requiredFields = mapper.writeValueAsString(missingKeys);
+                log.info(" Below mentioned keys and respective  source type are mandatory");
+                log.info(requiredFields);
+
+                ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                        ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
+                ctx.setAttribute(ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                        ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
+                ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_ERROR_MESSAGE,
+                        "Missing Mandatory Keys and source are" + requiredFields);
+                throw new SvcLogicException(
+                        " Missing  Mandatory Keys and source are" + requiredFields);
+
+
+            } else {
+                log.info("success ");
+                ctx.setAttribute(ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                        ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+
+            }
+
+        } catch (Exception e) {
+
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                    ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(ParamsHandlerConstant.OUTPUT_PARAM_STATUS,
+                    ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
+            ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_ERROR_MESSAGE,
+                    e.getMessage());
+            log.error(e.getMessage());
+            throw new SvcLogicException(e.getMessage());
+        }
+
+    }
+
 
 
 }
index 8498b63..4ac4fbb 100644 (file)
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.transformer;
+package org.onap.sdnc.config.params.transformer;
 
 import java.io.IOException;
 import java.util.List;
-
 import org.apache.commons.lang3.StringUtils;
-import org.openecomp.sdnc.config.params.data.Parameter;
-import org.openecomp.sdnc.config.params.data.PropertyDefinition;
-
+import org.onap.sdnc.config.params.data.Parameter;
+import org.onap.sdnc.config.params.data.PropertyDefinition;
 import com.fasterxml.jackson.core.JsonParseException;
 import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -40,48 +38,52 @@ import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
 public class ArtificatTransformer {
 
 
-       public String convertPDToYaml(PropertyDefinition propertyDefinition) throws JsonParseException, JsonMappingException, IOException{
-               String yamlContent = null;
-               if(propertyDefinition != null){
-                       ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
-                       mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
-                       yamlContent = mapper.writeValueAsString(propertyDefinition);            
-               }
-               return yamlContent;
-       }
-
-       public String transformYamlToJson(String yaml) throws JsonParseException, JsonMappingException, IOException {
-               ObjectMapper yamlReader = new ObjectMapper(new YAMLFactory());
-               Object obj = yamlReader.readValue(yaml, Object.class);
-               ObjectMapper jsonWriter = new ObjectMapper();
-               jsonWriter.enable(SerializationFeature.INDENT_OUTPUT);      
-               return jsonWriter.writeValueAsString(obj);
-       }
+    public String convertPDToYaml(PropertyDefinition propertyDefinition)
+            throws JsonParseException, JsonMappingException, IOException {
+        String yamlContent = null;
+        if (propertyDefinition != null) {
+            ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
+            mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
+            yamlContent = mapper.writeValueAsString(propertyDefinition);
+        }
+        return yamlContent;
+    }
 
-       public PropertyDefinition convertYAMLToPD(String pdContent) throws JsonParseException, JsonMappingException, IOException{
-               PropertyDefinition propertyDefinition = null;
-               if(StringUtils.isNotBlank(pdContent)){
-                       ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
-                       propertyDefinition = mapper.readValue(pdContent, PropertyDefinition.class);
-               }
-               return propertyDefinition;
-       }
+    public String transformYamlToJson(String yaml)
+            throws JsonParseException, JsonMappingException, IOException {
+        ObjectMapper yamlReader = new ObjectMapper(new YAMLFactory());
+        Object obj = yamlReader.readValue(yaml, Object.class);
+        ObjectMapper jsonWriter = new ObjectMapper();
+        jsonWriter.enable(SerializationFeature.INDENT_OUTPUT);
+        return jsonWriter.writeValueAsString(obj);
+    }
 
-       public String convertYAMLToParams(String pdContent) throws JsonParseException, JsonMappingException, IOException{
-               String paramJson = null;
-               if(StringUtils.isNotBlank(pdContent)){
-                       paramJson = convertPdToParams(convertYAMLToPD(pdContent));
-               }
-               return paramJson;
-       }
+    public PropertyDefinition convertYAMLToPD(String pdContent)
+            throws JsonParseException, JsonMappingException, IOException {
+        PropertyDefinition propertyDefinition = null;
+        if (StringUtils.isNotBlank(pdContent)) {
+            ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
+            propertyDefinition = mapper.readValue(pdContent, PropertyDefinition.class);
+        }
+        return propertyDefinition;
+    }
 
-       public String convertPdToParams(PropertyDefinition propertyDefinition) throws JsonParseException, JsonMappingException, IOException{
-               String paramJson = null;
-               if(propertyDefinition != null  && propertyDefinition.getParameters() != null){
-                       List<Parameter> parameters = propertyDefinition.getParameters();
+    public String convertYAMLToParams(String pdContent)
+            throws JsonParseException, JsonMappingException, IOException {
+        String paramJson = null;
+        if (StringUtils.isNotBlank(pdContent)) {
+            paramJson = convertPdToParams(convertYAMLToPD(pdContent));
+        }
+        return paramJson;
+    }
 
-               }
-               return paramJson;
-       }
+    public String convertPdToParams(PropertyDefinition propertyDefinition)
+            throws JsonParseException, JsonMappingException, IOException {
+        String paramJson = null;
+        if (propertyDefinition != null && propertyDefinition.getParameters() != null) {
+            List<Parameter> parameters = propertyDefinition.getParameters();
 
+        }
+        return paramJson;
+    }
 }
index cb4f1e0..3878329 100644 (file)
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.transformer.tosca;
-
-import org.openecomp.sdnc.config.params.data.PropertyDefinition;
-import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
+package org.onap.sdnc.config.params.transformer.tosca;
 
 import java.io.OutputStream;
+import org.onap.sdnc.config.params.data.PropertyDefinition;
+import org.onap.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
 
-public interface ArtifactProcessor
-{
+public interface ArtifactProcessor {
     /**
      * Generates Tosca artifact from PropertyDefinition object.
      *
-     * @param artifact
-     *                PropertyDefinition object which is to be converted to Tosca.
-     * @param stream
-     *                Stream to which the generated Tosca is to be written.
-     * @throws ArtifactProcessorException
-     *                If the Tosca Generation failed
+     * @param artifact PropertyDefinition object which is to be converted to Tosca.
+     * @param stream Stream to which the generated Tosca is to be written.
+     * @throws ArtifactProcessorException If the Tosca Generation failed
      */
-    void generateArtifact(PropertyDefinition artifact, OutputStream stream) throws ArtifactProcessorException;
+    void generateArtifact(PropertyDefinition artifact, OutputStream stream)
+            throws ArtifactProcessorException;
 
     /**
      * Generates Tosca artifact from PropertyDefinition string.
      *
-     * @param artifact
-     *               PropertyDefinition string which is to be converted to Tosca.
-     * @param stream
-     *               Stream to which the generated Tosca is to be written.
-     * @throws ArtifactProcessorException
-     *               If the Tosca Generation failed
+     * @param artifact PropertyDefinition string which is to be converted to Tosca.
+     * @param stream Stream to which the generated Tosca is to be written.
+     * @throws ArtifactProcessorException If the Tosca Generation failed
      */
     void generateArtifact(String artifact, OutputStream stream) throws ArtifactProcessorException;
 
     /**
      * Generates the PropertyDefinition object from a Tosca artifact.
      *
-     * @param toscaArtifact
-     *                Tosca artifact which is to be converted.
+     * @param toscaArtifact Tosca artifact which is to be converted.
      * @return PropertyDefinition object generated from Tosca
-     * @throws ArtifactProcessorException
-     *                If the PropertyDefinition Generation failed
+     * @throws ArtifactProcessorException If the PropertyDefinition Generation failed
      */
     PropertyDefinition readArtifact(String toscaArtifact) throws ArtifactProcessorException;
 }
index 9ec80c9..7d0ac9b 100644 (file)
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.transformer.tosca;
+package org.onap.sdnc.config.params.transformer.tosca;
 
 /**
  * Created by pranavdi on 3/29/2017.
  */
-public class ArtifactProcessorFactory
-{
-    private static class InstanceHolder
-    {
+public class ArtifactProcessorFactory {
+    private static class InstanceHolder {
         private static ArtifactProcessorImpl instance = new ArtifactProcessorImpl();
     }
 
-    private ArtifactProcessorFactory(){}
+    private ArtifactProcessorFactory() {}
 
-    public static ArtifactProcessor getArtifactProcessor()
-    {
+    public static ArtifactProcessor getArtifactProcessor() {
         return InstanceHolder.instance;
     }
 }
index e3dd5dc..f5dd7b6 100644 (file)
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.transformer.tosca;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
-import org.apache.commons.lang.StringUtils;
-
-import org.openecomp.sdc.tosca.datatypes.model.*;
-import org.openecomp.sdc.tosca.services.YamlUtil;
-import org.openecomp.sdnc.config.params.data.Parameter;
-import org.openecomp.sdnc.config.params.data.PropertyDefinition;
-import org.openecomp.sdnc.config.params.data.RequestKey;
-import org.openecomp.sdnc.config.params.data.ResponseKey;
-import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
-import org.slf4j.MDC;
+package org.onap.sdnc.config.params.transformer.tosca;
 
+import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import org.apache.commons.lang.StringUtils;
+import org.onap.sdnc.config.params.data.Parameter;
+import org.onap.sdnc.config.params.data.PropertyDefinition;
+import org.onap.sdnc.config.params.data.RequestKey;
+import org.onap.sdnc.config.params.data.ResponseKey;
+import org.onap.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
+import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.NodeType;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.TopologyTemplate;
+import org.openecomp.sdc.tosca.services.YamlUtil;
+import org.slf4j.MDC;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
 
-import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME;
-
-public class ArtifactProcessorImpl implements ArtifactProcessor
-{
+public class ArtifactProcessorImpl implements ArtifactProcessor {
     private static final String DERIVEDFROM = "org.openecomp.genericvnf";
-    private static final EELFLogger Log = EELFManager.getInstance().getLogger(ArtifactProcessorImpl.class);
+    private static final EELFLogger Log =
+            EELFManager.getInstance().getLogger(ArtifactProcessorImpl.class);
     private static final String EQUALSENCODING = "&equals;";
     private static final String COLONENCODING = "&colon;";
     private static final String COMMAENCODING = "&comma;";
@@ -60,12 +65,12 @@ public class ArtifactProcessorImpl implements ArtifactProcessor
     private static final String LESSTHANENCODING = "&lt;";
 
     @Override
-    public void generateArtifact(PropertyDefinition artifact, OutputStream stream) throws ArtifactProcessorException
-    {
+    public void generateArtifact(PropertyDefinition artifact, OutputStream stream)
+            throws ArtifactProcessorException {
         MDC.clear();
-        MDC.put(MDC_SERVICE_NAME,"ArtifactGenerator");
+        MDC.put(MDC_SERVICE_NAME, "ArtifactGenerator");
         Log.info("Entered into generateArtifact");
-        if(!StringUtils.isBlank(artifact.getKind())) {
+        if (!StringUtils.isBlank(artifact.getKind())) {
             logArtifact(artifact);
             ServiceTemplate serviceTemplate = new ServiceTemplate();
 
@@ -91,40 +96,38 @@ public class ArtifactProcessorImpl implements ArtifactProcessor
                 }
                 MDC.clear();
             }
-        }
-        else
-        {
+        } else {
             Log.error("Kind in PropertyDefinition is blank or null");
             throw new ArtifactProcessorException("Kind in PropertyDefinition is blank or null");
         }
     }
 
     @Override
-    public void generateArtifact(String artifact, OutputStream stream) throws ArtifactProcessorException
-    {
+    public void generateArtifact(String artifact, OutputStream stream)
+            throws ArtifactProcessorException {
         ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
         try {
             PropertyDefinition pd = mapper.readValue(artifact, PropertyDefinition.class);
             generateArtifact(pd, stream);
-        }
-        catch (IOException e)
-        {
-            Log.error("Error parsing property definition content = "+ artifact,e);
+        } catch (IOException e) {
+            Log.error("Error parsing property definition content = " + artifact, e);
             throw new ArtifactProcessorException(e);
         }
     }
 
     @Override
-    public PropertyDefinition readArtifact(String toscaArtifact) throws ArtifactProcessorException{
+    public PropertyDefinition readArtifact(String toscaArtifact) throws ArtifactProcessorException {
         Log.info("Entered into readArtifact.");
         Log.info("Received ToscaArtifact:\n" + toscaArtifact);
 
         PropertyDefinition propertyDefinitionObj = new PropertyDefinition();
-        ServiceTemplate serviceTemplate = new YamlUtil().yamlToObject(toscaArtifact, ServiceTemplate.class);
+        ServiceTemplate serviceTemplate =
+                new YamlUtil().yamlToObject(toscaArtifact, ServiceTemplate.class);
 
-        //mapping parameters
+        // mapping parameters
         Map<String, NodeType> nodeTypeMap = serviceTemplate.getNode_types();
-        Map<String, NodeTemplate> nodeTemplateMap = serviceTemplate.getTopology_template().getNode_templates();
+        Map<String, NodeTemplate> nodeTemplateMap =
+                serviceTemplate.getTopology_template().getNode_templates();
 
         String nodeTemplateName = nodeTemplateMap.keySet().toArray(new String[0])[0];
         NodeTemplate nodeTemplate = nodeTemplateMap.get(nodeTemplateName);
@@ -133,16 +136,18 @@ public class ArtifactProcessorImpl implements ArtifactProcessor
         String kind = nodeTypeMap.keySet().toArray(new String[0])[0];
         NodeType nodeType = nodeTypeMap.get(kind);
         String version = nodeType.getVersion();
-        Log.info("ReadArtifact for "+ kind + " with version "+version);
+        Log.info("ReadArtifact for " + kind + " with version " + version);
         propertyDefinitionObj.setKind(kind);
         propertyDefinitionObj.setVersion(version);
 
         List<Parameter> parameterList = new LinkedList<>();
 
-        Map<String, org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition> propertyDefinitionFromTOSCA = nodeType.getProperties();
-        if(null != propertyDefinitionFromTOSCA){
+        Map<String, org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition> propertyDefinitionFromTOSCA =
+                nodeType.getProperties();
+        if (null != propertyDefinitionFromTOSCA) {
             for (String propertyName : propertyDefinitionFromTOSCA.keySet()) {
-                org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition propertyDefinition = propertyDefinitionFromTOSCA.get(propertyName);
+                org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition propertyDefinition =
+                        propertyDefinitionFromTOSCA.get(propertyName);
 
                 Parameter parameter = new Parameter();
                 parameter.setName(propertyName);
@@ -163,10 +168,16 @@ public class ArtifactProcessorImpl implements ArtifactProcessor
 
                 String propertValueExpr = (String) nodeTemplateProperties.get(propertyName);
                 String[] stringTokens = parsePropertyValueExpression(propertValueExpr);
-                String ruleType = stringTokens[0].substring(stringTokens[0].indexOf('=')+1,stringTokens[0].length()).replaceAll(">","").trim();
-                String responseExpression = stringTokens[1].substring(stringTokens[1].indexOf('=')+1,stringTokens[1].length());
-                String source = stringTokens[2].substring(stringTokens[2].indexOf('=')+1,stringTokens[2].length()).replaceAll(">","").trim();
-                String requestExpression = stringTokens[3].substring(stringTokens[3].indexOf('=')+1,stringTokens[3].length());
+                String ruleType = stringTokens[0]
+                        .substring(stringTokens[0].indexOf('=') + 1, stringTokens[0].length())
+                        .replaceAll(">", "").trim();
+                String responseExpression = stringTokens[1]
+                        .substring(stringTokens[1].indexOf('=') + 1, stringTokens[1].length());
+                String source = stringTokens[2]
+                        .substring(stringTokens[2].indexOf('=') + 1, stringTokens[2].length())
+                        .replaceAll(">", "").trim();
+                String requestExpression = stringTokens[3]
+                        .substring(stringTokens[3].indexOf('=') + 1, stringTokens[3].length());
 
                 List<RequestKey> requestKeys = readRequestKeys(requestExpression);
                 List<ResponseKey> responseKeys = readResponseKeys(responseExpression);
@@ -185,7 +196,8 @@ public class ArtifactProcessorImpl implements ArtifactProcessor
         return propertyDefinitionObj;
     }
 
-    private List<ResponseKey> readResponseKeys(String responseExpression) throws ArtifactProcessorException {
+    private List<ResponseKey> readResponseKeys(String responseExpression)
+            throws ArtifactProcessorException {
         Log.info("Entered into readResponseKeys.");
         List<ResponseKey> responseKeyList = null;
         String expression;
@@ -197,12 +209,23 @@ public class ArtifactProcessorImpl implements ArtifactProcessor
             for (String responseKeyStr : responseKeys) {
                 ResponseKey responseKey = new ResponseKey();
                 try {
-                    responseKey.setUniqueKeyName(responseKeyStr.split(":")[0].replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">").replaceAll(COLONENCODING, ":").replaceAll(COMMAENCODING, ",").replaceAll(EQUALSENCODING,"=").trim());
-                    responseKey.setUniqueKeyValue(responseKeyStr.split(":")[1].replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">").replaceAll(COLONENCODING, ":").replaceAll(COMMAENCODING, ",").replaceAll(EQUALSENCODING,"=").trim());
-                    responseKey.setFieldKeyName(responseKeyStr.split(":")[2].replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">").replaceAll(COLONENCODING, ":").replaceAll(COMMAENCODING, ",").replaceAll(EQUALSENCODING,"=").trim());
+                    responseKey.setUniqueKeyName(responseKeyStr.split(":")[0]
+                            .replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">")
+                            .replaceAll(COLONENCODING, ":").replaceAll(COMMAENCODING, ",")
+                            .replaceAll(EQUALSENCODING, "=").trim());
+                    responseKey.setUniqueKeyValue(responseKeyStr.split(":")[1]
+                            .replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">")
+                            .replaceAll(COLONENCODING, ":").replaceAll(COMMAENCODING, ",")
+                            .replaceAll(EQUALSENCODING, "=").trim());
+                    responseKey.setFieldKeyName(responseKeyStr.split(":")[2]
+                            .replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">")
+                            .replaceAll(COLONENCODING, ":").replaceAll(COMMAENCODING, ",")
+                            .replaceAll(EQUALSENCODING, "=").trim());
                 } catch (ArrayIndexOutOfBoundsException e) {
-                    Log.error("Invalid response attribute found :" + responseKeyStr + "due to "+e);
-                    throw new ArtifactProcessorException("Invalid response attribute found :" + responseKeyStr);
+                    Log.error(
+                            "Invalid response attribute found :" + responseKeyStr + "due to " + e);
+                    throw new ArtifactProcessorException(
+                            "Invalid response attribute found :" + responseKeyStr);
                 }
                 responseKeyList.add(responseKey);
             }
@@ -215,14 +238,19 @@ public class ArtifactProcessorImpl implements ArtifactProcessor
         Log.info("Entered into readRequestKeys.");
         List<RequestKey> requestKeyList = null;
         String expression;
-        expression = requestExpression.replaceAll("<","").replaceAll(">","").trim();
-        if(StringUtils.isNotEmpty(expression)){
+        expression = requestExpression.replaceAll("<", "").replaceAll(">", "").trim();
+        if (StringUtils.isNotEmpty(expression)) {
             requestKeyList = new ArrayList<>();
             String[] requestKeys = expression.split(",");
-            for(String responseKeyStr :requestKeys){
+            for (String responseKeyStr : requestKeys) {
                 RequestKey requestKey = new RequestKey();
-                requestKey.setKeyName(responseKeyStr.split(":")[0].replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">").replaceAll(COLONENCODING,":").replaceAll(COMMAENCODING,",").replaceAll(EQUALSENCODING,"=").trim());
-                requestKey.setKeyValue(responseKeyStr.split(":")[1].replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">").replaceAll(COLONENCODING,":").replaceAll(COMMAENCODING,",").replaceAll(EQUALSENCODING,"=").trim());
+                requestKey.setKeyName(responseKeyStr.split(":")[0].replaceAll(LESSTHANENCODING, "<")
+                        .replaceAll(GREATERTHANENCODING, ">").replaceAll(COLONENCODING, ":")
+                        .replaceAll(COMMAENCODING, ",").replaceAll(EQUALSENCODING, "=").trim());
+                requestKey.setKeyValue(responseKeyStr.split(":")[1]
+                        .replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">")
+                        .replaceAll(COLONENCODING, ":").replaceAll(COMMAENCODING, ",")
+                        .replaceAll(EQUALSENCODING, "=").trim());
                 requestKeyList.add(requestKey);
             }
         }
@@ -230,105 +258,110 @@ public class ArtifactProcessorImpl implements ArtifactProcessor
         return requestKeyList;
     }
 
-    private String[] parsePropertyValueExpression(String propertValueExpr) throws ArtifactProcessorException{
+    private String[] parsePropertyValueExpression(String propertValueExpr)
+            throws ArtifactProcessorException {
         Log.info("Entered into parsePropertyValueExpression.");
         String nodeRegex = "<(.*?)>";
         Pattern pattern = Pattern.compile(nodeRegex, Pattern.CASE_INSENSITIVE);
         Matcher matcher = pattern.matcher(propertValueExpr);
         List<String> stringTokens = new ArrayList<>();
-        while(matcher.find()){
+        while (matcher.find()) {
             stringTokens.add(matcher.group(0));
         }
         String[] propertiesArr = new String[stringTokens.size()];
         propertiesArr = stringTokens.toArray(propertiesArr);
-        if(propertiesArr.length!=4){
+        if (propertiesArr.length != 4) {
             throw new ArtifactProcessorException("Invalid input found " + propertValueExpr);
         }
         Log.info("Exiting from parsePropertyValueExpression.");
         return propertiesArr;
     }
 
-    private void addNodeType(PropertyDefinition artifact, ServiceTemplate toscaTemplate) throws ArtifactProcessorException {
-        //Add basic fields for the node
+    private void addNodeType(PropertyDefinition artifact, ServiceTemplate toscaTemplate)
+            throws ArtifactProcessorException {
+        // Add basic fields for the node
         NodeType toscaNodeType = new NodeType();
         toscaNodeType.setDerived_from(DERIVEDFROM);
         toscaNodeType.setVersion(artifact.getVersion());
         toscaNodeType.setDescription("");
-        if(artifact.getParameters()!=null) {
-            Map<String, org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition> toscaPropertyMap = new HashMap<>();
+        if (artifact.getParameters() != null) {
+            Map<String, org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition> toscaPropertyMap =
+                    new HashMap<>();
             toscaNodeType.setProperties(toscaPropertyMap);
 
-            //Add properties from parameters of PD
+            // Add properties from parameters of PD
             for (Parameter pdParameter : artifact.getParameters()) {
                 addProperty(toscaNodeType, pdParameter);
             }
         }
 
         // This is where it adds node in node Map and adds the map in tosca template
-        Map<String,NodeType> toscaNodeMap = new HashMap<>();
-        toscaNodeMap.put(artifact.getKind(),toscaNodeType);
+        Map<String, NodeType> toscaNodeMap = new HashMap<>();
+        toscaNodeMap.put(artifact.getKind(), toscaNodeType);
         toscaTemplate.setNode_types(toscaNodeMap);
     }
 
-    private void addProperty(NodeType toscaNodeType, Parameter pdParameter) throws ArtifactProcessorException {
-        if(!StringUtils.isBlank(pdParameter.getName())&& !pdParameter.getName().matches(".*\\s+.*")) {
+    private void addProperty(NodeType toscaNodeType, Parameter pdParameter)
+            throws ArtifactProcessorException {
+        if (!StringUtils.isBlank(pdParameter.getName())
+                && !pdParameter.getName().matches(".*\\s+.*")) {
             Log.info("Adding parameter " + pdParameter.getName() + " in node type");
-            org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition toscaProperty = new org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition();
+            org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition toscaProperty =
+                    new org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition();
 
-            toscaProperty.setType(StringUtils.isBlank(pdParameter.getType()) ? "string" : pdParameter.getType());
+            toscaProperty.setType(
+                    StringUtils.isBlank(pdParameter.getType()) ? "string" : pdParameter.getType());
             toscaProperty.set_default(pdParameter.getDefaultValue());
 
             toscaProperty.setDescription(pdParameter.getDescription());
             toscaProperty.setRequired(pdParameter.isRequired());
 
             toscaNodeType.getProperties().put(pdParameter.getName(), toscaProperty);
-        }
-        else
-        {
-            String message ="Parameter name is empty,null or contains whitespace";
+        } else {
+            String message = "Parameter name is empty,null or contains whitespace";
             Log.error(message);
             throw new ArtifactProcessorException(message);
         }
     }
 
-    private void addNodeTemplate(PropertyDefinition artifact, ServiceTemplate toscaTemplate)
-    {
+    private void addNodeTemplate(PropertyDefinition artifact, ServiceTemplate toscaTemplate) {
         NodeTemplate nodeTemplate = new NodeTemplate();
         nodeTemplate.setType(artifact.getKind());
-        Map<String,Object> templateProperties = new HashMap<>();
-        //Add properties from parameters of PD
-        if(artifact.getParameters()!=null) {
+        Map<String, Object> templateProperties = new HashMap<>();
+        // Add properties from parameters of PD
+        if (artifact.getParameters() != null) {
             for (Parameter pdParameter : artifact.getParameters()) {
                 addTemplateProperty(templateProperties, pdParameter);
             }
             nodeTemplate.setProperties(templateProperties);
         }
-        Map<String,NodeTemplate> nodeTemplateMap = new HashMap<>();
-        nodeTemplateMap.put(artifact.getKind()+"_Template",nodeTemplate);
+        Map<String, NodeTemplate> nodeTemplateMap = new HashMap<>();
+        nodeTemplateMap.put(artifact.getKind() + "_Template", nodeTemplate);
         toscaTemplate.getTopology_template().setNode_templates(nodeTemplateMap);
     }
 
-    private void addTemplateProperty(Map<String,Object> templateProperties, Parameter pdParameter)
-    {
-        Log.info("Adding parameter "+ pdParameter.getName() + " in node templates");
+    private void addTemplateProperty(Map<String, Object> templateProperties,
+            Parameter pdParameter) {
+        Log.info("Adding parameter " + pdParameter.getName() + " in node templates");
         String responseKeys = buildResponseKeyExpression(pdParameter.getResponseKeys());
         String requestKeys = buildRequestKeyExpression(pdParameter.getRequestKeys());
         String ruleType = buildRuleType(pdParameter.getRuleType());
         String source = buildSourceSystem(pdParameter.getSource());
         String properties = ruleType + " " + responseKeys + " " + source + " " + requestKeys;
-        templateProperties.put(pdParameter.getName(),properties);
+        templateProperties.put(pdParameter.getName(), properties);
     }
 
-    protected String buildResponseKeyExpression(List<ResponseKey> responseKeys)
-    {
+    protected String buildResponseKeyExpression(List<ResponseKey> responseKeys) {
         StringBuilder propertyBuilder = new StringBuilder();
         propertyBuilder.append("<response-keys = ");
-        if(responseKeys!=null) {
+        if (responseKeys != null) {
             Iterator<ResponseKey> itr = responseKeys.iterator();
             while (itr.hasNext()) {
                 ResponseKey res = itr.next();
-                if(res!=null)
-                    propertyBuilder.append(encode(res.getUniqueKeyName()) + ":" + encode(res.getUniqueKeyValue()) + ":" + encode(res.getFieldKeyName()));
+                if (res != null)
+                    propertyBuilder.append(
+                            encode(res.getUniqueKeyName()) + ":" + encode(res.getUniqueKeyValue())
+                                    + ":" + encode(res.getFieldKeyName()));
                 if (itr.hasNext())
                     propertyBuilder.append(" , ");
             }
@@ -337,16 +370,16 @@ public class ArtifactProcessorImpl implements ArtifactProcessor
         return propertyBuilder.toString();
     }
 
-    protected String buildRequestKeyExpression(List<RequestKey> requestKeys)
-    {
+    protected String buildRequestKeyExpression(List<RequestKey> requestKeys) {
         StringBuilder propertyBuilder = new StringBuilder();
         propertyBuilder.append("<request-keys = ");
-        if(requestKeys!=null) {
+        if (requestKeys != null) {
             Iterator<RequestKey> itr = requestKeys.iterator();
             while (itr.hasNext()) {
                 RequestKey res = itr.next();
-                if(res!=null)
-                    propertyBuilder.append(encode(res.getKeyName()) + ":" + encode(res.getKeyValue()));
+                if (res != null)
+                    propertyBuilder
+                            .append(encode(res.getKeyName()) + ":" + encode(res.getKeyValue()));
                 if (itr.hasNext())
                     propertyBuilder.append(" , ");
             }
@@ -355,46 +388,41 @@ public class ArtifactProcessorImpl implements ArtifactProcessor
         return propertyBuilder.toString();
     }
 
-    protected String buildRuleType(String classType)
-    {
+    protected String buildRuleType(String classType) {
         StringBuilder propertyBuilder = new StringBuilder();
-        String encodedClassType = StringUtils.isBlank(encode(classType))?"":encode(classType);
+        String encodedClassType = StringUtils.isBlank(encode(classType)) ? "" : encode(classType);
         propertyBuilder.append("<");
-        propertyBuilder.append("rule-type = "+encodedClassType);
+        propertyBuilder.append("rule-type = " + encodedClassType);
         propertyBuilder.append(">");
         return propertyBuilder.toString();
     }
 
-    protected String buildSourceSystem(String source)
-    {
+    protected String buildSourceSystem(String source) {
         StringBuilder sourceBuilder = new StringBuilder();
         sourceBuilder.append("<source-system = ");
-        sourceBuilder.append(StringUtils.isBlank(encode(source))?"":encode(source));
+        sourceBuilder.append(StringUtils.isBlank(encode(source)) ? "" : encode(source));
         sourceBuilder.append(">");
         return sourceBuilder.toString();
     }
 
-    protected String encode(String string)
-    {
+    protected String encode(String string) {
         String encodedString = null;
-        if(string!=null) {
-            encodedString = string.trim().replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll(":","&colon;").replaceAll(",","&comma;").replaceAll("=","&equals;");
+        if (string != null) {
+            encodedString = string.trim().replaceAll("<", "&lt;").replaceAll(">", "&gt;")
+                    .replaceAll(":", "&colon;").replaceAll(",", "&comma;")
+                    .replaceAll("=", "&equals;");
         }
         return encodedString;
     }
 
-    private void logArtifact(PropertyDefinition artifact)
-    {
+    private void logArtifact(PropertyDefinition artifact) {
         ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
-        String stringArtifact=null;
-        try
-        {
+        String stringArtifact = null;
+        try {
             stringArtifact = mapper.writeValueAsString(artifact);
             Log.info("Received PropertyDefinition:\n" + stringArtifact);
-        }
-        catch (JsonProcessingException e)
-        {
-            Log.error("Exception while logging artifact:",e);
+        } catch (JsonProcessingException e) {
+            Log.error("Exception while logging artifact:", e);
         }
 
     }
index e788fbf..1921e9e 100644 (file)
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.transformer.tosca.exceptions;
+package org.onap.sdnc.config.params.transformer.tosca.exceptions;
 
 /**
  * Created by pranavdi on 3/17/2017.
  */
-public class ArtifactProcessorException extends Exception
-{
+public class ArtifactProcessorException extends Exception {
     public ArtifactProcessorException() {}
 
-    public ArtifactProcessorException(String message)
-    {
+    public ArtifactProcessorException(String message) {
         super(message);
     }
 
-    public ArtifactProcessorException(Throwable cause)
-    {
+    public ArtifactProcessorException(Throwable cause) {
         super(cause);
     }
 
-    public ArtifactProcessorException(String message, Throwable cause)
-    {
-        super(message,cause);
+    public ArtifactProcessorException(String message, Throwable cause) {
+        super(message, cause);
     }
 }
index be11384..25ab29e 100644 (file)
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.parser;
+package org.onap.sdnc.config.params.parser;
+
 
-import static org.junit.Assert.assertEquals;
 
-import java.io.File;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.attribute.BasicFileAttributes;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
 import org.apache.commons.io.IOUtils;
-import org.junit.Test;
+import org.apache.commons.lang.StringUtils;
 import org.junit.Ignore;
-import org.openecomp.sdnc.config.params.ParamsHandlerConstant;
-import org.openecomp.sdnc.config.params.data.PropertyDefinition;
-import org.openecomp.sdnc.config.params.parser.PropertyDefinitionNode;
-import org.openecomp.sdnc.config.params.transformer.ArtificatTransformer;
-
+import org.junit.Test;
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.sdnc.config.params.ParamsHandlerConstant;
+import org.onap.sdnc.config.params.data.PropertyDefinition;
+import org.onap.sdnc.config.params.transformer.ArtificatTransformer;
 
 public class TestPropertyDefinitionNode {
 
-   @Ignore
+    @Ignore
     public void testProcessMissingParamKeys() throws Exception {
         PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
         Map<String, String> inParams = new HashMap<String, String>();
         inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
 
-        String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
+        String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+                .getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
         inParams.put(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT, yamlData);
 
-        String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
+        String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+                .getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
         inParams.put(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA, jsonData);
 
         SvcLogicContext ctx = new SvcLogicContext();
         propertyDefinitionNode.processMissingParamKeys(inParams, ctx);
-        assertEquals(ctx.getAttribute("test."+ParamsHandlerConstant.OUTPUT_PARAM_STATUS), ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+        assertEquals(ctx.getAttribute("test." + ParamsHandlerConstant.OUTPUT_PARAM_STATUS),
+                ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
 
     }
 
@@ -74,18 +69,29 @@ public class TestPropertyDefinitionNode {
         Map<String, String> inParams = new HashMap<String, String>();
         inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
 
-        String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
+        String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+                .getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
         inParams.put(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT, yamlData);
 
-        String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
+        String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+                .getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
         inParams.put(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA, jsonData);
 
         inParams.put(ParamsHandlerConstant.INPUT_PARAM_SYSTEM_NAME, "SOURCE");
 
         SvcLogicContext ctx = new SvcLogicContext();
         propertyDefinitionNode.processExternalSystemParamKeys(inParams, ctx);
-        assertEquals(ctx.getAttribute("test."+ParamsHandlerConstant.OUTPUT_PARAM_STATUS), ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
-}
+
+        for (Object key : ctx.getAttributeKeySet()) {
+            String parmName = (String) key;
+            String parmValue = ctx.getAttribute(parmName);
+            if (StringUtils.contains(parmName, "keys")) {
+                System.out.println("Key: " + parmName + ",    Value: " + parmValue);
+            }
+        }
+        assertEquals(ctx.getAttribute("test." + ParamsHandlerConstant.OUTPUT_PARAM_STATUS),
+                ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+    }
 
     @Test
     public void mergeJsonData() throws Exception {
@@ -93,24 +99,47 @@ public class TestPropertyDefinitionNode {
         Map<String, String> inParams = new HashMap<String, String>();
         inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
 
-        String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
+        String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+                .getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
         inParams.put(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA, jsonData);
 
-        String mergeJsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/merge-param.json"), Charset.defaultCharset());
+        String mergeJsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+                .getResourceAsStream("parser/merge-param.json"), Charset.defaultCharset());
         inParams.put(ParamsHandlerConstant.INPUT_PARAM_MERGE__JSON_DATA, mergeJsonData);
 
         SvcLogicContext ctx = new SvcLogicContext();
         propertyDefinitionNode.mergeJsonData(inParams, ctx);
-        assertEquals(ctx.getAttribute("test."+ParamsHandlerConstant.OUTPUT_PARAM_STATUS), ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+        String mergedParams = ctx
+                .getAttribute("test." + ParamsHandlerConstant.OUTPUT_PARAM_CONFIGURATION_PARAMETER);
+        assertNotNull(mergedParams);
+        assertEquals(ctx.getAttribute("test." + ParamsHandlerConstant.OUTPUT_PARAM_STATUS),
+                ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
     }
 
     @Test
     public void testArtificatTransformer() throws Exception {
         ArtificatTransformer transformer = new ArtificatTransformer();
-        String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
+        String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+                .getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
 
         PropertyDefinition propertyDefinition = transformer.convertYAMLToPD(yamlData);
         String yaml = transformer.convertPDToYaml(propertyDefinition);
     }
-    
+
+
+    @Test
+    public void testValidationPd() throws Exception {
+        PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
+        Map<String, String> inParams = new HashMap<String, String>();
+        SvcLogicContext ctx = new SvcLogicContext();
+        String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+                .getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
+        String mergeJsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader()
+                .getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
+        inParams.put(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT, jsonData);
+        inParams.put(ParamsHandlerConstant.OUTPUT_PARAM_CONFIGURATION_PARAMETER, mergeJsonData);
+        inParams.put(ParamsHandlerConstant.INPUT_PARAM_SYSTEM_NAME, "INSTAR");
+        propertyDefinitionNode.validateParams(inParams, ctx);
+    }
+
 }
index 33845dd..19651fc 100644 (file)
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.transformer.tosca;
-
+package org.onap.sdnc.config.params.transformer.tosca;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
 import org.junit.Assert;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
-import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
-
-import java.io.*;
+import org.onap.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
 
-public class TestArtifactProcessor{
+public class TestArtifactProcessor {
     @Rule
     public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
@@ -42,37 +49,38 @@ public class TestArtifactProcessor{
         ArtifactProcessor arp = ArtifactProcessorFactory.getArtifactProcessor();
 
         String pdString = getFileContent("tosca/ExamplePropertyDefinition.yml");
-        OutputStream outstream=null;
+        OutputStream outstream = null;
 
         File tempFile = temporaryFolder.newFile("TestTosca.yml");
         outstream = new FileOutputStream(tempFile);
-        arp.generateArtifact(pdString,outstream);
+        arp.generateArtifact(pdString, outstream);
         outstream.flush();
         outstream.close();
 
         String expectedTosca = getFileContent("tosca/ExpectedTosca.yml");
         String toscaString = getFileContent(tempFile);
-        Assert.assertEquals(expectedTosca,toscaString);
+        Assert.assertEquals(expectedTosca, toscaString);
     }
 
     @Test
-    public void testArtifactProcessorWithStringOutput() throws IOException, ArtifactProcessorException {
+    public void testArtifactProcessorWithStringOutput()
+            throws IOException, ArtifactProcessorException {
 
         ArtifactProcessor arp = ArtifactProcessorFactory.getArtifactProcessor();
 
         String pdString = getFileContent("tosca/ExamplePropertyDefinition.yml");
-        OutputStream outstream=null;
+        OutputStream outstream = null;
 
         outstream = new ByteArrayOutputStream();
-        arp.generateArtifact(pdString,outstream);
+        arp.generateArtifact(pdString, outstream);
         outstream.flush();
         outstream.close();
 
         String expectedTosca = getFileContent("tosca/ExpectedTosca.yml");
-        String toscaString = outstream.toString();    
+        String toscaString = outstream.toString();
     }
 
-    private String getFileContent(String fileName) throws IOException{
+    private String getFileContent(String fileName) throws IOException {
         ClassLoader classLoader = new TestArtifactProcessor().getClass().getClassLoader();
         InputStream is = new FileInputStream(classLoader.getResource(fileName).getFile());
         BufferedReader buf = new BufferedReader(new InputStreamReader(is));
@@ -88,7 +96,7 @@ public class TestArtifactProcessor{
         return fileString;
     }
 
-    private String getFileContent(File file) throws IOException{
+    private String getFileContent(File file) throws IOException {
         InputStream is = new FileInputStream(file);
         BufferedReader buf = new BufferedReader(new InputStreamReader(is));
         String line = buf.readLine();
index 9501802..7477d74 100644 (file)
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.transformer.tosca;
-
+package org.onap.sdnc.config.params.transformer.tosca;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
 import org.junit.Assert;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
-import org.openecomp.sdnc.config.params.data.Parameter;
-import org.openecomp.sdnc.config.params.data.PropertyDefinition;
-import org.openecomp.sdnc.config.params.data.RequestKey;
-import org.openecomp.sdnc.config.params.data.ResponseKey;
-import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
+import org.onap.sdnc.config.params.data.Parameter;
+import org.onap.sdnc.config.params.data.PropertyDefinition;
+import org.onap.sdnc.config.params.data.RequestKey;
+import org.onap.sdnc.config.params.data.ResponseKey;
+import org.onap.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
 
-import java.io.*;
-import java.util.ArrayList;
-import java.util.List;
-public class TestGenerateArtifactObject
-{
+public class TestGenerateArtifactObject {
     @Rule
     public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
     @Test
     public void testObjectArtifactProcessor() throws IOException, ArtifactProcessorException {
 
-        String expectedTosca="node_types:\n" +
-                "  VNF:\n" +
-                "    derived_from: org.openecomp.genericvnf\n" +
-                "    version: V1\n" +
-                "    description: ''\n" +
-                "    properties:\n" +
-                "      LOCAL_ACCESS_IP_ADDR:\n" +
-                "        type: string\n" +
-                "        required: false\n" +
-                "        default: 0.0.0.0\n" +
-                "        status: SUPPORTED\n" +
-                "      LOCAL_CORE_ALT_IP_ADDR:\n" +
-                "        type: String\n" +
-                "        required: false\n" +
-                "        default: value\n" +
-                "        status: SUPPORTED\n" +
-                "topology_template:\n" +
-                "  node_templates:\n" +
-                "    VNF_Template:\n" +
-                "      type: VNF\n" +
-                "      properties:\n" +
-                "        LOCAL_ACCESS_IP_ADDR: <rule-type = myRule1> <response-keys = > <source-system = source> <request-keys = class-type:interface-ip-address , address_fqdn:someVal , address_type:v4>\n" +
-                "        LOCAL_CORE_ALT_IP_ADDR: <rule-type = myRule2> <response-keys = name1:value1:field1> <source-system = source> <request-keys = >\n";
-        //Create object
+        String expectedTosca = "node_types:\n" + "  VNF:\n"
+                + "    derived_from: org.openecomp.genericvnf\n" + "    version: V1\n"
+                + "    description: ''\n" + "    properties:\n" + "      LOCAL_ACCESS_IP_ADDR:\n"
+                + "        type: string\n" + "        required: false\n"
+                + "        default: 0.0.0.0\n" + "        status: SUPPORTED\n"
+                + "      LOCAL_CORE_ALT_IP_ADDR:\n" + "        type: String\n"
+                + "        required: false\n" + "        default: value\n"
+                + "        status: SUPPORTED\n" + "topology_template:\n" + "  node_templates:\n"
+                + "    VNF_Template:\n" + "      type: VNF\n" + "      properties:\n"
+                + "        LOCAL_ACCESS_IP_ADDR: <rule-type = myRule1> <response-keys = > <source-system = source> <request-keys = class-type:interface-ip-address , address_fqdn:someVal , address_type:v4>\n"
+                + "        LOCAL_CORE_ALT_IP_ADDR: <rule-type = myRule2> <response-keys = name1:value1:field1> <source-system = source> <request-keys = >\n";
+        // Create object
         PropertyDefinition pd = new PropertyDefinition();
         pd.setKind("VNF");
         pd.setVersion("V1");
         pd.setParameters(createParameters());
 
-        //Call ArtifactProcessor
-        OutputStream outstream=null;
+        // Call ArtifactProcessor
+        OutputStream outstream = null;
 
-        File toscaFile =temporaryFolder.newFile("TestTosca.yml");
+        File toscaFile = temporaryFolder.newFile("TestTosca.yml");
         outstream = new FileOutputStream(toscaFile);
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
-        arp.generateArtifact(pd,outstream);
+        arp.generateArtifact(pd, outstream);
         outstream.flush();
         outstream.close();
 
         String toscaString = getFileContent(toscaFile);
-        Assert.assertEquals(expectedTosca,toscaString);
+        Assert.assertEquals(expectedTosca, toscaString);
 
     }
 
     @Test
     public void testPDpropertiesSetNull() throws IOException, ArtifactProcessorException {
-        String expectedTosca = "node_types:\n" +
-                "  PropertyDefinition:\n" +
-                "    derived_from: org.openecomp.genericvnf\n" +
-                "    version: V1\n" +
-                "    description: ''\n" +
-                "topology_template:\n" +
-                "  node_templates:\n" +
-                "    PropertyDefinition_Template:\n" +
-                "      type: PropertyDefinition\n";
-        //Create object
+        String expectedTosca = "node_types:\n" + "  PropertyDefinition:\n"
+                + "    derived_from: org.openecomp.genericvnf\n" + "    version: V1\n"
+                + "    description: ''\n" + "topology_template:\n" + "  node_templates:\n"
+                + "    PropertyDefinition_Template:\n" + "      type: PropertyDefinition\n";
+        // Create object
         PropertyDefinition pd = new PropertyDefinition();
         pd.setKind("PropertyDefinition");
         pd.setVersion("V1");
-        OutputStream outstream=null;
+        OutputStream outstream = null;
 
-        File toscaFile =temporaryFolder.newFile("TestTosca.yml");
+        File toscaFile = temporaryFolder.newFile("TestTosca.yml");
         outstream = new FileOutputStream(toscaFile);
 
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
-        arp.generateArtifact(pd,outstream);
+        arp.generateArtifact(pd, outstream);
         outstream.flush();
         outstream.close();
 
         String toscaString = getFileContent(toscaFile);
-        Assert.assertEquals(expectedTosca,toscaString);
+        Assert.assertEquals(expectedTosca, toscaString);
     }
 
-   @Test
+    @Test
     public void testArtifactGeneratorInvalidStream() throws IOException {
         String expectedMsg = "java.io.IOException: Stream Closed";
         PropertyDefinition pd = new PropertyDefinition();
@@ -127,25 +115,22 @@ public class TestGenerateArtifactObject
         pd.setVersion("V1");
         pd.setParameters(createParameters());
 
-        //Call ArtifactProcessor
-        OutputStream outstream=null;
+        // Call ArtifactProcessor
+        OutputStream outstream = null;
         try {
-            File toscaFile =temporaryFolder.newFile("TestTosca.yml");
+            File toscaFile = temporaryFolder.newFile("TestTosca.yml");
             outstream = new FileOutputStream(toscaFile);
             outstream.close();
             ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
-            arp.generateArtifact(pd,outstream);
+            arp.generateArtifact(pd, outstream);
             Assert.fail();
-        }
-        catch (ArtifactProcessorException e)
-        {
-            Assert.assertEquals(expectedMsg,e.getMessage());
+        } catch (ArtifactProcessorException e) {
+            Assert.assertEquals(expectedMsg, e.getMessage());
         }
     }
 
-    private List<Parameter> createParameters()
-    {
-        //Create single Parameter object 1
+    private List<Parameter> createParameters() {
+        // Create single Parameter object 1
         Parameter singleParameter1 = new Parameter();
         singleParameter1.setName("LOCAL_ACCESS_IP_ADDR");
         singleParameter1.setRequired(false);
@@ -154,7 +139,7 @@ public class TestGenerateArtifactObject
         singleParameter1.setRuleType("myRule1");
         singleParameter1.setRequestKeys(createRequestKeys());
 
-        //Create single Parameter object 2
+        // Create single Parameter object 2
         Parameter singleParameter2 = new Parameter();
         singleParameter2.setName("LOCAL_CORE_ALT_IP_ADDR");
         singleParameter2.setType("String");
@@ -164,56 +149,53 @@ public class TestGenerateArtifactObject
         singleParameter2.setRuleType("myRule2");
         singleParameter2.setResponseKeys(createResponseKeys());
 
-        //Add the Parameter objects to the List
+        // Add the Parameter objects to the List
         List<Parameter> parameterList = new ArrayList<Parameter>();
         parameterList.add(singleParameter1);
         parameterList.add(singleParameter2);
         return parameterList;
     }
 
-    private List<RequestKey> createRequestKeys()
-    {
-        //Create RequestKey object 1
+    private List<RequestKey> createRequestKeys() {
+        // Create RequestKey object 1
         RequestKey requestKey1 = new RequestKey();
         requestKey1.setKeyName("class-type");
         requestKey1.setKeyValue("interface-ip-address");
 
-        //Create RequestKey object 2
+        // Create RequestKey object 2
         RequestKey requestKey2 = new RequestKey();
         requestKey2.setKeyName("address_fqdn");
         requestKey2.setKeyValue("someVal");
 
-        //Create RequestKey object 3
+        // Create RequestKey object 3
         RequestKey requestKey3 = new RequestKey();
         requestKey3.setKeyName("address_type");
         requestKey3.setKeyValue("v4");
 
-        //Add the RequestKey Objects to the List
+        // Add the RequestKey Objects to the List
         List<RequestKey> requestKeyList = new ArrayList<RequestKey>();
         requestKeyList.add(requestKey1);
         requestKeyList.add(requestKey2);
         requestKeyList.add(requestKey3);
-        return  requestKeyList;
+        return requestKeyList;
     }
 
-    private List<ResponseKey> createResponseKeys()
-    {
-        //Create RequestKey object 1
+    private List<ResponseKey> createResponseKeys() {
+        // Create RequestKey object 1
         ResponseKey responseKey1 = new ResponseKey();
 
         responseKey1.setUniqueKeyName("name1");
         responseKey1.setUniqueKeyValue("value1");
         responseKey1.setFieldKeyName("field1");
 
-        //Add the RequestKey Objects to the List
+        // Add the RequestKey Objects to the List
         List<ResponseKey> responseKeyList = new ArrayList<ResponseKey>();
         responseKeyList.add(responseKey1);
 
-        return  responseKeyList;
+        return responseKeyList;
     }
 
-    private Parameter createParameter()
-    {
+    private Parameter createParameter() {
         Parameter singleParameter1 = new Parameter();
         singleParameter1.setName("LOCAL_ACCESS_IP_ADDR");
         singleParameter1.setRequired(false);
@@ -224,20 +206,19 @@ public class TestGenerateArtifactObject
         return singleParameter1;
     }
 
-    @Test(expected =Exception.class)
+    @Test(expected = Exception.class)
     public void testPDnull() throws IOException, ArtifactProcessorException {
         PropertyDefinition pd = null;
-        OutputStream outstream=null;
+        OutputStream outstream = null;
 
         outstream = new FileOutputStream(".\\TestTosca.yml");
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
-        arp.generateArtifact(pd,outstream);
+        arp.generateArtifact(pd, outstream);
         outstream.flush();
         outstream.close();
     }
 
-    private String getFileContent(File file) throws IOException
-    {
+    private String getFileContent(File file) throws IOException {
         InputStream is = new FileInputStream(file);
         BufferedReader buf = new BufferedReader(new InputStreamReader(is));
         String line = buf.readLine();
index 4ffbe52..fb5e934 100644 (file)
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.transformer.tosca;
-
+package org.onap.sdnc.config.params.transformer.tosca;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
 import org.junit.Assert;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
-import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
-
-import java.io.*;
-import java.net.URL;
+import org.onap.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
 
-public class TestGenerateArtifactString{
+public class TestGenerateArtifactString {
 
     @Rule
     public TemporaryFolder temporaryFolder = new TemporaryFolder();
@@ -42,58 +47,56 @@ public class TestGenerateArtifactString{
     public void testStringArtifactGenerator() throws IOException, ArtifactProcessorException {
 
         String pdString = getFileContent("tosca/ExamplePropertyDefinition.yml");
-        OutputStream outstream=null;
+        OutputStream outstream = null;
 
         File tempFile = temporaryFolder.newFile("TestTosca.yml");
         outstream = new FileOutputStream(tempFile);
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
-        arp.generateArtifact(pdString,outstream);
+        arp.generateArtifact(pdString, outstream);
         outstream.flush();
         outstream.close();
 
         String expectedTosca = getFileContent("tosca/ExpectedTosca.yml");
         String toscaString = getFileContent(tempFile);
-        Assert.assertEquals(expectedTosca,toscaString);
+        Assert.assertEquals(expectedTosca, toscaString);
 
     }
 
     @Test
-    public void testArtifactGeneratorWithParameterNameBlank() throws IOException, ArtifactProcessorException {
+    public void testArtifactGeneratorWithParameterNameBlank()
+            throws IOException, ArtifactProcessorException {
 
         String pdString = getFileContent("tosca/ExamplePropertyDefinition2.yml");
-        OutputStream outstream=null;
-        String expectedMsg ="Parameter name is empty,null or contains whitespace";
+        OutputStream outstream = null;
+        String expectedMsg = "Parameter name is empty,null or contains whitespace";
 
         File tempFile = temporaryFolder.newFile("TestTosca.yml");
         outstream = new FileOutputStream(tempFile);
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
         try {
             arp.generateArtifact(pdString, outstream);
-        }
-        catch (ArtifactProcessorException e)
-        {
-            Assert.assertEquals(expectedMsg,e.getMessage());
+        } catch (ArtifactProcessorException e) {
+            Assert.assertEquals(expectedMsg, e.getMessage());
         }
         outstream.flush();
         outstream.close();
     }
 
     @Test
-    public void testArtifactGeneratorWithParameterNameNull() throws IOException, ArtifactProcessorException {
+    public void testArtifactGeneratorWithParameterNameNull()
+            throws IOException, ArtifactProcessorException {
 
         String pdString = getFileContent("tosca/ExamplePropertyDefinition3.yml");
-        OutputStream outstream=null;
-        String expectedMsg ="Parameter name is empty,null or contains whitespace";
+        OutputStream outstream = null;
+        String expectedMsg = "Parameter name is empty,null or contains whitespace";
 
         File tempFile = temporaryFolder.newFile("TestTosca.yml");
         outstream = new FileOutputStream(tempFile);
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
         try {
             arp.generateArtifact(pdString, outstream);
-        }
-        catch (ArtifactProcessorException e)
-        {
-            Assert.assertEquals(expectedMsg,e.getMessage());
+        } catch (ArtifactProcessorException e) {
+            Assert.assertEquals(expectedMsg, e.getMessage());
         }
         outstream.flush();
         outstream.close();
@@ -103,25 +106,22 @@ public class TestGenerateArtifactString{
     public void testArtifactGeneratorWithKindNull() throws IOException, ArtifactProcessorException {
 
         String pdString = getFileContent("tosca/ExamplePropertyDefinition4.yml");
-        OutputStream outstream=null;
-        String expectedMsg ="Kind in PropertyDefinition is blank or null";
+        OutputStream outstream = null;
+        String expectedMsg = "Kind in PropertyDefinition is blank or null";
 
         File tempFile = temporaryFolder.newFile("TestTosca.yml");
         outstream = new FileOutputStream(tempFile);
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
         try {
             arp.generateArtifact(pdString, outstream);
-        }
-        catch (ArtifactProcessorException e)
-        {
-            Assert.assertEquals(expectedMsg,e.getMessage());
+        } catch (ArtifactProcessorException e) {
+            Assert.assertEquals(expectedMsg, e.getMessage());
         }
         outstream.flush();
         outstream.close();
     }
 
-    private String getFileContent(String fileName) throws IOException
-    {
+    private String getFileContent(String fileName) throws IOException {
         ClassLoader classLoader = new TestGenerateArtifactString().getClass().getClassLoader();
         InputStream is = new FileInputStream(classLoader.getResource(fileName).getFile());
         BufferedReader buf = new BufferedReader(new InputStreamReader(is));
@@ -137,8 +137,7 @@ public class TestGenerateArtifactString{
         return fileString;
     }
 
-    private String getFileContent(File file) throws IOException
-    {
+    private String getFileContent(File file) throws IOException {
         InputStream is = new FileInputStream(file);
         BufferedReader buf = new BufferedReader(new InputStreamReader(is));
         String line = buf.readLine();
index 3eb231a..d4de5b5 100644 (file)
  * ============LICENSE_END=========================================================\r
  */\r
 \r
-package org.openecomp.sdnc.config.params.transformer.tosca;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.openecomp.sdnc.config.params.data.RequestKey;\r
-import org.openecomp.sdnc.config.params.data.ResponseKey;\r
+package org.onap.sdnc.config.params.transformer.tosca;\r
 \r
 import java.util.ArrayList;\r
 import java.util.List;\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.onap.sdnc.config.params.data.RequestKey;\r
+import org.onap.sdnc.config.params.data.ResponseKey;\r
 \r
-public class TestPropertyQueryString\r
-{\r
-   @Test\r
-    public void testBuildResponseKeys()\r
-    {\r
+public class TestPropertyQueryString {\r
+    @Test\r
+    public void testBuildResponseKeys() {\r
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();\r
-        String properties= arp.buildResponseKeyExpression(createResponseKeys());\r
-        Assert.assertEquals("<response-keys = address-fqdn:0000000000000:ipaddress-v4 , key2:value2:field2>",properties);\r
+        String properties = arp.buildResponseKeyExpression(createResponseKeys());\r
+        Assert.assertEquals(\r
+                "<response-keys = address-fqdn:0000000000000:ipaddress-v4 , key2:value2:field2>",\r
+                properties);\r
     }\r
 \r
-   @Test\r
-    public void testBuildRequestKeys()\r
-    {\r
+    @Test\r
+    public void testBuildRequestKeys() {\r
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();\r
-        String properties= arp.buildRequestKeyExpression(createRequestKeys());\r
-        Assert.assertEquals("<request-keys = class-type:interface-ip-address , address_fqdn:00000000000000 , address_type:v4>",properties);\r
+        String properties = arp.buildRequestKeyExpression(createRequestKeys());\r
+        Assert.assertEquals(\r
+                "<request-keys = class-type:interface-ip-address , address_fqdn:00000000000000 , address_type:v4>",\r
+                properties);\r
     }\r
 \r
     @Test\r
-    public void testEncoding()\r
-    {\r
+    public void testEncoding() {\r
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();\r
 \r
         String expected1 = "&lt;class-type&gt;";\r
         String encoded1 = arp.encode("<class-type>");\r
-        Assert.assertEquals(expected1,encoded1);\r
+        Assert.assertEquals(expected1, encoded1);\r
 \r
         String expected2 = "&lt;&lt;&lt;metallica&lt;&gt;iron_maiden&gt;&gt;&gt;";\r
         String encoded2 = arp.encode("<<<metallica<>iron_maiden>>>");\r
-        Assert.assertEquals(expected2,encoded2);\r
+        Assert.assertEquals(expected2, encoded2);\r
 \r
         String expected3 = "band-list&colon;metallica&comma;ironmaiden";\r
         String encoded3 = arp.encode("band-list:metallica,ironmaiden");\r
-        Assert.assertEquals(expected3,encoded3);\r
+        Assert.assertEquals(expected3, encoded3);\r
 \r
         String expected4 = "motorhead&equals;lemmy";\r
         String encoded4 = arp.encode("motorhead=lemmy");\r
-        Assert.assertEquals(expected4,encoded4);\r
+        Assert.assertEquals(expected4, encoded4);\r
 \r
         String expected5 = "DreamTheater";\r
         String encoded5 = arp.encode("  DreamTheater  ");\r
-        Assert.assertEquals(expected5,encoded5);\r
+        Assert.assertEquals(expected5, encoded5);\r
     }\r
 \r
     @Test\r
-    public void testBuildRuleType()\r
-    {\r
+    public void testBuildRuleType() {\r
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();\r
         String input = "IPV4";\r
         String expected = "<rule-type = IPV4>";\r
-        Assert.assertEquals(expected,arp.buildRuleType(input));\r
+        Assert.assertEquals(expected, arp.buildRuleType(input));\r
     }\r
 \r
     @Test\r
-    public void testRuleTypeSetNull()\r
-    {\r
+    public void testRuleTypeSetNull() {\r
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();\r
         String expected = "<rule-type = >";\r
-        Assert.assertEquals(expected,arp.buildRuleType(null));\r
+        Assert.assertEquals(expected, arp.buildRuleType(null));\r
     }\r
 \r
     @Test\r
-    public void testBuildRequestKeysWithKeyNull()\r
-    {\r
+    public void testBuildRequestKeysWithKeyNull() {\r
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();\r
         List<RequestKey> requestKeyList = new ArrayList<RequestKey>();\r
         requestKeyList.add(null);\r
-        String properties= arp.buildRequestKeyExpression(requestKeyList);\r
-        Assert.assertEquals("<request-keys = >",properties);\r
+        String properties = arp.buildRequestKeyExpression(requestKeyList);\r
+        Assert.assertEquals("<request-keys = >", properties);\r
     }\r
 \r
     @Test\r
-    public void testBuildResponseKeysWithKeyNull()\r
-    {\r
+    public void testBuildResponseKeysWithKeyNull() {\r
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();\r
         List<ResponseKey> responseKeyList = new ArrayList<ResponseKey>();\r
         responseKeyList.add(null);\r
-        String properties= arp.buildResponseKeyExpression(responseKeyList);\r
-        Assert.assertEquals("<response-keys = >",properties);\r
+        String properties = arp.buildResponseKeyExpression(responseKeyList);\r
+        Assert.assertEquals("<response-keys = >", properties);\r
     }\r
 \r
     @Test\r
-    public void testBuildSourceSystem()\r
-    {\r
+    public void testBuildSourceSystem() {\r
         ArtifactProcessorImpl arp = new ArtifactProcessorImpl();\r
-        Assert.assertEquals("<source-system = source>",arp.buildSourceSystem("source"));\r
+        Assert.assertEquals("<source-system = source>", arp.buildSourceSystem("source"));\r
     }\r
-    \r
-    //@Test\r
-    private List<RequestKey> createRequestKeys()\r
-    {\r
-        //Create RequestKey object 1\r
+\r
+    // @Test\r
+    private List<RequestKey> createRequestKeys() {\r
+        // Create RequestKey object 1\r
         RequestKey requestKey1 = new RequestKey();\r
         requestKey1.setKeyName("class-type");\r
         requestKey1.setKeyValue("interface-ip-address");\r
 \r
-        //Create RequestKey object 2\r
+        // Create RequestKey object 2\r
         RequestKey requestKey2 = new RequestKey();\r
         requestKey2.setKeyName("address_fqdn");\r
         requestKey2.setKeyValue("00000000000000");\r
 \r
-        //Create RequestKey object 3\r
+        // Create RequestKey object 3\r
         RequestKey requestKey3 = new RequestKey();\r
         requestKey3.setKeyName("address_type");\r
         requestKey3.setKeyValue("v4");\r
 \r
-        //Add the RequestKey Objects to the List\r
+        // Add the RequestKey Objects to the List\r
         List<RequestKey> requestKeyList = new ArrayList<RequestKey>();\r
         requestKeyList.add(requestKey1);\r
         requestKeyList.add(requestKey2);\r
         requestKeyList.add(requestKey3);\r
-        return  requestKeyList;\r
+        return requestKeyList;\r
     }\r
-    \r
-    //@Test\r
-    private List<ResponseKey> createResponseKeys()\r
-    {\r
-        //Create RequestKey object 1\r
+\r
+    // @Test\r
+    private List<ResponseKey> createResponseKeys() {\r
+        // Create RequestKey object 1\r
         ResponseKey responseKey1 = new ResponseKey();\r
 \r
         responseKey1.setUniqueKeyName("address-fqdn");\r
@@ -161,11 +153,11 @@ public class TestPropertyQueryString
         responseKey2.setUniqueKeyValue("value2");\r
         responseKey2.setFieldKeyName("field2");\r
 \r
-        //Add the RequestKey Objects to the List\r
+        // Add the RequestKey Objects to the List\r
         List<ResponseKey> responseKeyList = new ArrayList<ResponseKey>();\r
         responseKeyList.add(responseKey1);\r
         responseKeyList.add(responseKey2);\r
 \r
-        return  responseKeyList;\r
+        return responseKeyList;\r
     }\r
 }\r
index 1b65a21..4072936 100644 (file)
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.sdnc.config.params.transformer.tosca;
+package org.onap.sdnc.config.params.transformer.tosca;
 
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
 import org.junit.Assert;
 import org.junit.Test;
-import org.openecomp.sdnc.config.params.data.PropertyDefinition;
-import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
-
-import java.io.*;
+import org.onap.sdnc.config.params.data.PropertyDefinition;
+import org.onap.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
 
 public class TestReadArtifact {
     @Test
@@ -38,38 +41,53 @@ public class TestReadArtifact {
         String toscaArtifact = getFileContent("tosca/ReadArtifactPositiveInputTosca.yml");
         ArtifactProcessorImpl artifact = new ArtifactProcessorImpl();
         PropertyDefinition ouptPD = artifact.readArtifact(toscaArtifact);
-        Assert.assertEquals(ouptPD.getKind(),"Property Definition");
-        Assert.assertEquals(ouptPD.getVersion(),"V1");
+        Assert.assertEquals(ouptPD.getKind(), "Property Definition");
+        Assert.assertEquals(ouptPD.getVersion(), "V1");
 
-        Assert.assertEquals(ouptPD.getParameters().get(0).getDefaultValue(),"0.0.0.0");
-        Assert.assertEquals(ouptPD.getParameters().get(0).getName(),"abc");
-        Assert.assertEquals(ouptPD.getParameters().get(0).getSource(),"source");
-        Assert.assertEquals(ouptPD.getParameters().get(0).getRuleType(),"interface-ip-address");
-        Assert.assertEquals(ouptPD.getParameters().get(0).getDescription(),"param_desc");
-        Assert.assertEquals(ouptPD.getParameters().get(0).getType(),"param1_type");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyName(),"address_fqdn");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyValue(),"0");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyName(),"address_fqdn");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyValue(),"0");
-        Assert.assertEquals(ouptPD.getParameters().get(0).getResponseKeys().get(0).getUniqueKeyName(),"address-0");
-        Assert.assertEquals(ouptPD.getParameters().get(0).getResponseKeys().get(0).getFieldKeyName(),"0");
+        Assert.assertEquals(ouptPD.getParameters().get(0).getDefaultValue(), "0.0.0.0");
+        Assert.assertEquals(ouptPD.getParameters().get(0).getName(), "abc");
+        Assert.assertEquals(ouptPD.getParameters().get(0).getSource(), "source");
+        Assert.assertEquals(ouptPD.getParameters().get(0).getRuleType(), "interface-ip-address");
+        Assert.assertEquals(ouptPD.getParameters().get(0).getDescription(), "param_desc");
+        Assert.assertEquals(ouptPD.getParameters().get(0).getType(), "param1_type");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyName(),
+                "address_fqdn");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyValue(),
+                "0");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyName(),
+                "address_fqdn");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyValue(),
+                "0");
+        Assert.assertEquals(
+                ouptPD.getParameters().get(0).getResponseKeys().get(0).getUniqueKeyName(),
+                "address-0");
+        Assert.assertEquals(
+                ouptPD.getParameters().get(0).getResponseKeys().get(0).getFieldKeyName(), "0");
 
-        Assert.assertEquals(ouptPD.getParameters().get(1).getDefaultValue(),"value");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getName(),"param 2");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getSource(),"source");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getRuleType(),"interface-ip-address");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getDescription(),"param2");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getType(),"param2 type");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyName(),"address_fqdn");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyValue(),"0");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(1).getKeyName(),"address_type");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(1).getKeyValue(),"v4");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getResponseKeys().get(0).getUniqueKeyName(),"address-0");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getResponseKeys().get(0).getUniqueKeyValue(),"0");
-        Assert.assertEquals(ouptPD.getParameters().get(1).getResponseKeys().get(0).getFieldKeyName(),"0");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getDefaultValue(), "value");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getName(), "param 2");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getSource(), "source");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getRuleType(), "interface-ip-address");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getDescription(), "param2");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getType(), "param2 type");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyName(),
+                "address_fqdn");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyValue(),
+                "0");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(1).getKeyName(),
+                "address_type");
+        Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(1).getKeyValue(),
+                "v4");
+        Assert.assertEquals(
+                ouptPD.getParameters().get(1).getResponseKeys().get(0).getUniqueKeyName(),
+                "address-0");
+        Assert.assertEquals(
+                ouptPD.getParameters().get(1).getResponseKeys().get(0).getUniqueKeyValue(), "0");
+        Assert.assertEquals(
+                ouptPD.getParameters().get(1).getResponseKeys().get(0).getFieldKeyName(), "0");
 
     }
-    
+
     @Test
     public void testReadArtifactNegetive() throws IOException {
 
@@ -79,13 +97,13 @@ public class TestReadArtifact {
             PropertyDefinition ouptPD = artifact.readArtifact(toscaArtifact);
         } catch (ArtifactProcessorException e) {
             Assert.assertNotNull(e);
-            Assert.assertEquals(e.getMessage(),"Invalid input found <> source1 <reqk1:reqv1 , reqk2:reqv2>");
+            Assert.assertEquals(e.getMessage(),
+                    "Invalid input found <> source1 <reqk1:reqv1 , reqk2:reqv2>");
         }
     }
 
-    private String getFileContent(String fileName) throws IOException
-    {
-        ClassLoader classLoader = new  TestReadArtifact().getClass().getClassLoader();
+    private String getFileContent(String fileName) throws IOException {
+        ClassLoader classLoader = new TestReadArtifact().getClass().getClassLoader();
         InputStream is = new FileInputStream(classLoader.getResource(fileName).getFile());
         BufferedReader buf = new BufferedReader(new InputStreamReader(is));
         String line = buf.readLine();
index bfb5445..a06abfc 100644 (file)
@@ -19,7 +19,7 @@ vnf-parameter-list:
   description: null\r
   type: null \r
   required: false\r
-  source: "INSTAR"\r
+  source: "A&AI"\r
   rule-type: null\r
   default: "0:0:0:0"\r
   request-keys:\r
@@ -59,7 +59,7 @@ vnf-parameter-list:
   description: null\r
   type: null \r
   required: false\r
-  source: "INSTAR"\r
+  source: "Manual"\r
   rule-type: null\r
   default: "0.0.0.0"\r
   request-keys: null\r
@@ -68,8 +68,8 @@ vnf-parameter-list:
   description: null\r
   type: null \r
   required: false\r
-  source: null\r
+  source: INSTAR\r
   rule-type: null\r
   default: "32"\r
   request-keys: null\r
-  response-keys: null
\ No newline at end of file
+  response-keys: null\r
index f565819..f01a7f0 100644 (file)
@@ -36,7 +36,7 @@ import org.onap.appc.artifact.handler.utils.ArtifactHandlerProviderUtil;
 import org.onap.appc.artifact.handler.utils.SdcArtifactHandlerConstants;
 import org.onap.appc.yang.YANGGenerator;
 import org.onap.appc.yang.impl.YANGGeneratorFactory;
-import org.openecomp.sdnc.config.params.transformer.tosca.ArtifactProcessorImpl;
+import org.onap.sdnc.config.params.transformer.tosca.ArtifactProcessorImpl;
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
 import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
index 08df6f0..56b9c28 100644 (file)
@@ -28,7 +28,7 @@ import org.json.JSONArray;
 import org.json.JSONObject;
 import org.onap.appc.instar.interfaces.ResponseHandlerInterface;
 import org.onap.appc.instar.utils.InstarClientConstant;
-import org.openecomp.sdnc.config.params.data.ResponseKey;
+import org.onap.sdnc.config.params.data.ResponseKey;
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 
 import com.att.eelf.configuration.EELFLogger;
index cc2eeaa..5014059 100644 (file)
@@ -32,8 +32,8 @@ import org.onap.appc.instar.interfaces.RestClientInterface;
 import org.onap.appc.instar.interfaces.RuleHandlerInterface;
 import org.onap.appc.instar.node.InstarClientNode;
 import org.onap.appc.instar.utils.InstarClientConstant;
-import org.openecomp.sdnc.config.params.data.Parameter;
-import org.openecomp.sdnc.config.params.data.ResponseKey;
+import org.onap.sdnc.config.params.data.Parameter;
+import org.onap.sdnc.config.params.data.ResponseKey;
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 
 import com.att.eelf.configuration.EELFLogger;
index 1d343c6..06613d5 100644 (file)
@@ -39,7 +39,7 @@ import org.onap.appc.instar.interfaceImpl.InterfaceIpAddressImpl;
 import org.onap.appc.instar.interfaces.RestClientInterface;
 import org.onap.appc.instar.interfaces.RuleHandlerInterface;
 import org.onap.appc.instar.utils.InstarClientConstant;
-import org.openecomp.sdnc.config.params.data.Parameter;
+import org.onap.sdnc.config.params.data.Parameter;
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
 import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
index f29bebd..fc651f6 100644 (file)
@@ -27,8 +27,8 @@ package org.onap.appc.instar.interfaceImpl;
 import java.util.ArrayList;
 import java.util.List;
 import org.junit.Test;
-import org.openecomp.sdnc.config.params.data.Parameter;
-import org.openecomp.sdnc.config.params.data.ResponseKey;
+import org.onap.sdnc.config.params.data.Parameter;
+import org.onap.sdnc.config.params.data.ResponseKey;
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
 
 public class TestInterfaceIpAddressImpl {