HCE Project PHP language client API bindings OOP style  1.1.1
Hierarchical Cluster Engine PHP Client Interface API OOP style
 All Classes Namespaces Files Functions Variables Pages
test_admin_node_manager.php
Go to the documentation of this file.
1 <?php
14 // Set default timezone if not set in host environment
15 @date_default_timezone_set ( @date_default_timezone_get () );
16 
17 require_once 'hce/admin/Constants.inc.php';
18 require_once 'hce/admin/Node.inc.php';
19 require_once 'hce/admin/NodeCommand.inc.php';
20 require_once 'hce/admin/NodeManager.inc.php';
21 
22 // Create node, default initialization for localhost 1-1-2 router
23 $node = new \HCE\admin\Node ();
24 if ($node->getErrorCode ()) {
25  echo 'Error ' . $node->error . ' create node instance with default initialization!' . PHP_EOL;
26  exit ( 1 );
27 }
28 echo 'node created' . PHP_EOL;
29 
30 // Create node manager initialized with node
31 $nodeManager = new \HCE\admin\NodeManager ( array (
32  $node
33 ) );
34 if ($nodeManager->getErrorCode ()) {
35  echo 'Error ' . $nodeManager->getErrorCode () . ' create node manager instance!' . PHP_EOL;
36  exit ( 1 );
37 }
38 echo 'node manager created' . PHP_EOL;
39 
40 // Create node command
41 $nodeCommand = new \HCE\admin\NodeCommand ( 'ECHO' );
42 if ($nodeCommand->getErrorCode ()) {
43  echo 'Error ' . $nodeCommand->getErrorCode () . ' create node command instance!' . PHP_EOL;
44  exit ( 1 );
45 }
46 echo 'node command created' . PHP_EOL;
47 
48 if (! $nodeManager->execute ( $nodeCommand )) {
49  echo 'Error ' . $nodeManager->getErrorCode () . ' execute command "' . $nodeCommand->getCommandName () . '"!' . PHP_EOL;
50 }
51 
52 echo $nodeManager->getResponsesDump () . PHP_EOL;
53 echo var_dump ( $nodeManager->getResponsesData () ) . PHP_EOL;
54 echo var_dump ( $nodeManager->getResponsesFields () ) . PHP_EOL;
55 
56 ?>