Ejemplo n.º 1
0
 public function testMockedNode()
 {
     $this->mockServer->queueResponse($this->getTestData(__FUNCTION__));
     $node = new Node($this->jenkins);
     $node->update();
     $this->assertEquals(array(), $node->assignedLabels);
     $this->assertEquals("hello world", $node->description);
     $this->assertEquals(2, count($node->jobs));
     $this->assertInstanceOf('mogman1\\Jenkins\\ApiObject\\Job', $node->jobs[0]);
     $this->assertEquals("jenkins-web-api", $node->jobs[0]->name);
     $this->assertInstanceOf('mogman1\\Jenkins\\ApiObject\\Job', $node->jobs[1]);
     $this->assertEquals("foo", $node->jobs[1]->name);
     $this->assertEquals("NORMAL", $node->mode);
     $this->assertEquals("blah", $node->nodeName);
     $this->assertEquals("the master Jenkins node", $node->nodeDescription);
     $this->assertEquals(2, $node->numExecutors);
     $this->assertEquals(array(), $node->overallLoad);
     $this->assertInstanceOf('mogman1\\Jenkins\\ApiObject\\View', $node->primaryView);
     $this->assertTrue($node->quietingDown);
     $this->assertEquals("10", $node->slaveAgentPort);
     $this->assertEquals(array(), $node->unlabeledLoad);
     $this->assertTrue($node->useCrumbs);
     $this->assertTrue($node->useSecurity);
     $this->assertInstanceOf('mogman1\\Jenkins\\ApiObject\\View', $node->views[0]);
     $this->assertEquals("All", $node->views[0]->name);
     $this->assertInstanceOf('mogman1\\Jenkins\\ApiObject\\View', $node->views[1]);
     $this->assertEquals("All2", $node->views[1]->name);
 }
Ejemplo n.º 2
0
 /**
  * Returns information on this server node
  *
  * @return \mogman1\Jenkins\Node
  */
 public function getNodeInfo()
 {
     return Node::factory($this, $this->get("/")->getJson());
 }
Ejemplo n.º 3
0
 /**
  * Constructs a node from data assumed to have come from a Jenkins API call
  *
  * @param Jenkins $conn
  * @param JsonData $data
  * @return \mogman1\Jenkins\Node
  */
 public static function factory(Jenkins $conn, JsonData $data)
 {
     $node = new Node($conn);
     $node->updateProperties($data);
     return $node;
 }