Search in sources :

Example 6 with ServiceContext

use of com.google.api.server.spi.ServiceContext in project endpoints-java by cloudendpoints.

the class RestServletRequestParamReaderTest method setUp.

@Before
public void setUp() throws Exception {
    endpointMethod = EndpointMethod.create(TestApi.class, TestApi.class.getMethod("test", Long.TYPE, List.class, SimpleDate.class, TestResource.class));
    request = new MockHttpServletRequest();
    ServiceContext serviceContext = ServiceContext.create();
    serializationConfig = new ApiSerializationConfig();
    TypeLoader typeLoader = new TypeLoader();
    apiConfig = new ApiConfig.Factory().create(serviceContext, typeLoader, TestApi.class);
    ApiConfigAnnotationReader annotationReader = new ApiConfigAnnotationReader();
    annotationReader.loadEndpointClass(serviceContext, TestApi.class, apiConfig);
    annotationReader.loadEndpointMethods(serviceContext, TestApi.class, apiConfig.getApiClassConfig().getMethods());
    methodConfig = apiConfig.getApiClassConfig().getMethods().get(endpointMethod);
}
Also used : ApiConfigAnnotationReader(com.google.api.server.spi.config.annotationreader.ApiConfigAnnotationReader) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) ServiceContext(com.google.api.server.spi.ServiceContext) TypeLoader(com.google.api.server.spi.TypeLoader) ApiSerializationConfig(com.google.api.server.spi.config.model.ApiSerializationConfig) Before(org.junit.Before)

Example 7 with ServiceContext

use of com.google.api.server.spi.ServiceContext in project endpoints-java by cloudendpoints.

the class TypesTest method setUp.

@Before
public void setUp() throws Exception {
    ServiceContext serviceContext = ServiceContext.create();
    TypeLoader typeLoader = new TypeLoader();
    apiConfig = new ApiConfig.Factory().create(serviceContext, typeLoader, TestEndpoint.class);
    apiConfig.getSerializationConfig().addSerializationConfig(IntegerToStringSerializer.class);
    apiConfig.getSerializationConfig().addSerializationConfig(LongToStringSerializer.class);
    apiConfig.getSerializationConfig().addSerializationConfig(FloatToStringSerializer.class);
}
Also used : TestEndpoint(com.google.api.server.spi.testing.TestEndpoint) ServiceContext(com.google.api.server.spi.ServiceContext) TypeLoader(com.google.api.server.spi.TypeLoader) Before(org.junit.Before)

Aggregations

ServiceContext (com.google.api.server.spi.ServiceContext)7 ApiConfig (com.google.api.server.spi.config.model.ApiConfig)5 TypeLoader (com.google.api.server.spi.TypeLoader)4 ApiConfigLoader (com.google.api.server.spi.config.ApiConfigLoader)3 ApiConfigAnnotationReader (com.google.api.server.spi.config.annotationreader.ApiConfigAnnotationReader)3 Swagger (io.swagger.models.Swagger)3 Before (org.junit.Before)3 EndpointsPrettyPrinter (com.google.api.server.spi.response.EndpointsPrettyPrinter)2 File (java.io.File)2 URLClassLoader (java.net.URLClassLoader)2 Test (org.junit.Test)2 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)1 ApiKey (com.google.api.server.spi.config.model.ApiKey)1 ApiSerializationConfig (com.google.api.server.spi.config.model.ApiSerializationConfig)1 SchemaRepository (com.google.api.server.spi.config.model.SchemaRepository)1 ApiConfigValidator (com.google.api.server.spi.config.validation.ApiConfigValidator)1 DiscoveryGenerator (com.google.api.server.spi.discovery.DiscoveryGenerator)1 DiscoveryContext (com.google.api.server.spi.discovery.DiscoveryGenerator.DiscoveryContext)1 SwaggerGenerator (com.google.api.server.spi.swagger.SwaggerGenerator)1 SwaggerContext (com.google.api.server.spi.swagger.SwaggerGenerator.SwaggerContext)1