-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae85c60
commit 4febbd3
Showing
5 changed files
with
251 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Tests | ||
|
||
The tests contained in this folder are written in Hurl (see [docs](https://hurl.dev/docs/manual.html)). | ||
|
||
Install Hurl with instructions as per the documentation. | ||
|
||
Configure the Rest API: | ||
|
||
* Enable it | ||
* Set auth for shared key, and set the value in test.env | ||
* Set `adminConsole.access.allow-wildcards-in-excludes` to true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<jive> | ||
<plugin> | ||
<restapi> | ||
<enabled>true</enabled> | ||
<httpAuth>secret</httpAuth> | ||
<secret>potato</secret> | ||
</restapi> | ||
</plugin> | ||
<adminConsole> | ||
<access> | ||
<allow-wildcards-in-excludes>true</allow-wildcards-in-excludes> | ||
</access> | ||
<port>9090</port> | ||
<securePort>9091</securePort> | ||
</adminConsole> | ||
<connectionProvider> | ||
<className>org.jivesoftware.database.EmbeddedConnectionProvider</className> | ||
</connectionProvider> | ||
<autosetup> | ||
<run>true</run> | ||
<locale>en</locale> | ||
<xmpp> | ||
<auth> | ||
<anonymous>true</anonymous> | ||
</auth> | ||
<domain>example.org</domain> | ||
<fqdn>example.org</fqdn> | ||
</xmpp> | ||
<database> | ||
<mode>embedded</mode> | ||
</database> | ||
<admin> | ||
<email>[email protected]</email> | ||
<password>admin</password> | ||
</admin> | ||
<users> | ||
<user1> | ||
<username>john</username> | ||
<password>secret</password> | ||
<name>John Doe</name> | ||
<email>[email protected]</email> | ||
<roster> | ||
<item1> | ||
<jid>[email protected]</jid> | ||
<nickname>Jane</nickname> | ||
</item1> | ||
</roster> | ||
</user1> | ||
<user2> | ||
<username>jane</username> | ||
<password>secret</password> | ||
<name>Jane Doe</name> | ||
<email>[email protected]</email> | ||
<roster> | ||
<item1> | ||
<jid>[email protected]</jid> | ||
<nickname>John</nickname> | ||
</item1> | ||
</roster> | ||
</user2> | ||
</users> | ||
</autosetup> | ||
</jive> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
### CLUSTERING ### | ||
|
||
GET {{host}}/plugins/restapi/v1/clustering/status | ||
Authorization: {{authkey}} | ||
HTTP 200 | ||
[Asserts] | ||
xpath "string(/clustering/status)" == "Disabled" | ||
|
||
GET {{host}}/plugins/restapi/v1/clustering/nodes | ||
Authorization: {{authkey}} | ||
HTTP 200 | ||
[Asserts] | ||
xpath "/clusterNodes[not(child::node())]" exists | ||
|
||
|
||
### USER GROUPS ### | ||
|
||
GET http://localhost:9090/plugins/restapi/v1/groups | ||
Authorization: {{authkey}} | ||
HTTP 200 | ||
[Asserts] | ||
xpath "/groups[not(child::node())]" exists # groups at the root, with no child nodes | ||
|
||
POST http://localhost:9090/plugins/restapi/v1/groups | ||
Authorization: {{authkey}} | ||
Content-Type: application/xml | ||
``` | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<group> | ||
<name>group1</name> | ||
<description>test-group</description> | ||
<shared>false</shared> | ||
<admins> | ||
<admin>jane</admin> | ||
</admins> | ||
<members> | ||
<member>john</member> | ||
</members> | ||
</group> | ||
``` | ||
HTTP 201 | ||
|
||
GET http://localhost:9090/plugins/restapi/v1/groups # check if the group was created | ||
Authorization: {{authkey}} | ||
HTTP 200 | ||
[Asserts] | ||
xpath "/groups/group[name='group1']" exists | ||
|
||
GET http://localhost:9090/plugins/restapi/v1/groups/group1 | ||
Authorization: {{authkey}} | ||
HTTP 200 | ||
[Asserts] | ||
xpath "/group[name='group1']" exists | ||
xpath "string(/group/description)" == "test-group" | ||
|
||
PUT http://localhost:9090/plugins/restapi/v1/groups/group1 | ||
Authorization: {{authkey}} | ||
Content-Type: application/xml | ||
``` | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<group> | ||
<name>group1</name> | ||
<description>test-group-updated</description> | ||
<shared>false</shared> | ||
<admins> | ||
<admin>jane</admin> | ||
</admins> | ||
<members> | ||
<member>john</member> | ||
</members> | ||
</group> | ||
``` | ||
HTTP 200 | ||
|
||
GET http://localhost:9090/plugins/restapi/v1/groups/group1 | ||
Authorization: {{authkey}} | ||
HTTP 200 | ||
[Asserts] | ||
xpath "/group[name='group1']" exists | ||
xpath "string(/group/description)" == "test-group-updated" | ||
|
||
DELETE http://localhost:9090/plugins/restapi/v1/groups/group1 | ||
Authorization: {{authkey}} | ||
HTTP 200 | ||
|
||
|
||
### CHAT ROOMS ### | ||
GET http://localhost:9090/plugins/restapi/v1/chatrooms | ||
Authorization: {{authkey}} | ||
HTTP 200 | ||
|
||
GET http://localhost:9090/plugins/restapi/v1/sessions | ||
Authorization: {{authkey}} | ||
HTTP 200 | ||
[Asserts] | ||
xpath "/sessions[not(child::node())]" count == 1 # sessions at the root, with no child nodes | ||
|
||
|
||
GET http://localhost:9090/plugins/restapi/v1/system/readiness/server | ||
Authorization: {{authkey}} | ||
HTTP 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
host=http://localhost:9090 | ||
authkey=potato |