X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FDistributedDataStoreIntegrationTest.java;h=e5b14b021e64aa770691aaf06e647ecc4ae4b3f3;hp=5bd67b4ed45ca95ea63a2da9e99292be9898faea;hb=aafb8cb044e992dd784d1f4f66508599cc4cd588;hpb=2f77e92af7a68b4a97dbfb709c6cc9b11a49878a diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java index 5bd67b4ed4..e5b14b021e 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java @@ -31,7 +31,9 @@ import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.Uninterruptibles; import com.typesafe.config.ConfigFactory; import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; import java.io.IOException; +import java.io.ObjectOutputStream; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; @@ -53,6 +55,7 @@ import org.opendaylight.controller.cluster.datastore.messages.FindLocalShard; import org.opendaylight.controller.cluster.datastore.messages.LocalShardFound; import org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot; import org.opendaylight.controller.cluster.datastore.persisted.MetadataShardDataTreeSnapshot; +import org.opendaylight.controller.cluster.datastore.persisted.PayloadVersion; import org.opendaylight.controller.cluster.datastore.persisted.ShardSnapshotState; import org.opendaylight.controller.cluster.datastore.utils.MockDataChangeListener; import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry; @@ -1271,12 +1274,9 @@ public class DistributedDataStoreIntegrationTest { new ShardSnapshotState(new MetadataShardDataTreeSnapshot(root)), Collections.emptyList(), 2, 1, 2, 1, 1, "member-1", null); - restoreFromSnapshot = new DatastoreSnapshot(name, null, - Arrays.asList( - new DatastoreSnapshot.ShardSnapshot("cars", - org.apache.commons.lang3.SerializationUtils.serialize(carsSnapshot)), - new DatastoreSnapshot.ShardSnapshot("people", - org.apache.commons.lang3.SerializationUtils.serialize(peopleSnapshot)))); + restoreFromSnapshot = new DatastoreSnapshot(name, null, Arrays.asList( + new DatastoreSnapshot.ShardSnapshot("cars", carsSnapshot), + new DatastoreSnapshot.ShardSnapshot("people", peopleSnapshot))); try (AbstractDataStore dataStore = setupDistributedDataStore(name, "module-shards-member1.conf", true, "cars", "people")) { @@ -1311,8 +1311,15 @@ public class DistributedDataStoreIntegrationTest { AbstractShardTest.writeToStore(dataTree, CarsModel.BASE_PATH, carsNode); NormalizedNode root = AbstractShardTest.readStore(dataTree, YangInstanceIdentifier.EMPTY); + MetadataShardDataTreeSnapshot shardSnapshot = new MetadataShardDataTreeSnapshot(root); final ByteArrayOutputStream bos = new ByteArrayOutputStream(); - new MetadataShardDataTreeSnapshot(root).serialize(bos); + try (final DataOutputStream dos = new DataOutputStream(bos)) { + PayloadVersion.BORON.writeTo(dos); + try (ObjectOutputStream oos = new ObjectOutputStream(dos)) { + oos.writeObject(shardSnapshot); + } + } + final org.opendaylight.controller.cluster.raft.Snapshot snapshot = org.opendaylight.controller.cluster.raft.Snapshot.create(bos.toByteArray(), Collections.emptyList(), 2, 1, 2, 1, 1, "member-1", null);