+ @Test
+ public void testUintCommitPayload() throws IOException {
+ shardDataTree.applyRecoveryPayload(CommitTransactionPayload.create(nextTransactionId(),
+ DataTreeCandidates.fromNormalizedNode(YangInstanceIdentifier.empty(), bigIntegerRoot()),
+ PayloadVersion.SODIUM_SR1));
+
+ assertCarsUint64();
+ }
+
+ @Test
+ public void testUintSnapshot() throws IOException, DataValidationFailedException {
+ shardDataTree.applyRecoverySnapshot(new ShardSnapshotState(new MetadataShardDataTreeSnapshot(bigIntegerRoot()),
+ true));
+
+ assertCarsUint64();
+ }
+
+ private void assertCarsUint64() {
+ final DataTreeSnapshot snapshot = shardDataTree.newReadOnlyTransaction(nextTransactionId()).getSnapshot();
+ final NormalizedNode<?, ?> cars = snapshot.readNode(CarsModel.CAR_LIST_PATH).get();
+
+ assertEquals(Builders.mapBuilder()
+ .withNodeIdentifier(new NodeIdentifier(CarsModel.CAR_QNAME))
+ .withChild(Builders.mapEntryBuilder()
+ .withNodeIdentifier(NodeIdentifierWithPredicates.of(CarsModel.CAR_QNAME,
+ CarsModel.CAR_NAME_QNAME, "foo"))
+ .withChild(ImmutableNodes.leafNode(CarsModel.CAR_NAME_QNAME, "foo"))
+ // Note: Uint64
+ .withChild(ImmutableNodes.leafNode(CarsModel.CAR_PRICE_QNAME, Uint64.ONE))
+ .build())
+ .build(), cars);
+ }
+
+ private static ContainerNode bigIntegerRoot() {
+ return Builders.containerBuilder()
+ .withNodeIdentifier(new NodeIdentifier(SchemaContext.NAME))
+ .withChild(Builders.containerBuilder()
+ .withNodeIdentifier(new NodeIdentifier(CarsModel.CARS_QNAME))
+ .withChild(Builders.mapBuilder()
+ .withNodeIdentifier(new NodeIdentifier(CarsModel.CAR_QNAME))
+ .withChild(Builders.mapEntryBuilder()
+ .withNodeIdentifier(NodeIdentifierWithPredicates.of(CarsModel.CAR_QNAME,
+ CarsModel.CAR_NAME_QNAME, "foo"))
+ .withChild(ImmutableNodes.leafNode(CarsModel.CAR_NAME_QNAME, "foo"))
+ // Note: old BigInteger
+ .withChild(ImmutableNodes.leafNode(CarsModel.CAR_PRICE_QNAME, BigInteger.ONE))
+ .build())
+ .build())
+ .build())
+ .build();
+ }
+