+ ShardDataTree dataTree = new ShardDataTree(SchemaContextHelper.full(), TreeType.OPERATIONAL);
+ AbstractShardTest.writeToStore(dataTree, CarsModel.BASE_PATH, carsNode);
+ NormalizedNode<?, ?> root = AbstractShardTest.readStore(dataTree.getDataTree(),
+ YangInstanceIdentifier.EMPTY);
+
+ Snapshot carsSnapshot = Snapshot.create(SerializationUtils.serializeNormalizedNode(root),
+ Collections.<ReplicatedLogEntry>emptyList(), 2, 1, 2, 1, 1, "member-1");
+
+ NormalizedNode<?, ?> peopleNode = PeopleModel.create();
+ dataTree = new ShardDataTree(SchemaContextHelper.full(), TreeType.OPERATIONAL);
+ AbstractShardTest.writeToStore(dataTree, PeopleModel.BASE_PATH, peopleNode);
+ root = AbstractShardTest.readStore(dataTree.getDataTree(), YangInstanceIdentifier.EMPTY);
+
+ Snapshot peopleSnapshot = Snapshot.create(SerializationUtils.serializeNormalizedNode(root),
+ Collections.<ReplicatedLogEntry>emptyList(), 2, 1, 2, 1, 1, "member-1");
+
+ 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))));
+
+ try (DistributedDataStore dataStore = setupDistributedDataStore(name, "module-shards-member1.conf",
+ true, "cars", "people")) {
+
+ DOMStoreReadTransaction readTx = dataStore.newReadOnlyTransaction();
+
+ Optional<NormalizedNode<?, ?>> optional = readTx.read(CarsModel.BASE_PATH).get(5, TimeUnit.SECONDS);
+ assertEquals("isPresent", true, optional.isPresent());
+ assertEquals("Data node", carsNode, optional.get());
+
+ optional = readTx.read(PeopleModel.BASE_PATH).get(5, TimeUnit.SECONDS);
+ assertEquals("isPresent", true, optional.isPresent());
+ assertEquals("Data node", peopleNode, optional.get());
+ }
+ }};
+ }