summaryrefslogtreecommitdiffstats
path: root/doc/afb-tests-overview.md
blob: d6f619fec5289a3678f93bbc91c9997af2428522 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
Overview of tests shipped with AFB-Daemon
=========================================

List of tests
-------------

Here are the tests shipped in the source tree:

* **afb-client-demo** (command-line WebSockets)

* **token-websock.qml** (Qt/QML WebSockets)

* ***.html** (HTML5/JS HTTP-REST & WebSockets)


Detail of tests
---------------

### afb-client-demo (command-line WebSockets)

This clients interactively calls bindings APIs from the command line, using the binder
[WebSockets](https://en.wikipedia.org/wiki/WebSocket) facility.

If _afb-daemon_ has been launched with the following parameters:


    $ afb-daemon --port=1234 --token=123456 [...]


Then run the client with :

    afb-client-demo ws://localhost:1234/api?token=123456 [<api> <verb> [<json-data>]]

For instance, to initialize the Audio binding from the command line :

    afb-client-demo ws://localhost:1234/api?token=123456

The command doesn't return. You should type requests of type <api> <verb> [<json-data>].
So, try:

    auth connect
    hello pingjson true

<br />



### token-websock.qml (Qt/QML WebSockets)

If _afb-daemon_ has been launched with the following parameters:

    $ afb-daemon --port=1234 --token=123456 [...]

and Qt5 is installed.

For installing Qt5 on **Ubuntu 16.04**:

    $ apt-get install qmlscene qml-module-qtwebsockets qml-module-qtquick-controls

For installing Qt5 on **Fedora >= 22** :

    $ dnf install qt5-qtdeclarative-devel qt5-qtwebsockets-devel qt5-qtquickcontrols


Then run the client with :

    qmlscene test/token-websock.qml

and interactively press the buttons, "Connect", "Refresh", "Logout".

<br />


### *.html (HTML5/JS HTTP-REST & WebSockets)

If _afb-daemon_ has been launched with the following parameters:

    $ afb-daemon --port=1234 --rootdir=$PWD/test [...]

_("$PWD/test_" being the "test" subdirectory of the source tree)_


Then open your preferred Web browser, connect to the following URL:

    http://localhost:1234

and interactively run the various tests.
pan class="o">[[ "$(cd $(dirname -- $0) && pwd -P)/$(basename -- $0)" != "$(cd $(dirname -- ${.sh.file}) && pwd -P)/$(basename -- ${.sh.file})" ]] && { SOURCED=1; SOURCEDIR=$(cd $(dirname -- ${.sh.file}) && pwd -P); } elif [ -n "$BASH_VERSION" ]; then [[ $0 != "$BASH_SOURCE" ]] && { SOURCED=1; SOURCEDIR=$(cd $(dirname -- $BASH_SOURCE) && pwd -P); } fi if [ $SOURCED -ne 1 ]; then unset SOURCED unset SOURCEDIR echo "Error: this script needs to be sourced in a supported shell" >&2 echo "Please check that the current shell is bash, zsh or ksh and run this script as '. $0 <args>'" >&2 return 1 else unset SOURCED if [ -z $1 ]; then echo -e "Usage: source envsetup.sh <board/device> [build dir]" return 1 fi if [ -n "$2" ]; then BUILD_DIR="$2" else BUILD_DIR=build fi # echo "DEPRECATED..." | figlet -f big -w 80 -c cat <<'EOF' >&2 ------------------------------------------------------------------------------ | using this script is... | | _____ ______ _____ _____ ______ _____ _______ ______ _____ | | | __ \| ____| __ \| __ \| ____/ ____| /\|__ __| ____| __ \ | | | | | | |__ | |__) | |__) | |__ | | / \ | | | |__ | | | | | | | | | | __| | ___/| _ /| __|| | / /\ \ | | | __| | | | | | | | |__| | |____| | | | \ \| |___| |____ / ____ \| | | |____| |__| | _ _ | | |_____/|______|_| |_| \_\______\_____/_/ \_\_| |______|_____(_|_|_) | | | | To support the newest/upcoming features, please use the script aglsetup.sh. | ------------------------------------------------------------------------------ EOF . $SOURCEDIR/aglsetup.sh -m $1 -b $BUILD_DIR agl-devel agl-netboot agl-appfw-smack agl-demo rc=$? unset SOURCEDIR unset BUILD_DIR return $rc fi