@Test public void testAddToDirtyList() { expect(scanner.getCassandra()).andReturn(supportMock); expect(supportMock.getPreparedQuery("storedQueryName")).andReturn(statementMock); expect(scanner.getName()).andReturn("scannerName"); expect(statementMock.bind("scannerName")).andReturn(bsMock); expect(sessionMock.execute(bsMock)).andReturn(rsMock); List<Row> rows = new ArrayList<>(); rows.add(rowMock); expect(rsMock.all()).andReturn(rows); expect(rowMock.getString(0)).andReturn("idValue"); expect(rowMock.getString(1)).andReturn("scannerNameValue"); expect(scanner.createKey("idValue", "scannerNameValue")).andReturn(mockKey); replay(); List<ScannerImpl.DocKey> strandedDocs = new ArrayList<>(); scanner.addToDirtyList(sessionMock, strandedDocs,"storedQueryName"); assertTrue(strandedDocs.contains(mockKey)); }
void addToDirtyList(CqlSession session, List<DocKey> strandedDocs, String query) { PreparedStatement preparedQuery; BoundStatement statement; preparedQuery = getCassandra().getPreparedQuery(query); statement = preparedQuery.bind(getName()); ResultSet batchedRs = session.execute(statement); List<DocKey> batchedKeys = batchedRs.all().stream() .map((row) -> createKey(row.getString(0), row.getString(1))).collect(Collectors.toList()); if (log.isInfoEnabled()) { log.info("Found {} {} documents to mark RESTART: {}", batchedKeys.size(), query, batchedKeys); } strandedDocs.addAll(batchedKeys); }
ScannerImpl extends StepImpl implements Scanner { void addToDirtyList(CqlSession session, List<DocKey> strandedDocs, String query) { PreparedStatement preparedQuery; BoundStatement statement; preparedQuery = getCassandra().getPreparedQuery(query); statement = preparedQuery.bind(getName()); ResultSet batchedRs = session.execute(statement); List<DocKey> batchedKeys = batchedRs.all().stream() .map((row) -> createKey(row.getString(0), row.getString(1))).collect(Collectors.toList()); if (log.isInfoEnabled()) { log.info("Found {} {} documents to mark RESTART: {}", batchedKeys.size(), query, batchedKeys); } strandedDocs.addAll(batchedKeys); } }
ScannerImpl extends StepImpl implements Scanner { void addToDirtyList(CqlSession session, List<DocKey> strandedDocs, String query) { PreparedStatement preparedQuery; BoundStatement statement; preparedQuery = getCassandra().getPreparedQuery(query); statement = preparedQuery.bind(getName()); ResultSet batchedRs = session.execute(statement); List<DocKey> batchedKeys = batchedRs.all().stream() .map((row) -> createKey(row.getString(0), row.getString(1))).collect(Collectors.toList()); if (log.isInfoEnabled()) { log.info("Found {} {} documents to mark RESTART: {}", batchedKeys.size(), query, batchedKeys); } strandedDocs.addAll(batchedKeys); } protected  ScannerImpl(); }
ScannerImpl extends StepImpl implements Scanner { void addToDirtyList(CqlSession session, List<DocKey> strandedDocs, String query) { PreparedStatement preparedQuery; BoundStatement statement; preparedQuery = getCassandra().getPreparedQuery(query); statement = preparedQuery.bind(getName()); ResultSet batchedRs = session.execute(statement); List<DocKey> batchedKeys = batchedRs.all().stream() .map((row) -> createKey(row.getString(0), row.getString(1))).collect(Collectors.toList()); if (log.isInfoEnabled()) { log.info("Found {} {} documents to mark RESTART: {}", batchedKeys.size(), query, batchedKeys); } strandedDocs.addAll(batchedKeys); } protected  ScannerImpl(); @Override void activate(); @Override void deactivate(); void run(); @Override void sendToNext(Document doc); void docFound(Document doc); @Override Runnable getScanOperation(); @Override Optional<Document> fetchById(String id); @Override long getInterval(); @Override Step[] getSubsequentSteps(); @Override boolean add(Document document); @Override boolean offer(Document document); @Override Document remove(); @Override Document poll(); @Override Document element(); @Override Document peek(); @Override void put(Document document); @Override boolean offer(Document document, long timeout, TimeUnit unit); @Override Document take(); @Override Document poll(long timeout, TimeUnit unit); @Override int remainingCapacity(); @Override boolean remove(Object o); @Override boolean containsAll(Collection<?> c); @Override boolean addAll(Collection<? extends Document> c); @Override boolean removeAll(Collection<?> c); @Override boolean retainAll(Collection<?> c); @Override void clear(); @Override boolean contains(Object o); @Override Iterator<Document> iterator(); @Override Object[] toArray(); @Override T[] toArray(T[] a); @Override int drainTo(Collection<? super Document> c); @Override int drainTo(Collection<? super Document> c, int maxElements); @Override boolean isEmpty(); @Override void advertise(); @Override void stopAdvertising(); @Override void acceptJiniRequests(); @Override void denyJiniRequests(); @Override boolean readyForJiniRequests(); boolean isScanActive(); void scanStarted(); void scanFinished(); boolean isRemembering(); boolean isHashing(); CassandraSupport getCassandra(); void setCassandra(CassandraSupport cassandra); }
ScannerImpl extends StepImpl implements Scanner { void addToDirtyList(CqlSession session, List<DocKey> strandedDocs, String query) { PreparedStatement preparedQuery; BoundStatement statement; preparedQuery = getCassandra().getPreparedQuery(query); statement = preparedQuery.bind(getName()); ResultSet batchedRs = session.execute(statement); List<DocKey> batchedKeys = batchedRs.all().stream() .map((row) -> createKey(row.getString(0), row.getString(1))).collect(Collectors.toList()); if (log.isInfoEnabled()) { log.info("Found {} {} documents to mark RESTART: {}", batchedKeys.size(), query, batchedKeys); } strandedDocs.addAll(batchedKeys); } protected  ScannerImpl(); @Override void activate(); @Override void deactivate(); void run(); @Override void sendToNext(Document doc); void docFound(Document doc); @Override Runnable getScanOperation(); @Override Optional<Document> fetchById(String id); @Override long getInterval(); @Override Step[] getSubsequentSteps(); @Override boolean add(Document document); @Override boolean offer(Document document); @Override Document remove(); @Override Document poll(); @Override Document element(); @Override Document peek(); @Override void put(Document document); @Override boolean offer(Document document, long timeout, TimeUnit unit); @Override Document take(); @Override Document poll(long timeout, TimeUnit unit); @Override int remainingCapacity(); @Override boolean remove(Object o); @Override boolean containsAll(Collection<?> c); @Override boolean addAll(Collection<? extends Document> c); @Override boolean removeAll(Collection<?> c); @Override boolean retainAll(Collection<?> c); @Override void clear(); @Override boolean contains(Object o); @Override Iterator<Document> iterator(); @Override Object[] toArray(); @Override T[] toArray(T[] a); @Override int drainTo(Collection<? super Document> c); @Override int drainTo(Collection<? super Document> c, int maxElements); @Override boolean isEmpty(); @Override void advertise(); @Override void stopAdvertising(); @Override void acceptJiniRequests(); @Override void denyJiniRequests(); @Override boolean readyForJiniRequests(); boolean isScanActive(); void scanStarted(); void scanFinished(); boolean isRemembering(); boolean isHashing(); CassandraSupport getCassandra(); void setCassandra(CassandraSupport cassandra); static final int DEF_MAX_ERROR_RETRY; static final String FOR_SCANNER; static final String RESET_DOCS_U; static final String UPDATE_HASH_U; }