ByteBuffer queryBytes = ByteBuffer.wrap(preparedSelQuery.getBytes(StandardCharsets.UTF_8)); CqlPreparedResult preparedResult = queryExecutor.prepare(queryBytes, rowsAscending.get(0), Compression.NONE); int queryId = preparedResult.getItemId();
@Before public void before() { CqlResult result = new CqlResult(); result.setRows(ImmutableList.of()); when(queryExecutor.execute(any(), any())).thenAnswer(invocation -> { Uninterruptibles.sleepUninterruptibly(queryDelayMillis, TimeUnit.MILLISECONDS); return result; }); CqlPreparedResult preparedResult = new CqlPreparedResult(); preparedResult.setItemId(1); when(queryExecutor.prepare(any(), any(), any())).thenReturn(preparedResult); when(queryExecutor.executePrepared(eq(1), any())).thenReturn(result); }
@Test public void getTimestampsForGivenRows() { String expected = "SELECT key, column1, column2 FROM \"foo__bar\"" + " WHERE key = ? LIMIT 100;"; int executorThreads = AtlasDbConstants.DEFAULT_SWEEP_CASSANDRA_READ_THREADS; executor.getTimestamps(TABLE_REF, ImmutableList.of(ROW, END_ROW), LIMIT, PTExecutors.newFixedThreadPool(executorThreads), executorThreads); verify(queryExecutor).prepare(argThat(byteBufferMatcher(expected)), eq(ROW), any()); verify(queryExecutor).executePrepared(eq(1), eq(ImmutableList.of(ByteBuffer.wrap(ROW)))); verify(queryExecutor).executePrepared(eq(1), eq(ImmutableList.of(ByteBuffer.wrap(END_ROW)))); }
ByteBuffer queryBytes = ByteBuffer.wrap(preparedSelQuery.getBytes(StandardCharsets.UTF_8)); CqlPreparedResult preparedResult = queryExecutor.prepare(queryBytes, rowsAscending.get(0), Compression.NONE); int queryId = preparedResult.getItemId();