aboutsummaryrefslogtreecommitdiffstats
path: root/node/utils_test.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-02-05 17:33:24 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-02-05 17:33:24 +0800
commitba7c125153ce1be30985784a18edf38645406d03 (patch)
tree92c1e2b8ec6ef0d4b39381148b3497e311e80b95 /node/utils_test.go
parent212828963172b3921827df15abdc8602480e947d (diff)
parent188ab928c3f2a2eac5ee0f7ac42cbf2f35568bcd (diff)
downloaddexon-ba7c125153ce1be30985784a18edf38645406d03.tar
dexon-ba7c125153ce1be30985784a18edf38645406d03.tar.gz
dexon-ba7c125153ce1be30985784a18edf38645406d03.tar.bz2
dexon-ba7c125153ce1be30985784a18edf38645406d03.tar.lz
dexon-ba7c125153ce1be30985784a18edf38645406d03.tar.xz
dexon-ba7c125153ce1be30985784a18edf38645406d03.tar.zst
dexon-ba7c125153ce1be30985784a18edf38645406d03.zip
Merge pull request #2168 from karalabe/move-rpc-into-node
cmd, common, node, rpc: move IPC into the node itself
Diffstat (limited to 'node/utils_test.go')
-rw-r--r--node/utils_test.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/node/utils_test.go b/node/utils_test.go
index 7755605ae..7cdfc2b3a 100644
--- a/node/utils_test.go
+++ b/node/utils_test.go
@@ -52,6 +52,7 @@ func NewNoopServiceD(*ServiceContext) (Service, error) { return new(NoopServiceD
// methods can be instrumented both return value as well as event hook wise.
type InstrumentedService struct {
protocols []p2p.Protocol
+ apis []rpc.API
start error
stop error
@@ -70,7 +71,7 @@ func (s *InstrumentedService) Protocols() []p2p.Protocol {
}
func (s *InstrumentedService) APIs() []rpc.API {
- return nil
+ return s.apis
}
func (s *InstrumentedService) Start(server *p2p.Server) error {
@@ -121,3 +122,14 @@ func InstrumentedServiceMakerB(base ServiceConstructor) ServiceConstructor {
func InstrumentedServiceMakerC(base ServiceConstructor) ServiceConstructor {
return InstrumentingWrapperMaker(base, reflect.TypeOf(InstrumentedServiceC{}))
}
+
+// OneMethodApi is a single-method API handler to be returned by test services.
+type OneMethodApi struct {
+ fun func()
+}
+
+func (api *OneMethodApi) TheOneMethod() {
+ if api.fun != nil {
+ api.fun()
+ }
+}