use of com.google.api.server.spi.config.model.ApiConfig in project endpoints-java by cloudendpoints.
the class ApiConfigValidatorTest method testNamespaceValidation_emptyDomain.
@Test
public void testNamespaceValidation_emptyDomain() throws Exception {
ApiConfig badNamespaceEmptyDomain = configFactory.copy(config);
badNamespaceEmptyDomain.getNamespaceConfig().setOwnerDomain("");
badNamespaceEmptyDomain.getNamespaceConfig().setOwnerName("name");
try {
validator.validate(badNamespaceEmptyDomain);
fail("Expected InvalidNamespaceException.");
} catch (InvalidNamespaceException expected) {
}
}
use of com.google.api.server.spi.config.model.ApiConfig in project endpoints-java by cloudendpoints.
the class ApiConfigValidatorTest method testInconsistentApiWideConfig.
@Test
public void testInconsistentApiWideConfig() throws Exception {
@Api(name = "testApi", version = "v1", resource = "foo")
final class Test1 {
}
ApiConfig config1 = configLoader.loadConfiguration(ServiceContext.create(), Test1.class);
@Api(name = "testApi", version = "v1", resource = "bar")
final class Test2 {
}
ApiConfig config2 = configLoader.loadConfiguration(ServiceContext.create(), Test2.class);
try {
validator.validate(Lists.newArrayList(config1, config2));
fail("Expected InconsistentApiConfigurationException.");
} catch (InconsistentApiConfigurationException expected) {
}
}
use of com.google.api.server.spi.config.model.ApiConfig in project endpoints-java by cloudendpoints.
the class ApiConfigValidatorTest method testApiMethodConfigWithApiMethodNameContainingEndingDot.
@Test
public void testApiMethodConfigWithApiMethodNameContainingEndingDot() 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 testNamespaceValidation_emptyName.
@Test
public void testNamespaceValidation_emptyName() throws Exception {
ApiConfig badNamespaceEmptyName = configFactory.copy(config);
badNamespaceEmptyName.getNamespaceConfig().setOwnerDomain("domain");
badNamespaceEmptyName.getNamespaceConfig().setOwnerName("");
try {
validator.validate(badNamespaceEmptyName);
fail("Expected InvalidNamespaceException.");
} catch (InvalidNamespaceException expected) {
}
}
use of com.google.api.server.spi.config.model.ApiConfig in project endpoints-java by cloudendpoints.
the class ApiConfigValidatorTest method testDifferentApisWithSameApiWideConfig.
@Test
public void testDifferentApisWithSameApiWideConfig() throws Exception {
@Api(name = "testApi", version = "v1", resource = "foo")
final class Test1 {
}
ApiConfig config1 = configLoader.loadConfiguration(ServiceContext.create(), Test1.class);
@Api(name = "testApi", version = "v1", resource = "foo")
@ApiClass(resource = "bar")
final class Test2 {
}
ApiConfig config2 = configLoader.loadConfiguration(ServiceContext.create(), Test2.class);
validator.validate(Lists.newArrayList(config1, config2));
}
Aggregations