Search in sources :

Example 11 with RestDescription

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

the class DiscoveryGeneratorTest method testWriteDiscovery_FooEndpointWithDescription.

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

Example 12 with RestDescription

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

the class DiscoveryGeneratorTest method testWriteDiscovery_ArrayEndpoint.

@Test
public void testWriteDiscovery_ArrayEndpoint() throws Exception {
    RestDescription doc = getDiscovery(new DiscoveryContext(), ArrayEndpoint.class);
    RestDescription expected = readExpectedAsDiscovery("array_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 13 with RestDescription

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

the class ProxyingDiscoveryServiceTest method getRestDocument.

@Test
public void getRestDocument() throws Exception {
    ProxyingDiscoveryService discoveryService = createDiscoveryService(true);
    when(provider.getRestDocument(SERVER_ROOT, API_NAME, API_VERSION)).thenReturn(REST_DOC);
    RestDescription actual = discoveryService.getRestDocument(createRequest("discovery/v1/apis/tictactoe/v1/rest"), API_NAME, API_VERSION);
    assertThat(actual).isEqualTo(REST_DOC);
}
Also used : RestDescription(com.google.api.services.discovery.model.RestDescription) Test(org.junit.Test)

Example 14 with RestDescription

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

the class DiscoveryGeneratorTest method testWriteDiscovery_FooEndpointDefaultContext.

@Test
public void testWriteDiscovery_FooEndpointDefaultContext() throws Exception {
    RestDescription doc = getDiscovery(new DiscoveryContext(), FooEndpoint.class);
    RestDescription expected = readExpectedAsDiscovery("foo_endpoint_default_context.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 15 with RestDescription

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

the class DiscoveryGeneratorTest method testWriteDiscovery_multipleApisWithSharedSchema.

@Test
public void testWriteDiscovery_multipleApisWithSharedSchema() throws Exception {
    // Read in an API that uses a resource with fields that have their own schema, then read in
    // another API that uses the same resource. The discovery for the second API should contain
    // both schema, rather than just the first one.
    getDiscovery(new DiscoveryContext(), EnumEndpointV2.class);
    RestDescription doc = getDiscovery(new DiscoveryContext(), EnumEndpoint.class);
    RestDescription expected = readExpectedAsDiscovery("enum_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)

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