private function assert(RetryPolicy $policy, $key, $numberOfAsserts, $consistency, $retries = self::NUMBER_OF_TIMEOUT_EXCEPTIONS)
{
try {
// Select the values
$query = "SELECT value_int FROM {$this->tableNamePrefix} WHERE key = {$key}";
$statement = new SimpleStatement($query);
$options = new ExecutionOptions(array("consistency" => $consistency, "retry_policy" => $policy));
$rows = $this->session->execute($statement, $options);
// Assert the values
$this->assertCount($numberOfAsserts, $rows);
foreach ($rows as $i => $row) {
$this->assertEquals($i + 1, $row["value_int"]);
}
} catch (Exception\TimeoutException $te) {
if (Integration::isDebug()) {
fprintf(STDOUT, "Assert TimeoutException: %s (%s:%d)" . PHP_EOL, $te->getMessage(), $te->getFile(), $te->getLine());
}
if ($retries > 0) {
$this->assert($policy, $key, $numberOfAsserts, $consistency, $retries - 1);
} else {
throw $te;
}
}
}