/
scenario-processor.go
235 lines (178 loc) · 6.29 KB
/
scenario-processor.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
package model
import (
agentExec "github.com/aaronchen2k/deeptest/internal/agent/exec"
"github.com/aaronchen2k/deeptest/internal/pkg/consts"
"github.com/kataras/iris/v12"
"time"
)
type Processor struct {
BaseModel
CreatedBy uint `json:"createdBy"`
Name string `json:"name" yaml:"name"`
Comments string `json:"comments" yaml:"comments"`
Method consts.HttpMethod `json:"method" yaml:"method"`
ParentId uint `json:"parentId"`
ScenarioId uint `json:"scenarioId"`
ProjectId uint `json:"projectId"`
EntityCategory consts.ProcessorCategory `json:"entityCategory"`
EntityType consts.ProcessorType `json:"entityType"`
EntityId uint `json:"entityId"` // Debug Interface Id for ProcessorInterface type
EndpointInterfaceId uint `json:"endpointInterfaceId"`
ProcessorInterfaceSrc consts.ProcessorInterfaceSrc `json:"processorInterfaceSrc"`
Ordr int `json:"ordr"`
Children []*Processor `gorm:"-" json:"children"`
Slots iris.Map `gorm:"-" json:"slots"`
}
func (Processor) TableName() string {
return "biz_processor"
}
//type ProcessorThreadGroup struct {
// BaseModel
// agentExec.ProcessorEntityBase
//
// Count int `json:"count" yaml:"count"`
// Loop int `json:"loop" yaml:"loop"`
//
// StartupDelay int `json:"startupDelay" yaml:"startupDelay"`
// RampUpPeriod int `json:"rampUpPeriod" yaml:"rampUpPeriod"`
// Duration int `json:"duration" yaml:"duration"`
//
// ErrorAction consts.ErrorAction
//}
//
//func (ProcessorThreadGroup) TableName() string {
// return "biz_processor_thread_group"
//}
type ProcessorGroup struct {
BaseModel
agentExec.ProcessorEntityBase
}
func (ProcessorGroup) TableName() string {
return "biz_processor_group"
}
type ProcessorLogic struct {
BaseModel
agentExec.ProcessorEntityBase
Expression string `json:"expression" yaml:"expression"`
}
func (ProcessorLogic) TableName() string {
return "biz_processor_logic"
}
type ProcessorLoop struct {
BaseModel
agentExec.ProcessorEntityBase
Times int `json:"times" yaml:"times"` // time
Range string `json:"range" yaml:"range"` // range
InType string `json:"inType" yaml:"inType"` // in
Variable string `json:"variable" yaml:"variable"` // variable
List string `json:"list" yaml:"list"` // list
Step string `json:"step" yaml:"step"`
IsRand bool `json:"isRand" yaml:"isRand"`
VariableName string `json:"variableName" yaml:"variableName"`
UntilExpression string `json:"untilExpression" yaml:"untilExpression"` // until
BreakIfExpression string `json:"breakIfExpression" yaml:"breakIfExpression"`
}
func (ProcessorLoop) TableName() string {
return "biz_processor_loop"
}
type ProcessorTimer struct {
BaseModel
agentExec.ProcessorEntityBase
SleepTime int `json:"sleepTime" yaml:"sleepTime"`
Unit string `json:"unit" yaml:"unit"`
}
func (ProcessorTimer) TableName() string {
return "biz_processor_timer"
}
type ProcessorPrint struct {
BaseModel
agentExec.ProcessorEntityBase
RightValue string `json:"rightValue" yaml:"rightValue"`
}
func (ProcessorPrint) TableName() string {
return "biz_processor_print"
}
type ProcessorVariable struct {
BaseModel
agentExec.ProcessorEntityBase
VariableName string `json:"variableName" yaml:"variableName"`
Expression string `json:"expression" yaml:"expression"`
}
func (ProcessorVariable) TableName() string {
return "biz_processor_variable"
}
type ProcessorAssertion struct {
BaseModel
agentExec.ProcessorEntityBase
Expression string `json:"expression" yaml:"expression"`
}
func (ProcessorAssertion) TableName() string {
return "biz_processor_assertion"
}
type ProcessorExtractor struct {
BaseModel
agentExec.ProcessorEntityBase
Src consts.ExtractorSrc `json:"src"`
Type consts.ExtractorType `json:"type"`
Key string `json:"key"` // form header
Expression string `json:"expression"`
//NodeProp string `json:"prop"`
BoundaryStart string `json:"boundaryStart"`
BoundaryEnd string `json:"boundaryEnd"`
BoundaryIndex int `json:"boundaryIndex"`
BoundaryIncluded bool `json:"boundaryIncluded"`
Variable string `json:"variable"`
Result string `json:"result"`
InterfaceId uint `json:"interfaceId"`
}
func (ProcessorExtractor) TableName() string {
return "biz_processor_extractor"
}
type ProcessorData struct {
BaseModel
agentExec.ProcessorEntityBase
Src consts.DataItSrc `json:"src" yaml:"src"`
Type consts.DataItType `json:"type,omitempty" yaml:"type,omitempty"`
Url string `json:"url,omitempty" yaml:"url,omitempty"`
DatapoolId uint `json:"datapoolId,omitempty" yaml:"datapoolId,omitempty"`
Separator string `json:"separator,omitempty" yaml:"separator,omitempty"`
RepeatTimes int `json:"repeatTimes,omitempty" yaml:"repeatTimes,omitempty"`
IsRand bool `json:"isRand,omitempty" yaml:"isRand,omitempty"`
VariableName string `json:"variableName,omitempty" yaml:"variableName,omitempty"`
}
func (ProcessorData) TableName() string {
return "biz_processor_data"
}
type ProcessorCookie struct {
BaseModel
agentExec.ProcessorEntityBase
CookieName string `json:"cookieName" yaml:"cookieName"`
VariableName string `json:"variableName" yaml:"variableName"`
RightValue string `json:"rightValue" yaml:"rightValue"`
Domain string `json:"domain" yaml:"domain"`
ExpireTime *time.Time `json:"expireTime" yaml:"expireTime"`
}
func (ProcessorCookie) TableName() string {
return "biz_processor_cookie"
}
type ProcessorCustomCode struct {
BaseModel
agentExec.ProcessorEntityBase
Content string `gorm:"type:longtext;" json:"content" yaml:"content"`
Desc string `json:"desc" yaml:"desc"`
//Output string `gorm:"type:longtext;" json:"output"`
//ResultStatus consts.ResultStatus `json:"resultStatus"`
//ResultMsg string `json:"resultMsg"`
}
func (ProcessorCustomCode) TableName() string {
return "biz_processor_custom_code"
}
type ProcessorComm struct {
Id uint `json:"id" yaml:"id"`
agentExec.ProcessorEntityBase
EntityId uint `json:"entityId"`
EndpointInterfaceId uint `json:"endpointInterfaceId"`
Method consts.HttpMethod `json:"method"`
SrcName string `json:"srcName"`
ProcessorInterfaceSrc consts.ProcessorInterfaceSrc `json:"processorInterfaceSrc"`
}