use of com.google.api.server.spi.config.model.ApiConfig in project endpoints-java by cloudendpoints.
the class ApiConfigValidatorTest method testApiMethodConfigWithApiMethodNameContainingStartingDot.
@Test
public void testApiMethodConfigWithApiMethodNameContainingStartingDot() throws Exception {
@Api(name = "testApi", version = "v1", resource = "bar")
final class Test {
@ApiMethod(name = ".Api.TestMethod")
public void test() {
}
}
ApiConfig config = configLoader.loadConfiguration(ServiceContext.create(), Test.class);
try {
validator.validate(config);
fail("Expected InvalidMethodNameException.");
} catch (InvalidMethodNameException expected) {
}
}
use of com.google.api.server.spi.config.model.ApiConfig in project endpoints-java by cloudendpoints.
the class ApiConfigValidatorTest method testNonuniqueRestSignatures_multiClass.
@Test
public void testNonuniqueRestSignatures_multiClass() throws Exception {
@Api
class Foo {
@ApiMethod(path = "path")
public void foo() {
}
}
ApiConfig config1 = configLoader.loadConfiguration(ServiceContext.create(), Foo.class);
@Api
class Bar {
@ApiMethod(path = "path")
public void bar() {
}
}
ApiConfig config2 = configLoader.loadConfiguration(ServiceContext.create(), Bar.class);
try {
validator.validate(Lists.newArrayList(config1, config2));
fail();
} catch (DuplicateRestPathException expected) {
}
}
use of com.google.api.server.spi.config.model.ApiConfig in project endpoints-java by cloudendpoints.
the class DiscoveryGeneratorTest method testDirectoryIsCloneable.
@Test
public void testDirectoryIsCloneable() throws Exception {
ApiConfig config = configLoader.loadConfiguration(ServiceContext.create(), FooEndpoint.class);
DiscoveryGenerator.Result result = generator.writeDiscovery(ImmutableList.of(config), context);
result.directory().clone();
}
use of com.google.api.server.spi.config.model.ApiConfig in project endpoints-java by cloudendpoints.
the class ApiConfigValidatorTest method testNamespaceValidation_fullySpecified.
@Test
public void testNamespaceValidation_fullySpecified() throws Exception {
ApiConfig validNamespaceFullySpecified = configFactory.copy(config);
validNamespaceFullySpecified.getNamespaceConfig().setOwnerDomain("domain");
validNamespaceFullySpecified.getNamespaceConfig().setOwnerName("name");
validNamespaceFullySpecified.getNamespaceConfig().setPackagePath("package");
validator.validate(validNamespaceFullySpecified);
}
use of com.google.api.server.spi.config.model.ApiConfig in project endpoints-java by cloudendpoints.
the class SwaggerGeneratorTest method testWriteSwagger_FooEndpoint.
@Test
public void testWriteSwagger_FooEndpoint() throws Exception {
ApiConfig config = configLoader.loadConfiguration(ServiceContext.create(), FooEndpoint.class);
Swagger swagger = generator.writeSwagger(ImmutableList.of(config), false, context);
Swagger expected = readExpectedAsSwagger("foo_endpoint.swagger");
compareSwagger(expected, swagger);
}
Aggregations