-
Notifications
You must be signed in to change notification settings - Fork 930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ftr: [refer dubbo 2.7.6] attachment type from map[string]stiring to map[string]interface{} #713
Merged
Merged
Changes from 14 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
e2348ff
attachment from map<string>string to map<string>interface{}
cvictory 0484cab
support attachment from map[sting]string to map[string]interface{} in…
cvictory 1e10374
support attachment from map[sting]string to map[string]interface{} in…
cvictory b48de97
support attachment from map[sting]string to map[string]interface{} in…
cvictory 253b1c5
raise hessian version to recently commit
cvictory c54cd14
merge from develop
cvictory 5a962dd
add license
cvictory 5db4706
fix integrate. it should be fixed after hessian has been released
cvictory 93bfb98
fix review issue and conflict
cvictory 580aecd
fix conflict
cvictory fe4afd8
support attachment type map[string]interface{] from context
cvictory 25dc92a
Merge branch 'develop' of github.com:apache/dubbo-go into attachent_t…
cvictory c509451
unit test
cvictory e93f459
modify dubbo-go-hessian2 to 1.6.3
cvictory f7440be
fix review issue
cvictory 0ad171a
move request,response,hessian from dubbo-go-hessian2
cvictory 4691787
add licence
cvictory a0eade9
modify comment
cvictory File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,8 @@ package proxy | |
|
||
import ( | ||
"context" | ||
hessian "github.com/apache/dubbo-go-hessian2" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OMG. move it to the second import block, pls. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
"github.com/apache/dubbo-go/protocol/invocation" | ||
"reflect" | ||
"testing" | ||
) | ||
|
@@ -40,6 +42,7 @@ type TestService struct { | |
MethodThree func(int, bool) (interface{}, error) | ||
MethodFour func(int, bool) (*interface{}, error) `dubbo:"methodFour"` | ||
MethodFive func() error | ||
MethodSix func(context.Context, string) (interface{}, error) | ||
Echo func(interface{}, *interface{}) error | ||
} | ||
|
||
|
@@ -120,3 +123,34 @@ func TestProxyImplement(t *testing.T) { | |
assert.Nil(t, s3.MethodOne) | ||
|
||
} | ||
|
||
func TestProxyImplementForContext(t *testing.T) { | ||
invoker := &TestProxyInvoker{ | ||
BaseInvoker: *protocol.NewBaseInvoker(common.URL{}), | ||
} | ||
p := NewProxy(invoker, nil, map[string]string{constant.ASYNC_KEY: "false"}) | ||
s := &TestService{} | ||
p.Implement(s) | ||
attahments1 := make(map[string]interface{}, 4) | ||
attahments1["k1"] = "v1" | ||
attahments1["k2"] = "v2" | ||
context := context.WithValue(context.Background(), constant.AttachmentKey, attahments1) | ||
r, err := p.Get().(*TestService).MethodSix(context, "xxx") | ||
v1 := r.(map[string]interface{}) | ||
assert.NoError(t, err) | ||
assert.Equal(t, v1["TestProxyInvoker"], "TestProxyInvokerValue") | ||
} | ||
|
||
type TestProxyInvoker struct { | ||
protocol.BaseInvoker | ||
} | ||
|
||
func (bi *TestProxyInvoker) Invoke(context context.Context, inv protocol.Invocation) protocol.Result { | ||
rpcInv := inv.(*invocation.RPCInvocation) | ||
mapV := inv.Attachments() | ||
mapV["TestProxyInvoker"] = "TestProxyInvokerValue" | ||
hessian.ReflectResponse(mapV, rpcInv.Reply()) | ||
return &protocol.RPCResult{ | ||
Rest: inv.Arguments(), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'd better leave some comments here so that others can understand the context better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, the comment should be aligned with the else branch in the same line or under the else branch if it is too long.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done