You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2019/04/17 21:45:35 UTC

[qpid-proton] branch master updated: PROTON-2035: [go] Inability to mock Golang interfaces

This is an automated email from the ASF dual-hosted git repository.

aconway pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git


The following commit(s) were added to refs/heads/master by this push:
     new d0cd7d1  PROTON-2035: [go] Inability to mock Golang interfaces
d0cd7d1 is described below

commit d0cd7d1c11aef7ac378ca47693931cb4de9934c5
Author: Alan Conway <ac...@redhat.com>
AuthorDate: Wed Apr 17 17:42:13 2019 -0400

    PROTON-2035: [go] Inability to mock Golang interfaces
    
    Moved unexported methods closed, wakeSync from electron.Endpoint to
    an unexported interface endpointInternal.
---
 go/src/qpid.apache.org/electron/endpoint.go | 2 ++
 go/src/qpid.apache.org/electron/handler.go  | 6 +++---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/go/src/qpid.apache.org/electron/endpoint.go b/go/src/qpid.apache.org/electron/endpoint.go
index a6ce6c8..ea4eb70 100644
--- a/go/src/qpid.apache.org/electron/endpoint.go
+++ b/go/src/qpid.apache.org/electron/endpoint.go
@@ -71,7 +71,9 @@ type Endpoint interface {
 	// endpoint and its children will be closed with an error. The error will only
 	// be detected when you try to use one of these endpoints or call Sync()
 	Sync() error
+}
 
+type endpointInternal interface {
 	// Called in handler goroutine when endpoint is remotely closed.
 	closed(err error) error
 	wakeSync()
diff --git a/go/src/qpid.apache.org/electron/handler.go b/go/src/qpid.apache.org/electron/handler.go
index 753f9d3..dfb3b8a 100644
--- a/go/src/qpid.apache.org/electron/handler.go
+++ b/go/src/qpid.apache.org/electron/handler.go
@@ -105,7 +105,7 @@ func (h *handler) HandleMessagingEvent(t proton.MessagingEvent, e proton.Event)
 				}
 			}
 			if ep, ok := h.links[l]; ok {
-				ep.wakeSync()
+				ep.(endpointInternal).wakeSync()
 			} else {
 				h.linkError(l, "no link")
 			}
@@ -161,7 +161,7 @@ func (h *handler) addLink(pl proton.Link, el Endpoint) {
 
 func (h *handler) linkClosed(l proton.Link, err error) {
 	if link, ok := h.links[l]; ok {
-		_ = link.closed(err)
+		_ = link.(endpointInternal).closed(err)
 		delete(h.links, l)
 		l.Free()
 	}
@@ -195,7 +195,7 @@ func (h *handler) shutdown(err error) {
 	}
 	h.sent = nil
 	for _, l := range h.links {
-		_ = l.closed(err)
+		_ = l.(endpointInternal).closed(err)
 	}
 	h.links = nil
 	for _, s := range h.sessions {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org