
com.aconex.scrutineer.DeletionVerifier Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scrutineer Show documentation
Show all versions of scrutineer Show documentation
Compares 2 streams of Ids and Versions to prove that a secondary source is
in sync with a primary source of truth. Designed to verify an elasticsearch
cluster contains correct information from a JDBC source.
package com.aconex.scrutineer;
import java.util.Iterator;
public class DeletionVerifier {
private final IdAndVersionStream primaryStream;
private final ExistenceChecker existenceChecker;
private final IdAndVersionStreamVerifierListener listener;
public DeletionVerifier(IdAndVersionStream primaryStream, ExistenceChecker existenceChecker, IdAndVersionStreamVerifierListener listener) {
this.primaryStream = primaryStream;
this.existenceChecker = existenceChecker;
this.listener = listener;
}
public void verify() {
primaryStream.open();
try {
Iterator iterator = primaryStream.iterator();
iterateAndCheck(iterator);
} finally {
primaryStream.close();
}
}
private void iterateAndCheck(Iterator iterator) {
while (iterator.hasNext()) {
IdAndVersion idAndVersion = iterator.next();
if (existenceChecker.exists(idAndVersion)) {
listener.onMissingInPrimaryStream(idAndVersion);
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy