コード例 #1
0
  private void testPrimingUnavailable(
      UnavailableConfig unavailableConfig, Consistency statementCL, Consistency expectedCL) {
    String query = "select * from people";
    PrimingRequest prime =
        PrimingRequest.queryBuilder()
            .withQuery(query)
            .withResult(unavailable)
            .withConfig(unavailableConfig)
            .build();
    primingClient.prime(prime);

    CassandraResult cassandraResult = cassandra().executeSimpleStatement(query, statementCL.name());

    CassandraResult.ResponseStatus status = cassandraResult.status();
    assertEquals(unavailable, status.getResult());
    assertEquals(expectedCL.name(), ((CassandraResult.UnavailableStatus) status).getConsistency());
    assertEquals(4, ((CassandraResult.UnavailableStatus) status).getRequiredAcknowledgements());
    assertEquals(3, ((CassandraResult.UnavailableStatus) status).getAlive());
  }
コード例 #2
0
  private void testPrimingWriteTimeout(
      WriteTimeoutConfig writeTimeoutConfig, Consistency statementCL, Consistency expectedCL) {
    String query = "select * from people";
    PrimingRequest prime =
        PrimingRequest.queryBuilder()
            .withQuery(query)
            .withResult(write_request_timeout)
            .withConfig(writeTimeoutConfig)
            .build();
    primingClient.prime(prime);

    CassandraResult cassandraResult = cassandra().executeSimpleStatement(query, statementCL.name());

    CassandraResult.ResponseStatus status = cassandraResult.status();
    assertEquals(write_request_timeout, status.getResult());
    assertEquals(expectedCL.name(), ((CassandraResult.WriteTimeoutStatus) status).getConsistency());
    assertEquals(2, ((CassandraResult.WriteTimeoutStatus) status).getReceivedAcknowledgements());
    assertEquals(3, ((CassandraResult.WriteTimeoutStatus) status).getRequiredAcknowledgements());
    assertEquals(BATCH_LOG, ((CassandraResult.WriteTimeoutStatus) status).getWriteTypePrime());
  }