Ejemplo n.º 1
0
			actual := make(map[string][]byte)
			for itr.Next() {
				count++
				k, v := itr.GetKeyValue()
				actual[k] = v
			}

			Expect(count).To(Equal(len(expected)))
			for k, v := range expected {
				Expect(actual[k]).To(Equal(v))
			}
		}
		///////// Test with an empty Ledger //////////
		//////////////////////////////////////////////
		It("does a bunch of stuff", func() {
			itr, _ := ledgerPtr.GetStateRangeScanIterator("chaincodeID2", "key2", "key5", false)
			expected := map[string][]byte{}
			AssertIteratorContains(itr, expected)
			itr.Close()

			itr, _ = ledgerPtr.GetStateRangeScanIterator("chaincodeID2", "key2", "key5", true)
			expected = map[string][]byte{}
			AssertIteratorContains(itr, expected)
			itr.Close()

			// Commit initial data to ledger
			ledgerPtr.BeginTxBatch(0)
			ledgerPtr.TxBegin("txUuid1")
			ledgerPtr.SetState("chaincodeID1", "key1", []byte("value1"))

			ledgerPtr.SetState("chaincodeID2", "key1", []byte("value1"))