Skip to content

Commit b630494

Browse files
committed
use of finality service in integration test
Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
1 parent e768d1e commit b630494

File tree

2 files changed

+6
-38
lines changed

2 files changed

+6
-38
lines changed

integration/fabricx/simple/views/create.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ import (
1313

1414
"github.com/hyperledger-labs/fabric-smart-client/integration/fabricx/simple/views/utils"
1515
"github.com/hyperledger-labs/fabric-smart-client/platform/common/services/logging"
16-
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric"
1716
fdriver "github.com/hyperledger-labs/fabric-smart-client/platform/fabric/driver"
1817
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/services/state"
19-
"github.com/hyperledger-labs/fabric-smart-client/platform/fabricx/core/finality"
18+
"github.com/hyperledger-labs/fabric-smart-client/platform/fabricx"
2019
"github.com/hyperledger-labs/fabric-smart-client/platform/view/view"
2120
)
2221

@@ -68,12 +67,12 @@ func (i *CreateView) Call(viewCtx view.Context) (interface{}, error) {
6867
}
6968

7069
// create a listener go check when the tx is committed
71-
network, ch, err := fabric.GetDefaultChannel(viewCtx)
70+
network, err := fabricx.GetDefaultFNS(viewCtx)
7271
if err != nil {
7372
return nil, err
7473
}
7574

76-
lm, err := finality.GetListenerManager(viewCtx, network.Name(), ch.Name())
75+
lm, err := network.FinalityService()
7776
if err != nil {
7877
return nil, err
7978
}

platform/fabricx/fns.go

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"github.com/hyperledger-labs/fabric-smart-client/platform/common/services/logging"
1414
"github.com/hyperledger-labs/fabric-smart-client/platform/common/utils/lazy"
1515
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric"
16-
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/core"
1716
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/core/generic/driver/config"
1817
"github.com/hyperledger-labs/fabric-smart-client/platform/fabricx/core/finality"
1918
"github.com/hyperledger-labs/fabric-smart-client/platform/fabricx/core/queryservice"
@@ -67,8 +66,8 @@ func (ns *NetworkService) QueryService() *QueryService {
6766
return ns.queryService
6867
}
6968

70-
func (ns *NetworkService) FinalityService(channel string) (*Finality, error) {
71-
return ns.finalityProvider.Get(channel)
69+
func (ns *NetworkService) FinalityService() (*Finality, error) {
70+
return ns.finalityProvider.Get("")
7271
}
7372

7473
type NetworkServiceProvider struct {
@@ -114,11 +113,7 @@ func GetNetworkServiceProvider(sp services.Provider) (*NetworkServiceProvider, e
114113
}
115114

116115
func GetFabricNetworkNames(sp services.Provider) ([]string, error) {
117-
provider, err := core.GetFabricNetworkServiceProvider(sp)
118-
if err != nil {
119-
return nil, err
120-
}
121-
return provider.Names(), nil
116+
return fabric.GetFabricNetworkNames(sp)
122117
}
123118

124119
// GetFabricNetworkService returns the Fabric Network Service for the passed id, nil if not found
@@ -138,29 +133,3 @@ func GetFabricNetworkService(sp services.Provider, id string) (*NetworkService,
138133
func GetDefaultFNS(sp services.Provider) (*NetworkService, error) {
139134
return GetFabricNetworkService(sp, "")
140135
}
141-
142-
// GetDefaultChannel returns the default channel of the default fns
143-
func GetDefaultChannel(sp services.Provider) (*NetworkService, *fabric.Channel, error) {
144-
network, err := GetDefaultFNS(sp)
145-
if err != nil {
146-
return nil, nil, err
147-
}
148-
channel, err := network.Channel("")
149-
if err != nil {
150-
return nil, nil, err
151-
}
152-
return network, channel, nil
153-
}
154-
155-
// GetChannel returns the requested channel for the passed network
156-
func GetChannel(sp services.Provider, network, channel string) (*NetworkService, *fabric.Channel, error) {
157-
fns, err := GetFabricNetworkService(sp, network)
158-
if err != nil {
159-
return nil, nil, err
160-
}
161-
ch, err := fns.Channel(channel)
162-
if err != nil {
163-
return nil, nil, err
164-
}
165-
return fns, ch, nil
166-
}

0 commit comments

Comments
 (0)