use of com.google.api.server.spi.config.ApiNamespace in project endpoints-java by cloudendpoints.
the class ApiConfigAnnotationReaderTest method testReadParametersInApiNamespace.
@Test
public void testReadParametersInApiNamespace() throws Exception {
@Api
class ValidNamespaceDefault {
}
ApiConfig config = createConfig(ValidNamespaceDefault.class);
annotationReader.loadEndpointClass(serviceContext, ValidNamespaceDefault.class, config);
@Api(namespace = @ApiNamespace(ownerDomain = "domain", ownerName = ""))
class BadNamespaceEmptyName {
}
config = createConfig(BadNamespaceEmptyName.class);
annotationReader.loadEndpointClass(serviceContext, BadNamespaceEmptyName.class, config);
assertEquals("domain", config.getNamespaceConfig().getOwnerDomain());
@Api(namespace = @ApiNamespace(ownerDomain = "", ownerName = "name"))
class BadNamespaceEmptyDomain {
}
config = createConfig(BadNamespaceEmptyDomain.class);
annotationReader.loadEndpointClass(serviceContext, BadNamespaceEmptyDomain.class, config);
assertEquals("name", config.getNamespaceConfig().getOwnerName());
@Api(namespace = @ApiNamespace(ownerDomain = "domain", ownerName = "name"))
class ValidNamespaceEmptyPackage {
}
config = createConfig(ValidNamespaceEmptyPackage.class);
annotationReader.loadEndpointClass(serviceContext, ValidNamespaceEmptyPackage.class, config);
assertEquals("domain", config.getNamespaceConfig().getOwnerDomain());
assertEquals("name", config.getNamespaceConfig().getOwnerName());
@Api(namespace = @ApiNamespace(ownerDomain = "domain", ownerName = "name", packagePath = "package"))
class ValidNamespaceFullySpecified {
}
config = createConfig(ValidNamespaceFullySpecified.class);
annotationReader.loadEndpointClass(serviceContext, ValidNamespaceFullySpecified.class, config);
assertEquals("domain", config.getNamespaceConfig().getOwnerDomain());
assertEquals("name", config.getNamespaceConfig().getOwnerName());
assertEquals("package", config.getNamespaceConfig().getPackagePath());
}
Aggregations