Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Commit

Permalink
refactored API and fixes (#51)
Browse files Browse the repository at this point in the history
* ignore case

Signed-off-by: vadiminshakov <[email protected]>

* fix example

Signed-off-by: vadiminshakov <[email protected]>

* fix test case

Signed-off-by: vadiminshakov <[email protected]>

* fix REST API test

Signed-off-by: vadiminshakov <[email protected]>

* Fix CI (#47)

* remove log msg

Signed-off-by: vadiminshakov <[email protected]>

* trigger CI on push && PR to 1.x, 2.x branches

Signed-off-by: vadiminshakov <[email protected]>

* new example request

Signed-off-by: vadiminshakov <[email protected]>

* handle nil and null block values

Signed-off-by: vadiminshakov <[email protected]>

* add test case for querying all db entries

Signed-off-by: vadiminshakov <[email protected]>

* del Explore, add GetRange rpc

Signed-off-by: vadiminshakov <[email protected]>

* increment go version

Signed-off-by: vadiminshakov <[email protected]>

* add handler for GerRange rpc, handle case of querying all

Signed-off-by: vadiminshakov <[email protected]>

* vendor chaincode before integration tests

Signed-off-by: vadiminshakov <[email protected]>

* ignore case

Signed-off-by: vadiminshakov <[email protected]>

* fix example

Signed-off-by: vadiminshakov <[email protected]>

* fix test case

Signed-off-by: vadiminshakov <[email protected]>

* fix REST API test

Signed-off-by: vadiminshakov <[email protected]>

* add test case for querying all db entries

Signed-off-by: vadiminshakov <[email protected]>
  • Loading branch information
vadiminshakov authored Jun 3, 2020
1 parent 27bbe13 commit 66b27f3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
7 changes: 4 additions & 3 deletions client/example/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"fmt"
fabcli "github.com/hyperledger-labs/fabex/client"
"github.com/hyperledger-labs/fabex/helpers"
pb "github.com/hyperledger-labs/fabex/proto"
"log"
)

Expand All @@ -42,9 +43,9 @@ func main() {

//txs, err := client.GetRange(1, 15)
//txs, err := client.Get(&pb.Entry{Txid:"3a3e933a3d9953b0b10e6573254b6d3cf2347d72058c0347a55054babdd8e1a1"})
//txs, err := client.Get(&pb.Entry{Payload: "WriteSet"})
//txs, err := client.Get(&pb.Entry{Blocknum: 5})
txs, err := client.Get(nil)
//txs, err := client.Get(&pb.Entry{Payload: "car0"})
//txs, err := client.Get(nil)
txs, err := client.Get(&pb.Entry{Blocknum: 5})
if err != nil {
log.Fatal(err)
}
Expand Down
8 changes: 7 additions & 1 deletion client/fabex_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,13 @@ func TestGet(t *testing.T) {
}
assert.Greater(t, len(txs), 0, "No transactions found")

txs, err = fabcli.Get(&pb.Entry{Payload: "WriteSet"})
txs, err = fabcli.Get(&pb.Entry{Payload: "car0"})
if err != nil {
t.Errorf(err.Error())
}
assert.Greater(t, len(txs), 0, "No transactions found")

txs, err = fabcli.Get(nil)
if err != nil {
t.Errorf(err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion db/mongodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (db *DBmongo) GetByBlocknum(blocknum uint64) ([]Tx, error) {
}

func (db *DBmongo) GetBlockInfoByPayload(payload string) ([]Tx, error) {
return db.getByFilter(bson.D{{"Payload", primitive.Regex{Pattern: payload, Options: ""}}})
return db.getByFilter(bson.D{{"Payload", primitive.Regex{Pattern: payload, Options: "i"}}})
}

func (db *DBmongo) QueryAll() ([]Tx, error) {
Expand Down
2 changes: 1 addition & 1 deletion rest/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func TestEndpoints(t *testing.T) {
})

t.Run("bykey", func(t *testing.T) {
resp, err := http.Get("http://localhost:5252/bykey/WriteSet")
resp, err := http.Get("http://localhost:5252/bykey/car0")
if err != nil {
t.Errorf(err.Error())
}
Expand Down

0 comments on commit 66b27f3

Please sign in to comment.