コード例 #1
0
 public function testGet()
 {
     $testJson = array('null' => NULL, 'false' => false, 'zero' => 0, "empty" => "", "summit" => "hello");
     $json = new JsonData(json_decode(json_encode($testJson), TRUE));
     $this->assertNotNull($json->get('null'));
     $this->assertEquals("", $json->get('null'));
     $this->assertTrue($json->get('null', TRUE));
     $this->assertNotNull($json->get('nothing'));
     $this->assertEquals("", $json->get('nothing'));
     $this->assertTrue($json->get('nothing', TRUE));
     $this->assertFalse($json->get('false'));
     $this->assertFalse($json->get('false', TRUE));
     $this->assertEquals(0, $json->get('zero'));
     $this->assertEquals(0, $json->get('zero', 1));
     $this->assertEquals("", $json->get('empty'));
     $this->assertEquals("", $json->get('empty', 1));
     $this->assertEquals("hello", $json->get('summit'));
     $this->assertEquals("hello", $json->get('summit', 1));
 }
コード例 #2
0
ファイル: Job.php プロジェクト: mogman1/jenkins-web-api
 /**
  * (non-PHPdoc)
  * @see \mogman1\Jenkins\ApiObject::updateImpProperties()
  */
 protected function updateImpProperties(JsonData $data)
 {
     //url and name are not updated since, once they are set, they should never change
     //TODO: figure out what actions are
     $this->actions = $data->get('actions', array());
     $this->buildable = $data->get('buildable', TRUE);
     $this->builds = Build::multiFactory($this->conn, $this->name, $data->get('builds', array()));
     $this->color = $data->get('color', "gray");
     $this->concurrentBuild = $data->get('concurrentBuild', FALSE);
     $this->description = $data->get('description', "");
     $this->displayName = $data->get('displayName', "");
     $this->displayNameOrNull = $data->get('displayNameOrNull', NULL);
     $this->downstreamProjects = $data->get('downstreamProjects', array());
     //TODO: create health report object
     $this->healthReport = $data->get('healthReport', array());
     $this->inQueue = $data->get('inQueue', FALSE);
     $this->keepDependencies = $data->get('keepDependencies', FALSE);
     $this->nextBuildNumber = $data->get('nextBuildNumber', "0");
     $this->property = $data->get('property', array());
     $this->queueItem = $data->get('queueItem', NULL);
     $this->scm = $data->get('scm', array());
     $this->upstreamProjects = $data->get('upstreamProjects', array());
     $build = $data->get('firstBuild', array());
     $this->firstBuild = $build ? Build::factory($this->conn, $this->name, new JsonData($build)) : NULL;
     $build = $data->get('lastBuild', array());
     $this->lastBuild = $build ? Build::factory($this->conn, $this->name, new JsonData($build)) : NULL;
     $build = $data->get('lastCompletedBuild', array());
     $this->lastCompletedBuild = $build ? Build::factory($this->conn, $this->name, new JsonData($build)) : NULL;
     $build = $data->get('lastFailedBuild', array());
     $this->lastFailedBuild = $build ? Build::factory($this->conn, $this->name, new JsonData($build)) : NULL;
     $build = $data->get('lastStableBuild', array());
     $this->lastStableBuild = $build ? Build::factory($this->conn, $this->name, new JsonData($build)) : NULL;
     $build = $data->get('lastSuccessfulBuild', array());
     $this->lastSuccessfulBuild = $build ? Build::factory($this->conn, $this->name, new JsonData($build)) : NULL;
     $build = $data->get('lastUnstableBuild', array());
     $this->lastUnstableBuild = $build ? Build::factory($this->conn, $this->name, new JsonData($build)) : NULL;
     $build = $data->get('lastUnsuccessfulBuild', array());
     $this->lastUnsuccessfulBuild = $build ? Build::factory($this->conn, $this->name, new JsonData($build)) : NULL;
 }
コード例 #3
0
ファイル: View.php プロジェクト: mogman1/jenkins-web-api
 /**
  * (non-PHPdoc)
  * @see \mogman1\Jenkins\ApiObject::updateImpProperties()
  */
 protected function updateImpProperties(JsonData $data)
 {
     $this->name = $data->get('name', "");
 }
コード例 #4
0
ファイル: Build.php プロジェクト: mogman1/jenkins-web-api
 protected function updateImpProperties(JsonData $data)
 {
     //number and url are not updated since, once they are set, they should never change
     $this->actions = $data->get('actions', array());
     $this->artifacts = $data->get('artifacts', array());
     $this->building = $data->get('building', FALSE);
     $this->builtOn = $data->get('builtOn', "");
     $this->changeSet = $data->get('changeSet', array());
     $this->culprits = $data->get('culprits', array());
     //TODO: create User object
     $this->description = $data->get('description', "");
     $this->duration = $data->get('duration', "0");
     $this->estimatedDuration = $data->get('estimatedDuration', "0");
     $this->executor = $data->get('executor', "");
     $this->fullDisplayName = $data->get('fullDisplayName', "");
     $this->id = $data->get('id', "");
     $this->keepLog = $data->get('keepLog', FALSE);
     $this->result = $data->get('result', "UNKNOWN");
     $this->timestamp = $data->get('timestamp', "0");
 }
コード例 #5
0
ファイル: QueueItem.php プロジェクト: mogman1/jenkins-web-api
 protected function updateImpProperties(JsonData $data)
 {
     //id and url are not updated since, once they are set, they should never change
     //TODO: figure out what actions are
     $this->actions = $data->get('actions', array());
     $this->blocked = $data->get('blocked', FALSE);
     $this->buildable = $data->get('buildable', FALSE);
     $this->cancelled = $data->get('cancelled', FALSE);
     $this->inQueueSince = $data->get('inQueueSince', "0");
     $this->params = $this->parseParamsString($data->get('params', ""));
     $this->stuck = $data->get('stuck', FALSE);
     $this->timestamp = $data->get('timestamp', "0");
     $this->why = $data->get('why', "");
     $task = $data->get('task', array());
     $this->task = $task ? Job::factory($this->conn, new JsonData($data->get('task', array()))) : NULL;
     $build = $data->get('executable', array());
     $this->executable = $build ? Build::factory($this->conn, $this->task->name, new JsonData($build)) : NULL;
 }
コード例 #6
0
ファイル: Node.php プロジェクト: mogman1/jenkins-web-api
 protected function updateImpProperties(JsonData $data)
 {
     $this->assignedLabels = $data->get('assignedLabels', array());
     $this->description = $data->get('description');
     $this->jobs = Job::multiFactory($this->conn, $data->get('jobs', array()));
     $this->mode = $data->get('mode', "UNKNOWN");
     $this->nodeDescription = $data->get('nodeDescription');
     $this->nodeName = $data->get('nodeName');
     $this->numExecutors = $data->get('numExecutors', 0);
     $this->overallLoad = $data->get('overallLoad', array());
     $this->quietingDown = $data->get('quietingDown', FALSE);
     $this->slaveAgentPort = $data->get('slaveAgentPort', 0);
     $this->unlabeledLoad = $data->get('unlabeledLoad', array());
     $this->useCrumbs = $data->get('useCrumbs', FALSE);
     $this->useSecurity = $data->get('useSecurity', FALSE);
     $this->views = View::multiFactory($this->conn, $data->get('views', array()));
     $viewData = $data->get('primaryView', array());
     $this->primaryView = $viewData ? View::factory($this->conn, new JsonData($data->get('primaryView', array()))) : NULL;
 }