public void clearActivityLog() { for (Scassandra node : sCluster.nodes()) { node.activityClient().clearAllRecordedActivity(); } }
public void clearActivityLog() { for (Scassandra node : sCluster.nodes()) { node.activityClient().clearAllRecordedActivity(); } }
protected void assertQueried(int hostNumber, int times) { assertThat(scassandras.node(hostNumber).activityClient().retrieveQueries()).hasSize(times); }
@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()); }
public BatchExecution executeBatch( Session session, String statement, ConsistencyLevel level, ConsistencyLevel serialLevel) { BatchStatement batch = new BatchStatement(); batch.add(new SimpleStatement(statement)); if (level != null) { batch.setConsistencyLevel(level); } if (serialLevel != null) { batch.setSerialConsistencyLevel(serialLevel); } session.execute(batch); List<BatchExecution> batches = sCluster.node(1).activityClient().retrieveBatches(); assertEquals(batches.size(), 1); return batches.get(0); }
public PreparedStatementExecution executePrepared( Session session, String statement, ConsistencyLevel level, ConsistencyLevel serialLevel) { PreparedStatement ps = session.prepare(statement); BoundStatement bound = ps.bind(); if (level != null) { bound.setConsistencyLevel(level); } if (serialLevel != null) { bound.setSerialConsistencyLevel(serialLevel); } session.execute(bound); List<PreparedStatementExecution> pses = sCluster.node(1).activityClient().retrievePreparedStatementExecutions(); PreparedStatementExecution pse = pses.get(0); assertTrue(pse.getPreparedStatementText().equals(statement)); return pse; }
public Query executeSimple( Session session, String statement, ConsistencyLevel level, ConsistencyLevel serialLevel) { SimpleStatement simpleStatement = new SimpleStatement(statement); if (level != null) { simpleStatement.setConsistencyLevel(level); } if (serialLevel != null) { simpleStatement.setSerialConsistencyLevel(serialLevel); } session.execute(simpleStatement); // Find the unique query in the activity log. List<Query> queries = sCluster.node(1).activityClient().retrieveQueries(); for (Query query : queries) { if (query.getQuery().equals(statement)) return query; } return null; }
public ActivityClient activityClient() { return scassandra.activityClient(); } }
public void validatePrepared(boolean expectAll) { // Prepare the statement String query = "select sansa_stark from the_known_world"; PreparedStatement statement = session.prepare(query); assertThat(cluster.manager.preparedQueries).containsValue(statement); // Ensure prepared properly based on expectation. List<PreparedStatementPreparation> preparationOne = scassandra.node(1).activityClient().retrievePreparedStatementPreparations(); List<PreparedStatementPreparation> preparationTwo = scassandra.node(2).activityClient().retrievePreparedStatementPreparations(); List<PreparedStatementPreparation> preparationThree = scassandra.node(3).activityClient().retrievePreparedStatementPreparations(); assertThat(preparationOne).hasSize(1); assertThat(preparationOne.get(0).getPreparedStatementText()).isEqualTo(query); if (expectAll) { assertThat(preparationTwo).hasSize(1); assertThat(preparationTwo.get(0).getPreparedStatementText()).isEqualTo(query); assertThat(preparationThree).hasSize(1); assertThat(preparationThree.get(0).getPreparedStatementText()).isEqualTo(query); } else { assertThat(preparationTwo).isEmpty(); assertThat(preparationThree).isEmpty(); } }
scassandra.node(1).activityClient().retrievePreparedStatementPreparations(); scassandra.node(1).activityClient().clearAllRecordedActivity(); scassandra.node(1).stop(); assertThat(cluster).host(1).goesDownWithin(10, TimeUnit.SECONDS); assertThat(cluster).host(1).comesUpWithin(60, TimeUnit.SECONDS); preparationOne = scassandra.node(1).activityClient().retrievePreparedStatementPreparations(); if (expectReprepare) { if (i == maxTries) throw e; scassandra.node(1).activityClient().clearAllRecordedActivity();
@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(); } }
node.activityClient().clearAllRecordedActivity();
@BeforeMethod(groups = "short") public void beforeMethod() { scassandra = ScassandraCluster.builder().withNodes(3).build(); scassandra.init(); queryOptions = new QueryOptions(); loadBalancingPolicy = new SortingLoadBalancingPolicy(); cluster = Cluster.builder() .addContactPoints(scassandra.address(2).getAddress()) .withPort(scassandra.getBinaryPort()) .withLoadBalancingPolicy(loadBalancingPolicy) .withQueryOptions(queryOptions) .withNettyOptions(nonQuietClusterCloseOptions) .build(); session = cluster.connect(); host1 = TestUtils.findHost(cluster, 1); host2 = TestUtils.findHost(cluster, 2); host3 = TestUtils.findHost(cluster, 3); // Make sure there are no prepares for (int host : Lists.newArrayList(1, 2, 3)) { assertThat(scassandra.node(host).activityClient().retrievePreparedStatementPreparations()) .hasSize(0); scassandra.node(host).activityClient().clearAllRecordedActivity(); } }
@BeforeMethod(groups = "short") public void beforeMethod() { scassandras = ScassandraCluster.builder().withNodes(3).build(); scassandras.init(); cluster = Cluster.builder() .addContactPoints(scassandras.address(1).getAddress()) .withPort(scassandras.getBinaryPort()) .withRetryPolicy(retryPolicy) .withLoadBalancingPolicy(new SortingLoadBalancingPolicy()) .withPoolingOptions( new PoolingOptions() .setCoreConnectionsPerHost(HostDistance.LOCAL, 1) .setMaxConnectionsPerHost(HostDistance.LOCAL, 1) .setHeartbeatIntervalSeconds(0)) .withNettyOptions(nonQuietClusterCloseOptions) // Mark everything as idempotent by default so RetryPolicy is exercised. .withQueryOptions(new QueryOptions().setDefaultIdempotence(true)) .build(); session = cluster.connect(); host1 = TestUtils.findHost(cluster, 1); host2 = TestUtils.findHost(cluster, 2); host3 = TestUtils.findHost(cluster, 3); errors = cluster.getMetrics().getErrorMetrics(); Mockito.reset(retryPolicy); for (Scassandra node : scassandras.nodes()) { node.activityClient().clearAllRecordedActivity(); } }
public void clearActivityLog() { for (Scassandra node : sCluster.nodes()) { node.activityClient().clearAllRecordedActivity(); } }
public void clearActivityLog() { for (Scassandra node : sCluster.nodes()) { node.activityClient().clearAllRecordedActivity(); } }
protected void assertQueried(int hostNumber, int times) { assertThat(scassandras.node(hostNumber).activityClient().retrieveQueries()).hasSize(times); }
@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()); }
public BatchExecution executeBatch( Session session, String statement, ConsistencyLevel level, ConsistencyLevel serialLevel) { BatchStatement batch = new BatchStatement(); batch.add(new SimpleStatement(statement)); if (level != null) { batch.setConsistencyLevel(level); } if (serialLevel != null) { batch.setSerialConsistencyLevel(serialLevel); } session.execute(batch); List<BatchExecution> batches = sCluster.node(1).activityClient().retrieveBatches(); assertEquals(batches.size(), 1); return batches.get(0); }
@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(); } }