Search in sources :

Example 16 with RestDescription

use of com.google.api.services.discovery.model.RestDescription in project endpoints-java by cloudendpoints.

the class DiscoveryGeneratorTest method testWriteDiscovery_FooEndpointLocalhost.

@Test
public void testWriteDiscovery_FooEndpointLocalhost() throws Exception {
    RestDescription doc = getDiscovery(new DiscoveryContext().setApiRoot("http://localhost:8080/api"), FooEndpoint.class);
    RestDescription expected = readExpectedAsDiscovery("foo_endpoint_localhost.json");
    compareDiscovery(expected, doc);
}
Also used : DiscoveryContext(com.google.api.server.spi.discovery.DiscoveryGenerator.DiscoveryContext) RestDescription(com.google.api.services.discovery.model.RestDescription) Test(org.junit.Test)

Example 17 with RestDescription

use of com.google.api.services.discovery.model.RestDescription in project endpoints-java by cloudendpoints.

the class DiscoveryGeneratorTest method testWriteDiscovery_parameterOrder.

@Test
public void testWriteDiscovery_parameterOrder() throws Exception {
    RestDescription doc = getDiscovery(new DiscoveryContext(), MultipleParameterEndpoint.class);
    RestDescription expected = readExpectedAsDiscovery("multiple_parameter_endpoint.json");
    compareDiscovery(expected, doc);
}
Also used : DiscoveryContext(com.google.api.server.spi.discovery.DiscoveryGenerator.DiscoveryContext) RestDescription(com.google.api.services.discovery.model.RestDescription) Test(org.junit.Test)

Example 18 with RestDescription

use of com.google.api.services.discovery.model.RestDescription in project endpoints-java by cloudendpoints.

the class ProxyingDiscoveryProviderTest method getRestDocument.

@Test
public void getRestDocument() throws Exception {
    when(restRequest.execute()).thenReturn(REST_DOC);
    RestDescription actual = provider.getRestDocument(REWRITTEN_ROOT, NAME, V1);
    assertThat(actual).isEqualTo(REST_DOC);
    verify(apis).generateRest(new com.google.api.services.discovery.model.ApiConfig().setConfig(V1_JSON_API_CONFIG));
}
Also used : RestDescription(com.google.api.services.discovery.model.RestDescription) ApiConfig(com.google.api.server.spi.config.model.ApiConfig) Test(org.junit.Test)

Example 19 with RestDescription

use of com.google.api.services.discovery.model.RestDescription in project endpoints-java by cloudendpoints.

the class DiscoveryGeneratorTest method testWriteDiscovery_AbsoluteCommonPathEndpoint.

@Test
public void testWriteDiscovery_AbsoluteCommonPathEndpoint() throws Exception {
    RestDescription doc = getDiscovery(context, AbsoluteCommonPathEndpoint.class);
    RestDescription expected = readExpectedAsDiscovery("absolute_common_path_endpoint.json");
    compareDiscovery(expected, doc);
}
Also used : RestDescription(com.google.api.services.discovery.model.RestDescription) Test(org.junit.Test)

Example 20 with RestDescription

use of com.google.api.services.discovery.model.RestDescription in project endpoints-java by cloudendpoints.

the class DiscoveryGeneratorTest method testWriteDiscovery_newHostname.

@Test
public void testWriteDiscovery_newHostname() throws Exception {
    RestDescription doc = getDiscovery(new DiscoveryContext().setApiRoot("http://notlocalhost/api").setHostname("localhost:8080"), FooEndpoint.class);
    RestDescription expected = readExpectedAsDiscovery("foo_endpoint_localhost.json");
    compareDiscovery(expected, doc);
}
Also used : DiscoveryContext(com.google.api.server.spi.discovery.DiscoveryGenerator.DiscoveryContext) RestDescription(com.google.api.services.discovery.model.RestDescription) Test(org.junit.Test)

Aggregations

RestDescription (com.google.api.services.discovery.model.RestDescription)23 Test (org.junit.Test)16 DiscoveryContext (com.google.api.server.spi.discovery.DiscoveryGenerator.DiscoveryContext)10 ApiKey (com.google.api.server.spi.config.model.ApiKey)5 ApiConfig (com.google.api.server.spi.config.model.ApiConfig)4 ImmutableMap (com.google.common.collect.ImmutableMap)4 Map (java.util.Map)3 JsonSchema (com.google.api.services.discovery.model.JsonSchema)2 File (java.io.File)2 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)1 GoogleCredential (com.google.api.client.googleapis.auth.oauth2.GoogleCredential)1 GoogleNetHttpTransport (com.google.api.client.googleapis.javanet.GoogleNetHttpTransport)1 FileContent (com.google.api.client.http.FileContent)1 GenericUrl (com.google.api.client.http.GenericUrl)1 HttpContent (com.google.api.client.http.HttpContent)1 HttpRequest (com.google.api.client.http.HttpRequest)1 HttpRequestFactory (com.google.api.client.http.HttpRequestFactory)1 HttpTransport (com.google.api.client.http.HttpTransport)1 JsonFactory (com.google.api.client.json.JsonFactory)1 ServiceContext (com.google.api.server.spi.ServiceContext)1