Atlas › Test

TestGetMethodMetadata

Exact test identity: go.temporal.io/server/common/api/TestGetMethodMetadata

Package
go.temporal.io/server/common/api
Suite / test hierarchy
TestGetMethodMetadata
Test
TestGetMethodMetadata
Introduced at
metadata.go ×2 Frontier kind: Joint frontier
Covered ranges
6
Covered lines
15
Covered files
1

Covered source

Expand a file to inspect source; the > gutter marks covered lines.

go.temporal.io/server/common/api/metadata.go 15 covered LOC · 6 ranges

Open complete file

217 // GetMethodMetadata gets metadata for a given API method in one of the services exported by
218 // frontend (WorkflowService, OperatorService, AdminService).
219 > func GetMethodMetadata(fullApiName string) MethodMetadata { metadata.go
220 > switch {
221 > case strings.HasPrefix(fullApiName, WorkflowServicePrefix):
222 > return workflowServiceMetadata[MethodName(fullApiName)]
223 case strings.HasPrefix(fullApiName, OperatorServicePrefix):
224 return operatorServiceMetadata[MethodName(fullApiName)]
225 > case strings.HasPrefix(fullApiName, NexusServicePrefix): metadata.go
226 > return nexusServiceMetadata[MethodName(fullApiName)]
227 > case strings.HasPrefix(fullApiName, AdminServicePrefix): metadata.go
228 > return MethodMetadata{Scope: ScopeCluster, Access: AccessAdmin}
229 > default: metadata.go
230 > return MethodMetadata{Scope: ScopeUnknown, Access: AccessUnknown}
231 }
232 }
233
234 // MethodName returns just the method name from a fully qualified name.
235 > func MethodName(fullApiName string) string { metadata.go
236 > index := strings.LastIndex(fullApiName, "/")
237 > if index > -1 {
238 > return fullApiName[index+1:] metadata.go
239 > }
240 return fullApiName
241 }