Exemplo n.º 1
0
				"key5": []byte("value5"),
				"key6": []byte("value6"),
				"key7": []byte("value7"),
				"key8": []byte("value8_new"),
			}
			AssertIteratorContains(itr, expected)
			itr.Close()
		})
	})

	Describe("Ledger GetSetMultipleKeys", func() {
		ledgerPtr := InitSpec()
		It("creates, populates, finishes, commits and validates a batch", func() {
			Expect(ledgerPtr.BeginTxBatch(1)).To(BeNil())
			ledgerPtr.TxBegin("txUuid1")
			ledgerPtr.SetStateMultipleKeys("chaincodeID", map[string][]byte{"key1": []byte("value1"), "key2": []byte("value2")})
			ledgerPtr.TxFinished("txUuid1", true)
			uuid := util.GenerateUUID()
			tx, err := protos.NewTransaction(protos.ChaincodeID{Path: "testUrl"}, uuid, "anyfunction", []string{"param1, param2"})
			Expect(err).To(BeNil())
			err = ledgerPtr.CommitTxBatch(1, []*protos.Transaction{tx}, nil, []byte("proof"))
			Expect(err).To(BeNil())
			values, err := ledgerPtr.GetStateMultipleKeys("chaincodeID", []string{"key1", "key2"}, true)
			Expect(err).To(BeNil())
			Expect(values).To(Equal([][]byte{[]byte("value1"), []byte("value2")}))
		})
	})

	Describe("Ledger CopyState", func() {
		ledgerPtr := InitSpec()
		It("creates, populates, finishes, commits and validates a batch", func() {