From f5da5198e43addc77989dee8b500cb69e9885f93 Mon Sep 17 00:00:00 2001 From: BT2983 Date: Mon, 23 Jul 2018 23:51:20 -0600 Subject: Adding naming micro-service code - more tests. Integration tests and more unit tests. Change-Id: Id3500085a43ff817d04d8f407e5cdbc4271dfb35 Issue-ID: CCSDK-342 Signed-off-by: BT2983 --- .../src/test/resources/application-test.properties | 38 ++++++++++++++++++++++ .../h2db/changelog/h2db.changelog-master.xml | 16 +++++++++ .../changelog/scripts/50_load_sim_data_dml.sql | 23 +++++++++++++ .../h2db/changelog/scripts/51_ref_data_upd_dml.sql | 5 +++ 4 files changed, 82 insertions(+) create mode 100644 ms/neng/src/test/resources/application-test.properties create mode 100644 ms/neng/src/test/resources/h2db/changelog/h2db.changelog-master.xml create mode 100644 ms/neng/src/test/resources/h2db/changelog/scripts/50_load_sim_data_dml.sql create mode 100644 ms/neng/src/test/resources/h2db/changelog/scripts/51_ref_data_upd_dml.sql (limited to 'ms/neng/src/test/resources') 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 00000000..ca8ac129 --- /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 00000000..496a2e9d --- /dev/null +++ b/ms/neng/src/test/resources/h2db/changelog/h2db.changelog-master.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + \ 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 00000000..5c750bd2 --- /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 00000000..2114a624 --- /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'); -- cgit 1.2.3-korg