use of com.google.api.server.spi.config.ApiFrontendLimits in project endpoints-java by cloudendpoints.
the class ApiConfigAnnotationReaderTest method testFrontendLimitsRuleWithSameMatchOverridesParentRule.
@Test
public void testFrontendLimitsRuleWithSameMatchOverridesParentRule() throws Exception {
@Api(frontendLimits = @ApiFrontendLimits(rules = { @ApiFrontendLimitRule(match = "test", qps = 1) }))
class Test {
}
@Api(frontendLimits = @ApiFrontendLimits(rules = { @ApiFrontendLimitRule(match = "test", userQps = 1) }))
final class Child extends Test {
}
ApiConfig config = createConfig(Child.class);
annotationReader.loadEndpointClass(serviceContext, Child.class, config);
assertEquals(1, config.getFrontendLimitsConfig().getRules().size());
FrontendLimitsRule rule = config.getFrontendLimitsConfig().getRules().get(0);
assertEquals("test", rule.getMatch());
assertEquals(-1, rule.getQps());
assertEquals(1, rule.getUserQps());
}
use of com.google.api.server.spi.config.ApiFrontendLimits in project endpoints-java by cloudendpoints.
the class ApiConfigAnnotationReaderTest method testFrontendLimitsRulesNotDuplicatedInInheritance.
@Test
public void testFrontendLimitsRulesNotDuplicatedInInheritance() throws Exception {
@Api(frontendLimits = @ApiFrontendLimits(rules = { @ApiFrontendLimitRule(match = "test", qps = 1) }))
class Test {
}
final class Child extends Test {
}
ApiConfig config = createConfig(Child.class);
annotationReader.loadEndpointClass(serviceContext, Child.class, config);
assertEquals(1, config.getFrontendLimitsConfig().getRules().size());
}
Aggregations