com.google.api.server.spi.config.ApiNamespace Java Examples
The following examples show how to use
com.google.api.server.spi.config.ApiNamespace.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApiConfigAnnotationReaderTest.java From endpoints-java with Apache License 2.0 | 5 votes |
@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()); }