summaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/test/resources
diff options
context:
space:
mode:
authorzhangfan345 <zhangfan345@huawei.com>2022-09-01 11:24:47 +0800
committerzhangfan345 <zhangfan345@huawei.com>2022-09-01 14:40:14 +0800
commit54e7ca4ddf183cd15bd7afff0c53b1970698432b (patch)
tree8b4e8f780b24b409e4e81a375e9e933415e444f5 /intentanalysis/src/test/resources
parent0699e877538e8ee6179750112a4414848058fe09 (diff)
Add UT to intent service
Issue-ID: USECASEUI-716 Signed-off-by: zhangfan345 <zhangfan345@huawei.com> Change-Id: I45b7faf76bf899510d11939021fd1d788c95a4bf
Diffstat (limited to 'intentanalysis/src/test/resources')
-rw-r--r--intentanalysis/src/test/resources/application.yaml6
-rw-r--r--intentanalysis/src/test/resources/intentdb-test-data.sql71
-rw-r--r--intentanalysis/src/test/resources/intentdb-test-init.sql78
3 files changed, 131 insertions, 24 deletions
diff --git a/intentanalysis/src/test/resources/application.yaml b/intentanalysis/src/test/resources/application.yaml
index 8973759..aa317ef 100644
--- a/intentanalysis/src/test/resources/application.yaml
+++ b/intentanalysis/src/test/resources/application.yaml
@@ -29,10 +29,12 @@ spring:
username:
password:
driver-class-name: org.h2.Driver
- schema: classpath:intentdb-test-init.sql
- data: classpath:intentdb-test-data.sql
main:
allow-bean-definition-overriding: true
+ sql:
+ init:
+ schema-locations: classpath:intentdb-test-init.sql
+ data-locations: classpath:intentdb-test-data.sql
###mybtis####
mybatis:
diff --git a/intentanalysis/src/test/resources/intentdb-test-data.sql b/intentanalysis/src/test/resources/intentdb-test-data.sql
index 14cbefc..058e055 100644
--- a/intentanalysis/src/test/resources/intentdb-test-data.sql
+++ b/intentanalysis/src/test/resources/intentdb-test-data.sql
@@ -16,7 +16,74 @@
*/
-- ----------------------------
-MERGE INTO intent (intent_id, intent_name)KEY(intent_id)values ('1234','test-intent');
+-- Records of intent
+-- ----------------------------
+MERGE INTO intent (intent_id, intent_name) KEY (intent_id)
+values ('intentId1', 'CLL Business intent');
+MERGE INTO intent (intent_id, intent_name) KEY (intent_id)
+values ('intentId2', 'CLL Business intent');
+
+-- ----------------------------
+-- Records of expectation
+-- ----------------------------
+MERGE INTO expectation (expectation_id, expectation_name, expectation_type, intent_id) KEY (expectation_id)
+values ('expectationId1', 'CLL Service Expectation', 'DELIVERY', 'intentId1');
+MERGE INTO expectation (expectation_id, expectation_name, expectation_type, intent_id) KEY (expectation_id)
+values ('expectationId2', 'CLL Assurance Expectation', 'ASSURANCE', 'intentId1');
+MERGE INTO expectation (expectation_id, expectation_name, expectation_type, intent_id) KEY (expectation_id)
+values ('expectationId3', 'CLL Service Expectation', 'DELIVERY', 'intentId2');
+
+-- ----------------------------
+-- Records of expectation_object
+-- ----------------------------
+MERGE INTO expectation_object (object_id, object_type, object_instance, expectation_id) KEY (object_id)
+values ('b1bc45a6-f396-4b65-857d-6d2312bfb352', 'OBJECT1', '', 'expectationId1');
+MERGE INTO expectation_object (object_id, object_type, object_instance, expectation_id) KEY (object_id)
+values ('931a8690-fa61-4c2b-a387-9e0fa6152136', 'OBJECT2', '', 'expectationId2');
+MERGE INTO expectation_object (object_id, object_type, object_instance, expectation_id) KEY (object_id)
+values ('3f36bf22-3416-4150-8005-cdc406a43310', 'OBJECT2', '', 'expectationId3');
+
+-- ----------------------------
+-- Records of expectation_target
+-- ----------------------------
+MERGE INTO expectation_target (target_id, target_name, expectation_id) KEY (target_id)
+values ('target1-1', 'source', 'expectationId1');
+MERGE INTO expectation_target (target_id, target_name, expectation_id) KEY (target_id)
+values ('target1-2', 'destination', 'expectationId1');
+MERGE INTO expectation_target (target_id, target_name, expectation_id) KEY (target_id)
+values ('target1-3', 'bandwidth', 'expectationId1');
+MERGE INTO expectation_target (target_id, target_name, expectation_id) KEY (target_id)
+values ('target2-1', 'bandwidthAssurance', 'expectationId2');
+MERGE INTO expectation_target (target_id, target_name, expectation_id) KEY (target_id)
+values ('target3-1', 'source', 'expectationId3');
+-- ----------------------------
+-- Records of condition
+-- ----------------------------
+MERGE INTO condition (condition_id, condition_name, operator_type, condition_value, parent_id) KEY (condition_id)
+values ('condition1-1', 'condition of the cll service source', 'EQUALTO', 'Company A', 'target1-1');
+MERGE INTO condition (condition_id, condition_name, operator_type, condition_value, parent_id) KEY (condition_id)
+values ('condition1-2', 'condition of the cll service destination', 'EQUALTO', 'Cloud 1', 'target1-2');
+MERGE INTO condition (condition_id, condition_name, operator_type, condition_value, parent_id) KEY (condition_id)
+values ('condition1-3', 'condition of the cll service bandwidth', 'EQUALTO', '1000', 'target1-3');
+MERGE INTO condition (condition_id, condition_name, operator_type, condition_value, parent_id) KEY (condition_id)
+values ('condition2-1', 'condition of the cll service bandwidth', 'EQUALTO', 'true', 'target2-1');
+MERGE INTO condition (condition_id, condition_name, operator_type, condition_value, parent_id) KEY (condition_id)
+values ('condition3-1', 'condition of the cll service source', 'EQUALTO', 'Company A', 'target3-1');
+
+-- ----------------------------
+-- Records of context
+-- ----------------------------
+MERGE INTO context (context_id, context_name, parent_id) KEY (context_id)
+values ('d64f3a5f-b091-40a6-bca0-1bc6b1ce8f43', 'intentContextName', 'intentId1');
+MERGE INTO context (context_id, context_name, parent_id) KEY (context_id)
+values ('72f6c546-f234-4be5-a2fe-5740139e20cb', 'intentContextName', 'intentId2');
+
+-- ----------------------------
+-- Records of fulfilment_info
+-- ----------------------------
+MERGE INTO fulfilment_info (fulfilment_info_id, fulfilment_info_status, not_fulfilled_state, not_fulfilled_reason) KEY (fulfilment_info_id)
+values ('intentId1', 'NOT_FULFILLED', 'COMPLIANT', 'NotFulfilledReason');
+MERGE INTO fulfilment_info (fulfilment_info_id, fulfilment_info_status, not_fulfilled_state, not_fulfilled_reason) KEY (fulfilment_info_id)
+values ('intentId2', 'NOT_FULFILLED', 'COMPLIANT', 'NotFulfilledReason');
-MERGE INTO expectation (expectation_id, expectation_name, target_moi, intent_id)KEY(expectation_id)values ('2234','test-expectation',null, '1234');
diff --git a/intentanalysis/src/test/resources/intentdb-test-init.sql b/intentanalysis/src/test/resources/intentdb-test-init.sql
index b84f8e3..211e1cb 100644
--- a/intentanalysis/src/test/resources/intentdb-test-init.sql
+++ b/intentanalysis/src/test/resources/intentdb-test-init.sql
@@ -14,29 +14,67 @@
Date: 30/12/2019 14:40:23
*/
-DROP TABLE IF EXISTS intent;
-DROP TABLE IF EXISTS expectation;
-DROP TABLE IF EXISTS state;
-
-CREATE TABLE if NOT EXISTS intent(
- intent_id varchar(255),
- intent_name varchar(255),
- CONSTRAINT intent_test_task_pkey PRIMARY KEY (intent_id)
+//CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
+
+DROP TABLE IF EXISTS intent;
+DROP TABLE IF EXISTS expectation;
+DROP TABLE IF EXISTS expectation_object;
+DROP TABLE IF EXISTS expectation_target;
+DROP TABLE IF EXISTS context;
+DROP TABLE IF EXISTS fulfilment_info;
+DROP TABLE IF EXISTS condition;
+
+create table if not exists intent
+(
+ intent_id varchar(255) primary key,
+ intent_name varchar(255)
);
-create table if not exists expectation(
- expectation_id varchar(255),
+create table if not exists expectation
+(
+ expectation_id varchar(255) primary key,
expectation_name varchar(255),
- target_moi varchar(255),
- intent_id varchar(255),
- CONSTRAINT expectation_test_task_pkey PRIMARY KEY (expectation_id)
+ expectation_type varchar(255),
+ intent_id varchar(255)
+);
+
+create table if not exists expectation_object
+(
+ object_id varchar(255) DEFAULT random_uuid(),
+ primary key (object_id),
+ object_type varchar(255),
+ object_instance varchar(255),
+ expectation_id varchar(255)
+);
+
+create table if not exists expectation_target
+(
+ target_id varchar(255) primary key,
+ target_name varchar(255),
+ expectation_id varchar(255)
);
-create table if not exists state(
- state_id varchar(255),
- state_name varchar(255),
- is_satisfied boolean,
- condition varchar(255),
- expectation_id varchar(255),
- CONSTRAINT state_test_task_pkey PRIMARY KEY (state_id)
+create table if not exists context
+(
+ context_id varchar(255) primary key,
+ context_name varchar(255),
+ parent_id varchar(255)
);
+
+create table if not exists fulfilment_info
+(
+ fulfilment_info_id varchar(255) primary key,
+ fulfilment_info_status varchar(255),
+ not_fulfilled_state varchar(255),
+ not_fulfilled_reason varchar(255)
+);
+
+create table if not exists condition
+(
+ condition_id varchar(255) primary key,
+ condition_name varchar(255),
+ operator_type varchar(255),
+ condition_value varchar(255),
+ parent_id varchar(255)
+);
+