/** * Create the table and client side timestamp session for the timestamp * tests. */ public function setUp() { // Process parent setup steps parent::setUp(); // Create the table $query = "CREATE TABLE {$this->tableNamePrefix} (key int PRIMARY KEY, value_int int)"; $this->session->execute(new SimpleStatement($query)); // Generate the insert and select queries $this->insertQuery = "INSERT INTO {$this->tableNamePrefix} (key, value_int) VALUES (?, ?)"; $this->selectQuery = "SELECT writeTime(value_int) FROM {$this->tableNamePrefix} WHERE key = ?"; // Create the connection for client side timestamps $cluster = \Cassandra::cluster()->withContactPoints(Integration::IP_ADDRESS)->withTimestampGenerator(new TimestampGenerator\Monotonic())->build(); $this->clientSideTimestampSession = $cluster->connect($this->keyspaceName); }
/** * Setup the schema metadata for the schema metadata tests. */ public function setUp() { // Process parent setup steps parent::setUp(); // Initialize the session schema metadata snapshot $this->schema = $this->session->schema(); }
public function setUp() { parent::setUp(); $statement = new SimpleStatement("CREATE TABLE {$this->tableNamePrefix} (key int PRIMARY KEY, value int)"); $this->session->execute($statement); $statement = new SimpleStatement("INSERT INTO {$this->tableNamePrefix} (key, value) VALUES (?, ?)"); for ($i = 0; $i < 10; $i++) { $options = new ExecutionOptions(array("arguments" => array($i, $i))); $this->session->execute($statement, $options); } }
/** * Setup the retry policy for multiple nodes. */ public function setUp() { // Ensure RF = 3 (anything greater than 1 is good) $this->replicationFactor = 3; // Process parent setup steps parent::setUp(); // Create the table $query = "CREATE TABLE {$this->tableNamePrefix} (key int, value_int int, PRIMARY KEY(key, value_int))"; $this->session->execute(new SimpleStatement($query)); // Create the insert query $this->insertQuery = "INSERT INTO {$this->tableNamePrefix} (key, value_int) VALUES (?, ?)"; }
/** * Setup the schema metadata for the schema metadata tests. */ public function setUp() { // Determine if UDA/UDF functionality should be enabled $testName = $this->getName(); if (strpos($testName, "UserDefined") !== false) { $this->isUserDefinedAggregatesFunctions = true; } // Process parent setup steps parent::setUp(); // Initialize the session schema metadata snapshot $this->schema = $this->session->schema(); }
/** * Create user types after initializing cluster and session */ protected function setUp() { parent::setUp(); foreach ($this->compositeCassandraTypes() as $cassandraType) { if ($cassandraType[0] instanceof Type\UserType) { $this->createUserType($cassandraType[0]); } } foreach ($this->nestedCassandraTypes() as $cassandraType) { if ($cassandraType[0] instanceof Type\UserType) { $this->createUserType($cassandraType[0]); } } }