Updated README

This commit is contained in:
James Booth
2015-06-14 01:52:23 +01:00
parent 203e0642fa
commit 23eb872a8d

View File

@@ -2,15 +2,15 @@
Stubbed XMPP (Jabber) Server. Stubbed XMPP (Jabber) Server.
# Overview # Overview
Stabber acts as a stubbed XMPP service for testing purposes, the API allows: Stabber acts as a stubbed XMPP service for testing purposes, supporting:
* Sending of XMPP stanzas. * Sending of XMPP stanzas.
* Responding to XMPP stanzas with stubbed responses, by id, and by query namespace * Responding to XMPP stanzas with stubbed responses, by id, and by query namespace
* Verifying that XMPP stanzas were received. * Verifying that XMPP stanzas were received.
* C API
* Python bindings https://github.com/boothj5/stabber-python
* HTTP API
An HTTP API is also included, currently only supporting the `stbbr_send`, `stbbr_for_id` and `stbbr_for_query` operations. The project is work in progress, and is being developed alongside https://github.com/boothj5/profanity
The project is work in progress with only the basics implemented, and is being developed alongside https://github.com/boothj5/profanity
Currently the only API is written in C. Python bindings are in progress: https://github.com/boothj5/stabber-python
# Installing # Installing
``` ```
@@ -19,18 +19,16 @@ Currently the only API is written in C. Python bindings are in progress: https:/
make make
make install (as root) make install (as root)
``` ```
# Using the C API # C API
Include the following header in your tests: Include the following header in your tests:
```c ```c
#include <stabber.h> #include <stabber.h>
```` ```
Include the following in the linker path when compiling tests: Include the following in the linker path when compiling tests:
``` ```
-lstabber -lstabber
``` ```
# C API
### Starting ### Starting
To start Stabber: To start Stabber:
```c ```c
@@ -112,7 +110,7 @@ stbbr_received(
"<body>I know, its a test.</body>" "<body>I know, its a test.</body>"
"</message>" "</message>"
); );
```` ```
By default the verification calls block for up to 10 seconds, the timeout in seconds can be set with: By default the verification calls block for up to 10 seconds, the timeout in seconds can be set with:
```c ```c
stbbr_set_timeout(3); stbbr_set_timeout(3);
@@ -126,12 +124,6 @@ Sometimes a test needs to wait until the client being tested has had time to sen
stbbr_wait_for("someid"); stbbr_wait_for("someid");
``` ```
# Logs
Stabber logs to:
```
~/.local/share/stabber/logs/stabber.log
```
# HTTP API # HTTP API
To start stabber in standalone mode: To start stabber in standalone mode:
``` ```
@@ -160,5 +152,18 @@ To respond to a stanza with a specfic query namespace sent from the client, send
curl --data '<iq type="result" to="stabber@localhost/profanity"><query xmlns="jabber:iq:roster" ver="362"><item jid="buddy1@localhost" subscription="both" name="Buddy1"/><item jid="buddy2@localhost" subscription="both" name="Buddy2"/></query></iq>' http://localhost:5231/for?query=jabber:iq:roster curl --data '<iq type="result" to="stabber@localhost/profanity"><query xmlns="jabber:iq:roster" ver="362"><item jid="buddy1@localhost" subscription="both" name="Buddy1"/><item jid="buddy2@localhost" subscription="both" name="Buddy2"/></query></iq>' http://localhost:5231/for?query=jabber:iq:roster
``` ```
### Verify sent stanzas
To verify that a stanza was received by Stabber, send a POST request to `http://localhost:5231/verify` where the body is the expected stanza, e.g.:
```
curl --data '<iq id="*" type="get"><ping xmlns="urn:xmpp:ping"/></iq>' http://localhost:5231/verify
```
The request will return immediately with a body containing either `true` or `false`.
# Logs
Stabber logs to:
```
~/.local/share/stabber/logs/stabber.log
```
# Examples # Examples
Example tests for Profanity can be found at: https://github.com/boothj5/profanity/tree/master/functionaltests Example tests for Profanity can be found at: https://github.com/boothj5/profanity/tree/master/functionaltests