@Test public void testProcessDocsByStatus() { expect(supportMock.getPreparedQuery("somequery")).andReturn(statementMock); expect(scanner.getName()).andReturn("foo"); expect(statementMock.bind("foo")).andReturn(bsMock); expect(supportMock.getSession()).andReturn(sessionMock); expect(sessionMock.execute(bsMock)).andReturn(rsMock); expect(rsMock.iterator()).andReturn(iterMock); expect(iterMock.hasNext()).andReturn(true).times(1); expect(iterMock.hasNext()).andReturn(false).times(1); expect(iterMock.next()).andReturn(rowMock); expect(rowMock.getString(0)).andReturn("foobarId"); expect(scanner.fetchById("foobarId")).andReturn(Optional.of(docMock)); scanner.docFound(docMock); replay(); scanner.processDocsByStatus(supportMock, "somequery"); }
void processDocsByStatus(CassandraSupport cassandra, String findForScannerQ) { PreparedStatement pq = cassandra.getPreparedQuery(findForScannerQ); BoundStatement bs = pq.bind(getName()); ResultSet rs = cassandra.getSession().execute(bs); log.info("found {} using {}", rs, findForScannerQ); int i=0; for (Row r : rs) { i++; fetchById(r.getString(0)).ifPresent(this::docFound); } log.info("updated {} FTI records", i); }
ScannerImpl extends StepImpl implements Scanner { void processDocsByStatus(CassandraSupport cassandra, String findForScannerQ) { PreparedStatement pq = cassandra.getPreparedQuery(findForScannerQ); BoundStatement bs = pq.bind(getName()); ResultSet rs = cassandra.getSession().execute(bs); log.info("found {} using {}", rs, findForScannerQ); int i=0; for (Row r : rs) { i++; fetchById(r.getString(0)).ifPresent(this::docFound); } log.info("updated {} FTI records", i); } }
ScannerImpl extends StepImpl implements Scanner { void processDocsByStatus(CassandraSupport cassandra, String findForScannerQ) { PreparedStatement pq = cassandra.getPreparedQuery(findForScannerQ); BoundStatement bs = pq.bind(getName()); ResultSet rs = cassandra.getSession().execute(bs); log.info("found {} using {}", rs, findForScannerQ); int i=0; for (Row r : rs) { i++; fetchById(r.getString(0)).ifPresent(this::docFound); } log.info("updated {} FTI records", i); } protected  ScannerImpl(); }
ScannerImpl extends StepImpl implements Scanner { void processDocsByStatus(CassandraSupport cassandra, String findForScannerQ) { PreparedStatement pq = cassandra.getPreparedQuery(findForScannerQ); BoundStatement bs = pq.bind(getName()); ResultSet rs = cassandra.getSession().execute(bs); log.info("found {} using {}", rs, findForScannerQ); int i=0; for (Row r : rs) { i++; fetchById(r.getString(0)).ifPresent(this::docFound); } log.info("updated {} FTI records", i); } 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 processDocsByStatus(CassandraSupport cassandra, String findForScannerQ) { PreparedStatement pq = cassandra.getPreparedQuery(findForScannerQ); BoundStatement bs = pq.bind(getName()); ResultSet rs = cassandra.getSession().execute(bs); log.info("found {} using {}", rs, findForScannerQ); int i=0; for (Row r : rs) { i++; fetchById(r.getString(0)).ifPresent(this::docFound); } log.info("updated {} FTI records", i); } 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; }