use of com.datastax.driver.core.StatementWrapperTest.CustomStatement in project java-driver by datastax.
the class QueryLoggerTest method should_log_wrapped_bound_statement.
@CassandraVersion("2.0.0")
@Test(groups = "short")
public void should_log_wrapped_bound_statement() throws Exception {
// given
normal.setLevel(TRACE);
queryLogger = QueryLogger.builder().withConstantThreshold(Long.MAX_VALUE).withMaxQueryStringLength(Integer.MAX_VALUE).build();
cluster().register(queryLogger);
// when
String query = "UPDATE test SET c_text = :param1 WHERE pk = :param2";
PreparedStatement ps = session().prepare(query);
BoundStatement bs = ps.bind();
bs.setString("param1", "foo");
bs.setInt("param2", 42);
session().execute(new CustomStatement(bs));
// then
String line = normalAppender.waitAndGet(10000);
assertThat(line).contains("Query completed normally").contains(ipOfNode(1)).contains(query).contains("param2:42").contains("param1:'foo'");
}
Aggregations