import java.io.File;
import java.io.FileOutputStream;
-import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collections;
import org.apache.commons.lang3.SerializationUtils;
import org.opendaylight.controller.md.cluster.datastore.model.PeopleModel;
import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
+import org.opendaylight.yangtools.yang.common.Uint64;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeConfiguration;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
-
/**
* Unit tests for DatastoreSnapshotRestore.
*
newShardManagerSnapshot("config-one", "config-two"),
Arrays.asList(new DatastoreSnapshot.ShardSnapshot("config-one", newSnapshot(CarsModel.BASE_PATH,
CarsModel.newCarsNode(CarsModel.newCarsMapNode(CarsModel.newCarEntry("optima",
- BigInteger.valueOf(20000L)),CarsModel.newCarEntry("sportage",
- BigInteger.valueOf(30000L)))))),
+ Uint64.valueOf(20000)),CarsModel.newCarEntry("sportage", Uint64.valueOf(30000)))))),
new DatastoreSnapshot.ShardSnapshot("config-two", newSnapshot(PeopleModel.BASE_PATH,
PeopleModel.emptyContainer()))));
assertNull("Expected null DatastoreSnapshot", instance.getAndRemove("oper"));
}
- private static void assertDatastoreSnapshotEquals(DatastoreSnapshot expected, DatastoreSnapshot actual) {
+ private static void assertDatastoreSnapshotEquals(final DatastoreSnapshot expected,
+ final DatastoreSnapshot actual) {
assertNotNull("DatastoreSnapshot is null", actual);
assertEquals("getType", expected.getType(), actual.getType());
}
}
- private static void assertSnapshotEquals(String prefix, Snapshot expected, Snapshot actual) {
+ private static void assertSnapshotEquals(final String prefix, final Snapshot expected, final Snapshot actual) {
assertEquals(prefix + " lastIndex", expected.getLastIndex(), actual.getLastIndex());
assertEquals(prefix + " lastTerm", expected.getLastTerm(), actual.getLastTerm());
assertEquals(prefix + " lastAppliedIndex", expected.getLastAppliedIndex(), actual.getLastAppliedIndex());
((ShardSnapshotState)actual.getState()).getSnapshot().getRootNode());
}
- private static ShardManagerSnapshot newShardManagerSnapshot(String... shards) {
+ private static ShardManagerSnapshot newShardManagerSnapshot(final String... shards) {
return new ShardManagerSnapshot(Arrays.asList(shards), Collections.emptyMap());
}
- private static Snapshot newSnapshot(YangInstanceIdentifier path, NormalizedNode<?, ?> node)
+ private static Snapshot newSnapshot(final YangInstanceIdentifier path, final NormalizedNode<?, ?> node)
throws Exception {
- DataTree dataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.OPERATIONAL);
- dataTree.setSchemaContext(SchemaContextHelper.full());
+ DataTree dataTree = new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_OPERATIONAL,
+ SchemaContextHelper.full());
AbstractShardTest.writeToStore(dataTree, path, node);
- NormalizedNode<?, ?> root = AbstractShardTest.readStore(dataTree, YangInstanceIdentifier.EMPTY);
+ NormalizedNode<?, ?> root = AbstractShardTest.readStore(dataTree, YangInstanceIdentifier.empty());
return Snapshot.create(new ShardSnapshotState(new MetadataShardDataTreeSnapshot(root)),
Collections.<ReplicatedLogEntry>emptyList(), 2, 1, 2, 1, 1, "member-1", null);