Revert "Leader should always apply modifications as local"
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / ShardRecoveryCoordinatorTest.java
index 142af6f5ed10297c0cf32a6a6c6f8f3457768e1f..4ad48a1d8301de1a19a70349cae12e1cacb798bd 100644 (file)
@@ -29,6 +29,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeConfiguration;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
 import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
 import org.opendaylight.yangtools.yang.data.impl.schema.tree.SchemaValidationFailedException;
@@ -57,7 +58,8 @@ public class ShardRecoveryCoordinatorTest extends AbstractTest {
     }
 
     @Test
-    public void testAppendRecoveredLogEntryCommitTransactionPayload() throws IOException {
+    public void testAppendRecoveredLogEntryCommitTransactionPayload() throws IOException,
+            DataValidationFailedException {
         try {
             coordinator.appendRecoveredLogEntry(CommitTransactionPayload.create(nextTransactionId(), createCar()));
         } catch (final SchemaValidationFailedException e) {
@@ -68,7 +70,7 @@ public class ShardRecoveryCoordinatorTest extends AbstractTest {
     }
 
     @Test
-    public void testApplyRecoverySnapshot() {
+    public void testApplyRecoverySnapshot() throws DataValidationFailedException {
         coordinator.applyRecoverySnapshot(createSnapshot());
 
         assertFalse(readCars(peopleDataTree).isPresent());
@@ -85,7 +87,7 @@ public class ShardRecoveryCoordinatorTest extends AbstractTest {
         }
     }
 
-    private DataTreeCandidate createCar() {
+    private DataTreeCandidate createCar() throws DataValidationFailedException {
         final DataTree dataTree = new InMemoryDataTreeFactory().create(
             DataTreeConfiguration.DEFAULT_OPERATIONAL, carsSchemaContext);
 
@@ -114,7 +116,7 @@ public class ShardRecoveryCoordinatorTest extends AbstractTest {
         return shardDataTree.readNode(PeopleModel.BASE_PATH);
     }
 
-    private static ShardSnapshotState createSnapshot() {
+    private static ShardSnapshotState createSnapshot() throws DataValidationFailedException {
         final DataTree dataTree = new InMemoryDataTreeFactory().create(
             DataTreeConfiguration.DEFAULT_OPERATIONAL, SchemaContextHelper.select(SchemaContextHelper.CARS_YANG,
                 SchemaContextHelper.PEOPLE_YANG));
@@ -129,6 +131,6 @@ public class ShardRecoveryCoordinatorTest extends AbstractTest {
         dataTree.commit(dataTree.prepare(modification));
 
         return new ShardSnapshotState(new MetadataShardDataTreeSnapshot(dataTree.takeSnapshot().readNode(
-                YangInstanceIdentifier.EMPTY).get()));
+                YangInstanceIdentifier.empty()).get()));
     }
 }