added tests

This commit is contained in:
Edwardro22
2017-07-29 11:19:29 +03:00
parent 783327b936
commit 548d84dac3
27 changed files with 131 additions and 18 deletions

View File

@@ -391,6 +391,10 @@ CREATE TABLE tp_aliases (
UNIQUE KEY `unique_tp_aliases` (`tpid`,`direction`,`tenant`,`category`,`account`,`subject`,`context`, `target`)
);
--
-- Table structure for table `tp_resource_limits`
--
DROP TABLE IF EXISTS tp_resource_limits;
CREATE TABLE tp_resource_limits (
`id` int(11) NOT NULL AUTO_INCREMENT,
@@ -411,6 +415,35 @@ CREATE TABLE tp_resource_limits (
UNIQUE KEY `unique_tp_resource_limits` (`tpid`, `tag`, `filter_type`, `filter_field_name`)
);
--
-- Table structure for table `tp_stats`
--
DROP TABLE IF EXISTS tp_stats;
CREATE TABLE tp_stats (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tpid` varchar(64) NOT NULL,
`tag` varchar(64) NOT NULL,
`filter_type` varchar(16) NOT NULL,
`filter_field_name` varchar(64) NOT NULL,
`filter_field_values` varchar(256) NOT NULL,
`activation_interval` varchar(64) NOT NULL,
`queue_length` int(11) NOT NULL,
`ttl` varchar(32) NOT NULL,
`metrics` varchar(64) NOT NULL,
`store` BOOLEAN NOT NULL,
`thresholds` varchar(64) NOT NULL,
`weight` decimal(8,2) NOT NULL,
`created_at` TIMESTAMP,
PRIMARY KEY (`id`),
KEY `tpid` (`tpid`),
UNIQUE KEY `unique_tp_stats` (`tpid`, `tag`, `filter_type`, `filter_field_name`)
);
--
-- Table structure for table `versions`
--
DROP TABLE IF EXISTS versions;
CREATE TABLE versions (
`id` int(11) NOT NULL AUTO_INCREMENT,

View File

@@ -386,6 +386,11 @@ CREATE TABLE tp_aliases (
CREATE INDEX tpaliases_tpid_idx ON tp_aliases (tpid);
CREATE INDEX tpaliases_idx ON tp_aliases ("tpid","direction","tenant","category","account","subject","context","target");
--
-- Table structure for table `tp_resource_limits`
--
DROP TABLE IF EXISTS tp_resource_limits;
CREATE TABLE tp_resource_limits (
"id" SERIAL PRIMARY KEY,
@@ -398,13 +403,43 @@ CREATE TABLE tp_resource_limits (
"usage_ttl" varchar(32) NOT NULL,
"limit" varchar(64) NOT NULL,
"allocation_message" varchar(64) NOT NULL,
"weight" decimal(8,2) NOT NULL,
"weight" NUMERIC(8,2) NOT NULL,
"action_trigger_ids" varchar(64) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE
);
CREATE INDEX tp_resource_limits_idx ON tp_resource_limits (tpid);
CREATE INDEX tp_resource_limits_unique ON tp_resource_limits ("tpid", "tag", "filter_type", "filter_field_name");
--
-- Table structure for table `tp_stats`
--
DROP TABLE IF EXISTS tp_stats;
CREATE TABLE tp_stats (
"id" SERIAL PRIMARY KEY,
"tpid" varchar(64) NOT NULL,
"tag" varchar(64) NOT NULL,
"filter_type" varchar(16) NOT NULL,
"filter_field_name" varchar(64) NOT NULL,
"filter_field_values" varchar(256) NOT NULL,
"activation_interval" varchar(64) NOT NULL,
"queue_length" INTEGER NOT NULL,
"ttl" varchar(32) NOT NULL,
"metrics" varchar(64) NOT NULL,
"store" BOOLEAN NOT NULL,
"thresholds" varchar(64) NOT NULL,
"weight" decimal(8,2) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE
);
CREATE INDEX tp_stats_idx ON tp_stats (tpid);
CREATE INDEX tp_stats_unique ON tp_stats ("tpid", "tag", "filter_type", "filter_field_name");
--
-- Table structure for table `versions`
--
DROP TABLE IF EXISTS versions;
CREATE TABLE versions (
"id" SERIAL PRIMARY KEY,

View File

@@ -1,6 +0,0 @@
#Id,FilterType,FilterFieldName,FilterFieldValues,ActivationInterval,TTL,Limit,AllocationReply,Weight,ActionTriggers
ResGroup1,*string,Account,1001;1002,2014-07-29T15:00:00Z,1s,7,,20,
ResGroup1,*string_prefix,Destination,10;20,,,,,,
ResGroup1,*rsr_fields,,Subject(~^1.*1$);Destination(1002),,,,,,
ResGroup2,*destinations,Destination,DST_FS,2014-07-29T15:00:00Z,3600s,8,SPECIAL_1002,10,
ResGroup3,*cdr_stats,,CDRST1:*min_ASR:34;CDRST_1001:*min_ASR:20,,,,,,
1 #Id FilterType FilterFieldName FilterFieldValues ActivationInterval TTL Limit AllocationReply Weight ActionTriggers
2 ResGroup1 *string Account 1001;1002 2014-07-29T15:00:00Z 1s 7 20
3 ResGroup1 *string_prefix Destination 10;20
4 ResGroup1 *rsr_fields Subject(~^1.*1$);Destination(1002)
5 ResGroup2 *destinations Destination DST_FS 2014-07-29T15:00:00Z 3600s 8 SPECIAL_1002 10
6 ResGroup3 *cdr_stats CDRST1:*min_ASR:34;CDRST_1001:*min_ASR:20

View File

@@ -1,2 +0,0 @@
#Id,FilterType,FilterFieldName,FilterFieldValues,ActivationInterval,QueueLength,TTL,Metrics,Store,Thresholds,Weight
Stats1,*string,Account,1001;1002,2014-07-29T15:00:00Z,100,1s,*asr;*acd;*acc,true,THRESH1;THRESH2,20
1 #Id FilterType FilterFieldName FilterFieldValues ActivationInterval QueueLength TTL Metrics Store Thresholds Weight
2 Stats1 *string Account 1001;1002 2014-07-29T15:00:00Z 100 1s *asr;*acd;*acc true THRESH1;THRESH2 20