* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.controller.clustering.it.provider.impl;
+import static com.google.common.base.Preconditions.checkState;
import static org.opendaylight.controller.clustering.it.provider.impl.AbstractTransactionHandler.ITEM;
-import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.SettableFuture;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Collection;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
-import javax.annotation.Nonnull;
-import org.opendaylight.controller.md.sal.dom.api.ClusteredDOMDataTreeChangeListener;
+import org.opendaylight.mdsal.dom.api.ClusteredDOMDataTreeChangeListener;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
import org.slf4j.LoggerFactory;
public class IdIntsListener implements ClusteredDOMDataTreeChangeListener {
-
private static final Logger LOG = LoggerFactory.getLogger(IdIntsListener.class);
private static final long SECOND_AS_NANO = 1000000000;
- private volatile NormalizedNode<?, ?> localCopy;
+ private volatile NormalizedNode localCopy;
private final AtomicLong lastNotifTimestamp = new AtomicLong(0);
private ScheduledExecutorService executorService;
private ScheduledFuture<?> scheduledFuture;
@Override
- public void onDataTreeChanged(@Nonnull final Collection<DataTreeCandidate> changes) {
+ public void onInitialData() {
+ // Intentional no-op
+ }
+
+ @Override
+ public void onDataTreeChanged(final Collection<DataTreeCandidate> changes) {
// There should only be one candidate reported
- Preconditions.checkState(changes.size() == 1);
+ checkState(changes.size() == 1);
lastNotifTimestamp.set(System.nanoTime());
return localCopy != null;
}
- public boolean checkEqual(final NormalizedNode<?, ?> expected) {
+ public boolean checkEqual(final NormalizedNode expected) {
return localCopy.equals(expected);
}
@SuppressFBWarnings("BC_UNCONFIRMED_CAST")
- public String diffWithLocalCopy(final NormalizedNode<?, ?> expected) {
+ public String diffWithLocalCopy(final NormalizedNode expected) {
return diffNodes((MapNode)expected, (MapNode)localCopy);
}
final YangInstanceIdentifier.NodeIdentifier itemNodeId = new YangInstanceIdentifier.NodeIdentifier(ITEM);
Map<NodeIdentifierWithPredicates, MapEntryNode> expIdIntMap = new HashMap<>();
- expected.getValue().forEach(node -> expIdIntMap.put(node.getIdentifier(), node));
+ expected.body().forEach(node -> expIdIntMap.put(node.getIdentifier(), node));
- actual.getValue().forEach(actIdInt -> {
+ actual.body().forEach(actIdInt -> {
final MapEntryNode expIdInt = expIdIntMap.remove(actIdInt.getIdentifier());
if (expIdInt == null) {
builder.append('\n').append(" Unexpected id-int entry for ").append(actIdInt.getIdentifier());
}
Map<NodeIdentifierWithPredicates, MapEntryNode> expItemMap = new HashMap<>();
- ((MapNode)expIdInt.getChild(itemNodeId).get()).getValue()
+ ((MapNode)expIdInt.findChildByArg(itemNodeId).get()).body()
.forEach(node -> expItemMap.put(node.getIdentifier(), node));
- ((MapNode)actIdInt.getChild(itemNodeId).get()).getValue().forEach(actItem -> {
+ ((MapNode)actIdInt.findChildByArg(itemNodeId).get()).body().forEach(actItem -> {
final MapEntryNode expItem = expItemMap.remove(actItem.getIdentifier());
if (expItem == null) {
builder.append('\n').append(" Unexpected item entry ").append(actItem.getIdentifier())