public function testConstructor()
 {
     $client = new Client();
     $hydrator = new APIHydrator([], null);
     $collection = new Collection();
     $service = new TestService($client, $hydrator, $collection);
     $this->assertSame($client, $service->getClient());
     $this->assertSame($hydrator, $service->getHydrator());
     $this->assertAttributeEquals($collection, 'collectionPrototype', $service);
 }
Esempio n. 2
0
{
    use \Cherry\Proc\TCriticalSection;
    public $serviceid = "info.noccylabs.testservice2";
    private $char;
    public function __construct($char)
    {
        $this->char = $char;
        $this->flags = ServiceInstance::SVC_RESTART + ServiceInstance::SVC_NO_DELAY;
    }
    function servicemain()
    {
        for ($s = 0; $s < 5; $s++) {
            usleep(100000);
            $key = fileinode(__FILE__);
            $this->enterCriticalSection($key);
            echo $this->char;
            $this->leaveCriticalSection();
        }
    }
    function servicehalt()
    {
        echo "X\n";
    }
}
$s1 = new TestService(".");
$s2 = new TestService(":");
$s1->start();
$s2->start();
sleep(5);
$s1->stop();
$s2->stop();
Esempio n. 3
0
<?php

ini_set('display_errors', 0);
$PRJ_ROOT = dirname(dirname(dirname(__FILE__)));
ini_set('include_path', $PRJ_ROOT . '/config/' . ':' . get_include_path());
require_once $PRJ_ROOT . '/src/service/test_svc.php';
$test_svc = new TestService();
$data = $test_svc->make();
$endTime = microtime(true);
$logInfo['errno'] = 0;
$logInfo['errormsg'] = $data;
$output = json_encode($logInfo);
error_log($output . "\n", 3, $PRJ_ROOT . '/logs/yk_process.log');
echo $output;
Esempio n. 4
0
                }
            } else {
                if ($method == 'PUT' && $request[0] == 'test') {
                    if (isset($request[1]) && is_numeric($request[1])) {
                        $sv = new TestService();
                        $input = json_decode(file_get_contents("php://input"));
                        // var_dump($input);
                        $rs = $sv->updateTest($input, getuserid($input));
                        // var_dump($rs);
                        return $rs;
                        exit;
                    }
                } else {
                    if ($method == 'DELETE' && $request[0] == 'test') {
                        if (isset($request[1]) && is_numeric($request[1])) {
                            $sv = new TestService();
                            $input = json_decode(file_get_contents("php://input"));
                            // var_dump($input);
                            $rs = $sv->deleteTest($request[1], getuserid($input));
                            // var_dump($rs);
                            return $rs;
                            exit;
                        }
                    } else {
                    }
                }
            }
        }
    }
} else {
}
Esempio n. 5
0
 /**
  * Close the MySQL database connection
  * @return void
  */
 function disconnect()
 {
     //if (isset(self::$myConnection))
     //	mysql_close(self::$myConnection);
     self::$connected = false;
 }