@itentialopensource/adapter-jira 1.7.2 → 1.7.5

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.
Files changed (189) hide show
  1. package/.eslintignore +1 -0
  2. package/AUTH.md +39 -0
  3. package/BROKER.md +199 -0
  4. package/CALLS.md +7365 -0
  5. package/CHANGELOG.md +24 -0
  6. package/CODE_OF_CONDUCT.md +12 -17
  7. package/CONTRIBUTING.md +88 -74
  8. package/ENHANCE.md +69 -0
  9. package/PROPERTIES.md +641 -0
  10. package/README.md +228 -420
  11. package/SUMMARY.md +9 -0
  12. package/SYSTEMINFO.md +11 -0
  13. package/TROUBLESHOOT.md +47 -0
  14. package/adapter.js +18753 -4899
  15. package/adapterBase.js +1274 -236
  16. package/entities/.generic/action.json +214 -0
  17. package/entities/.generic/schema.json +28 -0
  18. package/entities/Avatars/action.json +63 -0
  19. package/entities/Avatars/schema.json +4 -1
  20. package/entities/Dashboards/action.json +80 -0
  21. package/entities/Dashboards/mockdatafiles/copyDashboard-default.json +13 -0
  22. package/entities/Dashboards/mockdatafiles/createDashboard-default.json +13 -0
  23. package/entities/Dashboards/mockdatafiles/updateDashboard-default.json +13 -0
  24. package/entities/Dashboards/schema.json +5 -1
  25. package/entities/Groups/action.json +21 -0
  26. package/entities/Groups/mockdatafiles/bulkGetGroups-default.json +16 -0
  27. package/entities/Groups/schema.json +2 -1
  28. package/entities/InstanceInformation/action.json +25 -0
  29. package/entities/InstanceInformation/mockdatafiles/getLicense-default.json +20 -0
  30. package/entities/InstanceInformation/schema.json +19 -0
  31. package/entities/IssueCustomFieldConfigurationApps/action.json +45 -0
  32. package/entities/IssueCustomFieldConfigurationApps/mockdatafiles/getCustomFieldConfiguration-default.json +34 -0
  33. package/entities/IssueCustomFieldConfigurationApps/schema.json +20 -0
  34. package/entities/IssueCustomFieldContexts/action.json +268 -0
  35. package/entities/IssueCustomFieldContexts/mockdatafiles/createCustomFieldContext-default.json +9 -0
  36. package/entities/IssueCustomFieldContexts/mockdatafiles/getContextsForField-default.json +22 -0
  37. package/entities/IssueCustomFieldContexts/mockdatafiles/getCustomFieldContextsForProjectsAndIssueTypes-default.json +23 -0
  38. package/entities/IssueCustomFieldContexts/mockdatafiles/getDefaultValues-default.json +22 -0
  39. package/entities/IssueCustomFieldContexts/mockdatafiles/getIssueTypeMappingsForContexts-default.json +20 -0
  40. package/entities/IssueCustomFieldContexts/mockdatafiles/getProjectContextMapping-default.json +16 -0
  41. package/entities/IssueCustomFieldContexts/schema.json +31 -0
  42. package/entities/IssueCustomFieldOptions/action.json +105 -0
  43. package/entities/IssueCustomFieldOptions/mockdatafiles/createCustomFieldOption-default.json +20 -0
  44. package/entities/IssueCustomFieldOptions/mockdatafiles/getOptionsForContext-default.json +26 -0
  45. package/entities/IssueCustomFieldOptions/mockdatafiles/updateCustomFieldOption-default.json +19 -0
  46. package/entities/IssueCustomFieldOptions/schema.json +23 -0
  47. package/entities/IssueCustomFieldValuesApps/action.json +44 -0
  48. package/entities/IssueCustomFieldValuesApps/schema.json +20 -0
  49. package/entities/IssueFieldConfigurations/action.json +309 -0
  50. package/entities/IssueFieldConfigurations/mockdatafiles/createFieldConfiguration-default.json +5 -0
  51. package/entities/IssueFieldConfigurations/mockdatafiles/createFieldConfigurationScheme-default.json +5 -0
  52. package/entities/IssueFieldConfigurations/mockdatafiles/getAllFieldConfigurationSchemes-default.json +23 -0
  53. package/entities/IssueFieldConfigurations/mockdatafiles/getAllFieldConfigurations-default.json +19 -0
  54. package/entities/IssueFieldConfigurations/mockdatafiles/getFieldConfigurationItems-default.json +19 -0
  55. package/entities/IssueFieldConfigurations/mockdatafiles/getFieldConfigurationSchemeMappings-default.json +33 -0
  56. package/entities/IssueFieldConfigurations/mockdatafiles/getFieldConfigurationSchemeProjectMapping-default.json +26 -0
  57. package/entities/IssueFieldConfigurations/schema.json +33 -0
  58. package/entities/IssueTypeSchemes/action.json +207 -0
  59. package/entities/IssueTypeSchemes/mockdatafiles/createIssueTypeScheme-default.json +3 -0
  60. package/entities/IssueTypeSchemes/mockdatafiles/getAllIssueTypeSchemes-default.json +26 -0
  61. package/entities/IssueTypeSchemes/mockdatafiles/getIssueTypeSchemeForProjects-default.json +44 -0
  62. package/entities/IssueTypeSchemes/mockdatafiles/getIssueTypeSchemesMapping-default.json +24 -0
  63. package/entities/IssueTypeSchemes/schema.json +28 -0
  64. package/entities/IssueTypeScreenSchemes/action.json +228 -0
  65. package/entities/IssueTypeScreenSchemes/mockdatafiles/createIssueTypeScreenScheme-default.json +3 -0
  66. package/entities/IssueTypeScreenSchemes/mockdatafiles/getIssueTypeScreenSchemeMappings-default.json +28 -0
  67. package/entities/IssueTypeScreenSchemes/mockdatafiles/getIssueTypeScreenSchemeProjectAssociations-default.json +19 -0
  68. package/entities/IssueTypeScreenSchemes/mockdatafiles/getIssueTypeScreenSchemes-default.json +18 -0
  69. package/entities/IssueTypeScreenSchemes/mockdatafiles/getProjectsForIssueTypeScreenScheme-default.json +27 -0
  70. package/entities/IssueTypeScreenSchemes/schema.json +29 -0
  71. package/entities/Issueattachments/action.json +42 -0
  72. package/entities/Issueattachments/schema.json +3 -1
  73. package/entities/Issuefields/action.json +122 -0
  74. package/entities/Issuefields/mockdatafiles/getContextsForFieldDeprecated-default.json +12 -0
  75. package/entities/Issuefields/mockdatafiles/getFieldsPaginated-default.json +46 -0
  76. package/entities/Issuefields/schema.json +7 -1
  77. package/entities/Issueproperties/action.json +40 -0
  78. package/entities/Issueproperties/schema.json +3 -1
  79. package/entities/Issues/action.json +45 -0
  80. package/entities/Issues/mockdatafiles/getChangeLogsByIds-default.json +65 -0
  81. package/entities/Issues/mockdatafiles/getEvents-default.json +10 -0
  82. package/entities/Issues/schema.json +20 -0
  83. package/entities/Issuesearch/action.json +20 -0
  84. package/entities/Issuesearch/mockdatafiles/matchIssues-default.json +29 -0
  85. package/entities/Issuesearch/schema.json +2 -1
  86. package/entities/Issuesecuritylevel/action.json +21 -0
  87. package/entities/Issuesecuritylevel/mockdatafiles/getIssueSecurityLevelMembers-default.json +46 -0
  88. package/entities/Issuesecuritylevel/schema.json +2 -1
  89. package/entities/Issuetypes/action.json +21 -0
  90. package/entities/Issuetypes/mockdatafiles/getIssueTypesForProject-default.json +39 -0
  91. package/entities/Issuetypes/schema.json +2 -1
  92. package/entities/Issuewatchers/action.json +20 -0
  93. package/entities/Issuewatchers/mockdatafiles/getIsWatchingIssueBulk-default.json +7 -0
  94. package/entities/Issuewatchers/schema.json +2 -1
  95. package/entities/JQL/action.json +40 -0
  96. package/entities/JQL/mockdatafiles/getAutoCompletePost-default.json +89 -0
  97. package/entities/JQL/mockdatafiles/parseJqlQueries-default.json +119 -0
  98. package/entities/JQL/schema.json +3 -1
  99. package/entities/Jiraexpressions/action.json +20 -0
  100. package/entities/Jiraexpressions/mockdatafiles/analyseExpression-default.json +47 -0
  101. package/entities/Jiraexpressions/schema.json +2 -1
  102. package/entities/Labels/action.json +25 -0
  103. package/entities/Labels/mockdatafiles/getAllLabels-default.json +10 -0
  104. package/entities/Labels/schema.json +19 -0
  105. package/entities/ProjectEmail/action.json +45 -0
  106. package/entities/ProjectEmail/mockdatafiles/getProjectEmail-default.json +6 -0
  107. package/entities/ProjectEmail/schema.json +20 -0
  108. package/entities/ProjectFeatures/action.json +45 -0
  109. package/entities/ProjectFeatures/mockdatafiles/getFeaturesForProject-default.json +24 -0
  110. package/entities/ProjectFeatures/mockdatafiles/toggleFeatureForProject-default.json +24 -0
  111. package/entities/ProjectFeatures/schema.json +20 -0
  112. package/entities/Projects/action.json +102 -0
  113. package/entities/Projects/mockdatafiles/getHierarchy-default.json +50 -0
  114. package/entities/Projects/mockdatafiles/getRecent-default.json +50 -0
  115. package/entities/Projects/mockdatafiles/restore-default.json +139 -0
  116. package/entities/Projects/schema.json +6 -1
  117. package/entities/Projecttypes/action.json +21 -0
  118. package/entities/Projecttypes/mockdatafiles/getAllAccessibleProjectTypes-default.json +16 -0
  119. package/entities/Projecttypes/schema.json +2 -1
  120. package/entities/ScreenSchemes/action.json +85 -0
  121. package/entities/ScreenSchemes/mockdatafiles/createScreenScheme-default.json +3 -0
  122. package/entities/ScreenSchemes/mockdatafiles/getScreenSchemes-default.json +28 -0
  123. package/entities/ScreenSchemes/schema.json +22 -0
  124. package/entities/Screens/action.json +81 -0
  125. package/entities/Screens/mockdatafiles/createScreen-default.json +5 -0
  126. package/entities/Screens/mockdatafiles/getScreensForField-default.json +17 -0
  127. package/entities/Screens/mockdatafiles/updateScreen-default.json +5 -0
  128. package/entities/Screens/schema.json +5 -1
  129. package/entities/Users/action.json +84 -0
  130. package/entities/Users/mockdatafiles/getAllUsers-default.json +32 -0
  131. package/entities/Users/mockdatafiles/getAllUsersDefault-default.json +32 -0
  132. package/entities/Users/mockdatafiles/getUserEmail-default.json +1 -0
  133. package/entities/Users/schema.json +5 -1
  134. package/entities/Webhooks/action.json +106 -0
  135. package/entities/Webhooks/mockdatafiles/getDynamicWebhooksForApp-default.json +40 -0
  136. package/entities/Webhooks/mockdatafiles/getFailedWebhooks-default.json +17 -0
  137. package/entities/Webhooks/mockdatafiles/refreshWebhooks-default.json +3 -0
  138. package/entities/Webhooks/mockdatafiles/registerDynamicWebhooks-default.json +15 -0
  139. package/entities/Webhooks/schema.json +23 -0
  140. package/entities/WorkflowSchemeProjectAssociations/action.json +45 -0
  141. package/entities/WorkflowSchemeProjectAssociations/mockdatafiles/getWorkflowSchemeProjectAssociations-default.json +21 -0
  142. package/entities/WorkflowSchemeProjectAssociations/schema.json +20 -0
  143. package/entities/WorkflowTransitionRules/action.json +65 -0
  144. package/entities/WorkflowTransitionRules/mockdatafiles/deleteWorkflowTransitionRuleConfigurations-default.json +34 -0
  145. package/entities/WorkflowTransitionRules/mockdatafiles/getWorkflowTransitionRuleConfigurations-default.json +56 -0
  146. package/entities/WorkflowTransitionRules/mockdatafiles/updateWorkflowTransitionRuleConfigurations-default.json +34 -0
  147. package/entities/WorkflowTransitionRules/schema.json +21 -0
  148. package/entities/Workflows/action.json +61 -0
  149. package/entities/Workflows/mockdatafiles/createWorkflow-default.json +4 -0
  150. package/entities/Workflows/mockdatafiles/getWorkflowsPaginated-default.json +140 -0
  151. package/entities/Workflows/schema.json +4 -1
  152. package/entities/Workflowschemedrafts/action.json +20 -0
  153. package/entities/Workflowschemedrafts/schema.json +2 -1
  154. package/entities/Workflowschemes/action.json +21 -0
  155. package/entities/Workflowschemes/mockdatafiles/getAllWorkflowSchemes-default.json +30 -0
  156. package/entities/Workflowschemes/schema.json +2 -1
  157. package/error.json +12 -0
  158. package/package.json +42 -18
  159. package/pronghorn.json +27769 -74
  160. package/propertiesDecorators.json +14 -0
  161. package/propertiesSchema.json +472 -4
  162. package/refs?service=git-upload-pack +0 -0
  163. package/report/adapterInfo.json +10 -0
  164. package/report/updateReport1615159462702.json +95 -0
  165. package/report/updateReport1659707107792.json +120 -0
  166. package/sampleProperties.json +103 -6
  167. package/test/integration/adapterTestBasicGet.js +85 -0
  168. package/test/integration/adapterTestConnectivity.js +93 -0
  169. package/test/integration/adapterTestIntegration.js +3633 -101
  170. package/test/unit/adapterBaseTestUnit.js +949 -0
  171. package/test/unit/adapterTestUnit.js +4766 -109
  172. package/utils/adapterInfo.js +206 -0
  173. package/utils/addAuth.js +94 -0
  174. package/utils/basicGet.js +50 -0
  175. package/utils/checkMigrate.js +63 -0
  176. package/utils/entitiesToDB.js +179 -0
  177. package/utils/findPath.js +74 -0
  178. package/utils/methodDocumentor.js +225 -0
  179. package/utils/modify.js +154 -0
  180. package/utils/packModificationScript.js +1 -1
  181. package/utils/patches2bundledDeps.js +90 -0
  182. package/utils/pre-commit.sh +5 -0
  183. package/utils/removeHooks.js +20 -0
  184. package/utils/tbScript.js +184 -0
  185. package/utils/tbUtils.js +469 -0
  186. package/utils/testRunner.js +16 -16
  187. package/utils/troubleshootingAdapter.js +190 -0
  188. package/versions.json +142 -0
  189. package/img/adapter.png +0 -0
@@ -0,0 +1,120 @@
1
+ {
2
+ "errors": [],
3
+ "statistics": [
4
+ {
5
+ "owner": "errorJson",
6
+ "description": "New adapter errors available for use",
7
+ "value": 2
8
+ },
9
+ {
10
+ "owner": "errorJson",
11
+ "description": "Adapter errors no longer available for use",
12
+ "value": 0
13
+ },
14
+ {
15
+ "owner": "errorJson",
16
+ "description": "Adapter errors that have been updated (e.g. recommendation changes)",
17
+ "value": 29
18
+ },
19
+ {
20
+ "owner": "packageJson",
21
+ "description": "Number of production dependencies",
22
+ "value": 14
23
+ },
24
+ {
25
+ "owner": "packageJson",
26
+ "description": "Number of development dependencies",
27
+ "value": 7
28
+ },
29
+ {
30
+ "owner": "packageJson",
31
+ "description": "Number of npm scripts",
32
+ "value": 22
33
+ },
34
+ {
35
+ "owner": "packageJson",
36
+ "description": "Runtime Library dependency",
37
+ "value": "^4.45.6"
38
+ },
39
+ {
40
+ "owner": "propertiesSchemaJson",
41
+ "description": "Adapter properties defined in the propertiesSchema file",
42
+ "value": 70
43
+ },
44
+ {
45
+ "owner": "markdown",
46
+ "description": "Number of lines in the README.md",
47
+ "value": 338
48
+ },
49
+ {
50
+ "owner": "markdown",
51
+ "description": "Number of lines in the SUMMARY.md",
52
+ "value": 9
53
+ },
54
+ {
55
+ "owner": "markdown",
56
+ "description": "Number of lines in the PROPERTIES.md",
57
+ "value": 642
58
+ },
59
+ {
60
+ "owner": "markdown",
61
+ "description": "Number of lines in the TROUBLESHOOT.md",
62
+ "value": 48
63
+ },
64
+ {
65
+ "owner": "markdown",
66
+ "description": "Number of lines in the ENHANCE.md",
67
+ "value": 70
68
+ },
69
+ {
70
+ "owner": "markdown",
71
+ "description": "Number of lines in the BROKER.md",
72
+ "value": 70
73
+ },
74
+ {
75
+ "owner": "unitTestJS",
76
+ "description": "Number of lines of code in unit tests",
77
+ "value": 16041
78
+ },
79
+ {
80
+ "owner": "unitTestJS",
81
+ "description": "Number of unit tests",
82
+ "value": 1007
83
+ },
84
+ {
85
+ "owner": "integrationTestJS",
86
+ "description": "Number of lines of code in integration tests",
87
+ "value": 15682
88
+ },
89
+ {
90
+ "owner": "integrationTestJS",
91
+ "description": "Number of integration tests",
92
+ "value": 444
93
+ },
94
+ {
95
+ "owner": "staticFile",
96
+ "description": "Number of lines of code in adapterBase.js",
97
+ "value": 1789
98
+ },
99
+ {
100
+ "owner": "staticFile",
101
+ "description": "Number of static files added",
102
+ "value": 36
103
+ },
104
+ {
105
+ "owner": "Overall",
106
+ "description": "Total lines of Code",
107
+ "value": 33512
108
+ },
109
+ {
110
+ "owner": "Overall",
111
+ "description": "Total Tests",
112
+ "value": 1451
113
+ },
114
+ {
115
+ "owner": "Overall",
116
+ "description": "Total Files",
117
+ "value": 6
118
+ }
119
+ ]
120
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
- "id": "Jira",
2
+ "id": "jira",
3
3
  "type": "Jira",
4
4
  "properties": {
5
5
  "host": "your_host.atlassian.net",
@@ -8,7 +8,8 @@
8
8
  "version": "2",
9
9
  "cache_location": "none",
10
10
  "encode_pathvars": true,
11
- "save_metric": true,
11
+ "encode_queryvars": true,
12
+ "save_metric": false,
12
13
  "stub": true,
13
14
  "protocol": "https",
14
15
  "authentication": {
@@ -20,11 +21,16 @@
20
21
  "token_cache": "local",
21
22
  "invalid_token_error": 401,
22
23
  "auth_field": "header.headers.Authorization",
23
- "auth_field_format": "Basic {b64}{username}:{password}{/b64}"
24
+ "auth_field_format": "Basic {b64}{username}:{password}{/b64}",
25
+ "auth_logging": false,
26
+ "client_id": "",
27
+ "client_secret": "",
28
+ "grant_type": ""
24
29
  },
25
30
  "healthcheck": {
26
31
  "type": "intermittent",
27
- "frequency": 60000
32
+ "frequency": 60000,
33
+ "query_object": {}
28
34
  },
29
35
  "throttle": {
30
36
  "throttle_enabled": false,
@@ -55,13 +61,16 @@
55
61
  },
56
62
  "healthcheck_on_timeout": true,
57
63
  "return_raw": false,
58
- "archiving": false
64
+ "archiving": false,
65
+ "return_request": false
59
66
  },
60
67
  "proxy": {
61
68
  "enabled": false,
62
69
  "host": "",
63
70
  "port": 1,
64
- "protocol": "http"
71
+ "protocol": "http",
72
+ "username": "",
73
+ "password": ""
65
74
  },
66
75
  "ssl": {
67
76
  "ecdhCurve": "",
@@ -87,6 +96,94 @@
87
96
  "key_file": "",
88
97
  "cert_file": ""
89
98
  }
99
+ },
100
+ "devicebroker": {
101
+ "getDevice": [
102
+ {
103
+ "path": "/get/devices/{id}",
104
+ "method": "GET",
105
+ "query": {},
106
+ "body": {},
107
+ "headers": {},
108
+ "handleFailure": "ignore",
109
+ "requestFields": {
110
+ "id": "name"
111
+ },
112
+ "responseDatakey": "",
113
+ "responseFields": {
114
+ "name": "host",
115
+ "ostype": "os",
116
+ "ostypePrefix": "system-",
117
+ "ipaddress": "attributes.ipaddr",
118
+ "port": "443"
119
+ }
120
+ }
121
+ ],
122
+ "getDevicesFiltered": [
123
+ {
124
+ "path": "/get/devices",
125
+ "method": "GET",
126
+ "query": {},
127
+ "body": {},
128
+ "headers": {},
129
+ "handleFailure": "ignore",
130
+ "requestFields": {},
131
+ "responseDatakey": "",
132
+ "responseFields": {
133
+ "name": "host",
134
+ "ostype": "os",
135
+ "ostypePrefix": "system-",
136
+ "ipaddress": "attributes.ipaddr",
137
+ "port": "443"
138
+ }
139
+ }
140
+ ],
141
+ "isAlive": [
142
+ {
143
+ "path": "/get/devices/{id}/status",
144
+ "method": "GET",
145
+ "query": {},
146
+ "body": {},
147
+ "headers": {},
148
+ "handleFailure": "ignore",
149
+ "requestFields": {
150
+ "id": "name"
151
+ },
152
+ "responseDatakey": "",
153
+ "responseFields": {
154
+ "status": "status",
155
+ "statusValue": "online"
156
+ }
157
+ }
158
+ ],
159
+ "getConfig": [
160
+ {
161
+ "path": "/get/devices/{id}/configPart1",
162
+ "method": "GET",
163
+ "query": {},
164
+ "body": {},
165
+ "headers": {},
166
+ "handleFailure": "ignore",
167
+ "requestFields": {
168
+ "id": "name"
169
+ },
170
+ "responseDatakey": "",
171
+ "responseFields": {}
172
+ }
173
+ ],
174
+ "getCount": [
175
+ {
176
+ "path": "/get/devices",
177
+ "method": "GET",
178
+ "query": {},
179
+ "body": {},
180
+ "headers": {},
181
+ "handleFailure": "ignore",
182
+ "requestFields": {},
183
+ "responseDatakey": "",
184
+ "responseFields": {}
185
+ }
186
+ ]
90
187
  }
91
188
  },
92
189
  "groups": [],
@@ -0,0 +1,85 @@
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
+ const { Discovery } = require('@itential/itential-utils');
22
+ console.log('Retrieving properties.json file...');
23
+ const rawProps = require(path.join(iapDir, 'properties.json'));
24
+ console.log('Decrypting properties...');
25
+ const discovery = new Discovery();
26
+ const pronghornProps = utils.decryptProperties(rawProps, path.join(__dirname, '..'), discovery);
27
+ console.log('Found properties.\n');
28
+ return pronghornProps;
29
+ };
30
+
31
+ let a;
32
+
33
+ describe('[integration] Adapter BasicGET Test', () => {
34
+ context('Testing GET calls without query parameters', () => {
35
+ before(async () => {
36
+ const iapDir = path.join(__dirname, '../../../../../');
37
+ if (!utils.areWeUnderIAPinstallationDirectory()) {
38
+ const sampleProperties = require('../../sampleProperties.json');
39
+ const adapter = { properties: sampleProperties };
40
+ a = basicGet.getAdapterInstance(adapter);
41
+ } else {
42
+ const pronghornProps = getPronghornProps(iapDir);
43
+ console.log('Connecting to Database...');
44
+ const database = await basicGet.connect(pronghornProps);
45
+ console.log('Connection established.');
46
+ const adapter = await database.collection(utils.SERVICE_CONFIGS_COLLECTION).findOne(
47
+ { model: name }
48
+ );
49
+ a = basicGet.getAdapterInstance(adapter);
50
+ }
51
+ });
52
+
53
+ after((done) => {
54
+ done();
55
+ });
56
+
57
+ const basicGets = methods.filter((method) => (method.route.verb === 'GET' && method.input.length === 0));
58
+ if (basicGets.length === 0) {
59
+ console.log('No non-parameter GET calls found.');
60
+ process.exit(0);
61
+ }
62
+ const functionNames = basicGets.map((g) => g.name);
63
+ const request = function request(f, ad) {
64
+ return new Promise((resolve, reject) => {
65
+ const getRespCode = (resp) => {
66
+ if (resp) {
67
+ if (resp.metrics.code !== 200) {
68
+ console.log('\x1b[31m', `Testing ${f} \nResponseCode: ${resp.metrics.code}`);
69
+ }
70
+ resolve(resp.metrics.code);
71
+ } else {
72
+ console.log('\x1b[31m', `call ${f} results in failure`);
73
+ reject(new Error(`${f} failed`));
74
+ }
75
+ };
76
+ ad[f](getRespCode, console.log);
77
+ });
78
+ };
79
+
80
+ itParam('GET call should return 200', functionNames, (fname) => {
81
+ console.log(`\t ${fname}`);
82
+ return request(fname, a).then((result) => assert.equal(result, 200));
83
+ });
84
+ });
85
+ });
@@ -0,0 +1,93 @@
1
+ /* @copyright Itential, LLC 2020 */
2
+
3
+ /* global describe it context before after */
4
+ /* eslint no-unused-vars: warn */
5
+
6
+ const mocha = require('mocha');
7
+ const assert = require('assert');
8
+ const diagnostics = require('network-diagnostics');
9
+
10
+ let host;
11
+ process.argv.forEach((val) => {
12
+ if (val.indexOf('--HOST') === 0) {
13
+ [, host] = val.split('=');
14
+ }
15
+ });
16
+
17
+ describe('[integration] Adapter Test', () => {
18
+ context(`Testing network connection on ${host}`, () => {
19
+ before(() => {
20
+ diagnostics.setTestURL(host);
21
+ });
22
+
23
+ after((done) => {
24
+ done();
25
+ });
26
+
27
+ it('DNS resolve', (done) => {
28
+ diagnostics.haveDNS((result) => {
29
+ try {
30
+ assert.equal(result, true);
31
+ done();
32
+ } catch (error) {
33
+ done(error);
34
+ }
35
+ });
36
+ });
37
+
38
+ it('Responds to ping', (done) => {
39
+ diagnostics.havePing((result) => {
40
+ try {
41
+ assert.equal(result, true);
42
+ done();
43
+ } catch (error) {
44
+ done(error);
45
+ }
46
+ });
47
+ });
48
+
49
+ it('Support HTTP on port 80', (done) => {
50
+ diagnostics.haveHTTP((result) => {
51
+ try {
52
+ assert.equal(result, true);
53
+ done();
54
+ } catch (error) {
55
+ done(error);
56
+ }
57
+ });
58
+ });
59
+
60
+ it('Support HTTPS on port 443', (done) => {
61
+ diagnostics.haveHTTPS((result) => {
62
+ try {
63
+ assert.equal(result, true);
64
+ done();
65
+ } catch (error) {
66
+ done(error);
67
+ }
68
+ });
69
+ });
70
+
71
+ it('Support IPv4', (done) => {
72
+ diagnostics.haveIPv4Async((result) => {
73
+ try {
74
+ assert.equal(result, true);
75
+ done();
76
+ } catch (error) {
77
+ done(error);
78
+ }
79
+ });
80
+ });
81
+
82
+ it('Support IPv6', (done) => {
83
+ diagnostics.haveIPv6Async((result) => {
84
+ try {
85
+ assert.equal(result, true);
86
+ done();
87
+ } catch (error) {
88
+ done(error);
89
+ }
90
+ });
91
+ });
92
+ });
93
+ });