Codota Logo
Scassandra.primingClient
Code IndexAdd Codota to your IDE (free)

How to use
primingClient
method
in
org.scassandra.Scassandra

Best Java code snippets using org.scassandra.Scassandra.primingClient (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
LocalDateTime l =
  • Codota Iconnew LocalDateTime()
  • Codota IconLocalDateTime.now()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseLocalDateTime(text)
  • Smart code suggestions by Codota
}
origin: com.datastax.cassandra/cassandra-driver-core

@AfterMethod(groups = "short", alwaysRun = true)
public void afterMethod() {
 for (Scassandra node : scassandras.nodes()) {
  node.primingClient().clearAllPrimes();
 }
 if (cluster != null) cluster.close();
}
origin: com.datastax.cassandra/cassandra-driver-core

@BeforeClass(groups = {"short", "long"})
public void beforeTestClass() {
 scassandra = TestUtils.createScassandraServer();
 scassandra.start();
 primingClient = scassandra.primingClient();
 activityClient = scassandra.activityClient();
 currentClient = scassandra.currentClient();
 hostAddress = new InetSocketAddress(ip, scassandra.getBinaryPort());
}
origin: com.datastax.cassandra/cassandra-driver-core

@Test(groups = "short")
public void should_fail_if_host_fails_query() {
 String query = "mock";
 sCluster
   .node(1)
   .primingClient()
   .prime(
     PrimingRequest.queryBuilder()
       .withQuery(query)
       .withThen(then().withResult(Result.unavailable))
       .build());
 // given a statement with a host configured to fail the given query.
 Host host1 = TestUtils.findHost(cluster, 1);
 Statement statement = new SimpleStatement(query).setHost(host1);
 try {
  // when statement is executed an error should be raised.
  session.execute(statement);
  fail("Query should have failed");
 } catch (NoHostAvailableException e) {
  // then the request should fail with a NHAE and no host was tried.
  assertThat(e.getErrors()).hasSize(1);
  assertThat(e.getErrors().values().iterator().next()).isInstanceOf(UnavailableException.class);
 } finally {
  verifyNoLbpInteractions();
 }
}
origin: com.datastax.cassandra/cassandra-driver-core

 @Test(groups = "short")
 public void should_countdown_inflight_requests_metrics() {
  sCluster
    .node(1)
    .primingClient()
    .prime(PrimingRequest.queryBuilder().withQuery("mock query").withThen(then()).build());

  Cluster cluster = null;
  try {
   cluster = builder().build();
   Session session = cluster.connect();

   assertThat(cluster.getMetrics().getInFlightRequests().getValue()).isEqualTo(0);
   session.executeAsync("mock query").getUninterruptibly();
   session.executeAsync("mock query").getUninterruptibly();
   assertThat(cluster.getMetrics().getInFlightRequests().getValue()).isEqualTo(0);

  } finally {
   if (cluster != null) {
    cluster.close();
   }
  }
 }
}
origin: com.datastax.cassandra/cassandra-driver-core

@Test(groups = "short")
public void should_count_inflight_requests_metrics() {
 sCluster
   .node(1)
   .primingClient()
   .prime(
     PrimingRequest.queryBuilder()
       .withQuery("mock query")
       .withThen(then().withFixedDelay(100000L))
       .build());
 Cluster cluster = null;
 try {
  cluster = builder().build();
  Session session = cluster.connect();
  assertThat(cluster.getMetrics().getInFlightRequests().getValue()).isEqualTo(0);
  session.executeAsync("mock query");
  session.executeAsync("mock query");
  assertThat(cluster.getMetrics().getInFlightRequests().getValue()).isEqualTo(2);
 } finally {
  if (cluster != null) {
   cluster.close();
  }
 }
}
origin: com.datastax.cassandra/cassandra-driver-core

@Test(groups = "short")
public void should_retry_on_client_timeout_if_statement_idempotent() {
 cluster.getConfiguration().getSocketOptions().setReadTimeoutMillis(1);
 try {
  scassandras
    .node(1)
    .primingClient()
    .prime(
      PrimingRequest.queryBuilder()
        .withQuery("mock query")
        .withThen(then().withFixedDelay(1000L).withRows(row("result", "result1")))
        .build());
  session.execute(new SimpleStatement("mock query").setIdempotent(true));
  assertOnRequestErrorWasCalled(1, OperationTimedOutException.class);
  assertThat(errors.getClientTimeouts().getCount()).isEqualTo(1);
  assertThat(errors.getRetries().getCount()).isEqualTo(1);
  assertThat(errors.getRetriesOnClientTimeout().getCount()).isEqualTo(1);
  assertQueried(1, 1);
  assertQueried(2, 1);
  assertQueried(3, 0);
 } finally {
  cluster
    .getConfiguration()
    .getSocketOptions()
    .setReadTimeoutMillis(SocketOptions.DEFAULT_READ_TIMEOUT_MILLIS);
 }
}
origin: com.datastax.cassandra/cassandra-driver-core

scassandras
  .node(1)
  .primingClient()
  .prime(
    PrimingRequest.queryBuilder()
origin: com.datastax.cassandra/cassandra-driver-core

scassandras
  .node(1)
  .primingClient()
  .prime(
    PrimingRequest.queryBuilder()
origin: com.datastax.cassandra/cassandra-driver-core

protected void simulateError(int hostNumber, Result result) {
 scassandras
   .node(hostNumber)
   .primingClient()
   .prime(
     PrimingRequest.queryBuilder()
       .withQuery("mock query")
       .withThen(then().withResult(result))
       .build());
}
origin: com.datastax.cassandra/cassandra-driver-core

@Test(groups = "short")
public void should_not_start_speculative_execution_if_first_execution_completes_successfully() {
 scassandras
   .node(1)
   .primingClient()
   .prime(
     PrimingRequest.queryBuilder()
       .withQuery("mock query")
       .withThen(then().withRows(row("result", "result1")))
       .build());
 long execStartCount = errors.getSpeculativeExecutions().getCount();
 ResultSet rs = session.execute("mock query");
 Row row = rs.one();
 assertThat(row.getString("result")).isEqualTo("result1");
 assertThat(errors.getSpeculativeExecutions().getCount()).isEqualTo(execStartCount);
 ExecutionInfo executionInfo = rs.getExecutionInfo();
 assertThat(executionInfo.getTriedHosts()).containsOnly(host1);
 assertThat(executionInfo.getQueriedHost()).isEqualTo(host1);
 assertThat(executionInfo.getSpeculativeExecutions()).isEqualTo(0);
 assertThat(executionInfo.getSuccessfulExecutionIndex()).isEqualTo(0);
}
origin: com.datastax.cassandra/cassandra-driver-core

private void prime(int node, Result result) {
 sCluster
   .node(node)
   .primingClient()
   .prime(
     queryBuilder()
       .withQuery(QueryTracker.QUERY)
       .withThen(then().withResult(result))
       .build());
}
origin: com.datastax.cassandra/cassandra-driver-core

@BeforeMethod(groups = "short")
public void beforeMethod() {
 cluster =
   Cluster.builder()
     .addContactPoints(scassandras.address(1).getAddress())
     .withPort(scassandras.getBinaryPort())
     .withRetryPolicy(FallthroughRetryPolicy.INSTANCE)
     .build();
 session = cluster.connect();
 host1 = TestUtils.findHost(cluster, 1);
 errors = cluster.getMetrics().getErrorMetrics();
 for (Scassandra node : scassandras.nodes()) {
  node.primingClient().clearAllPrimes();
  node.activityClient().clearAllRecordedActivity();
 }
}
origin: com.datastax.cassandra/cassandra-driver-core

protected void simulateError(int hostNumber, Result result, Config config) {
 PrimingRequest.Then.ThenBuilder then = then().withResult(result);
 PrimingRequestBuilder builder = PrimingRequest.queryBuilder().withQuery("mock query");
 if (config != null) then = then.withConfig(config);
 builder = builder.withThen(then);
 scassandras.node(hostNumber).primingClient().prime(builder.build());
}
origin: com.datastax.cassandra/cassandra-driver-core

protected void simulateNormalResponse(int hostNumber) {
 scassandras
   .node(hostNumber)
   .primingClient()
   .prime(
     PrimingRequest.queryBuilder()
       .withQuery("mock query")
       .withThen(then().withRows(row("result", "result1")))
       .build());
}
origin: com.datastax.cassandra/cassandra-driver-core

@Test(groups = "short")
public void should_start_speculative_execution_if_first_execution_takes_too_long() {
 scassandras
   .node(1)
   .primingClient()
   .prime(
     PrimingRequest.queryBuilder()
       .withQuery("mock query")
       .withThen(then().withRows(row("result", "result1")).withFixedDelay(400L))
       .build());
 scassandras
   .node(2)
   .primingClient()
   .prime(
     PrimingRequest.queryBuilder()
       .withQuery("mock query")
       .withThen(then().withRows(row("result", "result2")))
       .build());
 long execStartCount = errors.getSpeculativeExecutions().getCount();
 ResultSet rs = session.execute("mock query");
 Row row = rs.one();
 assertThat(row.getString("result")).isEqualTo("result2");
 assertThat(errors.getSpeculativeExecutions().getCount()).isEqualTo(execStartCount + 1);
 ExecutionInfo executionInfo = rs.getExecutionInfo();
 // triedHosts does not contain host1 because the request to it had not completed yet
 assertThat(executionInfo.getTriedHosts()).containsOnly(host2);
 assertThat(executionInfo.getQueriedHost()).isEqualTo(host2);
 assertThat(executionInfo.getSpeculativeExecutions()).isEqualTo(1);
 assertThat(executionInfo.getSuccessfulExecutionIndex()).isEqualTo(1);
}
origin: com.datastax.cassandra/cassandra-driver-core

.primingClient()
.prime(
  PrimingRequest.queryBuilder()
.primingClient()
.prime(
  PrimingRequest.queryBuilder()
origin: com.datastax.cassandra/cassandra-driver-core

scassandras
  .node(1)
  .primingClient()
  .prime(
    PrimingRequest.queryBuilder()
origin: com.datastax.cassandra/cassandra-driver-core

  Collections.<Map<String, ?>>singletonList(ImmutableMap.of("key", 1));
scassandra
  .primingClient()
  .prime(
    PrimingRequest.queryBuilder()
origin: com.datastax.cassandra/cassandra-driver-core

scassandras
  .node(1)
  .primingClient()
origin: com.datastax.cassandra/cassandra-driver-core

.primingClient()
.primingClient()
.prime(
  PrimingRequest.queryBuilder()
.primingClient()
.prime(
  PrimingRequest.queryBuilder()
org.scassandraScassandraprimingClient

Javadoc

Retrieves a Priming client that is configured with the same admin port as Scassandra.

Popular methods of Scassandra

  • activityClient
    Retrieves an Activity client that is configured with the same admin port as Scassandra.
  • start
    Start Scassandra. This will result in both the binary port for Cassandra to be opened and the admin
  • stop
    Stops Scassandra.
  • currentClient
    Retrieves a Current client that is configured with the same admin port as Scassandra.
  • getAdminPort
    The port that Scassandars REST API is listening on. This is the port that Priming / Activity verific
  • getBinaryPort
    The port Scassandra is listening on for connections from Cassandra.

Popular in Java

  • Making http post requests using okhttp
  • runOnUiThread (Activity)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • putExtra (Intent)
  • MessageFormat (java.text)
    MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Pattern (java.util.regex)
    A compiled representation of a regular expression. A regular expression, specified as a string, must
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • Reference (javax.naming)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now