NormalizedNodeAggregator should also report empty
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / persisted / AbstractVersionedShardDataTreeSnapshot.java
index 2712b24fa7933160d483031d8fbe065f188656dc..5e85434e4aa38bba477a3b64bc470a961be317f8 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.cluster.datastore.persisted;
 
-import com.google.common.base.Verify;
+import static com.google.common.base.Verify.verifyNotNull;
+
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
@@ -30,10 +31,8 @@ abstract class AbstractVersionedShardDataTreeSnapshot extends ShardDataTreeSnaps
     static @NonNull ShardSnapshotState versionedDeserialize(final ObjectInput in) throws IOException {
         final PayloadVersion version = PayloadVersion.readFrom(in);
         switch (version) {
-            case BORON:
-            case NEON_SR2:
-                return new ShardSnapshotState(readSnapshot(in), true);
             case SODIUM_SR1:
+                return new ShardSnapshotState(readSnapshot(in), true);
             case MAGNESIUM:
                 return new ShardSnapshotState(readSnapshot(in), false);
             case TEST_FUTURE_VERSION:
@@ -41,7 +40,7 @@ abstract class AbstractVersionedShardDataTreeSnapshot extends ShardDataTreeSnaps
                 // These versions are never returned and this code is effectively dead
             default:
                 // Not included as default in above switch to ensure we get warnings when new versions are added
-                throw new IOException("Encountered unhandled version" + version);
+                throw new IOException("Encountered unhandled version " + version);
         }
     }
 
@@ -56,8 +55,8 @@ abstract class AbstractVersionedShardDataTreeSnapshot extends ShardDataTreeSnaps
     }
 
     @Override
-    public final Optional<NormalizedNode<?, ?>> getRootNode() {
-        return Optional.of(Verify.verifyNotNull(rootNode(), "Snapshot %s returned non-present root node", getClass()));
+    public final Optional<NormalizedNode> getRootNode() {
+        return Optional.of(verifyNotNull(rootNode(), "Snapshot %s returned non-present root node", getClass()));
     }
 
     /**
@@ -65,7 +64,7 @@ abstract class AbstractVersionedShardDataTreeSnapshot extends ShardDataTreeSnaps
      *
      * @return The root node.
      */
-    abstract @NonNull NormalizedNode<?, ?> rootNode();
+    abstract @NonNull NormalizedNode rootNode();
 
     /**
      * Return the snapshot payload version. Implementations of this method should return a constant.
@@ -76,11 +75,9 @@ abstract class AbstractVersionedShardDataTreeSnapshot extends ShardDataTreeSnaps
 
     private void versionedSerialize(final ObjectOutput out, final PayloadVersion version) throws IOException {
         switch (version) {
-            case BORON:
-            case NEON_SR2:
             case SODIUM_SR1:
             case MAGNESIUM:
-                // Boron, NeonSR2, Sodium and Magnesium snapshots use Java Serialization, but differ in stream format
+                // Sodium and Magnesium snapshots use Java Serialization, but differ in stream format
                 out.writeObject(this);
                 return;
             case TEST_FUTURE_VERSION: