Skip to content

Commit 5f0ebc8

Browse files
updated
1 parent a8a468d commit 5f0ebc8

File tree

5 files changed

+78
-81
lines changed

5 files changed

+78
-81
lines changed

EndtoEndTests.sh

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ cleanup_function() {
229229

230230
#---------------------------------------------------------------------------------------------------
231231

232+
233+
232234
printf "\n${COLOR_CYAN}* Projects\n${COLOR_RESET}"
233235
# Project Functions
234236
run_test "node --no-deprecation wmiocli.js -d ${DEV_TENANT} -u ${USER} -p '${PASS}' project" "grep -c CLITestProject" "1" "Project List"
@@ -244,7 +246,6 @@ run_test "node --no-deprecation wmiocli.js -d ${DEV_TENANT} -u ${USER} -p '${PAS
244246

245247
#Import project
246248
run_test "node --no-deprecation wmiocli.js -d ${PROD_TENANT} -u ${USER} -p '${PASS}' project-import project.zip newnameproject" "grep 'IMPORT_SUCCESS' | wc -l" "1" "Import Project"
247-
rm project.zip
248249

249250
#Delete Imported Project
250251
run_test "node --no-deprecation wmiocli.js -d ${PROD_TENANT} -u ${USER} -p '${PASS}' project-delete $projectUid" "grep 'Project deleted successfully' | wc -l" "1" "Delete Imported Project"
@@ -259,6 +260,8 @@ run_test "node --no-deprecation wmiocli.js -d ${DEV_TENANT} -u ${USER} -p '${PAS
259260
#Update Project
260261
run_test "node --no-deprecation wmiocli.js -d ${DEV_TENANT} -u ${USER} -p '${PASS}' project-update $projectUid changed" "grep 'changed' | wc -l" "1" "Update Project Name"
261262

263+
264+
262265
#---------------------------------------------------------------------------------------------------
263266

264267
#Triggers
@@ -274,7 +277,7 @@ run_test "node --no-deprecation wmiocli.js -d ${DEV_TENANT} -u ${USER} -p '${PAS
274277
#Delete Project
275278
run_test "node --no-deprecation wmiocli.js -d ${DEV_TENANT} -u ${USER} -p '${PASS}' project-delete $projectUid" "grep 'Project deleted successfully' | wc -l" "1" "Delete Project"
276279

277-
# ---------------------------------------------------------------------------------------------------
280+
#---------------------------------------------------------------------------------------------------
278281

279282
printf "\n${COLOR_CYAN}* Publish/Deploy${COLOR_RESET}\n"
280283
#Deploy & Publish
@@ -360,7 +363,6 @@ run_test "node --no-deprecation wmiocli.js -d ${DEV_TENANT} -u ${USER} -p '${PAS
360363
#---------------------------------------------------------------------------------------------------
361364

362365
#Workflows
363-
364366
printf "\n${COLOR_CYAN}* Worlkflows${COLOR_RESET}\n"
365367
run_test "node --no-deprecation wmiocli.js -d ${DEV_TENANT} -u ${USER} -p '${PASS}' workflow-export CLITestProject fl835fe9b99489cc5c3dbdc8 wf.zip" "grep 'success' | wc -l" "1" "Export workflow"
366368
run_test_return_value "node --no-deprecation wmiocli.js -d ${DEV_TENANT} -u ${USER} -p '${PASS}' workflow-import CLITestProject wf.zip" "grep uid | wc -l" "1" "jq -r .output.uid" "Import Workflow"
@@ -385,27 +387,19 @@ rm fs.zip
385387

386388
#---------------------------------------------------------------------------------------------------
387389

388-
389-
390390
printf "\n${COLOR_CYAN}* Theme${COLOR_RESET}\n"
391-
run_test "node --no-deprecation wmiocli.js -d ${DEV_TENANT} -u ${USER} -p '${PASS}' theme ${themeId}" "grep 'settings' | wc -l" "1" "List Themes"
392-
393-
394-
node --no-deprecation wmiocli.js -d "${DEV_TENANT}" -u "${USER}" -p "${PASS}" theme > theme.json
395-
themeId=`jq -r '.output[] | select(.name == "ThemeRed") | .uid' theme.json`
396-
themeText=`jq -r '.output[] | select(.name == "ThemeRed")' theme.json`
397-
391+
run_test_return_value "node --no-deprecation wmiocli.js -d ${DEV_TENANT} -u ${USER} -p '${PASS}' theme" \
392+
"grep 'settings' | wc -l" \
393+
"1" \
394+
"jq -r '.output[] | select(.name == \"ThemeRed\") | .uid'" \
395+
"List Themes"
396+
themeId=`echo $result`
398397

399-
#run_test "node --no-deprecation wmiocli.js -d ${DEV_TENANT} -u ${USER} -p '${PASS}' theme ${themeId}" "grep 'settings' | wc -l" "1" "Get Individual Theme"
400398
run_test "node --no-deprecation wmiocli.js -d ${DEV_TENANT} -u ${USER} -p '${PASS}' theme ${themeId}" "grep 'settings' | wc -l" "1" "Get Individual Theme"
401-
402-
403-
#run_test_return_value "node --no-deprecation wmiocli.js -d ${DEV_TENANT} -u ${USER} -p '${PASS}' theme-create TestTheme 'Test Theme3' '$themeText'" "grep primaryColor | wc -l" "1" "jq -r .output.uid" "Theme create"
404-
run_test "node --no-deprecation wmiocli.js -d ${DEV_TENANT} -u ${USER} -p '${PASS}' theme-create TestTheme 'Test Theme3' '$themeText'" "grep primaryColor | wc -l" "1" "Theme create"
405-
node --no-deprecation wmiocli.js -d "${DEV_TENANT}" -u "${USER}" -p "${PASS}" theme > theme.json
406-
themeId=`jq -r '.output[] | select(.name == "TestTheme") | .uid' theme.json`
407-
rm theme.json
408-
399+
run_test_return_value "node --no-deprecation wmiocli.js -d ${DEV_TENANT} -u ${USER} -p '${PASS}' theme ${themeId}" "grep 'settings' | wc -l" "1" "cat" "Get Individual Theme"
400+
themeText=$result
401+
run_test_return_value "node --no-deprecation wmiocli.js -d ${DEV_TENANT} -u ${USER} -p '${PASS}' theme-create TestTheme 'Test Theme3' '$themeText'" "grep primaryColor | wc -l" "1" "jq -r .output.uid" "Theme create"
402+
themeId=`echo $result`
409403
run_test "node --no-deprecation wmiocli.js -d ${DEV_TENANT} -u ${USER} -p '${PASS}' theme-update ${themeId} TestTheme 'Test Theme3' '$themeText'" "grep primaryColor | wc -l" "1" "Theme Update"
410404

411405
run_test "node --no-deprecation wmiocli.js -d ${DEV_TENANT} -u ${USER} -p '${PASS}' theme-activate ${themeId}" "grep '\"active\":true' | wc -l" "1" "Theme activate"

README.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,24 @@ This requires you to provide your tenant domain name, along with a user and pass
44
The --help parameter provides further information on how to use this along with some examples of its usage.
55

66
This CLI tool has been tested against
7-
* webMethods.io Integration v11.0.3
7+
* webMethods.io Integration v11.0.6
88

99
# License
1010
This project is licensed under the Apache 2.0 License - see the LICENSE file for details
1111
These tools are provided as-is and without warranty or support. They do not constitute part of the Software AG product suite. Users are free to use, fork and modify them, subject to the license agreement. While Software AG welcomes contributions, we cannot guarantee to include every contribution in the master project.
1212

1313
Contact us via the TECHcommunity (https://techcommunity.softwareag.com/) if you have any questions.
14-
14+
15+
# IMPORTANT
16+
Due to a deprecated NPM library in a dependency of tough-cookie, if you're using a later version of node, you may see a deprecation notice for 'punycode'.
17+
This has been resolved in tough-cookie but hasn't been released (only a release candidate is available). One this is released, this will be updated to resovle this.
18+
In the meantime if you use this in scripts, you might want to suppress the deprecation notice as it may affect any parsing of results.
19+
20+
To do this run the cli tool as folows:
21+
```
22+
node --no-deprecation wmiocli.js ....
23+
```
24+
1525
# Installation
1626
```
1727
git clone https://github.com/SoftwareAG/webmethods-io-integration-apicli.git
@@ -23,7 +33,7 @@ node wmiocli.js --help
2333
# Usage
2434

2535
```
26-
──────────────────────────────────────────────────────────────────────────────┐
36+
──────────────────────────────────────────────────────────────────────────────┐
2737
│ webMethods.io Integration API CLI tool │
2838
│ This tool provides command line access to the webMethods.io Integration APIs │
2939
│ Intended to aid usage within DevOps Scenarios for asset deployment │
@@ -47,7 +57,7 @@ Options:
4757
--proxy <proxyURL> URL for proxy server if required
4858
--caCert <path-to-cert> Path to a CACert PEM file if required
4959
--ignoreTLSErrors Ignore TLS errors
50-
--experimental Provide help information on experimental commands
60+
--experimentalCommands Provide help information on experimental commands
5161
-h, --help display help for command
5262
5363
Commands:
@@ -169,6 +179,20 @@ $ node wmiocli.js
169179
-p password
170180
project-delete fl65d3aa87fc1783ea5cf8c8
171181
182+
Export Project:
183+
$ node wmiocli.js
184+
-d tenant.int-aws-us.webmethods.io
185+
-u user
186+
-p password
187+
project-export fl65d3aa87fc1783ea5cf8c8 myproject.zip
188+
189+
Import Project:
190+
$ node wmiocli.js
191+
-d tenant.int-aws-us.webmethods.io
192+
-u user
193+
-p password
194+
project-export myproject.zip MyNewProjectName
195+
172196
Get Project Assets:
173197
$ node wmiocli.js
174198
-d tenant.int-aws-us.webmethods.io
@@ -589,5 +613,4 @@ $ node wmiocli.js
589613
-p password
590614
idm-user-unlock <userid>
591615
where userid is the unique ID returned from the idm-user call
592-
593616
```

package-lock.json

Lines changed: 25 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
},
2525
"homepage": "https://github.com/dpembo/wmiocli#readme",
2626
"devDependencies": {
27-
"commander": "^12.1.0"
27+
"commander": "^8.3.0"
2828
},
2929
"dependencies": {
3030
"formdata-node": "^6.0.3",
31-
"https-proxy-agent": "^7.0.5",
31+
"https-proxy-agent": "^7.0.4",
3232
"log4js": "^6.9.1",
3333
"node-fetch": "^3.3.2",
3434
"readline-sync": "^1.4.10",

wmiocli.js

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Apache-2.0
55
*/
66

7-
const versionNo = "2024.11.0"
7+
const versionNo = "2024.8.0"
88
const { Command, Option } = require('commander');
99
const { exit } = require('process');
1010
const readline = require('readline-sync');
@@ -423,20 +423,14 @@ program.command('project-triggers-delete <project-id> <trigger-id>')
423423
project.deleteRefData(projectId,refDataName);
424424
});
425425

426-
program.command('project-export <project-id> [filename]')
427-
.description('Exports a project')
428-
.action((projectId,filename) => {
429-
checkOptions();
430-
project.init(tenantDomain, tenantUser, tenantPw, program.opts().timeout, program.opts().prettyprint)
431-
project.exportProj(projectId,filename);
432-
});
433426

434-
program.command('project-import <filename> [new-project-name]')
427+
428+
program.command('project-export <project-id>')
435429
.description('Exports a project')
436-
.action((filename,newProjectName) => {
430+
.action((projectId) => {
437431
checkOptions();
438432
project.init(tenantDomain, tenantUser, tenantPw, program.opts().timeout, program.opts().prettyprint)
439-
project.importProj(filename,newProjectName);
433+
project.exportProj(projectId);
440434
});
441435

442436
/**
@@ -759,13 +753,13 @@ program.command('idm-roles')
759753
idm.allRoles();
760754
});
761755

762-
program.command('idm-user-create <first-name> <last-name> <email> <username> [password]')
756+
program.command('idm-user-create <first-name> <last-name> <email> <username>')
763757
.description('Creates a new user in the IDM')
764-
.action(async (firstName,lastName,email,username,password) => {
758+
.action(async (firstName,lastName,email,username) => {
765759
checkOptions();
766760
try {
767761
await idm.init(tenantDomain, tenantUser, tenantPw, program.opts().timeout, program.opts().prettyprint);
768-
idm.createUser(firstName, lastName, email, username,password);
762+
idm.createUser(firstName, lastName, email, username);
769763
}
770764
catch (error) {
771765
console.error("Error:", error);
@@ -811,20 +805,6 @@ program.command('idm-user-unlock <user-id>')
811805
}
812806
});
813807

814-
program.command('idm-user-reset-password <user-id> <new-password>')
815-
.description('Unlocks a user')
816-
.action(async (userId,newPassword) => {
817-
checkOptions();
818-
try {
819-
await idm.init(tenantDomain, tenantUser, tenantPw, program.opts().timeout, program.opts().prettyprint);
820-
idm.resetPassword(userId,newPassword);
821-
}
822-
catch (error) {
823-
console.error("Error:", error);
824-
}
825-
});
826-
827-
828808

829809
/**
830810
* ------------------------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)