use of com.google.api.server.spi.config.model.ApiConfig in project endpoints-java by cloudendpoints.
the class ApiConfigAnnotationReaderTest method testGenericParameterTypes.
@Test
public void testGenericParameterTypes() throws Exception {
@Api
final class Test<T> {
@SuppressWarnings("unused")
public void setT(T t) {
}
}
ApiConfig config = createConfig(Test.class);
annotationReader.loadEndpointMethods(serviceContext, Test.class, config.getApiClassConfig().getMethods());
ApiParameterConfig parameter = config.getApiClassConfig().getMethods().get(methodToEndpointMethod(Test.class.getDeclaredMethod("setT", Object.class))).getParameterConfigs().get(0);
assertEquals(ApiParameterConfig.Classification.UNKNOWN, parameter.getClassification());
}
use of com.google.api.server.spi.config.model.ApiConfig in project endpoints-java by cloudendpoints.
the class ApiConfigAnnotationReaderTest method testLevelOverridingWithMethodOverrides.
@Test
public void testLevelOverridingWithMethodOverrides() throws Exception {
final class Test extends SimpleLevelOverridingInheritedApi {
@ApiMethod(scopes = { "s0c", "s1c" }, audiences = { "a0c", "a1c" }, clientIds = { "c0c", "c1c" })
@Override
public void overrides() {
super.overrides();
}
}
ApiConfig config = createConfig(Test.class);
annotationReader.loadEndpointClass(serviceContext, Test.class, config);
annotationReader.loadEndpointMethods(serviceContext, Test.class, config.getApiClassConfig().getMethods());
ApiMethodConfig overrides = config.getApiClassConfig().getMethods().get(methodToEndpointMethod(Test.class.getMethod("overrides")));
assertEquals(toScopeExpression("s0c", "s1c"), overrides.getScopeExpression());
assertEquals(Lists.newArrayList("a0c", "a1c"), overrides.getAudiences());
assertEquals(Lists.newArrayList("c0c", "c1c"), overrides.getClientIds());
}
use of com.google.api.server.spi.config.model.ApiConfig in project endpoints-java by cloudendpoints.
the class ApiConfigAnnotationReaderTest method testServiceWithSimpleReference.
@Test
public void testServiceWithSimpleReference() throws Exception {
ApiConfig config = createConfig(SimpleReferenceEndpoint.class);
annotationReader.loadEndpointClass(serviceContext, SimpleReferenceEndpoint.class, config);
// Especially should not be "api4" as provided by the inherited Endpoint4.
assertEquals("api", config.getName());
}
use of com.google.api.server.spi.config.model.ApiConfig 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());
}
use of com.google.api.server.spi.config.model.ApiConfig in project endpoints-java by cloudendpoints.
the class ApiConfigAnnotationReaderTest method testSimpleLevelOverridingWithInheritance.
@Test
public void testSimpleLevelOverridingWithInheritance() throws Exception {
ApiConfig config = createConfig(SimpleLevelOverridingInheritedApi.class);
annotationReader.loadEndpointClass(serviceContext, SimpleLevelOverridingInheritedApi.class, config);
annotationReader.loadEndpointMethods(serviceContext, SimpleLevelOverridingInheritedApi.class, config.getApiClassConfig().getMethods());
verifySimpleLevelOverriding(config);
}
Aggregations