func TestDataNodesSort(t *testing.T) {
	dataNodes := dataNodes{}
	dataNode1 := newDataNode(newDataKey("chaincodeID1", "key1"), []byte("value1_1"))
	dataNode2 := newDataNode(newDataKey("chaincodeID1", "key2"), []byte("value1_2"))
	dataNode3 := newDataNode(newDataKey("chaincodeID2", "key1"), []byte("value2_1"))
	dataNode4 := newDataNode(newDataKey("chaincodeID2", "key2"), []byte("value2_2"))
	dataNodes = append(dataNodes, []*dataNode{dataNode2, dataNode4, dataNode3, dataNode1}...)
	sort.Sort(dataNodes)
	testutil.AssertSame(t, dataNodes[0], dataNode1)
	testutil.AssertSame(t, dataNodes[1], dataNode2)
	testutil.AssertSame(t, dataNodes[2], dataNode3)
	testutil.AssertSame(t, dataNodes[3], dataNode4)
}
func TestBucketTreeDeltaBasic(t *testing.T) {
	conf = initConfig(26, 3, fnvHash)
	bucketTreeDelta := newBucketTreeDelta()
	b1 := bucketTreeDelta.getOrCreateBucketNode(newBucketKey(2, 1))
	testutil.AssertSame(t, bucketTreeDelta.getOrCreateBucketNode(newBucketKey(2, 1)), b1)
	b2 := bucketTreeDelta.getOrCreateBucketNode(newBucketKey(2, 2))
	b3 := bucketTreeDelta.getOrCreateBucketNode(newBucketKey(2, 3))
	testutil.AssertContainsAll(t, bucketTreeDelta.getBucketNodesAt(2), []*bucketNode{b1, b2, b3})

	b4 := bucketTreeDelta.getOrCreateBucketNode(newBucketKey(1, 1))
	b5 := bucketTreeDelta.getOrCreateBucketNode(newBucketKey(1, 2))
	testutil.AssertContainsAll(t, bucketTreeDelta.getBucketNodesAt(1), []*bucketNode{b4, b5})

	b6 := bucketTreeDelta.getOrCreateBucketNode(newBucketKey(0, 1))
	testutil.AssertContainsAll(t, bucketTreeDelta.getBucketNodesAt(0), []*bucketNode{b6})
	testutil.AssertContainsAll(t, bucketTreeDelta.getBucketNodesAt(1), []*bucketNode{b4, b5})
	testutil.AssertContainsAll(t, bucketTreeDelta.getBucketNodesAt(2), []*bucketNode{b1, b2, b3})

	testutil.AssertEquals(t, len(bucketTreeDelta.getBucketNodesAt(0)), 1)
	testutil.AssertEquals(t, len(bucketTreeDelta.getBucketNodesAt(1)), 2)
	testutil.AssertEquals(t, len(bucketTreeDelta.getBucketNodesAt(2)), 3)

	testutil.AssertSame(t, bucketTreeDelta.getRootNode(), b6)
}