Esempio n. 1
0
 private function setUpIndex()
 {
     $indexName = $this->indexName;
     $schema = $this->getSchemaType();
     $index = new YokozunaIndex($indexName, $schema);
     $store = StoreIndex::builder()->withIndex($index)->build();
     $fetch = FetchIndex::builder()->withIndexName($indexName)->build();
     try {
         $this->client->execute($fetch);
     } catch (\Exception $exc) {
         $this->client->execute($store);
         TestHelper::retryCommand($this->client, $fetch, 20);
     }
 }
Esempio n. 2
0
 /**
  * @deprecated
  *
  * not worth functional testing
  * Riak will fail to fetch the index for a couple seconds after store
  */
 public function testStoreAndFetchIndex()
 {
     $indexName = 'schedule_' . uniqid();
     $index = new YokozunaIndex($indexName, '_yz_default');
     $index->setNVal(3);
     $store = StoreIndex::builder()->withIndex($index)->build();
     $fetch = FetchIndex::builder()->withIndexName($indexName)->build();
     $delete = DeleteIndex::builder()->withIndexName($indexName)->build();
     $storeResponse = $this->client->execute($store);
     $fetchResponse = $this->retryCommand($fetch, 10);
     $deleteResponse = $this->client->execute($delete);
     $this->assertInstanceOf('Riak\\Client\\Command\\Search\\Response\\StoreIndexResponse', $storeResponse);
     $this->assertInstanceOf('Riak\\Client\\Command\\Search\\Response\\FetchIndexResponse', $fetchResponse);
     $this->assertInstanceOf('Riak\\Client\\Command\\Search\\Response\\DeleteIndexResponse', $deleteResponse);
 }
Esempio n. 3
0
 public function testExecuteCommand()
 {
     $index = new YokozunaIndex('index-name', 'schema-name');
     $response = new PutIndexResponse();
     $command = StoreIndex::builder()->withIndex($index)->build();
     $index->setNVal(33);
     $callback = function ($subject) {
         $this->assertInstanceOf('Riak\\Client\\Core\\Message\\Search\\PutIndexRequest', $subject);
         $this->assertEquals('schema-name', $subject->schema);
         $this->assertEquals('index-name', $subject->name);
         $this->assertEquals(33, $subject->nVal);
         return true;
     };
     $this->adapter->expects($this->once())->method('send')->with($this->callback($callback))->will($this->returnValue($response));
     $this->assertInstanceOf('Riak\\Client\\Command\\Search\\Response\\StoreIndexResponse', $this->client->execute($command));
 }