/** * Ensures that payloads can still be set individually on bound statements if the prepared * statement does not have a default payload. */ @Test(groups = "short") public void should_not_set_any_payload_on_bound_statement() throws Exception { RegularStatement statement = new SimpleStatement("SELECT c2 as col3 FROM t1 where c1 = ?"); PreparedStatement ps = session().prepare(statement); assertThat(ps.getOutgoingPayload()).isNull(); assertThat(ps.getIncomingPayload()).isNull(); // bound statement should not have outgoing payload BoundStatement bs = ps.bind(1); assertThat(bs.getOutgoingPayload()).isNull(); // explicitly set a payload for this boudn statement only bs.setOutgoingPayload(payload1); ResultSet rows = session().execute(bs); Map<String, ByteBuffer> actual = rows.getExecutionInfo().getIncomingPayload(); assertThat(actual).isEqualTo(payload1); // a second bound statement should not have any payload bs = ps.bind(); assertThat(bs.getOutgoingPayload()).isNull(); bs.setInt(0, 1); rows = session().execute(bs); actual = rows.getExecutionInfo().getIncomingPayload(); assertThat(actual).isNull(); }
@Test public void getValueMapWithClass() { valueMap.put("foo", "not a map"); assertThat(valueMap.getValueMap("foo", Traits.class)).isNull(); }
/** * Ensures that payloads can still be set individually on bound statements if the prepared * statement does not have a default payload. */ @Test(groups = "short") public void should_not_set_any_payload_on_bound_statement() throws Exception { RegularStatement statement = new SimpleStatement("SELECT c2 as col3 FROM t1 where c1 = ?"); PreparedStatement ps = session().prepare(statement); assertThat(ps.getOutgoingPayload()).isNull(); assertThat(ps.getIncomingPayload()).isNull(); // bound statement should not have outgoing payload BoundStatement bs = ps.bind(1); assertThat(bs.getOutgoingPayload()).isNull(); // explicitly set a payload for this boudn statement only bs.setOutgoingPayload(payload1); ResultSet rows = session().execute(bs); Map<String, ByteBuffer> actual = rows.getExecutionInfo().getIncomingPayload(); assertThat(actual).isEqualTo(payload1); // a second bound statement should not have any payload bs = ps.bind(); assertThat(bs.getOutgoingPayload()).isNull(); bs.setInt(0, 1); rows = session().execute(bs); actual = rows.getExecutionInfo().getIncomingPayload(); assertThat(actual).isNull(); }