import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import com.google.common.base.Optional;
+import java.io.IOException;
import org.junit.Before;
import org.junit.Test;
+import org.opendaylight.controller.cluster.datastore.persisted.CommitTransactionPayload;
import org.opendaylight.controller.cluster.datastore.utils.SerializationUtils;
import org.opendaylight.controller.md.cluster.datastore.model.CarsModel;
import org.opendaylight.controller.md.cluster.datastore.model.PeopleModel;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.slf4j.LoggerFactory;
-public class ShardRecoveryCoordinatorTest {
+public class ShardRecoveryCoordinatorTest extends AbstractTest {
private ShardDataTree peopleDataTree;
private SchemaContext peopleSchemaContext;
peopleDataTree = new ShardDataTree(peopleSchemaContext, TreeType.OPERATIONAL);
}
+ @Deprecated
@Test
public void testAppendRecoveredLogEntryDataTreeCandidatePayload(){
final ShardRecoveryCoordinator coordinator = new ShardRecoveryCoordinator(peopleDataTree,
coordinator.applyCurrentLogRecoveryBatch();
}
+ @Test
+ public void testAppendRecoveredLogEntryCommitTransactionPayload() throws IOException {
+ final ShardRecoveryCoordinator coordinator = new ShardRecoveryCoordinator(peopleDataTree,
+ peopleSchemaContext, null, "foobar", LoggerFactory.getLogger("foo"));
+ coordinator.startLogRecoveryBatch(10);
+ try {
+ coordinator.appendRecoveredLogEntry(CommitTransactionPayload.create(nextTransactionId(), createCar()));
+ } catch(final SchemaValidationFailedException e){
+ fail("SchemaValidationFailedException should not happen if pruning is done");
+ }
+
+ coordinator.applyCurrentLogRecoveryBatch();
+ }
+
@Test
public void testApplyRecoverySnapshot(){
final ShardRecoveryCoordinator coordinator = new ShardRecoveryCoordinator(peopleDataTree,