use of com.google.api.server.spi.config.model.ApiSerializationConfig in project endpoints-java by cloudendpoints.
the class ApiAnnotationIntrospectorTest method testApiDeserializationByConfig.
@Test
public void testApiDeserializationByConfig() throws Exception {
ApiSerializationConfig config = new ApiSerializationConfig();
config.addSerializationConfig(TestApiSerializationByConfigConverter.class);
objectMapper.setAnnotationIntrospector(new ApiAnnotationIntrospector(config));
TestApiSerializationByConfig value = objectMapper.readValue("\"test2serialized\"", TestApiSerializationByConfig.class);
assertEquals("test2", value.getFoo());
}
use of com.google.api.server.spi.config.model.ApiSerializationConfig 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);
}
use of com.google.api.server.spi.config.model.ApiSerializationConfig in project endpoints-java by cloudendpoints.
the class ApiAnnotationIntrospectorTest method testApiSerializationByConfig.
@Test
public void testApiSerializationByConfig() throws Exception {
ApiSerializationConfig config = new ApiSerializationConfig();
config.addSerializationConfig(TestApiSerializationByConfigConverter.class);
objectMapper.setAnnotationIntrospector(new ApiAnnotationIntrospector(config));
String json = objectMapper.writeValueAsString(new TestApiSerializationByConfig());
JsonNode value = objectMapper.readValue(json, JsonNode.class);
assertEquals("testserialized", value.asText());
}
use of com.google.api.server.spi.config.model.ApiSerializationConfig in project endpoints-java by cloudendpoints.
the class ApiAnnotationIntrospectorTest method testApiSerializationByParameterizedConfig.
@Test
public void testApiSerializationByParameterizedConfig() throws Exception {
ApiSerializationConfig config = new ApiSerializationConfig();
config.addSerializationConfig(TestApiSerializationByParameterizedConfigConverter.class);
objectMapper.setAnnotationIntrospector(new ApiAnnotationIntrospector(config));
String json = objectMapper.writeValueAsString(new TestApiSerializationByParameterizedConfig<String>("paramtest"));
JsonNode value = objectMapper.readValue(json, JsonNode.class);
assertEquals("paramtestserialized", value.asText());
}
Aggregations