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::updateFact
  */
 public function testUpdateFact1()
 {
     //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
     $request = new KieHBRequest();
     $request->message = 'Old message';
     $request->start = new Moment('1970-01-01T12:34:00');
     $request->time = new Moment('1970-01-02T12:34:00');
     $converter = new KieMomentConverter();
     $reqFact = new KieFact($request, ['factName' => 'trimetis.perdiem.Request', 'nodes' => ['message', 'start' => ['converter' => $converter, 'in' => false, 'out' => true], 'time' => ['converter' => $converter]], 'identifier' => 'hb_request']);
     $reqFact->updateFact($this->preparedata()['result']);
     /* @var KieHBRequest */
     $object = $reqFact->getObject();
     self::assertEquals('HeartBeat', $object->message);
     self::assertEquals('1970-01-01T12:34:00+0000', $object->start->format());
     self::assertEquals('2015-05-06T09:56:37+0000', $object->time->format());
 }