MCPcopy Create free account
hub / github.com/apache/dubbo-go / TestProxyImplementForContext

Function TestProxyImplementForContext

proxy/proxy_test.go:129–144  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

127}
128
129func TestProxyImplementForContext(t *testing.T) {
130 invoker := &TestProxyInvoker{
131 BaseInvoker: *base.NewBaseInvoker(&common.URL{}),
132 }
133 p := NewProxy(invoker, nil, map[string]string{constant.AsyncKey: "false"})
134 s := &TestService{}
135 p.Implement(s)
136 attachments1 := make(map[string]any, 4)
137 attachments1["k1"] = "v1"
138 attachments1["k2"] = "v2"
139 context := context.WithValue(context.Background(), constant.AttachmentKey, attachments1)
140 r, err := p.Get().(*TestService).MethodSix(context, "xxx")
141 v1 := r.(map[string]any)
142 require.NoError(t, err)
143 assert.Equal(t, "TestProxyInvokerValue", v1["TestProxyInvoker"])
144}
145
146type TestProxyInvoker struct {
147 base.BaseInvoker

Callers

nothing calls this directly

Calls 5

ImplementMethod · 0.95
GetMethod · 0.95
NewBaseInvokerFunction · 0.92
NewProxyFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected