Adding naming micro-service code - more tests.

Integration tests and more unit tests.

Change-Id: Id3500085a43ff817d04d8f407e5cdbc4271dfb35
Issue-ID: CCSDK-342
Signed-off-by: BT2983 <BT2983@att.com>
diff --git a/ms/neng/src/test/resources/application-test.properties b/ms/neng/src/test/resources/application-test.properties
new file mode 100644
index 0000000..ca8ac12
--- /dev/null
+++ b/ms/neng/src/test/resources/application-test.properties
@@ -0,0 +1,38 @@
+info.build.artifact=@project.artifactId@
+info.build.name=@project.name@
+info.build.description=@project.description@
+info.build.version=@project.version@
+
+spring.jersey.type=filter
+
+logging.level.root=info
+logging.level.org.glassfish=info
+logging.level.org.glassfish.jersey=info
+
+spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
+
+logging.pattern.console=%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr($ threadId: {PID:- }){magenta} %clr(---){faint} %clr([ hostname: %X{hostname} serviceName: %X{serviceName} version: %X{version} transactionId: %X{transactionId} requestTimeStamp: %X{requestTimestamp}  responseTimeStamp: %X{responseTimestamp} duration: %X{duration}]){yellow} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex
+
+liquibase.changeLog=classpath:/h2db/changelog/h2db.changelog-master.xml
+logging.level.liquibase: DEBUG
+
+spring.jersey.type=filter
+spring.mvc.urls=swagger,docs,prometheus,auditevents,info,heapdump,autoconfig,beans,loggers,dump,env,trace,health,configprops,mappings
+
+server.contextPath=/web
+
+spring.datasource.driver-class-name=org.h2.Driver
+spring.datasource.username=sa
+spring.datasource.password=sa
+spring.jpa.hibernate.ddl-auto=none
+spring.jpa.show-sql=true
+spring.datasource.url=jdbc:h2:mem:tests;DB_CLOSE_DELAY=-1;
+
+datasource.db.driver-class-name=org.h2.Driver
+datasource.db.url=jdbc:h2:mem:tests;DB_CLOSE_DELAY=-1;
+datasource.db.username=sa
+datasource.db.password=sa
+jpa.hibernate.ddl-auto=none
+jpa.show-sql=true
+
+entitymanager.packagesToScan=org.onap.ccsdk.apps.ms.neng.persistence.entity
diff --git a/ms/neng/src/test/resources/h2db/changelog/h2db.changelog-master.xml b/ms/neng/src/test/resources/h2db/changelog/h2db.changelog-master.xml
new file mode 100644
index 0000000..496a2e9
--- /dev/null
+++ b/ms/neng/src/test/resources/h2db/changelog/h2db.changelog-master.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ 
+<databaseChangeLog
+        xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9
+         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">
+ 
+    <include file="db/changelog/scripts/rel_18_10/create_base_tables.sql" />
+    <include file="db/changelog/scripts/rel_18_10/01_initial_ref_data_v1.sql" />
+    <include file="db/changelog/scripts/rel_18_10/02_create_indexes_ddl.sql" />
+    <include file="db/changelog/scripts/rel_18_10/04_ref_data_extrn_int.sql" />
+    
+    <include file="h2db/changelog/scripts/50_load_sim_data_dml.sql" />
+    <include file="h2db/changelog/scripts/51_ref_data_upd_dml.sql" />
+</databaseChangeLog>
\ No newline at end of file
diff --git a/ms/neng/src/test/resources/h2db/changelog/scripts/50_load_sim_data_dml.sql b/ms/neng/src/test/resources/h2db/changelog/scripts/50_load_sim_data_dml.sql
new file mode 100644
index 0000000..5c750bd
--- /dev/null
+++ b/ms/neng/src/test/resources/h2db/changelog/scripts/50_load_sim_data_dml.sql
@@ -0,0 +1,23 @@
+--liquibase formatted sql
+--changeset policy_man_sim:18_06.table_load.sql
+
+insert into policy_man_sim(policy_name, policy_response) values ('JQINSRIOV.Config_MS_SriovBigJson.1.xml', '[
+  {
+    "policyConfigMessage": "Config Retrieved! ",
+    "policyConfigStatus": "CONFIG_RETRIEVED",
+    "type": "JSON",
+    "config": {"riskLevel":"4","riskType":"test","policyName":"SriovBigJson","service":"SDNC-GenerateName","guard":"False","description":"SriovBigJson","templateVersion":"1607","priority":"4","version":"pannny_nnnn","content":{"policy-instance-name":"NameGenerationPolicyForSRIOV","naming-models":[{"naming-properties":[{"property-operation":"substr(5)","property-name":"COMPLEX"},{"property-name":"SEQUENCE","increment-sequence":{"max":"zzz","scope":"ENTIRETY","start-value":"001","length":"3","increment":"1","sequence-type":"alpha-numeric"}},{"property-name":"NF_NAMING_CODE"}],"naming-type":"VNF","nfRole":"vPE","naming-recipe":"COMPLEX|SEQUENCE|NF_NAMING_CODE"},{"naming-properties":[{"property-name":"VNF_NAME"},{"property-name":"SEQUENCE","increment-sequence":{"max":"999","scope":"ENTIRETY","start-value":"001","length":"3","increment":"1","sequence-type":"numeric"}},{"property-operation":"substr(-3)","property-name":"NFC_NAMING_CODE"}],"naming-type":"VM","nfRole":"vPE","naming-recipe":"VNF_NAME|SEQUENCE|NFC_NAMING_CODE"},{"naming-properties":[{"property-name":"VNF_NAME"},{"property-value":"-","property-name":"DELIMITER"},{"property-name":"VF_MODULE_LABEL"},{"property-name":"VF_MODULE_TYPE"},{"property-name":"SEQUENCE","increment-sequence":{"max":"99","scope":"PRECEEDING","start-value":"01","length":"2","increment":"1","sequence-type":"numeric"}}],"naming-type":"VF-MODULE","nfRole":"vPE","naming-recipe":"VNF_NAME|DELIMITER|VF_MODULE_LABEL|DELIMITER|VF_MODULE_TYPE|DELIMITER|SEQUENCE"},{"naming-properties":[{"property-name":"VF-MODULE_NAME"},{"property-value":"-","property-name":"DELIMITER"},{"property-value":"volumegroup","property-name":"CONSTANT"}],"naming-type":"VOLUME_GROUP","nfRole":"vPE","naming-recipe":"VF-MODULE_NAME|DELIMITER|CONSTANT"},{"naming-properties":[{"property-name":"VOLUME_GROUP_NAME"},{"property-value":"-","property-name":"DELIMITER"},{"property-value":"volume","property-name":"CONSTANT"},{"property-name":"SEQUENCE","increment-sequence":{"max":"99","scope":"PRECEEDING","start-value":"01","length":"2","increment":"1","sequence-type":"numeric"}}],"naming-type":"VOLUME","nfRole":"vPE","naming-recipe":"VOLUME_GROUP_NAME|DELIMITER|CONSTANT|DELIMITER|SEQUENCE"},{"naming-properties":[{"property-name":"VNF_NAME"},{"property-value":"-","property-name":"DELIMITER"},{"property-value":"affinity","property-name":"CONSTANT"}],"naming-type":"AFFINITY","nfRole":"vPE","naming-recipe":"VNF_NAME|DELIMITER|CONSTANT"},{"naming-properties":[{"property-name":"VNF_NAME"},{"property-value":"-","property-name":"DELIMITER"},{"property-value":"INT","property-name":"CONSTANT"},{"property-name":"SEQUENCE","increment-sequence":{"max":"99","scope":"PRECEEDING","start-value":"01","length":"2","increment":"1","sequence-type":"numeric"}}],"naming-type":"INTERNAL_NETWORK","nfRole":"vPE","naming-recipe":"VNF_NAME|DELIMITER|CONSTANT|SEQUENCE"}]}},
+    "policyName": "JQINSRIOV.Config_MS_SriovBigJson.1.xml",
+    "policyType": "MicroService",
+    "policyVersion": "1",
+    "matchingConditions": {
+      "ECOMPName": "SDNC",
+      "ONAPName": "SDNC",
+      "service": "SDNC-GenerateName"
+    },
+    "responseAttributes": {},
+    "property": null
+  }
+]');
+
+commit;
\ No newline at end of file
diff --git a/ms/neng/src/test/resources/h2db/changelog/scripts/51_ref_data_upd_dml.sql b/ms/neng/src/test/resources/h2db/changelog/scripts/51_ref_data_upd_dml.sql
new file mode 100644
index 0000000..2114a62
--- /dev/null
+++ b/ms/neng/src/test/resources/h2db/changelog/scripts/51_ref_data_upd_dml.sql
@@ -0,0 +1,5 @@
+--liquibase formatted sql
+--changeset ref_data_update:18_10.ref_data_update.sql
+
+DELETE FROM SERVICE_PARAMETER where NAME='use_db_policy';
+INSERT INTO SERVICE_PARAMETER(NAME, VALUE, CREATED_BY) VALUES ('use_db_policy','Y','Initial');