(t *testing.T)
| 40 | ) |
| 41 | |
| 42 | func TestRPCInvocation_ServiceKey(t *testing.T) { |
| 43 | providerURL := "dubbo://127.0.0.1:20000/com.ikurento.user.UserProvider?anyhost=true&" + |
| 44 | "application=BDTService&category=providers&default.timeout=10000&dubbo=dubbo-provider-golang-1.0.0&" + |
| 45 | "environment=dev&interface=com.ikurento.user.UserProvider&ip=192.168.56.1&methods=GetUser%2C&" + |
| 46 | "module=dubbogo+user-info+server&org=ikurento.com&owner=ZX&pid=1447&revision=0.0.1&" + |
| 47 | "side=provider&timeout=3000×tamp=1556509797245" |
| 48 | |
| 49 | sameInfPathConsumerURL := "dubbo://127.0.0.1:20000/com.ikurento.user.UserProvider?anyhost=true&" + |
| 50 | "application=BDTService&category=providers&default.timeout=10000&dubbo=dubbo-provider-golang-1.0.0&" + |
| 51 | "environment=dev&interface=com.ikurento.user.UserProvider&ip=192.168.56.1&methods=GetUser%2C&" + |
| 52 | "module=dubbogo+user-info+server&org=ikurento.com&owner=ZX&pid=1447&revision=0.0.1&" + |
| 53 | "side=provider&timeout=3000×tamp=1556509797245" |
| 54 | diffInfPathConsumerURL := "dubbo://127.0.0.1:20000/com.ikurento.user.UserProvider?anyhost=true&" + |
| 55 | "application=BDTService&category=providers&default.timeout=10000&dubbo=dubbo-provider-golang-1.0.0&" + |
| 56 | "environment=dev&interface=com.ikurento.user.UserProviderFoo&ip=192.168.56.1&methods=GetUser%2C&" + |
| 57 | "module=dubbogo+user-info+server&org=ikurento.com&owner=ZX&pid=1447&revision=0.0.1&" + |
| 58 | "side=provider&timeout=3000×tamp=1556509797245" |
| 59 | |
| 60 | providerUrl, err := common.NewURL(providerURL) |
| 61 | require.NoError(t, err) |
| 62 | |
| 63 | // invocation with same interface and path value |
| 64 | sameInfPathConsumerUrl, err := common.NewURL(sameInfPathConsumerURL) |
| 65 | require.NoError(t, err) |
| 66 | invocation := NewRPCInvocationWithOptions(WithAttachments(map[string]any{ |
| 67 | constant.InterfaceKey: sameInfPathConsumerUrl.GetParam(constant.InterfaceKey, ""), |
| 68 | constant.PathKey: sameInfPathConsumerUrl.Path, |
| 69 | constant.GroupKey: sameInfPathConsumerUrl.GetParam(constant.GroupKey, ""), |
| 70 | constant.VersionKey: sameInfPathConsumerUrl.GetParam(constant.VersionKey, ""), |
| 71 | })) |
| 72 | assert.Equal(t, providerUrl.ServiceKey(), invocation.ServiceKey()) |
| 73 | |
| 74 | // invocation with different interface and path value |
| 75 | diffInfPathConsumerUrl, err := common.NewURL(diffInfPathConsumerURL) |
| 76 | require.NoError(t, err) |
| 77 | invocation = NewRPCInvocationWithOptions(WithAttachments(map[string]any{ |
| 78 | constant.InterfaceKey: diffInfPathConsumerUrl.GetParam(constant.InterfaceKey, ""), |
| 79 | constant.PathKey: diffInfPathConsumerUrl.Path, |
| 80 | constant.GroupKey: diffInfPathConsumerUrl.GetParam(constant.GroupKey, ""), |
| 81 | constant.VersionKey: diffInfPathConsumerUrl.GetParam(constant.VersionKey, ""), |
| 82 | })) |
| 83 | assert.Equal(t, providerUrl.ServiceKey(), invocation.ServiceKey()) |
| 84 | } |
| 85 | |
| 86 | func TestNewRPCInvocation(t *testing.T) { |
| 87 | methodName := "testMethod" |
nothing calls this directly
no test coverage detected