public function testKeyspaceCanBeUpdated() { try { $this->cassandra->dropKeyspace('CassandraTest2'); } catch (Exception $e) { } $this->cassandra->createKeyspace('CassandraTest2'); $this->assertEquals(array('column-families' => array(), 'name' => 'CassandraTest2', 'placement-strategy' => 'org.apache.cassandra.locator.SimpleStrategy', 'placement-strategy-options' => array('replication_factor' => 1), 'replication-factor' => 1), $this->cassandra->getKeyspaceSchema('CassandraTest2', false)); $this->cassandra->updateKeyspace('CassandraTest2', 1, Cassandra::PLACEMENT_NETWORK, array('DC1' => 2, 'DC2' => 2)); $this->assertEquals(array('column-families' => array(), 'name' => 'CassandraTest2', 'placement-strategy' => 'org.apache.cassandra.locator.NetworkTopologyStrategy', 'placement-strategy-options' => array('DC2' => 2, 'DC1' => 2), 'replication-factor' => null), $this->cassandra->getKeyspaceSchema('CassandraTest2', false)); }
public function setup() { if (function_exists('apc_clear_cache')) { apc_clear_cache(); } $this->servers = array(array('host' => '127.0.0.1', 'port' => 9160)); $this->cassandra = Cassandra::createInstance($this->servers); $this->cassandra2 = Cassandra::createInstance($this->servers, 'Another'); if (!self::$setupComplete) { try { $this->cassandra->dropKeyspace('CassandraModelTest'); } catch (Exception $e) { } $this->cassandra->setMaxCallRetries(5); $this->cassandra->createKeyspace('CassandraModelTest'); $this->cassandra->useKeyspace('CassandraModelTest'); $this->cassandra->createStandardColumnFamily('CassandraModelTest', 'user', array(array('name' => 'email', 'type' => Cassandra::TYPE_UTF8), array('name' => 'name', 'type' => Cassandra::TYPE_UTF8, 'index-type' => Cassandra::INDEX_KEYS, 'index-name' => 'NameIdx'), array('name' => 'age', 'type' => Cassandra::TYPE_INTEGER, 'index-type' => Cassandra::INDEX_KEYS, 'index-name' => 'AgeIdx'))); /* $this->cassandra->createSuperColumnFamily( 'CassandraModelTest', 'cities', array( array( 'name' => 'population', 'type' => Cassandra::TYPE_INTEGER ), array( 'name' => 'comment', 'type' => Cassandra::TYPE_UTF8 ) ), Cassandra::TYPE_UTF8, Cassandra::TYPE_UTF8, Cassandra::TYPE_UTF8, 'Capitals supercolumn test', 1000, 1000, 0.5 ); */ self::$setupComplete = true; } else { $this->cassandra->useKeyspace('CassandraModelTest'); } $this->cassandra2->useKeyspace('CassandraModelTest'); }