Code

add gosa-si-client event set_activated_for_installation
[gosa.git] / gosa-si / tests / client.php
1 #!/usr/bin/php5 -q
2 <?php
4 require_once("../../gosa-core/include/class_socketClient.inc");
5 error_reporting(E_ALL);
7 $zahl= 1;
9 for($count = 1; $count <= $zahl; $count++)
10 {
12 $sock = new Socket_Client("127.0.0.1","20081",TRUE,1);
13 $sock->setEncryptionKey("secret-gosa-password");
15 if($sock->connected()){
16         /* Prepare a hunge bunch of data to be send */
18 # add
19 #$data = "<xml> <header>job_ping</header> <source>10.89.1.155:20083</source><mac>00:1B:77:04:8A:6C</mac> <timestamp>19700101000001</timestamp> </xml>";
20 #$data = "<xml> <header>job_sayHello</header> <source>10.89.1.155:20083</source><mac>00:1B:77:04:8A:6C</mac> <timestamp>20130102133900</timestamp> </xml>";
21 #$data = "<xml> <header>job_ping</header> <source>10.89.1.155:20083</source> <target>10.89.1.155:20081</target><mac>00:1B:77:04:8A:6C</mac> <timestamp>20130102133900</timestamp> </xml>";
23 # delete
24 #$data = "<xml> <header>gosa_delete_jobdb_entry</header><where><clause><phrase><id>3</id></phrase></clause></where></xml>";
26 # update  
27 #$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <where><clause><phrase> <status>waiting</status></phrase></clause> </where> <update><status>processing</status> <result>update</result></update></xml>";
29 # query
30 #$data = "<xml><header>gosa_query_jobdb</header><where><clause><connector>and</connector><phrase><operator>gt</operator><ROWID>0</ROWID></phrase><phrase><operator>le</operator><ROWID>5</ROWID></phrase></clause></where></xml>";
31 #$data= "<xml><header>gosa_query_jobdb</header><where><clause><phrase><headertag>ping</headertag></phrase></clause></where><limit><from>0</from><to>3</to></limit></xml>";
32 #$data= "<xml><header>gosa_query_jobdb</header><where><clause><phrase><headertag>ping</headertag></phrase></clause></where><limit><from>0</from><to>5</to></limit><orderby>timestamp</orderby></xml>";
33 #$data= "<xml><header>gosa_query_jobdb</header></xml>";
35 # count
36 #$data = "<xml> <header>gosa_count_jobdb</header></xml>";
38 # clear
39 #$data = "<xml> <header>gosa_clear_jobdb</header> </xml>";
41 # set gosa-si-client to 'activated'
42 $data = "<xml> <header>gosa_set_activated_for_installation</header> <target>10.89.1.31:20083</target> <source>127.0.0.1:20081</source> </xml>";
45     $sock->write($data);
46     $answer = "nothing";
47         $answer = $sock->read();
48     
49     echo "$count: $answer\n";
50         $sock->close(); 
51 }else{
52         echo "... FAILED!\n";
53 }
54 }
55 ?>