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(); } }
public PreparedStatementPreparation build() { if (preparedStatementText == null) { throw new IllegalStateException("Must set preparedStatementText in PreparedStatementPreparationBuilder"); } return new PreparedStatementPreparation(this.preparedStatementText); } }
assertThat(preparationOne.get(0).getPreparedStatementText()).isEqualTo(query); assertThat(preparationOne.get(0).getPreparedStatementText()).isEqualTo(query); break; } catch (AssertionError e) {
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(); } }
assertThat(preparationOne.get(0).getPreparedStatementText()).isEqualTo(query); assertThat(preparationOne.get(0).getPreparedStatementText()).isEqualTo(query); break; } catch (AssertionError e) {