use of com.google.api.server.spi.config.model.ApiConfig in project endpoints-java by cloudendpoints.
the class ApiConfigAnnotationReaderTest method testSimpleLevelOverriding.
@Test
public void testSimpleLevelOverriding() throws Exception {
ApiConfig config = createConfig(SimpleLevelOverridingApi.class);
annotationReader.loadEndpointClass(serviceContext, SimpleLevelOverridingApi.class, config);
annotationReader.loadEndpointMethods(serviceContext, SimpleLevelOverridingApi.class, config.getApiClassConfig().getMethods());
verifySimpleLevelOverriding(config);
}
use of com.google.api.server.spi.config.model.ApiConfig in project endpoints-java by cloudendpoints.
the class JsonConfigWriterTest method writeConfigWithParameterizedTypeTransformerConfig.
/**
* This tests writeConfig with a parameterized type which is transformed to {@code String}.
* When the transformer is present, writeConfig should not throw an exception.
*/
@Test
public void writeConfigWithParameterizedTypeTransformerConfig() throws Exception {
ApiConfig transformedApiConfig = configFactory.copy(apiConfig);
transformedApiConfig.getSerializationConfig().addSerializationConfig(ParameterizedTypeTransformer.class);
final class Endpoint {
@SuppressWarnings("unused")
public ParameterizedBean get(@Named("date") String id) {
return null;
}
}
new ApiConfigAnnotationReader().loadEndpointMethods(serviceContext, Endpoint.class, transformedApiConfig.getApiClassConfig().getMethods());
writer.writeConfig(Collections.singleton(transformedApiConfig));
}
use of com.google.api.server.spi.config.model.ApiConfig in project endpoints-java by cloudendpoints.
the class ApiConfigAnnotationReaderTest method testGenericBasePartiallySpecializedEndpoint.
@Test
public void testGenericBasePartiallySpecializedEndpoint() throws Exception {
ApiConfig config = createConfig(RestfulResourceEndpointBase.PartiallySpecializedEndpoint.class);
annotationReader.loadEndpointMethods(serviceContext, RestfulResourceEndpointBase.PartiallySpecializedEndpoint.class, config.getApiClassConfig().getMethods());
assertEquals(6, config.getApiClassConfig().getMethods().size());
assertNull(config.getApiClassConfig().getMethods().get(methodToEndpointMethod(RestfulResourceEndpointBase.FullySpecializedEndpoint.class.getMethod("list"))));
assertNotNull(config.getApiClassConfig().getMethods().get(methodToEndpointMethod(RestfulResourceEndpointBase.PartiallySpecializedEndpoint.class, RestfulResourceEndpointBase.PartiallySpecializedEndpoint.class.getMethod("get", long.class))));
assertNotNull(config.getApiClassConfig().getMethods().get(methodToEndpointMethod(RestfulResourceEndpointBase.PartiallySpecializedEndpoint.class, RestfulResourceEndpointBase.class.getMethod("list"))));
}
use of com.google.api.server.spi.config.model.ApiConfig in project endpoints-java by cloudendpoints.
the class ApiConfigAnnotationReaderTest method testEndpointWithNoPublicMethods.
@Test
public void testEndpointWithNoPublicMethods() throws Exception {
ApiConfig config = createConfig(Endpoint2.class);
annotationReader.loadEndpointMethods(serviceContext, Endpoint2.class, config.getApiClassConfig().getMethods());
assertEquals(0, config.getApiClassConfig().getMethods().size());
}
use of com.google.api.server.spi.config.model.ApiConfig in project endpoints-java by cloudendpoints.
the class ApiConfigAnnotationReaderTest method testServiceWithApiNameOverride.
@Test
public void testServiceWithApiNameOverride() throws Exception {
ApiConfig config = createConfig(Endpoint4.class);
annotationReader.loadEndpointClass(serviceContext, Endpoint4.class, config);
assertEquals("api4", config.getName());
}
Aggregations