MCPcopy Create free account
hub / github.com/grpc/grpc-java / pathParser

Method pathParser

xds/src/test/java/io/grpc/xds/RbacFilterTest.java:152–168  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

150 }
151
152 @Test
153 @SuppressWarnings("unchecked")
154 public void pathParser() {
155 PathMatcher pathMatcher = PathMatcher.newBuilder().setPath(STRING_MATCHER).build();
156 List<Permission> permissionList = Arrays.asList(
157 Permission.newBuilder().setUrlPath(pathMatcher).build());
158 List<Principal> principalList = Arrays.asList(
159 Principal.newBuilder().setUrlPath(pathMatcher).build());
160 ConfigOrError<RbacConfig> result = parse(permissionList, principalList);
161 assertThat(result.errorDetail).isNull();
162 ServerCall<Void,Void> serverCall = mock(ServerCall.class);
163 when(serverCall.getMethodDescriptor()).thenReturn(method().build());
164 GrpcAuthorizationEngine engine =
165 new GrpcAuthorizationEngine(result.config.authConfig());
166 AuthDecision decision = engine.evaluate(new Metadata(), serverCall);
167 assertThat(decision.decision()).isEqualTo(GrpcAuthorizationEngine.Action.DENY);
168 }
169
170 @Test
171 @SuppressWarnings("unchecked")

Callers

nothing calls this directly

Calls 10

parseMethod · 0.95
methodMethod · 0.95
evaluateMethod · 0.95
decisionMethod · 0.95
setPathMethod · 0.80
asListMethod · 0.80
authConfigMethod · 0.80
buildMethod · 0.65
getMethodDescriptorMethod · 0.65
newBuilderMethod · 0.45

Tested by

no test coverage detected