mirror of https://github.com/apache/jclouds.git
JCLOUDS-49 clear remaining async stuff from openstack
This commit is contained in:
parent
e42cc80092
commit
360e8b8d6a
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jclouds.openstack.v2_0.features;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
|
||||
import org.jclouds.openstack.v2_0.domain.Extension;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.SelectJson;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Extensions via their REST API.
|
||||
* <p/>
|
||||
*
|
||||
* @see ExtensionApi
|
||||
* @see <a href=
|
||||
* "http://docs.openstack.org/api/openstack-compute/2/content/Extensions-d1e1444.html"
|
||||
* />
|
||||
*/
|
||||
@RequestFilters(AuthenticateRequest.class)
|
||||
public interface ExtensionAsyncApi {
|
||||
|
||||
/**
|
||||
* @see ExtensionApi#list
|
||||
*/
|
||||
@Named("extension:list")
|
||||
@GET
|
||||
@SelectJson("extensions")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Path("/extensions")
|
||||
@Fallback(EmptySetOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends Set<? extends Extension>> list();
|
||||
|
||||
/**
|
||||
* @see ExtensionApi#get
|
||||
*/
|
||||
@Named("extension:get")
|
||||
@GET
|
||||
@SelectJson("extension")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Path("/extensions/{alias}")
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<? extends Extension> get(@PathParam("alias") String id);
|
||||
|
||||
}
|
|
@ -16,17 +16,16 @@
|
|||
*/
|
||||
package org.jclouds.openstack.internal;
|
||||
|
||||
import static org.jclouds.providers.AnonymousProviderMetadata.forApiOnEndpoint;
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.apis.ApiMetadata;
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.IntegrationTestAsyncClient;
|
||||
import org.jclouds.http.IntegrationTestClient;
|
||||
import org.jclouds.openstack.functions.ParseAuthenticationResponseFromHeaders;
|
||||
import org.jclouds.rest.AnonymousRestApiMetadata;
|
||||
import org.jclouds.providers.ProviderMetadata;
|
||||
import org.jclouds.rest.internal.BaseRestAnnotationProcessingTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -41,7 +40,7 @@ public class OpenStackAuthClientTest extends BaseRestAnnotationProcessingTest<Op
|
|||
Invokable<?, ?> method = method(OpenStackAuthClient.class, "authenticate", String.class, String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("foo", "bar"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/v1.0 HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/v1 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: */*\nHost: localhost:8080\nX-Auth-Key: bar\nX-Auth-User: foo\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
|
@ -55,7 +54,7 @@ public class OpenStackAuthClientTest extends BaseRestAnnotationProcessingTest<Op
|
|||
Invokable<?, ?> method = method(OpenStackAuthClient.class, "authenticateStorage", String.class, String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("foo", "bar"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/v1.0 HTTP/1.1");
|
||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/v1 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: */*\nHost: localhost:8080\nX-Storage-Pass: bar\nX-Storage-User: foo\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
|
@ -66,9 +65,8 @@ public class OpenStackAuthClientTest extends BaseRestAnnotationProcessingTest<Op
|
|||
}
|
||||
|
||||
@Override
|
||||
public ApiMetadata createApiMetadata() {
|
||||
return AnonymousRestApiMetadata.forClientMappedToAsyncClient(IntegrationTestClient.class, IntegrationTestAsyncClient.class).toBuilder().defaultEndpoint(
|
||||
"http://localhost:8080").version("1.0").build();
|
||||
public ProviderMetadata createProviderMetadata() {
|
||||
return forApiOnEndpoint(IntegrationTestClient.class, "http://localhost:8080");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue