- @Override
- public void onDataChanged(final AsyncDataChangeEvent<InstanceIdentifier, NormalizedNode<?, ?>> change) {
- if (postSetup) {
- receivedChange.set(change);
+ ChangeEventListener(Function<DataTreeCandidate, Boolean>[] matchers) {
+ this.expChangeCount = matchers.length;
+ this.matchers = matchers;
+ }
+
+ Collection<DataTreeCandidate> changes() {
+ try {
+ Collection<DataTreeCandidate> changes = internalListener.future.get(10, TimeUnit.SECONDS);
+ Uninterruptibles.sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
+ return changes;
+ } catch (TimeoutException e) {
+ throw new AssertionError(String.format(
+ "Data tree change notifications not received. Expected: %s. Actual: %s - %s",
+ expChangeCount, accumulatedChanges.size(), accumulatedChanges), e);
+ } catch (InterruptedException | ExecutionException e) {
+ throw new AssertionError("Data tree change notifications failed", e);