use of com.google.api.server.spi.config.model.ApiMethodConfig in project endpoints-java by cloudendpoints.
the class ApiAnnotationConfigTest method testSetScopesIfSpecified_empty.
@Test
public void testSetScopesIfSpecified_empty() throws Exception {
String[] empty = {};
annotationConfig.setScopesIfSpecified(empty);
EndpointMethod method = getResultNoParamsMethod();
ApiMethodConfig methodConfig = config.getApiClassConfig().getMethods().getOrCreate(method);
assertEquals(toScopeExpression(), methodConfig.getScopeExpression());
String[] scopes = { "bleh", "more bleh" };
annotationConfig.setScopesIfSpecified(scopes);
annotationConfig.setScopesIfSpecified(empty);
assertEquals(toScopeExpression(), config.getScopeExpression());
}
use of com.google.api.server.spi.config.model.ApiMethodConfig in project endpoints-java by cloudendpoints.
the class ApiAnnotationConfigTest method testSetClientIdsIfSpecified_empty.
@Test
public void testSetClientIdsIfSpecified_empty() throws Exception {
String[] empty = {};
annotationConfig.setClientIdsIfSpecified(empty);
EndpointMethod method = getResultNoParamsMethod();
ApiMethodConfig methodConfig = config.getApiClassConfig().getMethods().getOrCreate(method);
assertEquals(Collections.emptyList(), methodConfig.getClientIds());
String[] clientIds = { "bleh", "more bleh" };
annotationConfig.setClientIdsIfSpecified(clientIds);
annotationConfig.setClientIdsIfSpecified(empty);
assertEquals(Collections.emptyList(), config.getClientIds());
}
use of com.google.api.server.spi.config.model.ApiMethodConfig in project endpoints-java by cloudendpoints.
the class ApiAnnotationConfigTest method testSetClientIdsIfSpecified.
@Test
public void testSetClientIdsIfSpecified() throws Exception {
String[] clientIds = { "foo", "bar" };
annotationConfig.setClientIdsIfSpecified(clientIds);
assertEquals(Arrays.asList(clientIds), config.getClientIds());
ApiMethodConfig methodConfig = config.getApiClassConfig().getMethods().getOrCreate(getResultNoParamsMethod());
assertEquals(Arrays.asList(clientIds), methodConfig.getClientIds());
}
use of com.google.api.server.spi.config.model.ApiMethodConfig in project endpoints-java by cloudendpoints.
the class ApiConfigAnnotationReaderTest method testEndpointWithBridgeMethods.
@Test
public void testEndpointWithBridgeMethods() throws Exception {
ApiConfig config = createConfig(BridgeInheritanceEndpoint.class);
annotationReader.loadEndpointClass(serviceContext, BridgeInheritanceEndpoint.class, config);
annotationReader.loadEndpointMethods(serviceContext, BridgeInheritanceEndpoint.class, config.getApiClassConfig().getMethods());
assertEquals(2, config.getApiClassConfig().getMethods().size());
ApiMethodConfig fn1 = config.getApiClassConfig().getMethods().get(methodToEndpointMethod(BridgeInheritanceEndpoint.class.getMethod("fn1")));
validateMethod(fn1, "api6.foos.fn1", "fn1", ApiMethod.HttpMethod.GET, DEFAULT_SCOPES, DEFAULT_AUDIENCES, DEFAULT_CLIENTIDS, null, null);
ApiMethodConfig fn2 = config.getApiClassConfig().getMethods().get(methodToEndpointMethod(BridgeInheritanceEndpoint.class.getSuperclass().getMethod("fn2")));
validateMethod(fn2, "api6.foos.fn2", "fn2", ApiMethod.HttpMethod.GET, DEFAULT_SCOPES, DEFAULT_AUDIENCES, DEFAULT_CLIENTIDS, null, null);
ApiMethodConfig bridge = config.getApiClassConfig().getMethods().get(methodToEndpointMethod(BridgeInheritanceEndpoint.class.getSuperclass().getMethod("fn1")));
assertNull(bridge);
}
use of com.google.api.server.spi.config.model.ApiMethodConfig in project endpoints-java by cloudendpoints.
the class ApiConfigAnnotationReaderTest method testSimpleOverrideEndpoint.
@Test
public void testSimpleOverrideEndpoint() throws Exception {
ApiConfig config = createConfig(SimpleOverrideEndpoint.class);
annotationReader.loadEndpointClass(serviceContext, SimpleOverrideEndpoint.class, config);
annotationReader.loadEndpointMethods(serviceContext, SimpleOverrideEndpoint.class, config.getApiClassConfig().getMethods());
assertEquals(1, config.getApiClassConfig().getMethods().size());
ApiMethodConfig foo = config.getApiClassConfig().getMethods().get(methodToEndpointMethod(SimpleOverrideEndpoint.class.getMethod("foo", String.class)));
validateMethod(foo, "api.foos.fn", "fn", ApiMethod.HttpMethod.GET, DEFAULT_SCOPES, DEFAULT_AUDIENCES, DEFAULT_CLIENTIDS, null, null);
}
Aggregations