use of com.google.api.server.spi.discovery.DiscoveryGenerator.DiscoveryContext 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);
}
use of com.google.api.server.spi.discovery.DiscoveryGenerator.DiscoveryContext 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);
}
use of com.google.api.server.spi.discovery.DiscoveryGenerator.DiscoveryContext in project endpoints-java by cloudendpoints.
the class DiscoveryGeneratorTest method testWriteDiscovery_MapEndpoint_WithArrayValue.
@Test
public void testWriteDiscovery_MapEndpoint_WithArrayValue() throws Exception {
System.setProperty(MAP_SCHEMA_SUPPORT_ARRAYS_VALUES.systemPropertyName, "yes");
try {
RestDescription doc = getDiscovery(new DiscoveryContext(), MapEndpoint.class);
RestDescription expected = readExpectedAsDiscovery("map_endpoint_with_array.json");
compareDiscovery(expected, doc);
} finally {
System.clearProperty(MAP_SCHEMA_SUPPORT_ARRAYS_VALUES.systemPropertyName);
}
}
use of com.google.api.server.spi.discovery.DiscoveryGenerator.DiscoveryContext 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);
}
use of com.google.api.server.spi.discovery.DiscoveryGenerator.DiscoveryContext 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);
}
Aggregations