Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 080b1385 authored by Olivier Lequeux's avatar Olivier Lequeux
Browse files

fis SensioLabsInsight items

parent eb7d993b
{ {
"name": "ccin2p3/lavoisiercli", "name": "ccin2p3/lavoisiercli",
"description": "Lavoisier client", "description": "Lavoisier client",
"license" : "proprietary",
"authors": [ "authors": [
{ {
"name": "Olivier Lequeux", "name": "Olivier Lequeux",
......
...@@ -4,7 +4,7 @@ namespace Lavoisier\Exceptions; ...@@ -4,7 +4,7 @@ namespace Lavoisier\Exceptions;
use \Lavoisier\Query; use \Lavoisier\Query;
class cURLException extends \Exception class CurlLException extends \Exception
{ {
private $userMessage = null; private $userMessage = null;
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
namespace Lavoisier\Hydrators; namespace Lavoisier\Hydrators;
use \Lavoisier\Hydrators\IHydrator;
class DefaultHydrator implements IHydrator{ class DefaultHydrator implements IHydrator{
public function hydrate($str) { public function hydrate($str) {
......
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
namespace Lavoisier\Hydrators; namespace Lavoisier\Hydrators;
use \Lavoisier\Hydrators\IHydrator;
use \Lavoisier\Entries\IEntries; use \Lavoisier\Entries\IEntries;
use \Lavoisier\Entries\Entries;
class EntriesHydrator implements IHydrator class EntriesHydrator implements IHydrator
{ {
...@@ -77,7 +75,7 @@ class EntriesHydrator implements IHydrator ...@@ -77,7 +75,7 @@ class EntriesHydrator implements IHydrator
} }
} else { } else {
$str = strval($sxi->current()); $str = strval($sxi->current());
if ($this->value_as_key == true) { if ($this->value_as_key === true) {
$key = $str; $key = $str;
} }
if ($key === null) { if ($key === null) {
......
...@@ -7,12 +7,10 @@ use \Lavoisier\Entries\Entries; ...@@ -7,12 +7,10 @@ use \Lavoisier\Entries\Entries;
class SimpleXMLHydrator implements IHydrator class SimpleXMLHydrator implements IHydrator
{ {
private $prefix; private $prefix;
private $ns;
function __construct() function __construct()
{ {
$this->prefix = ''; $this->prefix = '';
$this->ns = '';
} }
public function hydrate($str) public function hydrate($str)
...@@ -31,10 +29,9 @@ class SimpleXMLHydrator implements IHydrator ...@@ -31,10 +29,9 @@ class SimpleXMLHydrator implements IHydrator
return $sxObject; return $sxObject;
} }
public function registerNamespace($prefix, $ns) public function registerNamespace($prefix)
{ {
$this->prefix = $prefix; $this->prefix = $prefix;
$this->ns = $ns;
} }
public function registerEntriesNamespace($useLavoisierXMLNS = true) public function registerEntriesNamespace($useLavoisierXMLNS = true)
......
...@@ -17,7 +17,7 @@ class Query ...@@ -17,7 +17,7 @@ class Query
{ {
static private $queryTemplates; static private $queryTemplates;
private $is_secure; private $secureMode;
private $schema; private $schema;
private $hostname; private $hostname;
private $port; private $port;
...@@ -41,7 +41,7 @@ class Query ...@@ -41,7 +41,7 @@ class Query
public function __construct($hostname, $view = '', $operation = 'lavoisier', $accept='xml') public function __construct($hostname, $view = '', $operation = 'lavoisier', $accept='xml')
{ {
$this->setIsSecure(false); $this->setSecureMode(false);
$this->hostname = $hostname; $this->hostname = $hostname;
$this->port = '8080'; $this->port = '8080';
$this->operation = $operation; $this->operation = $operation;
...@@ -56,7 +56,8 @@ class Query ...@@ -56,7 +56,8 @@ class Query
'lavoisier' => "%s%s:%s/%s/%s%s%saccept=%s", 'lavoisier' => "%s%s:%s/%s/%s%s%saccept=%s",
'lavoisier_base' => "%s%s:%s/%s/%s%s", 'lavoisier_base' => "%s%s:%s/%s/%s%s",
'notify' => "%s%s:%s/%s/%s", 'notify' => "%s%s:%s/%s/%s",
'resources' => "%s%s:%s/%s/%s" 'resources' => "%s%s:%s/%s/%s",
'console' => '%s%s:%s/%s'
); );
$this->hydrator = new DefaultHydrator(); $this->hydrator = new DefaultHydrator();
...@@ -67,10 +68,10 @@ class Query ...@@ -67,10 +68,10 @@ class Query
} }
public function setIsSecure($is_secure) public function setSecureMode($is_secure)
{ {
$this->is_secure = $is_secure; $this->secureMode = $is_secure;
if ($this->is_secure === true) { if ($this->secureMode === true) {
$this->schema = 'https://'; $this->schema = 'https://';
} else { } else {
$this->schema = 'http://'; $this->schema = 'http://';
...@@ -104,7 +105,7 @@ class Query ...@@ -104,7 +105,7 @@ class Query
public function setMethod($method) public function setMethod($method)
{ {
if (($method === 'GET') or ($method === 'POST')) { if (($method === 'GET') || ($method === 'POST')) {
$this->method = $method; $this->method = $method;
} else { } else {
...@@ -154,6 +155,19 @@ class Query ...@@ -154,6 +155,19 @@ class Query
} }
} }
public function isInstanceRunning() {
$ch = curl_init(($this->getUrl(false, "console")));
curl_setopt($ch, CURLOPT_CONNECT_ONLY, true);
curl_exec($ch);
$response = curl_getinfo($ch);
$response['last_curl_error'] = curl_error($ch);
curl_close($ch);
return empty($response['last_curl_error']);
}
public function curl() public function curl()
{ {
// init curl session // init curl session
......
...@@ -37,8 +37,7 @@ class EntriesTest extends \PHPUnit_Framework_TestCase ...@@ -37,8 +37,7 @@ class EntriesTest extends \PHPUnit_Framework_TestCase
$input = file_get_contents(dirname(__FILE__) . '/Resources/tickets.xml'); $input = file_get_contents(dirname(__FILE__) . '/Resources/tickets.xml');
$hydrator = new \Lavoisier\Hydrators\EntriesHydrator("\TicketingSystem\Ticket\GgusFields"); $hydrator = new \Lavoisier\Hydrators\EntriesHydrator("\TicketingSystem\Ticket\GgusFields");
$coll = $hydrator->hydrate($input); $hydrator->hydrate($input);
//print_r($coll);
} }
......
...@@ -82,4 +82,12 @@ class QueryTest extends \PHPUnit_Framework_TestCase ...@@ -82,4 +82,12 @@ class QueryTest extends \PHPUnit_Framework_TestCase
} }
public function testIsRunning() {
$q =new Query("nohost");
$this->assertEquals("http://nohost:8080/lavoisier", $q ->getUrl(false, "console"));
$this->assertEquals(false, $q->isInstanceRunning());
}
} }
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment