Example #1
0
 public function getHeartBeat()
 {
     if (!$this->listenHeart()) {
         return false;
     }
     $response = new KieHBResponse();
     $reqFact = new KieFact($response, ['factName' => 'trimetis.heartbeat.Response', 'nodes' => ['output', 'responseDate'], 'identifier' => 'response']);
     $results = $this->getResults();
     $response = $reqFact->parseQuery($results['result']);
     $request = new KieHBRequest();
     $reqFact = new KieFact($request, ['identifier' => 'hb_request']);
     $reqFact->updateFact($results['result']);
     return ['response' => $response, 'request' => $request];
 }
Example #2
0
 /**
  * @covers KieFact::parseQuery
  */
 public function testParseQueryOneResult()
 {
     //Poszukiwanie z query, podajemy fact pola do wypełnienia, jesli puste to próbujemy wypełnić wszystkie
     //Dla faktu już zdefiniowanego robimy update, poszukujemy w resultatach identyfikatora i robimy wsteczny update pól
     $response = new heartbeat\KieHBResponse();
     $converter = new KieMomentConverter();
     $reqFact = new KieFact(null, ['factName' => 'trimetis.perdiem.Response', 'object' => $response, 'nodes' => ['output', 'responseDate' => ['converter' => $converter, 'in' => true, 'out' => true]], 'identifier' => 'response']);
     $query = $reqFact->parseQuery($this->preparedata1()['result']);
     self::assertCount(1, $query);
     $r1 = $query[0];
     self::assertEquals('HeartBeat', $r1->output);
     self::assertEquals('2015-05-06T09:56:37+0000', $r1->responseDate->format());
 }