@Test public void testNoMatch() { TokenBucketAdmissionController controller = new TokenBucketAdmissionController(Collections.emptyList(), titusRuntime); AdmissionControllerRequest request = AdmissionControllerRequest.newBuilder() .withCallerId("any") .withEndpointName("any") .build(); AdmissionControllerResponse response = controller.apply(request); assertThat(response.isAllowed()).isTrue(); assertThat(response.getReasonMessage()).isEqualTo("Rate limits not configured"); }
@Override public AdmissionControllerResponse apply(AdmissionControllerRequest request) { return findTokenBucket(request).map(this::consume).orElse(DEFAULT_OK); }
TokenBucketAdmissionController implements AdmissionController { @Override public AdmissionControllerResponse apply(AdmissionControllerRequest request) { return findTokenBucket(request).map(this::consume).orElse(DEFAULT_OK); } }
TokenBucketAdmissionController implements AdmissionController { @Override public AdmissionControllerResponse apply(AdmissionControllerRequest request) { return findTokenBucket(request).map(this::consume).orElse(DEFAULT_OK); } TokenBucketAdmissionController(List<TokenBucketConfiguration> tokenBucketConfigurations,
                                          TitusRuntime titusRuntime); }
TokenBucketAdmissionController implements AdmissionController { @Override public AdmissionControllerResponse apply(AdmissionControllerRequest request) { return findTokenBucket(request).map(this::consume).orElse(DEFAULT_OK); } TokenBucketAdmissionController(List<TokenBucketConfiguration> tokenBucketConfigurations,
                                          TitusRuntime titusRuntime); @Override AdmissionControllerResponse apply(AdmissionControllerRequest request); }
TokenBucketAdmissionController implements AdmissionController { @Override public AdmissionControllerResponse apply(AdmissionControllerRequest request) { return findTokenBucket(request).map(this::consume).orElse(DEFAULT_OK); } TokenBucketAdmissionController(List<TokenBucketConfiguration> tokenBucketConfigurations,
                                          TitusRuntime titusRuntime); @Override AdmissionControllerResponse apply(AdmissionControllerRequest request);  }