Beispiel #1
0
#!/usr/local/bin/php -q
<?php 
/*
 * Test ID: JBX_12
 * Description: Locks an existing MUC room.
 * 
 * Pre-conditions:
 * - The MUC room stubroom must exist and must not be locked.
 * 
 * Pre-condition:
 * - The MUC room stubroom is locked with the <lockmuc_pwd> password defined in the jabbex_conf.xml file.
 * 
 */
require_once "../Jabbex.php";
$jabex = new Jabbex("res_1934568934756");
$jabex->lock_muc_room("stubroom");
 * Pre-conditions:
 * 		1 - Jabbex doit être bien configurer pour dialoguer avec le serveur openfire
 * 		2 - les pramètres $unix_name, $name, $desc, $user doivent être renségnés (se sont des string)
 * 			projet qui mappe le salon de discution à rendre inaccessible.
 * 		3 - le $user admin ici doit exister en tant que administrateur des projets correspondants qui existent déjà dans codendi. 
 * Post-conditions:
 * 		1 - les muc rooms unix-nameperf-test0,unix-nameperf-test1, unix-nameperf-test2 et unix-nameperf-test3 sont créés ainsi que les groupes partagés correspondants .avec les temps suivants :
 * 			->temps mis apres appel numéro 1 : 10.859273910522 s
 * 			->temps mis apres appel numéro 2 : 6.793231010437 s
 * 			->temps mis apres appel numéro 3 : 6.5583012104034 s
 * 			->temps mis apres appel numéro 4 : 7.0762600898743 s
 * 			-> Ce qui donne un temps total :31.287104129791 s
 * Pour confirmer les résultats on peut se rendre à l'url suivant (http://kilauea.grenoble.xrce.xerox.com:8017/plugins/IM/?view=codendi_im_admin ) ,avant et aprés l'exécution de ce script .
 */
require_once "../include/jabbex_api/Jabbex.php";
$jabex = new Jabbex("res_3271989");
$unix_name = "unix-nameperf-test";
$name = "name-perf-test";
$desc = "desc-perftest";
$user = "******";
$begin = microtime(true);
$deb = $begin;
$time = 0;
echo '\\n\\nDébut : ' . $begin;
for ($i = 0; $i < 4; $i++) {
    //create_muc_room($muc_room_short_name, $muc_room_full_name, $muc_room_description, $muc_room_owner_username)
    $jabex->create_muc_room($unix_name . $i, $name . $i, $desc . $i, $user);
    $jabex->create_shared_group($unix_name . $i, $name . $i);
    $time = microtime(true) - $deb;
    $deb = microtime(true);
    print '\\n\\n\\n temps mis apres appel numéro ' . ($i + 1) . ' : ' . $time;
Beispiel #3
0
#!/usr/local/bin/php -q
<?php 
/*
 * Test ID: JBX_01
 * Test description: This test tries to add the user eclapton as a member of the invalid room invalid_muc_012x68dc.
 * Pre-conditions:
 * 		1 - Jabbex must be properly configured to use your Jabber server;
 * 		2 - The room invalid_muc_012x68dc must NOT exist;
 * 		3 - The default Jabbex JID must be an admin of the stubroom;
 * 		4 - No other connection of the default JID that uses resource res_3271981 must be active.
 * 		5 - The user eclapton must exist.
 * 
 * Post-conditions:
 * 		1 - An exception is thrown with message 'Invalid MUC room invalid_muc_012x68dc...'
 * 		2 - Jabbex closes the connection to the Jabber server.
 */
require_once "../Jabbex.php";
$jabex = new Jabbex("res_3271981");
$jabex->muc_add_member("invalid_muc_012x68dc", "eclapton");
Beispiel #4
0
#!/usr/bin/php -q
<?php 
/*
 * Test ID: JBX_02
 * 
 * Test description: This test adds the user eclapton as a member of the room stubroom.
 * Pre-conditions:
 * 		1 - Jabbex must be properly configured to use your Jabber server;
 * 		2 - The room stubroom must exist;
 * 		3 - The default Jabbex JID must be an admin of the stubroom;
 * 		4 - No other connection of the default JID that uses resource res_3271981 must be active.
 * 		5 - The user eclapton must exist and must not be a member of the stubroom.
 * 
 * Post-conditions:
 * 		1 - The user eclapton is added to stubroom's members list (no error or warning messages must be printed).
 * 		2 - Jabbex closes the connection to the Jabber server.
 */
require_once "../Jabbex.php";
$jabex = new Jabbex("res_3271981");
$jabex->muc_add_member("stubroom", "eclapton");
Beispiel #5
0
#!/usr/bin/php -q
<?php 
/*
 * Test ID: JBX_10
 * Test description: This test deletes an existing MUC room named "stubroom".
 * Pre-conditions:
 * 		1 - Jabbex must be properly configured to use your Jabber server;
 * 		2 - The room "stubroom" must exist;
 * 		3 - The default Jabbex JID must have permission to delete a MUC room;
 * 		4 - No other connection of the default JID that uses resource res_3271989 must be active.
 * 
 * Post-conditions:
 * 		1 - The room "stubroom" is deleted.
 * 		2 - Jabbex closes the connection to the Jabber server.
 */
require_once "../Jabbex.php";
$jabex = new Jabbex("res_3271989");
$jabex->delete_muc_room("stubroom");
Beispiel #6
0
#!/usr/local/bin/php -q
<?php 
/*
 * Test ID: JBX_06
 * Test description: This test creates a MUC room named stubroom.
 * Pre-conditions:
 * 		1 - Jabbex must be properly configured to use your Jabber server;
 * 		2 - The room stubroom must NOT exist;
 * 		3 - The default Jabbex JID must have permission to create a MUC room;
 * 		4 - No other connection of the default JID that uses resource res_3271989 must be active.
 * 		5 - The user "bbking" must exist in the server.
 * 
 * Post-conditions:
 * 		1 - The room stubroom is created with the name "My Stub Room (Room Name)" 
 * 			and the description "Here I put the description of my room (Projetc short description)" (no error or warning messages must be printed).
 * 		2 - The default JabbeX JID must be set as room owner and the user bbking must be set as room admin.
 * 		3 - Jabbex closes the connection to the Jabber server.
 */
require_once "../Jabbex.php";
$jabex = new Jabbex("res_3271989");
$jabex->create_muc_room("stubroom", "My Stub Room (Room Name)", "Here I put the description of my room (Projetc short description)", "bbking");
Beispiel #7
0
#!/usr/bin/php -q
<?php 
/*
 * Test ID: JBX_15
 * Test description: This test removes the user eclapton from the stubroom's members list.
 * Pre-conditions:
 * 		1 - Jabbex must be properly configured to use your Jabber server;
 * 		2 - The room stubroom must exist;
 * 		3 - The default Jabbex JID must be an admin of the stubroom;
 * 		4 - No other connection of the default JID that uses resource res_3271981 must be active.
 * 		5 - The user eclapton must exist and must be a member of the stubroom.
 * 
 * Post-conditions:
 * 		1 - The user eclapton is removed from stubroom's members list (no error or warning messages must be printed).
 * 		2 - Jabbex closes the connection to the Jabber server.
 */
require_once "../Jabbex.php";
$jabex = new Jabbex("res_3271981");
$jabex->muc_remove_member("stubroom", "eclapton");
<?php

/*
 * Created on May 7, 2008
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
require_once "../include/jabbex_api/Jabbex.php";
$jabex = new Jabbex("res_3271989");
$unix_name = "unix_name";
$name = "name";
$desc = "desc";
$user = "******";
$begin = microtime(true);
$deb = $begin;
$time = 0;
echo 'Début :' . $begin;
for ($i = 0; $i < 7; $i++) {
    //create_muc_room($muc_room_short_name, $muc_room_full_name, $muc_room_description, $muc_room_owner_username)
    $jabex->create_muc_room($unix_name . $i, $name . $i, $desc . $i, $user);
    $time = microtime(true) - $deb;
    $deb = microtime(true);
    print '\\n temps mis apres appel numéro ' . ($i + 1) . ' : ' . $time;
}
$end = microtime(true) - $begin;
print "temps total :" . $end . "\n";
Beispiel #9
0
#!/usr/local/bin/php -q
<?php 
/*
 * Test ID: JBX_18
 * Test description: Returns the current IM status of the the user bbking.
 * Pre-conditions: 
 * - The user bbking must exist.
 * 
 * Post-conditions: 
 * - The status returned must be coherent with the current user status (check it manually).
 */
require_once "../Jabbex.php";
$jabex = new Jabbex("res_3271981");
var_dump($jabex->user_status("*****@*****.**"));
Beispiel #10
0
#!/usr/local/bin/php -q
<?php 
/*

Test ID: JBX_13
Test Description: Checks whether a MUC exists or not.

Pre-conditions:
The room stubroom must exist;
The room invalid_room_qoivf82347rr must NOT exist;

Post-conditions:
Two “PASS” are echoed, one for the test with an existing room and other for the test with an invalid room.
*/
require_once "../Jabbex.php";
$jabbex = new Jabbex("res_3271989");
if ($jabbex->_muc_exists("stubroom")) {
    echo "PASS\n";
} else {
    echo "FAIL\n";
}
if ($jabbex->_muc_exists("invalid_room_qoivf82347rr")) {
    echo "FAIL\n";
} else {
    echo "PASS\n";
}
Beispiel #11
0
#!/usr/local/bin/php -q
<?php 
/*
 * Test ID: JBX_08
 * Test description: This test makes available a shared group named "My little stub project" with id "stub".
 * Pre-conditions:
 * 		1 - Jabbex must be properly configured to use your Jabber server;
 * 		2 - The project id stub must exist (and state = A) in the Codendi environment;
 * 		3 - The default Jabbex JID must have permission to create a shared group with the Helga plugin;
 * 		4 - The Helga plugin must be installed and JabbeX must be configured to properly use it;
 * 		5 - No other connection of the default JID that uses resource res_32723989 must be active.
 * 
 * Post-conditions:
 * 		1 - The shared group corresponding to the project stub is set as "shared" with the name "My little stub project";
 * 		3 - Jabbex closes the connection to the Jabber server.
 */
require_once "../Jabbex.php";
$jabex = new Jabbex("res_32723989");
$jabex->create_shared_group("stub", "My little stub project");
Beispiel #12
0
#!/usr/bin/php -q
<?php 
/*
 * Test ID: JBX_16
 * Test description: Test whether the values return by the function get_server_conf (server configuration parameters) are correct.
 * Pre-conditions:
 *  - None.
 * 
 * Post-conditions:
 * - Check whether the values returned match the values in the jabbex_conf.xml configuration file.
 */
require_once "../Jabbex.php";
$jabbex = new Jabbex("res_3271981");
var_dump($jabbex->get_server_conf());
#!/usr/local/bin/php -q
<?php 
/*
* Test ID: JBX_07
Test Description: Tries to create a shared group that maps to an invalid Codendi project.
Pre-conditions:
The Codendi project InvalidGroup_XXXAUTYS must NOT exist;

Post-conditions:
The fatal exception 3008 (The shared group you are trying to enable does not exist) must be thrown and the execution must be aborted.
*/
require_once "../Jabbex.php";
$jabex = new Jabbex("123654789");
$jabex->create_shared_group("InvalidGroup_XXXAUTYS", "XGREXDtTXRt");
// An invalid group.
Beispiel #14
0
#!/usr/bin/php -q
<?php 
/*
 * Test ID: JBX_21
 * Description: Call a JabbeX function with an invalid string parameter.
 * Pre-conditions:
 * - None
 * 
 * Post-Conditions
 * - Throws exception ("Invalid string parameter.",3002)
 */
require_once "../../Jabbex.php";
$jabbex = new Jabbex("35715928654");
$jabbex->_jabber_connect();
$jabbex->create_muc_room(" ", " ", "blahasodnud", "daniel");
#!/usr/local/bin/php -q
<?php 
/*
 * Test ID: JBX_09
 * Test description: This test creates a MUC room and a shared group named "Crossing Alabama".
 * Pre-conditions:
 * 		1 - Jabbex must be properly configured to use your Jabber server;
 * 		2 - The room id xingalab must NOT exist;
 * 		3 - The default Jabbex JID must have permission to create a MUC room;
 * 		4 - No other connection of the default JID that uses resource res_398671989 must be active.
 * 		5 - The user "bbking" must exist in the server.
 * 		6 - The project id xingalab must exist in the Codendi environment;
 *		7 - The default Jabbex JID must have permission to create a shared group with the Helga plugin;
 * 		8 - The Helga plugin must be installed and JabbeX must be configured to properly use it; 
 * Post-conditions:
 * 		1 - The room xingalab is created with the name "Crossing Alabama" 
 * 			and the description "Here I put the description of my room (Projetc short description)" (no error or warning messages must be printed).
 * 		2 - The default JabbeX JID must be set as room owner and the user bbking must be set as room admin.
 * 		3 - The shared group corresponding to the project stub is set as "shared" with the name "Crossing Alabama";
 * 		4 - Jabbex closes the connection to the Jabber server.
 */
require_once "../Jabbex.php";
$jabex = new Jabbex("res_398671989");
$jabex->create_shared_group("xingalab", "Crossing Alabama");
$jabex->create_muc_room("xingalab", "Crossing Alabama", "Here I put the description of my room (Projetc short description)", "bbking");
Beispiel #16
0
#!/usr/local/bin/php -q
<?php 
/*
 * Test ID: JBX_03
 * Description: Fails to connect to the Jabber server.
 * Pre-conditions:
 * - The Jabber server is down or inaccessible by JabbeX.
 * 
 * Post-Conditions
 * - Throws exception 'Unable to connect to the Jabber server.'
 */
require_once "../../Jabbex.php";
$jabex = new Jabbex("res_324863841");
$jabex->_jabber_connect();
Beispiel #17
0
#!/usr/local/bin/php -q
<?php 
/*
 * Test ID: JBX_14
 * Test description: This test instantiates several JabbeX objects and creates MUC rooms and a shared groups with them.
 * Pre-conditions:
 * 		- Check the pre-conditions for the tests CreateMUC and CreateSharedGroup.
 * Post-conditions:
 * 		- Check the pos-conditions for the tests CreateMUC and CreateSharedGroup.
 * 
 */
require_once "../Jabbex.php";
$jabex1 = new Jabbex("12364789");
$jabex2 = new Jabbex("12365478");
$jabex3 = new Jabbex("12365479");
$jabex4 = new Jabbex("12365489");
$jabex5 = new Jabbex("12365789");
$jabex1->create_shared_group("xingalab", "Crossing Alabama");
$jabex2->create_muc_room("xingalab", "My Xingalab Room (Project Name)", "Here I put the description of my room (Projetc short description)", "bbking");
$jabex5->__destruct();
$jabex4->create_shared_group("stubroom", "My little stub project");
$jabex3->create_muc_room("stubroom", "My Stub Room (Project Name)", "Here I put the description of my room (Projetc short description)", "bbking");