@itentialopensource/adapter-att_mobility 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +6 -0
- package/.eslintrc.js +18 -0
- package/.gitlab/.gitkeep +0 -0
- package/.gitlab/issue_templates/.gitkeep +0 -0
- package/.gitlab/issue_templates/Default.md +17 -0
- package/.gitlab/issue_templates/bugReportTemplate.md +76 -0
- package/.gitlab/issue_templates/featureRequestTemplate.md +14 -0
- package/.jshintrc +0 -0
- package/AUTH.md +39 -0
- package/BROKER.md +199 -0
- package/CALLS.md +206 -0
- package/CHANGELOG.md +9 -0
- package/CODE_OF_CONDUCT.md +43 -0
- package/CONTRIBUTING.md +172 -0
- package/ENHANCE.md +69 -0
- package/LICENSE +201 -0
- package/PROPERTIES.md +641 -0
- package/README.md +337 -0
- package/SUMMARY.md +9 -0
- package/SYSTEMINFO.md +11 -0
- package/TROUBLESHOOT.md +47 -0
- package/adapter.js +1345 -0
- package/adapterBase.js +1787 -0
- package/entities/.generic/action.json +214 -0
- package/entities/.generic/schema.json +28 -0
- package/entities/.system/action.json +50 -0
- package/entities/.system/mockdatafiles/getToken-default.json +3 -0
- package/entities/.system/mockdatafiles/healthcheck-default.json +3 -0
- package/entities/.system/schema.json +19 -0
- package/entities/.system/schemaTokenReq.json +53 -0
- package/entities/.system/schemaTokenResp.json +53 -0
- package/entities/Mobility/action.json +24 -0
- package/entities/Mobility/schema.json +19 -0
- package/entities/Sp/action.json +107 -0
- package/entities/Sp/schema.json +23 -0
- package/error.json +190 -0
- package/package.json +86 -0
- package/pronghorn.json +876 -0
- package/propertiesDecorators.json +14 -0
- package/propertiesSchema.json +1248 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/adapterInfo.json +10 -0
- package/report/attOpenAPI.json +149 -0
- package/report/creationReport.json +255 -0
- package/sampleProperties.json +195 -0
- package/test/integration/adapterTestBasicGet.js +83 -0
- package/test/integration/adapterTestConnectivity.js +93 -0
- package/test/integration/adapterTestIntegration.js +507 -0
- package/test/unit/adapterBaseTestUnit.js +949 -0
- package/test/unit/adapterTestUnit.js +1485 -0
- package/utils/adapterInfo.js +206 -0
- package/utils/addAuth.js +94 -0
- package/utils/artifactize.js +146 -0
- package/utils/basicGet.js +50 -0
- package/utils/checkMigrate.js +63 -0
- package/utils/entitiesToDB.js +178 -0
- package/utils/findPath.js +74 -0
- package/utils/methodDocumentor.js +225 -0
- package/utils/modify.js +154 -0
- package/utils/packModificationScript.js +35 -0
- package/utils/patches2bundledDeps.js +90 -0
- package/utils/pre-commit.sh +32 -0
- package/utils/removeHooks.js +20 -0
- package/utils/setup.js +33 -0
- package/utils/tbScript.js +246 -0
- package/utils/tbUtils.js +490 -0
- package/utils/testRunner.js +298 -0
- package/utils/troubleshootingAdapter.js +195 -0
- package/workflows/README.md +3 -0
|
Binary file
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.0.0",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "ATT-Mobility",
|
|
5
|
+
"version": "1.0.0"
|
|
6
|
+
},
|
|
7
|
+
"servers": [
|
|
8
|
+
{
|
|
9
|
+
"url": "https://apsapi.att.com:{port}",
|
|
10
|
+
"variables": {
|
|
11
|
+
"port": {
|
|
12
|
+
"default": "8082"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"paths": {
|
|
18
|
+
"/sp/mobilityactivations/api/v1/serviceactivation/{requestId}": {
|
|
19
|
+
"get": {
|
|
20
|
+
"description": "getServiceActivationStatus",
|
|
21
|
+
"parameters": [
|
|
22
|
+
{
|
|
23
|
+
"in": "path",
|
|
24
|
+
"name": "requestId",
|
|
25
|
+
"required": true,
|
|
26
|
+
"schema": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"responses": {
|
|
32
|
+
"200": {
|
|
33
|
+
"description": "Success"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"/sp/mobility/billingmgmt/api/v1/billingaccount/{billingAccountNumber}": {
|
|
39
|
+
"get": {
|
|
40
|
+
"description": "getBillingAccountDetails",
|
|
41
|
+
"parameters": [
|
|
42
|
+
{
|
|
43
|
+
"in": "path",
|
|
44
|
+
"name": "billingAccountNumber",
|
|
45
|
+
"required": true,
|
|
46
|
+
"schema": {
|
|
47
|
+
"type": "string"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"responses": {
|
|
52
|
+
"200": {
|
|
53
|
+
"description": "Success"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"/sp/mobility/lineconfig/api/v1/service/{subscriberLine}": {
|
|
59
|
+
"get": {
|
|
60
|
+
"description": "getSubscriberLineDetails",
|
|
61
|
+
"parameters": [
|
|
62
|
+
{
|
|
63
|
+
"in": "path",
|
|
64
|
+
"name": "subscriberLine",
|
|
65
|
+
"required": true,
|
|
66
|
+
"schema": {
|
|
67
|
+
"type": "string"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
"responses": {
|
|
72
|
+
"200": {
|
|
73
|
+
"description": "Success"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"/sp/mobilityactivations/api/v1/serviceactivation": {
|
|
79
|
+
"post": {
|
|
80
|
+
"description": "postServiceActivation",
|
|
81
|
+
"requestBody": {
|
|
82
|
+
"required": true,
|
|
83
|
+
"content": {
|
|
84
|
+
"application/json": {
|
|
85
|
+
"schema": {
|
|
86
|
+
"type": "object"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"responses": {
|
|
92
|
+
"200": {
|
|
93
|
+
"description": "Success"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"/sp/mobility/lineconfig/api/v1/service/{subsciberLine}": {
|
|
99
|
+
"patch": {
|
|
100
|
+
"description": "editSubscriberLineDetails",
|
|
101
|
+
"parameters": [
|
|
102
|
+
{
|
|
103
|
+
"in": "path",
|
|
104
|
+
"name": "subsciberLine",
|
|
105
|
+
"required": true,
|
|
106
|
+
"schema": {
|
|
107
|
+
"type": "string"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
"requestBody": {
|
|
112
|
+
"required": true,
|
|
113
|
+
"content": {
|
|
114
|
+
"application/json": {
|
|
115
|
+
"schema": {
|
|
116
|
+
"type": "object"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"responses": {
|
|
122
|
+
"200": {
|
|
123
|
+
"description": "Success"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"/api/mobility/lineDetails/imei": {
|
|
129
|
+
"post": {
|
|
130
|
+
"description": "queryDeviceByIMEI",
|
|
131
|
+
"parameters": [
|
|
132
|
+
{
|
|
133
|
+
"in": "header",
|
|
134
|
+
"name": "imei",
|
|
135
|
+
"required": true,
|
|
136
|
+
"schema": {
|
|
137
|
+
"type": "string"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
],
|
|
141
|
+
"responses": {
|
|
142
|
+
"200": {
|
|
143
|
+
"description": "Success"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
{
|
|
2
|
+
"errors": [],
|
|
3
|
+
"statistics": [
|
|
4
|
+
{
|
|
5
|
+
"owner": "errorJson",
|
|
6
|
+
"description": "Standard adapter errors available for use",
|
|
7
|
+
"value": 31
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"owner": "packageJson",
|
|
11
|
+
"description": "Number of production dependencies",
|
|
12
|
+
"value": 16
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"owner": "packageJson",
|
|
16
|
+
"description": "Number of development dependencies",
|
|
17
|
+
"value": 7
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"owner": "packageJson",
|
|
21
|
+
"description": "Number of npm scripts",
|
|
22
|
+
"value": 22
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"owner": "packageJson",
|
|
26
|
+
"description": "Runtime Library dependency",
|
|
27
|
+
"value": "^4.48.0"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"owner": "propertiesSchemaJson",
|
|
31
|
+
"description": "Adapter properties defined in the propertiesSchema file",
|
|
32
|
+
"value": 70
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"owner": "adapterJS",
|
|
36
|
+
"description": "Lines of code generated in adapter.js",
|
|
37
|
+
"value": 1355
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"owner": "adapterJS",
|
|
41
|
+
"description": "Number of Functions added to adapter.js",
|
|
42
|
+
"value": 6
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"owner": "pronghornJson",
|
|
46
|
+
"description": "Number of Methods added to pronghorn.json",
|
|
47
|
+
"value": 6
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"owner": "markdown",
|
|
51
|
+
"description": "Number of lines in the README.md",
|
|
52
|
+
"value": 338
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"owner": "markdown",
|
|
56
|
+
"description": "Number of lines in the SUMMARY.md",
|
|
57
|
+
"value": 9
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"owner": "markdown",
|
|
61
|
+
"description": "Number of lines in the PROPERTIES.md",
|
|
62
|
+
"value": 642
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"owner": "markdown",
|
|
66
|
+
"description": "Number of lines in the TROUBLESHOOT.md",
|
|
67
|
+
"value": 48
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"owner": "markdown",
|
|
71
|
+
"description": "Number of lines in the ENHANCE.md",
|
|
72
|
+
"value": 70
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"owner": "markdown",
|
|
76
|
+
"description": "Number of lines in the BROKER.md",
|
|
77
|
+
"value": 200
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"owner": "markdown",
|
|
81
|
+
"description": "Number of lines in the CALLS.md",
|
|
82
|
+
"value": 171
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"owner": "markdown",
|
|
86
|
+
"description": "Number of lines in the AUTH.md",
|
|
87
|
+
"value": 40
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"owner": "markdown",
|
|
91
|
+
"description": "Number of lines in the SYSTEMINFO.md",
|
|
92
|
+
"value": 11
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"owner": "unitTestJS",
|
|
96
|
+
"description": "Number of lines of code in unit tests",
|
|
97
|
+
"value": 1486
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"owner": "unitTestJS",
|
|
101
|
+
"description": "Number of unit tests",
|
|
102
|
+
"value": 67
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"owner": "integrationTestJS",
|
|
106
|
+
"description": "Number of lines of code in integration tests",
|
|
107
|
+
"value": 504
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"owner": "integrationTestJS",
|
|
111
|
+
"description": "Number of integration tests",
|
|
112
|
+
"value": 11
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"owner": "actionJson",
|
|
116
|
+
"description": "Number of actions for Sp entity",
|
|
117
|
+
"value": 5
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"owner": "actionJson",
|
|
121
|
+
"description": "Number of actions for Mobility entity",
|
|
122
|
+
"value": 1
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"owner": "actionJson",
|
|
126
|
+
"description": "Total number of actions",
|
|
127
|
+
"value": 6
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"owner": "actionJson",
|
|
131
|
+
"description": "Total number of entities",
|
|
132
|
+
"value": 2
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"owner": "schemaJson",
|
|
136
|
+
"description": "Number of schemas for Sp entity",
|
|
137
|
+
"value": 1
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"owner": "schemaJson",
|
|
141
|
+
"description": "Number of schemas for Mobility entity",
|
|
142
|
+
"value": 1
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"owner": "schemaJson",
|
|
146
|
+
"description": "Total number of schemas",
|
|
147
|
+
"value": 2
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"owner": "mockdata",
|
|
151
|
+
"description": "Number of mock data files for Sp entity",
|
|
152
|
+
"value": 0
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"owner": "mockdata",
|
|
156
|
+
"description": "Number of mock data files for Mobility entity",
|
|
157
|
+
"value": 0
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"owner": "mockdata",
|
|
161
|
+
"description": "Total number of mock data files",
|
|
162
|
+
"value": 0
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"owner": "actionJson",
|
|
166
|
+
"description": "Number of actions for .system entity",
|
|
167
|
+
"value": 2
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"owner": "schemaJson",
|
|
171
|
+
"description": "Number of schemas for .system entity",
|
|
172
|
+
"value": 3
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"owner": "mockdata",
|
|
176
|
+
"description": "Number of mock data files for .system entity",
|
|
177
|
+
"value": 2
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"owner": "System",
|
|
181
|
+
"description": "System entity files",
|
|
182
|
+
"value": 6
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"owner": "usecases",
|
|
186
|
+
"description": "Number of workflows",
|
|
187
|
+
"value": 0
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"owner": "staticFile",
|
|
191
|
+
"description": "Number of lines of code in adapterBase.js",
|
|
192
|
+
"value": 1788
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"owner": "staticFile",
|
|
196
|
+
"description": "Number of static files added",
|
|
197
|
+
"value": 38
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"owner": "Overall",
|
|
201
|
+
"description": "Total lines of Code",
|
|
202
|
+
"value": 5133
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"owner": "Overall",
|
|
206
|
+
"description": "Total Tests",
|
|
207
|
+
"value": 78
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"owner": "Overall",
|
|
211
|
+
"description": "Total Files",
|
|
212
|
+
"value": 56
|
|
213
|
+
}
|
|
214
|
+
],
|
|
215
|
+
"warnings": [],
|
|
216
|
+
"apiParsingReport": {
|
|
217
|
+
"no_mockdata": [
|
|
218
|
+
{
|
|
219
|
+
"fnName": "getServiceActivationStatus",
|
|
220
|
+
"method": "get",
|
|
221
|
+
"path": "/sp/mobilityactivations/api/v1/serviceactivation/{requestId}"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"fnName": "getBillingAccountDetails",
|
|
225
|
+
"method": "get",
|
|
226
|
+
"path": "/sp/mobility/billingmgmt/api/v1/billingaccount/{billingAccountNumber}"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"fnName": "getSubscriberLineDetails",
|
|
230
|
+
"method": "get",
|
|
231
|
+
"path": "/sp/mobility/lineconfig/api/v1/service/{subscriberLine}"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"fnName": "postServiceActivation",
|
|
235
|
+
"method": "post",
|
|
236
|
+
"path": "/sp/mobilityactivations/api/v1/serviceactivation"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"fnName": "editSubscriberLineDetails",
|
|
240
|
+
"method": "patch",
|
|
241
|
+
"path": "/sp/mobility/lineconfig/api/v1/service/{subsciberLine}"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"fnName": "queryDeviceByIMEI",
|
|
245
|
+
"method": "post",
|
|
246
|
+
"path": "/api/mobility/lineDetails/imei"
|
|
247
|
+
}
|
|
248
|
+
],
|
|
249
|
+
"errors": [],
|
|
250
|
+
"warnings": [],
|
|
251
|
+
"callsTotal": 6,
|
|
252
|
+
"callsConverted": 6,
|
|
253
|
+
"no_mockdata_num": 6
|
|
254
|
+
}
|
|
255
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "Adapter-att_mobility",
|
|
3
|
+
"type": "att_mobility",
|
|
4
|
+
"properties": {
|
|
5
|
+
"host": "apsapi.att.com",
|
|
6
|
+
"port": 8082,
|
|
7
|
+
"base_path": "/",
|
|
8
|
+
"version": "",
|
|
9
|
+
"cache_location": "none",
|
|
10
|
+
"encode_pathvars": true,
|
|
11
|
+
"encode_queryvars": true,
|
|
12
|
+
"save_metric": false,
|
|
13
|
+
"stub": false,
|
|
14
|
+
"protocol": "https",
|
|
15
|
+
"authentication": {
|
|
16
|
+
"auth_method": "no_authentication",
|
|
17
|
+
"username": "username",
|
|
18
|
+
"password": "password",
|
|
19
|
+
"token": "token",
|
|
20
|
+
"token_timeout": 600000,
|
|
21
|
+
"token_cache": "local",
|
|
22
|
+
"invalid_token_error": 401,
|
|
23
|
+
"auth_field": "header.headers.Authorization",
|
|
24
|
+
"auth_field_format": "Basic {b64}{username}:{password}{/b64}",
|
|
25
|
+
"auth_logging": false,
|
|
26
|
+
"client_id": "",
|
|
27
|
+
"client_secret": "",
|
|
28
|
+
"grant_type": ""
|
|
29
|
+
},
|
|
30
|
+
"healthcheck": {
|
|
31
|
+
"type": "none",
|
|
32
|
+
"frequency": 60000,
|
|
33
|
+
"query_object": {}
|
|
34
|
+
},
|
|
35
|
+
"throttle": {
|
|
36
|
+
"throttle_enabled": false,
|
|
37
|
+
"number_pronghorns": 1,
|
|
38
|
+
"sync_async": "sync",
|
|
39
|
+
"max_in_queue": 1000,
|
|
40
|
+
"concurrent_max": 1,
|
|
41
|
+
"expire_timeout": 0,
|
|
42
|
+
"avg_runtime": 200,
|
|
43
|
+
"priorities": [
|
|
44
|
+
{
|
|
45
|
+
"value": 0,
|
|
46
|
+
"percent": 100
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
"request": {
|
|
51
|
+
"number_redirects": 0,
|
|
52
|
+
"number_retries": 3,
|
|
53
|
+
"limit_retry_error": [
|
|
54
|
+
0
|
|
55
|
+
],
|
|
56
|
+
"failover_codes": [],
|
|
57
|
+
"attempt_timeout": 5000,
|
|
58
|
+
"global_request": {
|
|
59
|
+
"payload": {},
|
|
60
|
+
"uriOptions": {},
|
|
61
|
+
"addlHeaders": {},
|
|
62
|
+
"authData": {}
|
|
63
|
+
},
|
|
64
|
+
"healthcheck_on_timeout": true,
|
|
65
|
+
"return_raw": false,
|
|
66
|
+
"archiving": false,
|
|
67
|
+
"return_request": false
|
|
68
|
+
},
|
|
69
|
+
"proxy": {
|
|
70
|
+
"enabled": false,
|
|
71
|
+
"host": "",
|
|
72
|
+
"port": 1,
|
|
73
|
+
"protocol": "http",
|
|
74
|
+
"username": "",
|
|
75
|
+
"password": ""
|
|
76
|
+
},
|
|
77
|
+
"ssl": {
|
|
78
|
+
"ecdhCurve": "",
|
|
79
|
+
"enabled": false,
|
|
80
|
+
"accept_invalid_cert": false,
|
|
81
|
+
"ca_file": "",
|
|
82
|
+
"key_file": "",
|
|
83
|
+
"cert_file": "",
|
|
84
|
+
"secure_protocol": "",
|
|
85
|
+
"ciphers": ""
|
|
86
|
+
},
|
|
87
|
+
"mongo": {
|
|
88
|
+
"host": "",
|
|
89
|
+
"port": 0,
|
|
90
|
+
"database": "",
|
|
91
|
+
"username": "",
|
|
92
|
+
"password": "",
|
|
93
|
+
"replSet": "",
|
|
94
|
+
"db_ssl": {
|
|
95
|
+
"enabled": false,
|
|
96
|
+
"accept_invalid_cert": false,
|
|
97
|
+
"ca_file": "",
|
|
98
|
+
"key_file": "",
|
|
99
|
+
"cert_file": ""
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"devicebroker": {
|
|
103
|
+
"getDevice": [
|
|
104
|
+
{
|
|
105
|
+
"path": "/get/devices/{id}",
|
|
106
|
+
"method": "GET",
|
|
107
|
+
"query": {},
|
|
108
|
+
"body": {},
|
|
109
|
+
"headers": {},
|
|
110
|
+
"handleFailure": "ignore",
|
|
111
|
+
"requestFields": {
|
|
112
|
+
"id": "name"
|
|
113
|
+
},
|
|
114
|
+
"responseDatakey": "",
|
|
115
|
+
"responseFields": {
|
|
116
|
+
"name": "host",
|
|
117
|
+
"ostype": "os",
|
|
118
|
+
"ostypePrefix": "system-",
|
|
119
|
+
"ipaddress": "attributes.ipaddr",
|
|
120
|
+
"port": "443"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
"getDevicesFiltered": [
|
|
125
|
+
{
|
|
126
|
+
"path": "/get/devices",
|
|
127
|
+
"method": "GET",
|
|
128
|
+
"query": {},
|
|
129
|
+
"body": {},
|
|
130
|
+
"headers": {},
|
|
131
|
+
"handleFailure": "ignore",
|
|
132
|
+
"requestFields": {},
|
|
133
|
+
"responseDatakey": "",
|
|
134
|
+
"responseFields": {
|
|
135
|
+
"name": "host",
|
|
136
|
+
"ostype": "os",
|
|
137
|
+
"ostypePrefix": "system-",
|
|
138
|
+
"ipaddress": "attributes.ipaddr",
|
|
139
|
+
"port": "443"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
"isAlive": [
|
|
144
|
+
{
|
|
145
|
+
"path": "/get/devices/{id}/status",
|
|
146
|
+
"method": "GET",
|
|
147
|
+
"query": {},
|
|
148
|
+
"body": {},
|
|
149
|
+
"headers": {},
|
|
150
|
+
"handleFailure": "ignore",
|
|
151
|
+
"requestFields": {
|
|
152
|
+
"id": "name"
|
|
153
|
+
},
|
|
154
|
+
"responseDatakey": "",
|
|
155
|
+
"responseFields": {
|
|
156
|
+
"status": "status",
|
|
157
|
+
"statusValue": "online"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
"getConfig": [
|
|
162
|
+
{
|
|
163
|
+
"path": "/get/devices/{id}/configPart1",
|
|
164
|
+
"method": "GET",
|
|
165
|
+
"query": {},
|
|
166
|
+
"body": {},
|
|
167
|
+
"headers": {},
|
|
168
|
+
"handleFailure": "ignore",
|
|
169
|
+
"requestFields": {
|
|
170
|
+
"id": "name"
|
|
171
|
+
},
|
|
172
|
+
"responseDatakey": "",
|
|
173
|
+
"responseFields": {}
|
|
174
|
+
}
|
|
175
|
+
],
|
|
176
|
+
"getCount": [
|
|
177
|
+
{
|
|
178
|
+
"path": "/get/devices",
|
|
179
|
+
"method": "GET",
|
|
180
|
+
"query": {},
|
|
181
|
+
"body": {},
|
|
182
|
+
"headers": {},
|
|
183
|
+
"handleFailure": "ignore",
|
|
184
|
+
"requestFields": {},
|
|
185
|
+
"responseDatakey": "",
|
|
186
|
+
"responseFields": {}
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"groups": [],
|
|
192
|
+
"brokers": [],
|
|
193
|
+
"logLevel": "none",
|
|
194
|
+
"timeout": 120000
|
|
195
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/* @copyright Itential, LLC 2020 */
|
|
2
|
+
|
|
3
|
+
/* global describe context before after */
|
|
4
|
+
/* eslint global-require: warn */
|
|
5
|
+
/* eslint no-unused-vars: warn */
|
|
6
|
+
/* eslint import/no-extraneous-dependencies: warn */
|
|
7
|
+
/* eslint import/no-dynamic-require: warn */
|
|
8
|
+
/* eslint import/no-unresolved: warn */
|
|
9
|
+
|
|
10
|
+
const mocha = require('mocha');
|
|
11
|
+
const path = require('path');
|
|
12
|
+
const assert = require('assert');
|
|
13
|
+
const itParam = require('mocha-param');
|
|
14
|
+
|
|
15
|
+
const utils = require('../../utils/tbUtils');
|
|
16
|
+
const basicGet = require('../../utils/basicGet');
|
|
17
|
+
const { name } = require('../../package.json');
|
|
18
|
+
const { methods } = require('../../pronghorn.json');
|
|
19
|
+
|
|
20
|
+
const getPronghornProps = (iapDir) => {
|
|
21
|
+
console.log('Retrieving properties.json file...');
|
|
22
|
+
const rawProps = require(path.join(iapDir, 'properties.json'));
|
|
23
|
+
console.log('Decrypting properties...');
|
|
24
|
+
const pronghornProps = utils.decryptProperties(rawProps, iapDir);
|
|
25
|
+
console.log('Found properties.\n');
|
|
26
|
+
return pronghornProps;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
let a;
|
|
30
|
+
|
|
31
|
+
describe('[integration] Adapter BasicGET Test', () => {
|
|
32
|
+
context('Testing GET calls without query parameters', () => {
|
|
33
|
+
before(async () => {
|
|
34
|
+
const iapDir = path.join(__dirname, '../../../../../');
|
|
35
|
+
if (!utils.areWeUnderIAPinstallationDirectory()) {
|
|
36
|
+
const sampleProperties = require('../../sampleProperties.json');
|
|
37
|
+
const adapter = { properties: sampleProperties };
|
|
38
|
+
a = basicGet.getAdapterInstance(adapter);
|
|
39
|
+
} else {
|
|
40
|
+
const pronghornProps = getPronghornProps(iapDir);
|
|
41
|
+
console.log('Connecting to Database...');
|
|
42
|
+
const database = await basicGet.connect(pronghornProps);
|
|
43
|
+
console.log('Connection established.');
|
|
44
|
+
const adapter = await database.collection(utils.SERVICE_CONFIGS_COLLECTION).findOne(
|
|
45
|
+
{ model: name }
|
|
46
|
+
);
|
|
47
|
+
a = basicGet.getAdapterInstance(adapter);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
after((done) => {
|
|
52
|
+
done();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const basicGets = methods.filter((method) => (method.route.verb === 'GET' && method.input.length === 0));
|
|
56
|
+
if (basicGets.length === 0) {
|
|
57
|
+
console.log('No non-parameter GET calls found.');
|
|
58
|
+
process.exit(0);
|
|
59
|
+
}
|
|
60
|
+
const functionNames = basicGets.map((g) => g.name);
|
|
61
|
+
const request = function request(f, ad) {
|
|
62
|
+
return new Promise((resolve, reject) => {
|
|
63
|
+
const getRespCode = (resp) => {
|
|
64
|
+
if (resp) {
|
|
65
|
+
if (resp.metrics.code !== 200) {
|
|
66
|
+
console.log('\x1b[31m', `Testing ${f} \nResponseCode: ${resp.metrics.code}`);
|
|
67
|
+
}
|
|
68
|
+
resolve(resp.metrics.code);
|
|
69
|
+
} else {
|
|
70
|
+
console.log('\x1b[31m', `call ${f} results in failure`);
|
|
71
|
+
reject(new Error(`${f} failed`));
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
ad[f](getRespCode, console.log);
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
itParam('GET call should return 200', functionNames, (fname) => {
|
|
79
|
+
console.log(`\t ${fname}`);
|
|
80
|
+
return request(fname, a).then((result) => assert.equal(result, 200));
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
});
|