本文整理匯總了Java中com.google.api.server.spi.config.ApiNamespace類的典型用法代碼示例。如果您正苦於以下問題:Java ApiNamespace類的具體用法?Java ApiNamespace怎麽用?Java ApiNamespace使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ApiNamespace類屬於com.google.api.server.spi.config包,在下文中一共展示了ApiNamespace類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testReadParametersInApiNamespace
import com.google.api.server.spi.config.ApiNamespace; //導入依賴的package包/類
@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());
}