introduce KeystoneProperties/TENANT_NAME KeystoneProperties/TENANT_ID properties; set value of prefix to tenantName

This commit is contained in:
Adrian Cole 2012-06-19 01:06:44 -06:00
parent f686737df3
commit b5797ad543
45 changed files with 461 additions and 227 deletions

View File

@ -41,7 +41,25 @@ public interface KeystoneProperties {
* />
*/
public static final String CREDENTIAL_TYPE = "jclouds.keystone.credential-type";
/**
* set this property to specify the tenant id of the authenticated user. Cannot be used simultaneously with {@link #TENANT_NAME}
* @see <a href="http://wiki.openstack.org/CLIAuth">openstack docs</a>
*/
public static final String TENANT_ID = "jclouds.keystone.tenant-id";
/**
* set this property to specify the tenant name of the authenticated user. Cannot be used simultaneously with {@link #TENANT_ID}
* @see <a href="http://wiki.openstack.org/CLIAuth">openstack docs</a>
*/
public static final String TENANT_NAME = "jclouds.keystone.tenant-name";
/**
* set this property to {@code true} to designate that the service requires explicit specification of either {@link #TENANT_NAME} or {@link #TENANT_ID}
* @see <a href="http://wiki.openstack.org/CLIAuth">openstack docs</a>
*/
public static final String REQUIRES_TENANT = "jclouds.keystone.requires-tenant";
/**
* version of the keystone service
*/

View File

@ -28,6 +28,8 @@ import org.jclouds.openstack.keystone.v2_0.domain.Access;
import org.jclouds.openstack.keystone.v2_0.domain.ApiAccessKeyCredentials;
import org.jclouds.openstack.keystone.v2_0.functions.internal.BaseAuthenticator;
import com.google.common.base.Optional;
@CredentialType(CredentialTypes.API_ACCESS_KEY_CREDENTIALS)
@Singleton
public class AuthenticateApiAccessKeyCredentials extends BaseAuthenticator<ApiAccessKeyCredentials> {
@ -39,13 +41,13 @@ public class AuthenticateApiAccessKeyCredentials extends BaseAuthenticator<ApiAc
}
@Override
protected Access authenticateWithTenantNameOrNull(String tenantId, ApiAccessKeyCredentials apiAccessKeyCredentials) {
return client.authenticateWithTenantNameAndCredentials(tenantId, apiAccessKeyCredentials);
protected Access authenticateWithTenantName(Optional<String> tenantName, ApiAccessKeyCredentials apiAccessKeyCredentials) {
return client.authenticateWithTenantNameAndCredentials(tenantName.orNull(), apiAccessKeyCredentials);
}
@Override
protected Access authenticateWithTenantId(String tenantId, ApiAccessKeyCredentials apiAccessKeyCredentials) {
return client.authenticateWithTenantIdAndCredentials(tenantId, apiAccessKeyCredentials);
protected Access authenticateWithTenantId(Optional<String> tenantId, ApiAccessKeyCredentials apiAccessKeyCredentials) {
return client.authenticateWithTenantIdAndCredentials(tenantId.orNull(), apiAccessKeyCredentials);
}
@Override

View File

@ -28,6 +28,8 @@ import org.jclouds.openstack.keystone.v2_0.domain.Access;
import org.jclouds.openstack.keystone.v2_0.domain.PasswordCredentials;
import org.jclouds.openstack.keystone.v2_0.functions.internal.BaseAuthenticator;
import com.google.common.base.Optional;
@CredentialType(CredentialTypes.PASSWORD_CREDENTIALS)
@Singleton
public class AuthenticatePasswordCredentials extends BaseAuthenticator<PasswordCredentials> {
@ -39,13 +41,13 @@ public class AuthenticatePasswordCredentials extends BaseAuthenticator<PasswordC
}
@Override
protected Access authenticateWithTenantNameOrNull(String tenantId, PasswordCredentials apiAccessKeyCredentials) {
return client.authenticateWithTenantNameAndCredentials(tenantId, apiAccessKeyCredentials);
protected Access authenticateWithTenantName(Optional<String> tenantName, PasswordCredentials apiAccessKeyCredentials) {
return client.authenticateWithTenantNameAndCredentials(tenantName.orNull(), apiAccessKeyCredentials);
}
@Override
protected Access authenticateWithTenantId(String tenantId, PasswordCredentials apiAccessKeyCredentials) {
return client.authenticateWithTenantIdAndCredentials(tenantId, apiAccessKeyCredentials);
protected Access authenticateWithTenantId(Optional<String> tenantId, PasswordCredentials apiAccessKeyCredentials) {
return client.authenticateWithTenantIdAndCredentials(tenantId.orNull(), apiAccessKeyCredentials);
}
@Override

View File

@ -18,45 +18,80 @@
*/
package org.jclouds.openstack.keystone.v2_0.functions.internal;
import static com.google.common.base.Preconditions.checkState;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import org.jclouds.domain.Credentials;
import org.jclouds.logging.Logger;
import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.*;
import org.jclouds.openstack.keystone.v2_0.domain.Access;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.inject.Inject;
import com.google.inject.name.Named;
public abstract class BaseAuthenticator<C> implements Function<Credentials, Access> {
@Resource
protected Logger logger = Logger.NULL;
@Inject(optional = true)
@Named(TENANT_NAME)
protected String defaultTenantName;
@Inject(optional = true)
@Named(TENANT_ID)
protected String defaultTenantId;
@Inject(optional = true)
@Named(REQUIRES_TENANT)
protected boolean requiresTenant;
@PostConstruct
public void checkPropertiesAreCompatible() {
checkState(defaultTenantName == null || defaultTenantId == null, "you cannot specify both %s and %s",
TENANT_NAME, TENANT_ID);
}
@Override
public Access apply(Credentials input) {
String tenantId = null;
Optional<String> tenantName = Optional.fromNullable(defaultTenantName);
Optional<String> tenantId = Optional.fromNullable(defaultTenantId);
String usernameOrAccessKey = input.identity;
if (input.identity.indexOf(':') == -1) {
logger.debug("Identity %s does not match format tenantName:accessKey", input.identity);
} else {
tenantId = input.identity.substring(0, input.identity.indexOf(':'));
if (!tenantName.isPresent() && input.identity.indexOf(':') != -1) {
tenantName = Optional.of(input.identity.substring(0, input.identity.indexOf(':')));
usernameOrAccessKey = input.identity.substring(input.identity.indexOf(':') + 1);
}
String passwordOrSecretKey = input.credential;
C creds = createCredentials(usernameOrAccessKey, passwordOrSecretKey);
Access access;
if (tenantId != null && tenantId.matches("^[0-9]+$")) {
if (tenantId.isPresent()) {
access = authenticateWithTenantId(tenantId, creds);
} else if (tenantName.isPresent()) {
access = authenticateWithTenantName(tenantName, creds);
} else if (!requiresTenant) {
access = authenticateWithTenantName(tenantName, creds);
} else {
access = authenticateWithTenantNameOrNull(tenantId, creds);
throw new IllegalArgumentException(
String.format(
"current configuration is set to [%s]. Unless you set [%s] or [%s], you must prefix your identity with 'tenantName:'",
REQUIRES_TENANT, TENANT_NAME, TENANT_ID));
}
return access;
}
public abstract C createCredentials(String identity, String credential);
protected abstract Access authenticateWithTenantId(String tenantId, C apiAccessKeyCredentials);
protected abstract Access authenticateWithTenantId(Optional<String> tenantId, C apiAccessKeyCredentials);
protected abstract Access authenticateWithTenantNameOrNull(String tenantId, C apiAccessKeyCredentials);
protected abstract Access authenticateWithTenantName(Optional<String> tenantId, C apiAccessKeyCredentials);
}

View File

@ -49,9 +49,9 @@ public class BaseKeystoneRestClientExpectTest<S> extends BaseRestClientExpectTes
public BaseKeystoneRestClientExpectTest() {
provider = "openstack-keystone";
keystoneAuthWithUsernameAndPassword = KeystoneFixture.INSTANCE.initialAuthWithUsernameAndPassword(identity,
keystoneAuthWithUsernameAndPassword = KeystoneFixture.INSTANCE.initialAuthWithUsernameAndPasswordAndTenantName(identity,
credential);
keystoneAuthWithAccessKeyAndSecretKey = KeystoneFixture.INSTANCE.initialAuthWithAccessKeyAndSecretKey(identity,
keystoneAuthWithAccessKeyAndSecretKey = KeystoneFixture.INSTANCE.initialAuthWithAccessKeyAndSecretKeyAndTenantName(identity,
credential);
authToken = KeystoneFixture.INSTANCE.getAuthToken();

View File

@ -49,6 +49,19 @@ public enum KeystoneFixture {
}
public HttpRequest initialAuthWithUsernameAndPassword(String username, String password){
return HttpRequest
.builder()
.method("POST")
.endpoint(URI.create("http://localhost:5000/v2.0/tokens"))
.headers(ImmutableMultimap.of(HttpHeaders.ACCEPT, "application/json"))
.payload(
payloadFromStringWithContentType(
format(
"{\"auth\":{\"passwordCredentials\":{\"username\":\"%s\",\"password\":\"%s\"}}}",
username, password), "application/json")).build();
}
public HttpRequest initialAuthWithUsernameAndPasswordAndTenantName(String username, String password){
return HttpRequest
.builder()
.method("POST")
@ -61,7 +74,7 @@ public enum KeystoneFixture {
username, password, getTenantName()), "application/json")).build();
}
public HttpRequest initialAuthWithAccessKeyAndSecretKey(String accessKey, String secretKey){
public HttpRequest initialAuthWithAccessKeyAndSecretKeyAndTenantName(String accessKey, String secretKey){
return HttpRequest
.builder()
.method("POST")

View File

@ -26,6 +26,7 @@ import java.util.Properties;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties;
import org.jclouds.openstack.keystone.v2_0.internal.KeystoneFixture;
import org.jclouds.openstack.nova.v2_0.NovaClient;
import org.jclouds.openstack.nova.v2_0.internal.BaseNovaClientExpectTest;
import org.jclouds.openstack.nova.v2_0.parse.ParseServerListTest;
@ -52,6 +53,7 @@ public class AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest extends Ba
protected Properties setupProperties() {
Properties contextProperties = super.setupProperties();
contextProperties.setProperty("jclouds.keystone.credential-type", "apiAccessKeyCredentials");
contextProperties.setProperty("jclouds.keystone.tenant-id", KeystoneFixture.INSTANCE.getTenantId());
return contextProperties;
}

View File

@ -0,0 +1,82 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.nova.v2_0;
import static org.testng.Assert.assertEquals;
import java.net.URI;
import java.util.Properties;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties;
import org.jclouds.openstack.keystone.v2_0.internal.KeystoneFixture;
import org.jclouds.openstack.nova.v2_0.NovaClient;
import org.jclouds.openstack.nova.v2_0.internal.BaseNovaClientExpectTest;
import org.jclouds.openstack.nova.v2_0.parse.ParseServerListTest;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
/**
*
* @see KeystoneProperties#CREDENTIAL_TYPE
* @author Adrian Cole
*/
@Test(groups = "unit", testName = "AccessKeyAndSecretKeyAndTenantIdAuthenticationExpectTest")
public class AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest extends BaseNovaClientExpectTest {
public AccessKeyAndSecretKeyAndTenantNamePropertyAuthenticationExpectTest() {
identity = "identity";
}
/**
* this reflects the properties that a user would pass to createContext
*/
@Override
protected Properties setupProperties() {
Properties contextProperties = super.setupProperties();
contextProperties.setProperty("jclouds.keystone.credential-type", "apiAccessKeyCredentials");
contextProperties.setProperty("jclouds.keystone.tenant-name", KeystoneFixture.INSTANCE.getTenantName());
return contextProperties;
}
public void testListServersWhenResponseIs2xx() throws Exception {
HttpRequest listServers = HttpRequest
.builder()
.method("GET")
.endpoint(URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers"))
.headers(
ImmutableMultimap.<String, String> builder().put("Accept", "application/json")
.put("X-Auth-Token", authToken).build()).build();
HttpResponse listServersResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResource("/server_list.json")).build();
NovaClient clientWhenServersExist = requestsSendResponses(keystoneAuthWithAccessKeyAndSecretKeyAndTenantName,
responseWithKeystoneAccess, listServers, listServersResponse);
assertEquals(clientWhenServersExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1"));
assertEquals(clientWhenServersExist.getServerClientForZone("az-1.region-a.geo-1").listServers().toString(),
new ParseServerListTest().expected().toString());
}
}

View File

@ -64,7 +64,7 @@ public class AccessKeyAndSecretKeyAuthenticationExpectTest extends BaseNovaClien
HttpResponse listServersResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResource("/server_list.json")).build();
NovaClient clientWhenServersExist = requestsSendResponses(keystoneAuthWithAccessKeyAndSecretKey,
NovaClient clientWhenServersExist = requestsSendResponses(keystoneAuthWithAccessKeyAndSecretKeyAndTenantName,
responseWithKeystoneAccess, listServers, listServersResponse);
assertEquals(clientWhenServersExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1"));

View File

@ -21,12 +21,10 @@ package org.jclouds.openstack.nova.v2_0;
import static org.testng.Assert.assertEquals;
import java.net.URI;
import java.util.Properties;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties;
import org.jclouds.openstack.nova.v2_0.NovaClient;
import org.jclouds.openstack.nova.v2_0.internal.BaseNovaClientExpectTest;
import org.jclouds.openstack.nova.v2_0.parse.ParseServerListTest;
import org.testng.annotations.Test;
@ -41,17 +39,10 @@ import com.google.common.collect.ImmutableSet;
*/
@Test(groups = "unit", testName = "PasswordAuthenticationExpectTest")
public class PasswordAuthenticationExpectTest extends BaseNovaClientExpectTest {
/**
* this reflects the properties that a user would pass to createContext
*/
@Override
protected Properties setupProperties() {
Properties contextProperties = super.setupProperties();
contextProperties.setProperty("jclouds.keystone.credential-type", "passwordCredentials");
return contextProperties;
public PasswordAuthenticationExpectTest() {
identity = "identity";
}
public void testListServersWhenResponseIs2xx() throws Exception {
HttpRequest listServers = HttpRequest
.builder()

View File

@ -0,0 +1,76 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.nova.v2_0;
import static org.testng.Assert.assertEquals;
import java.net.URI;
import java.util.Properties;
import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties;
import org.jclouds.openstack.nova.v2_0.NovaClient;
import org.jclouds.openstack.nova.v2_0.internal.BaseNovaClientExpectTest;
import org.jclouds.openstack.nova.v2_0.parse.ParseServerListTest;
import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
/**
*
* @see KeystoneProperties#CREDENTIAL_TYPE
* @author Adrian Cole
*/
@Test(groups = "unit", testName = "PasswordAuthenticationExpectTest")
public class PasswordAuthenticationWithTenantNameExpectTest extends BaseNovaClientExpectTest {
/**
* this reflects the properties that a user would pass to createContext
*/
@Override
protected Properties setupProperties() {
Properties contextProperties = super.setupProperties();
contextProperties.setProperty("jclouds.keystone.credential-type", "passwordCredentials");
return contextProperties;
}
public void testListServersWhenResponseIs2xx() throws Exception {
HttpRequest listServers = HttpRequest
.builder()
.method("GET")
.endpoint(URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers"))
.headers(
ImmutableMultimap.<String, String> builder().put("Accept", "application/json")
.put("X-Auth-Token", authToken).build()).build();
HttpResponse listServersResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResource("/server_list.json")).build();
NovaClient clientWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, listServers, listServersResponse);
assertEquals(clientWhenServersExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1"));
assertEquals(clientWhenServersExist.getServerClientForZone("az-1.region-a.geo-1").listServers().toString(),
new ParseServerListTest().expected().toString());
}
}

View File

@ -82,7 +82,7 @@ public class NovaComputeServiceAdapterExpectTest extends BaseNovaComputeServiceC
.payload(payloadFromResource("/server_details.json")).build();
Map<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
.put(keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess)
.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess)
.put(extensionsOfNovaRequest, extensionsOfNovaResponse)
.put(listImagesDetail, listImagesDetailResponse)
.put(listFlavorsDetail, listFlavorsDetailResponse)
@ -136,7 +136,7 @@ public class NovaComputeServiceAdapterExpectTest extends BaseNovaComputeServiceC
.payload(payloadFromResource("/server_details.json")).build();
Map<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
.put(keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess)
.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess)
.put(extensionsOfNovaRequest, extensionsOfNovaResponse)
.put(listImagesDetail, listImagesDetailResponse)
.put(listFlavorsDetail, listFlavorsDetailResponse)

View File

@ -58,7 +58,7 @@ public class NovaComputeServiceExpectTest extends BaseNovaComputeServiceExpectTe
public void testListLocationsWhenResponseIs2xx() throws Exception {
Map<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
.put(keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess)
.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess)
.put(extensionsOfNovaRequest, extensionsOfNovaResponse).put(listImagesDetail, listImagesDetailResponse)
.put(listServers, listServersResponse).put(listFlavorsDetail, listFlavorsDetailResponse).build();
@ -78,7 +78,7 @@ public class NovaComputeServiceExpectTest extends BaseNovaComputeServiceExpectTe
Map<HttpRequest, HttpResponse> defaultTemplateTryStack = ImmutableMap
.<HttpRequest, HttpResponse> builder()
.put(keystoneAuthWithUsernameAndPassword,
.put(keystoneAuthWithUsernameAndPasswordAndTenantName,
HttpResponse
.builder()
.statusCode(200)
@ -132,7 +132,7 @@ public class NovaComputeServiceExpectTest extends BaseNovaComputeServiceExpectTe
HttpResponse listServersResponse = HttpResponse.builder().statusCode(404).build();
ComputeService clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
ComputeService clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, listServers, listServersResponse);
assertTrue(clientWhenNoServersExist.listNodes().isEmpty());

View File

@ -72,7 +72,7 @@ public class AllocateAndAddFloatingIpToNodeExpectTest extends BaseNovaComputeSer
HttpRequest addFloatingIPRequest = addFloatingIPForAddress("10.0.0.3");
AllocateAndAddFloatingIpToNode fn = requestsSendResponses(
ImmutableMap.<HttpRequest, HttpResponse> builder().put(keystoneAuthWithUsernameAndPassword,
ImmutableMap.<HttpRequest, HttpResponse> builder().put(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess).put(extensionsOfNovaRequest, extensionsOfNovaResponse).put(
allocateFloatingIP, allocateFloatingIPResponse)
.put(addFloatingIPRequest, addFloatingIPResponse).build()).getContext().utils().injector()
@ -118,7 +118,7 @@ public class AllocateAndAddFloatingIpToNodeExpectTest extends BaseNovaComputeSer
HttpRequest addFloatingIPRequest = addFloatingIPForAddress("10.0.0.5");
AllocateAndAddFloatingIpToNode fn = requestsSendResponses(
ImmutableMap.<HttpRequest, HttpResponse> builder().put(keystoneAuthWithUsernameAndPassword,
ImmutableMap.<HttpRequest, HttpResponse> builder().put(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess).put(extensionsOfNovaRequest, extensionsOfNovaResponse).put(
allocateFloatingIP, allocateFloatingIPResponse)
.put(addFloatingIPRequest, addFloatingIPResponse).put(listFloatingIPs,

View File

@ -50,7 +50,7 @@ public class GetImageWhenImageInZoneHasActiveStatusPredicateWithResultExpectTest
.payload(payloadFromResource("/image_list_detail_imageextension.json")).build();
private Map<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder()
.put(keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess)
.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess)
.put(listImagesDetail, listImagesDetailImageExtensionResponse).build();
public void testReturnsFalseOnImageStatusSavingAndTrueOnActive() {

View File

@ -49,7 +49,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testSuspend() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "suspend").build(),
standardResponseBuilder(202).build()
@ -61,7 +61,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testSuspendFailsNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "suspend").build(),
standardResponseBuilder(404).build()
@ -74,7 +74,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testSuspendFailsNotAuthorized() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "suspend").build(),
standardResponseBuilder(403).build()
@ -86,7 +86,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testResume() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "resume").build(),
standardResponseBuilder(202).build()
@ -98,7 +98,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testResumeFailsNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "resume").build(),
standardResponseBuilder(404).build()
@ -111,7 +111,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testResumeFailsNotAuthorized() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "resume").build(),
standardResponseBuilder(403).build()
@ -123,7 +123,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testLock() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "lock").build(),
standardResponseBuilder(202).build()
@ -135,7 +135,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testLockFailsNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "lock").build(),
standardResponseBuilder(404).build()
@ -147,7 +147,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testUnlock() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "unlock").build(),
standardResponseBuilder(202).build()
@ -159,7 +159,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testUnlockFailsNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "unlock").build(),
standardResponseBuilder(404).build()
@ -171,7 +171,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testPause() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "pause").build(),
standardResponseBuilder(202).build()
@ -183,7 +183,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testPauseFailsNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "pause").build(),
standardResponseBuilder(404).build()
@ -195,7 +195,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testUnpause() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "unpause").build(),
standardResponseBuilder(202).build()
@ -207,7 +207,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testUnpauseFailsNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "unpause").build(),
standardResponseBuilder(404).build()
@ -219,7 +219,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testMigrateServer() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "migrate").build(),
standardResponseBuilder(202).build()
@ -232,7 +232,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testMigrateServerFailsNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "migrate").build(),
standardResponseBuilder(404).build()
@ -244,7 +244,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testResetNetworkOfServer() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "resetNetwork").build(),
standardResponseBuilder(202).build()
@ -256,7 +256,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testResetNetworkOfServerFailsNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "resetNetwork").build(),
standardResponseBuilder(404).build()
@ -268,7 +268,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testInjectNetworkInfoIntoServer() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "injectNetworkInfo").build(),
standardResponseBuilder(202).build()
@ -280,7 +280,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testInjectNetworkInfoIntoServerFailsNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "injectNetworkInfo").build(),
standardResponseBuilder(404).build()
@ -292,7 +292,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testBackupServer() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("POST")
.payload(payloadFromStringWithContentType("{\"createBackup\":{\"backup_type\":\"weekly\",\"rotation\":3,\"name\":\"mybackup\",\"metadata\":{\"some\":\"data or other\"}}}", MediaType.APPLICATION_JSON)).build(),
@ -307,7 +307,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testBackupServerFailNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("POST")
.payload(payloadFromStringWithContentType("{\"createBackup\":{\"backup_type\":\"weekly\",\"rotation\":3,\"name\":\"mybackup\",\"metadata\":{\"some\":\"data or other\"}}}", MediaType.APPLICATION_JSON)).build(),
@ -320,7 +320,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testLiveMigrateServer() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "GONNAOVERWRITE")
.payload(payloadFromStringWithContentType("{\"os-migrateLive\":{\"host\":\"bighost\",\"block_migration\":true,\"disk_over_commit\":false}}", MediaType.APPLICATION_JSON)).build(),
@ -333,7 +333,7 @@ public class AdminActionsClientExpectTest extends BaseNovaClientExpectTest {
public void testLiveMigrateServerFailsNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/action");
AdminActionsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardActionRequestBuilderVoidResponse(endpoint, "GONNAOVERWRITE")
.payload(payloadFromStringWithContentType("{\"os-migrateLive\":{\"host\":\"bighost\",\"block_migration\":true,\"disk_over_commit\":false}}", MediaType.APPLICATION_JSON)).build(),

View File

@ -44,7 +44,7 @@ public class FlavorExtraSpecsClientExpectTest extends BaseNovaClientExpectTest {
public void testGetAllExtraSpecs() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/9/os-extra_specs");
FlavorExtraSpecsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(200).payload(payloadFromResource("/volume_type_extra_specs.json")).build()
@ -56,7 +56,7 @@ public class FlavorExtraSpecsClientExpectTest extends BaseNovaClientExpectTest {
public void testGetAllExtraSpecsFailNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/9/os-extra_specs");
FlavorExtraSpecsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(404).build()
@ -68,7 +68,7 @@ public class FlavorExtraSpecsClientExpectTest extends BaseNovaClientExpectTest {
public void testSetAllExtraSpecs() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/9/os-extra_specs");
FlavorExtraSpecsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint)
.method("POST")
@ -82,7 +82,7 @@ public class FlavorExtraSpecsClientExpectTest extends BaseNovaClientExpectTest {
public void testSetExtraSpec() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/5/os-extra_specs/test1");
FlavorExtraSpecsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint)
.method("PUT")
@ -96,7 +96,7 @@ public class FlavorExtraSpecsClientExpectTest extends BaseNovaClientExpectTest {
public void testGetExtraSpec() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/5/os-extra_specs/test1");
FlavorExtraSpecsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(200).payload(payloadFromStringWithContentType("{\"test1\":\"another value\"}", MediaType.APPLICATION_JSON)).build()
@ -108,7 +108,7 @@ public class FlavorExtraSpecsClientExpectTest extends BaseNovaClientExpectTest {
public void testGetExtraSpecFailNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/5/os-extra_specs/test1");
FlavorExtraSpecsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(404).build()
@ -120,7 +120,7 @@ public class FlavorExtraSpecsClientExpectTest extends BaseNovaClientExpectTest {
public void testDeleteExtraSpec() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/5/os-extra_specs/test1");
FlavorExtraSpecsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("DELETE").build(),
standardResponseBuilder(200).build()
@ -132,7 +132,7 @@ public class FlavorExtraSpecsClientExpectTest extends BaseNovaClientExpectTest {
public void testDeleteExtraSpecFailNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/flavors/5/os-extra_specs/test1");
FlavorExtraSpecsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("DELETE").build(),
standardResponseBuilder(404).build()

View File

@ -46,7 +46,7 @@ public class FloatingIPAsyncClientExpectTest extends BaseNovaAsyncClientExpectTe
public void testWhenNamespaceInExtensionsListFloatingIpPresent() throws Exception {
NovaAsyncClient clientWhenExtensionNotInList = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaAsyncClient clientWhenExtensionNotInList = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse);
assertEquals(clientWhenExtensionNotInList.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1"));
@ -57,7 +57,7 @@ public class FloatingIPAsyncClientExpectTest extends BaseNovaAsyncClientExpectTe
public void testWhenNamespaceNotInExtensionsListFloatingIpNotPresent() throws Exception {
NovaAsyncClient clientWhenExtensionNotInList = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaAsyncClient clientWhenExtensionNotInList = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, unmatchedExtensionsOfNovaResponse);
assertEquals(clientWhenExtensionNotInList.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1"));
@ -78,7 +78,7 @@ public class FloatingIPAsyncClientExpectTest extends BaseNovaAsyncClientExpectTe
HttpResponse listFloatingIPsResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResource("/floatingip_list.json")).build();
NovaAsyncClient clientWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaAsyncClient clientWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, listFloatingIPs, listFloatingIPsResponse);
assertEquals(clientWhenFloatingIPsExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1"));
@ -98,7 +98,7 @@ public class FloatingIPAsyncClientExpectTest extends BaseNovaAsyncClientExpectTe
HttpResponse listFloatingIPsResponse = HttpResponse.builder().statusCode(404).build();
NovaAsyncClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaAsyncClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, listFloatingIPs, listFloatingIPsResponse);
assertTrue(clientWhenNoServersExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().listFloatingIPs().get()
@ -117,7 +117,7 @@ public class FloatingIPAsyncClientExpectTest extends BaseNovaAsyncClientExpectTe
HttpResponse getFloatingIPResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResource("/floatingip_details.json")).build();
NovaAsyncClient clientWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaAsyncClient clientWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, getFloatingIP, getFloatingIPResponse);
assertEquals(clientWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().getFloatingIP("1").get()
@ -135,7 +135,7 @@ public class FloatingIPAsyncClientExpectTest extends BaseNovaAsyncClientExpectTe
HttpResponse getFloatingIPResponse = HttpResponse.builder().statusCode(404).build();
NovaAsyncClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaAsyncClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, getFloatingIP, getFloatingIPResponse);
assertNull(clientWhenNoServersExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().getFloatingIP("1").get());
@ -154,7 +154,7 @@ public class FloatingIPAsyncClientExpectTest extends BaseNovaAsyncClientExpectTe
HttpResponse allocateFloatingIPResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResource("/floatingip_details.json")).build();
NovaAsyncClient clientWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaAsyncClient clientWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, allocateFloatingIP,
allocateFloatingIPResponse);
@ -175,7 +175,7 @@ public class FloatingIPAsyncClientExpectTest extends BaseNovaAsyncClientExpectTe
HttpResponse allocateFloatingIPResponse = HttpResponse.builder().statusCode(404).build();
NovaAsyncClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaAsyncClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, allocateFloatingIP,
allocateFloatingIPResponse);

View File

@ -45,7 +45,7 @@ import com.google.common.collect.ImmutableSet;
public class FloatingIPClientExpectTest extends BaseNovaClientExpectTest {
public void testWhenNamespaceInExtensionsListFloatingIpPresent() throws Exception {
NovaClient clientWhenExtensionNotInList = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenExtensionNotInList = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse);
assertEquals(clientWhenExtensionNotInList.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1"));
@ -56,7 +56,7 @@ public class FloatingIPClientExpectTest extends BaseNovaClientExpectTest {
public void testWhenNamespaceNotInExtensionsListFloatingIpNotPresent() throws Exception {
NovaClient clientWhenExtensionNotInList = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenExtensionNotInList = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, unmatchedExtensionsOfNovaResponse);
assertEquals(clientWhenExtensionNotInList.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1"));
@ -77,7 +77,7 @@ public class FloatingIPClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse listFloatingIPsResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResource("/floatingip_list.json")).build();
NovaClient clientWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, listFloatingIPs, listFloatingIPsResponse);
assertEquals(clientWhenFloatingIPsExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1"));
@ -97,7 +97,7 @@ public class FloatingIPClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse listFloatingIPsResponse = HttpResponse.builder().statusCode(404).build();
NovaClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, listFloatingIPs, listFloatingIPsResponse);
assertTrue(clientWhenNoServersExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().listFloatingIPs().isEmpty());
@ -115,7 +115,7 @@ public class FloatingIPClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse getFloatingIPResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResource("/floatingip_details.json")).build();
NovaClient clientWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, getFloatingIP, getFloatingIPResponse);
assertEquals(clientWhenFloatingIPsExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().getFloatingIP("1")
@ -133,7 +133,7 @@ public class FloatingIPClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse getFloatingIPResponse = HttpResponse.builder().statusCode(404).build();
NovaClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, getFloatingIP, getFloatingIPResponse);
assertNull(clientWhenNoServersExist.getFloatingIPExtensionForZone("az-1.region-a.geo-1").get().getFloatingIP("1"));
@ -152,7 +152,7 @@ public class FloatingIPClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse allocateFloatingIPResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResource("/floatingip_details.json")).build();
NovaClient clientWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenFloatingIPsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, allocateFloatingIP,
allocateFloatingIPResponse);
@ -173,7 +173,7 @@ public class FloatingIPClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse allocateFloatingIPResponse = HttpResponse.builder().statusCode(404).build();
NovaClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, allocateFloatingIP,
allocateFloatingIPResponse);

View File

@ -51,7 +51,7 @@ public class HostAdministrationClientExpectTest extends BaseNovaClientExpectTest
public void testList() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts");
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
HttpRequest.builder().method("GET").headers(ImmutableMultimap.of("Accept", MediaType.APPLICATION_JSON, "X-Auth-Token", authToken))
.endpoint(endpoint).build(),
@ -69,7 +69,7 @@ public class HostAdministrationClientExpectTest extends BaseNovaClientExpectTest
public void testGet() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/xyz");
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
HttpRequest.builder().method("GET").headers(ImmutableMultimap.of("Accept", MediaType.APPLICATION_JSON, "X-Auth-Token", authToken))
.endpoint(endpoint).build(),
@ -87,7 +87,7 @@ public class HostAdministrationClientExpectTest extends BaseNovaClientExpectTest
public void testEnableHost() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu");
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
HttpRequest.builder().method("PUT").headers(ImmutableMultimap.of("Accept", MediaType.APPLICATION_JSON, "X-Auth-Token", authToken))
.payload(payloadFromStringWithContentType("{\"status\":\"enable\"}", MediaType.APPLICATION_JSON))
@ -101,7 +101,7 @@ public class HostAdministrationClientExpectTest extends BaseNovaClientExpectTest
@Test(expectedExceptions = ResourceNotFoundException.class)
public void testEnableHostFailNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu");
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
HttpRequest.builder().method("PUT").headers(ImmutableMultimap.of("Accept", MediaType.APPLICATION_JSON, "X-Auth-Token", authToken))
.payload(payloadFromStringWithContentType("{\"status\":\"enable\"}", MediaType.APPLICATION_JSON))
@ -113,7 +113,7 @@ public class HostAdministrationClientExpectTest extends BaseNovaClientExpectTest
public void testEnableHostFailNotEnabled() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu");
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
HttpRequest.builder().method("PUT").headers(ImmutableMultimap.of("Accept", MediaType.APPLICATION_JSON, "X-Auth-Token", authToken))
.payload(payloadFromStringWithContentType("{\"status\":\"enable\"}", MediaType.APPLICATION_JSON))
@ -126,7 +126,7 @@ public class HostAdministrationClientExpectTest extends BaseNovaClientExpectTest
public void testDisableHost() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu");
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
HttpRequest.builder().method("PUT").headers(ImmutableMultimap.of("Accept", MediaType.APPLICATION_JSON, "X-Auth-Token", authToken))
.payload(payloadFromStringWithContentType("{\"status\":\"disable\"}", MediaType.APPLICATION_JSON))
@ -139,7 +139,7 @@ public class HostAdministrationClientExpectTest extends BaseNovaClientExpectTest
public void testStartMaintenance() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu");
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
HttpRequest.builder().method("PUT").headers(ImmutableMultimap.of("Accept", MediaType.APPLICATION_JSON, "X-Auth-Token", authToken))
.payload(payloadFromStringWithContentType("{\"maintenance_mode\":\"enable\"}", MediaType.APPLICATION_JSON))
@ -152,7 +152,7 @@ public class HostAdministrationClientExpectTest extends BaseNovaClientExpectTest
public void testStopMaintenance() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu");
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
HttpRequest.builder().method("PUT").headers(ImmutableMultimap.of("Accept", MediaType.APPLICATION_JSON, "X-Auth-Token", authToken))
.payload(payloadFromStringWithContentType("{\"maintenance_mode\":\"disable\"}", MediaType.APPLICATION_JSON))
@ -165,7 +165,7 @@ public class HostAdministrationClientExpectTest extends BaseNovaClientExpectTest
public void testStartupHost() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu/startup");
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
HttpRequest.builder().method("GET").headers(ImmutableMultimap.of("Accept", MediaType.APPLICATION_JSON, "X-Auth-Token", authToken))
.endpoint(endpoint).build(),
@ -178,7 +178,7 @@ public class HostAdministrationClientExpectTest extends BaseNovaClientExpectTest
@Test(expectedExceptions = ResourceNotFoundException.class)
public void testStartupHostFailNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu/startup");
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
HttpRequest.builder().method("GET").headers(ImmutableMultimap.of("Accept", MediaType.APPLICATION_JSON, "X-Auth-Token", authToken))
.endpoint(endpoint).build(),
@ -188,7 +188,7 @@ public class HostAdministrationClientExpectTest extends BaseNovaClientExpectTest
public void testStartupHostFailWrongActionInProgress() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu/startup");
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
HttpRequest.builder().method("GET").headers(ImmutableMultimap.of("Accept", MediaType.APPLICATION_JSON, "X-Auth-Token", authToken))
.endpoint(endpoint).build(),
@ -200,7 +200,7 @@ public class HostAdministrationClientExpectTest extends BaseNovaClientExpectTest
public void testShutdownHost() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu/shutdown");
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
HttpRequest.builder().method("GET").headers(ImmutableMultimap.of("Accept", MediaType.APPLICATION_JSON, "X-Auth-Token", authToken))
.endpoint(endpoint).build(),
@ -212,7 +212,7 @@ public class HostAdministrationClientExpectTest extends BaseNovaClientExpectTest
public void testRebootHost() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-hosts/ubuntu/reboot");
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAdministrationClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
HttpRequest.builder().method("GET").headers(ImmutableMultimap.of("Accept", MediaType.APPLICATION_JSON, "X-Auth-Token", authToken))
.endpoint(endpoint).build(),

View File

@ -48,7 +48,7 @@ public class HostAggregateClientExpectTest extends BaseNovaClientExpectTest {
public void testList() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates");
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(200).payload(payloadFromResource("/host_aggregate_list.json")).build())
@ -60,7 +60,7 @@ public class HostAggregateClientExpectTest extends BaseNovaClientExpectTest {
public void testGet() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1");
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(200).payload(payloadFromResource("/host_aggregate_with_host_details.json")).build())
@ -71,7 +71,7 @@ public class HostAggregateClientExpectTest extends BaseNovaClientExpectTest {
public void testGetFailNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1");
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(404).build()).getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
@ -81,7 +81,7 @@ public class HostAggregateClientExpectTest extends BaseNovaClientExpectTest {
public void testCreateAggregate() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates");
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("POST")
.payload(payloadFromStringWithContentType("{\"aggregate\":{\"name\":\"ubuntu1\",\"availability_zone\":\"nova\"}}", MediaType.APPLICATION_JSON))
@ -94,7 +94,7 @@ public class HostAggregateClientExpectTest extends BaseNovaClientExpectTest {
public void testDeleteAggregate() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1");
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("DELETE").build(),
standardResponseBuilder(200).build()).getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
@ -104,7 +104,7 @@ public class HostAggregateClientExpectTest extends BaseNovaClientExpectTest {
public void testDeleteAggregateFailNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1");
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("DELETE").build(),
standardResponseBuilder(404).build()).getHostAggregateExtensionForZone("az-1.region-a.geo-1").get();
@ -114,7 +114,7 @@ public class HostAggregateClientExpectTest extends BaseNovaClientExpectTest {
public void testUpdateName() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1");
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("POST")
.payload(payloadFromStringWithContentType("{\"aggregate\":{\"name\":\"newaggregatename\"}}", MediaType.APPLICATION_JSON)).build(),
@ -125,7 +125,7 @@ public class HostAggregateClientExpectTest extends BaseNovaClientExpectTest {
public void testUpdateAvailabilityZone() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1");
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("POST")
.payload(payloadFromStringWithContentType("{\"aggregate\":{\"availability_zone\":\"zone1\"}}", MediaType.APPLICATION_JSON)).build(),
@ -136,7 +136,7 @@ public class HostAggregateClientExpectTest extends BaseNovaClientExpectTest {
public void testAddHost() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1/action");
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("POST")
.payload(payloadFromStringWithContentType("{\"add_host\":{\"host\":\"ubuntu\"}}", MediaType.APPLICATION_JSON)).build(),
@ -147,7 +147,7 @@ public class HostAggregateClientExpectTest extends BaseNovaClientExpectTest {
public void testRemoveHost() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1/action");
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("POST")
.payload(payloadFromStringWithContentType("{\"remove_host\":{\"host\":\"ubuntu\"}}", MediaType.APPLICATION_JSON)).build(),
@ -159,7 +159,7 @@ public class HostAggregateClientExpectTest extends BaseNovaClientExpectTest {
public void testSetMetadata() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-aggregates/1/action");
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
HostAggregateClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("POST")
.payload(payloadFromStringWithContentType("{\"set_metadata\":{\"metadata\":{\"mykey\":\"some value or other\"}}}", MediaType.APPLICATION_JSON)).build(),

View File

@ -54,7 +54,7 @@ public class KeyPairClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse listKeyPairsResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResource("/keypair_list.json")).build();
NovaClient clientWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, listKeyPairs, listKeyPairsResponse);
assertEquals(clientWhenServersExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1"));
@ -74,7 +74,7 @@ public class KeyPairClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse listKeyPairsResponse = HttpResponse.builder().statusCode(404).build();
NovaClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, listKeyPairs, listKeyPairsResponse);
assertTrue(clientWhenNoServersExist.getKeyPairExtensionForZone("az-1.region-a.geo-1").get().listKeyPairs().isEmpty());
@ -95,7 +95,7 @@ public class KeyPairClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse createKeyPairResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResource("/keypair_created.json")).build();
NovaClient clientWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createKeyPair, createKeyPairResponse);
assertEquals(clientWhenServersExist.getKeyPairExtensionForZone("az-1.region-a.geo-1").get().createKeyPair("testkeypair")
@ -119,7 +119,7 @@ public class KeyPairClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse createKeyPairResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResource("/keypair_created.json")).build();
NovaClient clientWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createKeyPair, createKeyPairResponse);
assertEquals(
@ -143,7 +143,7 @@ public class KeyPairClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse deleteKeyPairResponse = HttpResponse.builder().statusCode(202).build();
NovaClient clientWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, deleteKeyPair, deleteKeyPairResponse);
assertTrue(clientWhenServersExist.getKeyPairExtensionForZone("az-1.region-a.geo-1").get().deleteKeyPair("testkeypair"));

View File

@ -46,7 +46,7 @@ public class QuotaClassClientExpectTest extends BaseNovaClientExpectTest {
public void testGetQuotas() throws Exception {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-class-sets/jcloudstestquotas");
QuotaClassClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
QuotaClassClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(200).payload(payloadFromResource("/quota_class.json")).build()).getQuotaClassExtensionForZone("az-1.region-a.geo-1").get();
@ -56,7 +56,7 @@ public class QuotaClassClientExpectTest extends BaseNovaClientExpectTest {
public void testGetQuotasFailsTenantNotFound() throws Exception {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-class-sets/jcloudstestquotas");
QuotaClassClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
QuotaClassClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(404).build()).getQuotaClassExtensionForZone("az-1.region-a.geo-1").get();
@ -65,7 +65,7 @@ public class QuotaClassClientExpectTest extends BaseNovaClientExpectTest {
public void testUpdateQuotas() throws Exception {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-class-sets/myclass");
QuotaClassClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
QuotaClassClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
HttpRequest.builder().endpoint(endpoint).method("PUT")
.headers(ImmutableMultimap.of("X-Auth-Token", authToken))
@ -79,7 +79,7 @@ public class QuotaClassClientExpectTest extends BaseNovaClientExpectTest {
@Test(expectedExceptions = ResourceNotFoundException.class)
public void testUpdateQuotasFailsNotFound() throws Exception {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-class-sets/jcloudstestquotas");
QuotaClassClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
QuotaClassClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
HttpRequest.builder().endpoint(endpoint).method("PUT")
.headers(ImmutableMultimap.of("X-Auth-Token", authToken))

View File

@ -46,7 +46,7 @@ public class QuotaClientExpectTest extends BaseNovaClientExpectTest {
public void testGetQuotas() throws Exception {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-sets/demo");
QuotaClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
QuotaClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(200).payload(payloadFromResource("/quotas.json")).build()).getQuotaExtensionForZone("az-1.region-a.geo-1").get();
@ -56,7 +56,7 @@ public class QuotaClientExpectTest extends BaseNovaClientExpectTest {
public void testGetQuotasFailsTenantNotFound() throws Exception {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-sets/demo");
QuotaClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
QuotaClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(404).build()).getQuotaExtensionForZone("az-1.region-a.geo-1").get();
@ -65,7 +65,7 @@ public class QuotaClientExpectTest extends BaseNovaClientExpectTest {
public void testGetDefaultQuotas() throws Exception {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-sets/demo/defaults");
QuotaClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
QuotaClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(200).payload(payloadFromResource("/quotas.json")).build()).getQuotaExtensionForZone("az-1.region-a.geo-1").get();
@ -75,7 +75,7 @@ public class QuotaClientExpectTest extends BaseNovaClientExpectTest {
public void testGetDefaultQuotasFailsTenantNotFound() throws Exception {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-sets/demo/defaults");
QuotaClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
QuotaClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(404).build()).getQuotaExtensionForZone("az-1.region-a.geo-1").get();
@ -85,7 +85,7 @@ public class QuotaClientExpectTest extends BaseNovaClientExpectTest {
public void testUpdateQuotas() throws Exception {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-sets/demo");
QuotaClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
QuotaClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
HttpRequest.builder().endpoint(endpoint).method("PUT")
.headers(ImmutableMultimap.of("X-Auth-Token", authToken))
@ -99,7 +99,7 @@ public class QuotaClientExpectTest extends BaseNovaClientExpectTest {
@Test(expectedExceptions = ResourceNotFoundException.class)
public void testUpdateQuotasFailsNotFound() throws Exception {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-quota-sets/demo");
QuotaClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
QuotaClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
HttpRequest.builder().endpoint(endpoint).method("PUT")
.headers(ImmutableMultimap.of("X-Auth-Token", authToken))

View File

@ -55,7 +55,7 @@ public class SecurityGroupClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse listSecurityGroupsResponse = HttpResponse.builder().statusCode(200).payload(
payloadFromResource("/securitygroup_list.json")).build();
NovaClient clientWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, listSecurityGroups,
listSecurityGroupsResponse);
@ -73,7 +73,7 @@ public class SecurityGroupClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse listListSecurityGroupsResponse = HttpResponse.builder().statusCode(404).build();
NovaClient clientWhenNoSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenNoSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, listListSecurityGroups,
listListSecurityGroupsResponse);
@ -91,7 +91,7 @@ public class SecurityGroupClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
payloadFromResource("/securitygroup_details.json")).build();
NovaClient clientWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, getSecurityGroup,
getSecurityGroupResponse);
@ -107,7 +107,7 @@ public class SecurityGroupClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(404).build();
NovaClient clientWhenNoSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenNoSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, getSecurityGroup,
getSecurityGroupResponse);
@ -129,7 +129,7 @@ public class SecurityGroupClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse createSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload(
payloadFromResource("/securitygroup_created.json")).build();
NovaClient clientWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createSecurityGroup,
createSecurityGroupResponse);
@ -147,7 +147,7 @@ public class SecurityGroupClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse deleteSecurityGroupResponse = HttpResponse.builder().statusCode(202).build();
NovaClient clientWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, deleteSecurityGroup,
deleteSecurityGroupResponse);
@ -172,7 +172,7 @@ public class SecurityGroupClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse createSecurityGroupRuleResponse = HttpResponse.builder().statusCode(200).payload(
payloadFromResource("/securitygrouprule_created.json")).build();
NovaClient clientWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createSecurityGroupRule,
createSecurityGroupRuleResponse);
@ -198,7 +198,7 @@ public class SecurityGroupClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse createSecurityGroupRuleResponse = HttpResponse.builder().statusCode(200).payload(
payloadFromResource("/securitygrouprule_created.json")).build();
NovaClient clientWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, createSecurityGroupRule,
createSecurityGroupRuleResponse);
@ -217,7 +217,7 @@ public class SecurityGroupClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse deleteSecurityGroupRuleResponse = HttpResponse.builder().statusCode(202).build();
NovaClient clientWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, deleteSecurityGroupRule,
deleteSecurityGroupRuleResponse);

View File

@ -41,7 +41,7 @@ public class ServerWithSecurityGroupsClientExpectTest extends BaseNovaClientExpe
public void testGetServerWithSecurityGroups() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-create-server-ext/8d0a6ca5-8849-4b3d-b86e-f24c92490ebb");
ServerWithSecurityGroupsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(200).payload(payloadFromResource("/server_with_security_groups.json")).build()
@ -55,7 +55,7 @@ public class ServerWithSecurityGroupsClientExpectTest extends BaseNovaClientExpe
public void testGetServerWithSecurityGroupsFailNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-create-server-ext/8d0a6ca5-8849-4b3d-b86e-f24c92490ebb");
ServerWithSecurityGroupsClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(404).build()

View File

@ -52,7 +52,7 @@ public class SimpleTenantUsageClientExpectTest extends BaseNovaClientExpectTest
public void testList() throws Exception {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-simple-tenant-usage");
SimpleTenantUsageClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
SimpleTenantUsageClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
HttpRequest.builder().method("GET").headers(ImmutableMultimap.of("Accept", MediaType.APPLICATION_JSON, "X-Auth-Token", authToken))
.endpoint(endpoint).build(),
@ -76,7 +76,7 @@ public class SimpleTenantUsageClientExpectTest extends BaseNovaClientExpectTest
public void testGet() throws Exception {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-simple-tenant-usage/test-1234");
SimpleTenantUsageClient client = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
SimpleTenantUsageClient client = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
HttpRequest.builder().method("GET").headers(ImmutableMultimap.of("Accept", MediaType.APPLICATION_JSON, "X-Auth-Token", authToken))
.endpoint(endpoint).build(),

View File

@ -41,7 +41,7 @@ public class VirtualInterfaceClientExpectTest extends BaseNovaClientExpectTest {
public void testListVirtualInterfaces() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/os-virtual-interfaces");
VirtualInterfaceClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(200).payload(payloadFromResource("/virtual_interfaces_list.json")).build()
@ -55,7 +55,7 @@ public class VirtualInterfaceClientExpectTest extends BaseNovaClientExpectTest {
public void testListVirtualInterfacesFailNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/1/os-virtual-interfaces");
VirtualInterfaceClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(404).build()

View File

@ -56,7 +56,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testListVolumes() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volumes");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(200).payload(payloadFromResource("/volume_list.json")).build()
@ -69,7 +69,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testListVolumesFail() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volumes");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(404).build()
@ -82,7 +82,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testListVolumesInDetail() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volumes/detail");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(200).payload(payloadFromResource("/volume_list_detail.json")).build()
@ -95,7 +95,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testListVolumesInDetailFail() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volumes/detail");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(404).build()
@ -108,7 +108,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testCreateVolume() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volumes");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint)
.method("POST")
@ -125,7 +125,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testCreateVolumeFail() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volumes");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint)
.endpoint(endpoint)
@ -141,7 +141,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testGetVolume() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volumes/1");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(200).payload(payloadFromResource("/volume_details.json")).build()
@ -161,7 +161,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testGetVolumeFail() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volumes/1");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(404).build()
@ -173,7 +173,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testDeleteVolume() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volumes/1");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("DELETE").build(),
standardResponseBuilder(200).payload(payloadFromResource("/attachment_details.json")).build()
@ -185,7 +185,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testDeleteVolumeFail() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volumes/1");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("DELETE").build(),
standardResponseBuilder(404).build()
@ -197,7 +197,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testListAttachments() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-1/os-volume_attachments");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(200).payload(payloadFromResource("/attachment_list.json")).build()
@ -217,7 +217,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testListAttachmentsFail() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-2/os-volume_attachments");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(401).build()
@ -229,7 +229,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testGetAttachment() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-1/os-volume_attachments/1");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(200).payload(payloadFromResource("/attachment_details.json")).build()
@ -242,7 +242,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testGetAttachmentFail() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-1/os-volume_attachments/1");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(404).build()
@ -254,7 +254,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testAttachVolume() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-1/os-volume_attachments");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("POST")
.payload(payloadFromStringWithContentType("{\"volumeAttachment\":{\"volumeId\":\"1\",\"device\":\"/dev/vdc\"}}", MediaType.APPLICATION_JSON)).endpoint(endpoint).build(),
@ -269,7 +269,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testAttachVolumeFail() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-1/os-volume_attachments");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("POST")
.payload(payloadFromStringWithContentType("{\"volumeAttachment\":{\"volumeId\":\"1\",\"device\":\"/dev/vdc\"}}", MediaType.APPLICATION_JSON)).endpoint(endpoint).build(),
@ -282,7 +282,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testDetachVolume() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-1/os-volume_attachments/1");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("DELETE").build(),
standardResponseBuilder(200).payload(payloadFromResource("/attachment_details.json")).build()
@ -294,7 +294,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testDetachVolumeFail() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/instance-1/os-volume_attachments/1");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("DELETE").build(),
standardResponseBuilder(404).build()
@ -306,7 +306,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testListSnapshots() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(200).payload(payloadFromResource("/snapshot_list.json")).build()
@ -319,7 +319,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testListSnapshotsFail() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(404).build()
@ -332,7 +332,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testGetSnapshot() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots/1");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(200).payload(payloadFromResource("/snapshot_details.json")).build()
@ -345,7 +345,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testGetSnapshotFail() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots/1");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(404).build()
@ -357,7 +357,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testListSnapshotsInDetail() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots/detail");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(200).payload(payloadFromResource("/snapshot_list_detail.json")).build()
@ -379,7 +379,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testListSnapshotsInDetailFail() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots/detail");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(404).build()
@ -392,7 +392,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testCreateSnapshot() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint)
.method("POST")
@ -409,7 +409,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testCreateSnapshotFail() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint)
.method("POST")
@ -424,7 +424,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testDeleteSnapshot() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots/1");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("DELETE").build(),
standardResponseBuilder(200).payload(payloadFromResource("/snapshot_details.json")).build()
@ -437,7 +437,7 @@ public class VolumeClientExpectTest extends BaseNovaClientExpectTest {
public void testDeleteSnapshotFail() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-snapshots/1");
VolumeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("DELETE").build(),
standardResponseBuilder(401).build()

View File

@ -51,7 +51,7 @@ public class VolumeTypeClientExpectTest extends BaseNovaClientExpectTest {
public void testListVolumeTypes() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types");
VolumeTypeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(200).payload(payloadFromResource("/volume_type_list.json")).build()
@ -64,7 +64,7 @@ public class VolumeTypeClientExpectTest extends BaseNovaClientExpectTest {
public void testGetVolumeType() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/8");
VolumeTypeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(200).payload(payloadFromResource("/volume_type.json")).build()
@ -77,7 +77,7 @@ public class VolumeTypeClientExpectTest extends BaseNovaClientExpectTest {
public void testGetVolumeTypeFailNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/8");
VolumeTypeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(404).build()
@ -89,7 +89,7 @@ public class VolumeTypeClientExpectTest extends BaseNovaClientExpectTest {
public void testCreateVolumeType() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types");
VolumeTypeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("POST")
.payload(payloadFromStringWithContentType("{\"volume_type\":{\"name\":\"jclouds-test-1\"}}", MediaType.APPLICATION_JSON))
@ -104,7 +104,7 @@ public class VolumeTypeClientExpectTest extends BaseNovaClientExpectTest {
public void testCreateVolumeTypeWithOptsNONE() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types");
VolumeTypeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("POST")
.payload(payloadFromStringWithContentType("{\"volume_type\":{\"name\":\"jclouds-test-1\",\"extra_specs\":{}}}", MediaType.APPLICATION_JSON))
@ -119,7 +119,7 @@ public class VolumeTypeClientExpectTest extends BaseNovaClientExpectTest {
public void testCreateVolumeTypeWithOptsSet() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types");
VolumeTypeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("POST")
.payload(payloadFromStringWithContentType("{\"volume_type\":{\"name\":\"jclouds-test-1\",\"extra_specs\":{\"x\": \"y\"}}}", MediaType.APPLICATION_JSON))
@ -134,7 +134,7 @@ public class VolumeTypeClientExpectTest extends BaseNovaClientExpectTest {
public void testDeleteVolumeType() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/8");
VolumeTypeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("DELETE").build(),
standardResponseBuilder(200).build()
@ -146,7 +146,7 @@ public class VolumeTypeClientExpectTest extends BaseNovaClientExpectTest {
public void testDeleteVolumeTypeFailNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/8");
VolumeTypeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("DELETE").build(),
standardResponseBuilder(404).build()
@ -158,7 +158,7 @@ public class VolumeTypeClientExpectTest extends BaseNovaClientExpectTest {
public void testGetAllExtraSpecs() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/9/extra_specs");
VolumeTypeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(200).payload(payloadFromResource("/volume_type_extra_specs.json")).build()
@ -170,7 +170,7 @@ public class VolumeTypeClientExpectTest extends BaseNovaClientExpectTest {
public void testGetAllExtraSpecsFailNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/9/extra_specs");
VolumeTypeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(404).build()
@ -182,7 +182,7 @@ public class VolumeTypeClientExpectTest extends BaseNovaClientExpectTest {
public void testSetAllExtraSpecs() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/9/extra_specs");
VolumeTypeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint)
.method("POST")
@ -196,7 +196,7 @@ public class VolumeTypeClientExpectTest extends BaseNovaClientExpectTest {
public void testSetExtraSpec() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/5/extra_specs/test1");
VolumeTypeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint)
.method("PUT")
@ -210,7 +210,7 @@ public class VolumeTypeClientExpectTest extends BaseNovaClientExpectTest {
public void testGetExtraSpec() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/5/extra_specs/test1");
VolumeTypeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(200).payload(payloadFromStringWithContentType("{\"test1\":\"another value\"}", MediaType.APPLICATION_JSON)).build()
@ -222,7 +222,7 @@ public class VolumeTypeClientExpectTest extends BaseNovaClientExpectTest {
public void testGetExtraSpecFailNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/5/extra_specs/test1");
VolumeTypeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).build(),
standardResponseBuilder(404).build()
@ -234,7 +234,7 @@ public class VolumeTypeClientExpectTest extends BaseNovaClientExpectTest {
public void testDeleteExtraSpec() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/5/extra_specs/test1");
VolumeTypeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("DELETE").build(),
standardResponseBuilder(200).build()
@ -246,7 +246,7 @@ public class VolumeTypeClientExpectTest extends BaseNovaClientExpectTest {
public void testDeleteExtraSpecFailNotFound() {
URI endpoint = URI.create("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-volume-types/5/extra_specs/test1");
VolumeTypeClient client = requestsSendResponses(
keystoneAuthWithUsernameAndPassword,
keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
standardRequestBuilder(endpoint).method("DELETE").build(),
standardResponseBuilder(404).build()

View File

@ -55,7 +55,7 @@ public class ExtensionClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse listExtensionsResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResource("/extension_list.json")).build();
NovaClient clientWhenExtensionsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenExtensionsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, listExtensions, listExtensionsResponse);
assertEquals(clientWhenExtensionsExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1"));
@ -75,7 +75,7 @@ public class ExtensionClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse listExtensionsResponse = HttpResponse.builder().statusCode(404).build();
NovaClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, listExtensions, listExtensionsResponse);
assertTrue(clientWhenNoServersExist.getExtensionClientForZone("az-1.region-a.geo-1").listExtensions().isEmpty());
@ -95,7 +95,7 @@ public class ExtensionClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse getExtensionResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResource("/extension_details.json")).build();
NovaClient clientWhenExtensionsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenExtensionsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, getExtension, getExtensionResponse);
assertEquals(clientWhenExtensionsExist.getExtensionClientForZone("az-1.region-a.geo-1").getExtensionByAlias("RS-PIE")
@ -114,7 +114,7 @@ public class ExtensionClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse getExtensionResponse = HttpResponse.builder().statusCode(404)
.payload(payloadFromResource("/extension_details.json")).build();
NovaClient clientWhenNoExtensionsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenNoExtensionsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, getExtension, getExtensionResponse);
assertNull(clientWhenNoExtensionsExist.getExtensionClientForZone("az-1.region-a.geo-1").getExtensionByAlias("RS-PIE"));

View File

@ -55,7 +55,7 @@ public class FlavorClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse listFlavorsResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResource("/flavor_list.json")).build();
NovaClient clientWhenFlavorsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenFlavorsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, listFlavors, listFlavorsResponse);
assertEquals(clientWhenFlavorsExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1"));
@ -75,7 +75,7 @@ public class FlavorClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse listFlavorsResponse = HttpResponse.builder().statusCode(404).build();
NovaClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, listFlavors, listFlavorsResponse);
assertTrue(clientWhenNoServersExist.getFlavorClientForZone("az-1.region-a.geo-1").listFlavors().isEmpty());
@ -95,7 +95,7 @@ public class FlavorClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse getFlavorResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResource("/flavor_details.json")).build();
NovaClient clientWhenFlavorsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenFlavorsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, getFlavor, getFlavorResponse);
assertEquals(
@ -115,7 +115,7 @@ public class FlavorClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse getFlavorResponse = HttpResponse.builder().statusCode(404)
.payload(payloadFromResource("/flavor_details.json")).build();
NovaClient clientWhenNoFlavorsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenNoFlavorsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, getFlavor, getFlavorResponse);
assertNull(clientWhenNoFlavorsExist.getFlavorClientForZone("az-1.region-a.geo-1").getFlavor("123"));

View File

@ -54,7 +54,7 @@ public class ImageClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse listImagesResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResource("/image_list.json")).build();
NovaClient clientWhenImagesExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenImagesExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, listImages, listImagesResponse);
assertEquals(clientWhenImagesExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1"));
@ -74,7 +74,7 @@ public class ImageClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse listImagesResponse = HttpResponse.builder().statusCode(404).build();
NovaClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, listImages, listImagesResponse);
assertTrue(clientWhenNoServersExist.getImageClientForZone("az-1.region-a.geo-1").listImages().isEmpty());
@ -93,7 +93,7 @@ public class ImageClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse getImageResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResource("/image_details.json")).build();
NovaClient clientWhenImagesExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenImagesExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, getImage, getImageResponse);
assertEquals(
@ -112,7 +112,7 @@ public class ImageClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse getImageResponse = HttpResponse.builder().statusCode(404).build();
NovaClient clientWhenNoImagesExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenNoImagesExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, getImage, getImageResponse);
assertNull(clientWhenNoImagesExist.getImageClientForZone("az-1.region-a.geo-1").getImage(

View File

@ -56,7 +56,7 @@ public class ServerClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse listServersResponse = HttpResponse.builder().statusCode(200)
.payload(payloadFromResource("/server_list.json")).build();
NovaClient clientWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, listServers, listServersResponse);
assertEquals(clientWhenServersExist.getConfiguredZones(), ImmutableSet.of("az-1.region-a.geo-1"));
@ -76,7 +76,7 @@ public class ServerClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse listServersResponse = HttpResponse.builder().statusCode(404).build();
NovaClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, listServers, listServersResponse);
assertTrue(clientWhenNoServersExist.getServerClientForZone("az-1.region-a.geo-1").listServers().isEmpty());
@ -98,7 +98,7 @@ public class ServerClientExpectTest extends BaseNovaClientExpectTest {
HttpResponse createServerResponse = HttpResponse.builder().statusCode(202).message("HTTP/1.1 202 Accepted")
.payload(payloadFromResourceWithContentType("/new_server.json","application/json; charset=UTF-8")).build();
NovaClient clientWithNewServer = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWithNewServer = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, createServer, createServerResponse);
assertEquals(clientWithNewServer.getServerClientForZone("az-1.region-a.geo-1").createServer("test-e92", "1241", "100").toString(),
@ -123,7 +123,7 @@ public class ServerClientExpectTest extends BaseNovaClientExpectTest {
.payload(payloadFromResourceWithContentType("/new_server.json","application/json; charset=UTF-8")).build();
NovaClient clientWithNewServer = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWithNewServer = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, createServer, createServerResponse);
assertEquals(clientWithNewServer.getServerClientForZone("az-1.region-a.geo-1").createServer("test-e92", "1241",
@ -153,7 +153,7 @@ public class ServerClientExpectTest extends BaseNovaClientExpectTest {
ImmutableMultimap.<String, String> builder()
.put("Location", "https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/images/" + imageId).build()).build();
NovaClient clientWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenServerExists = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, createImage, createImageResponse);
assertEquals(clientWhenServerExists.getServerClientForZone("az-1.region-a.geo-1").createImageFromServer(imageName, serverId),
@ -177,7 +177,7 @@ public class ServerClientExpectTest extends BaseNovaClientExpectTest {
.build();
HttpResponse createImageResponse = HttpResponse.builder().statusCode(404).build();
NovaClient clientWhenServerDoesNotExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenServerDoesNotExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, createImage, createImageResponse);
try {

View File

@ -57,7 +57,7 @@ public class CreateSecurityGroupIfNeededTest extends BaseNovaClientExpectTest {
Builder<HttpRequest, HttpResponse> builder = ImmutableMap.builder();
builder.put(keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess);
builder.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
builder.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
int groupId = 2769;
@ -135,7 +135,7 @@ public class CreateSecurityGroupIfNeededTest extends BaseNovaClientExpectTest {
Builder<HttpRequest, HttpResponse> builder = ImmutableMap.builder();
builder.put(keystoneAuthWithUsernameAndPassword, responseWithKeystoneAccess);
builder.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess);
builder.put(extensionsOfNovaRequest, extensionsOfNovaResponse);
HttpResponse createSecurityGroupResponse = HttpResponse.builder().statusCode(400)

View File

@ -54,7 +54,7 @@ public class FindSecurityGroupWithNameAndReturnTrueExpectTest extends BaseNovaCl
HttpResponse listSecurityGroupsResponse = HttpResponse.builder().statusCode(200).payload(
payloadFromResource("/securitygroup_list.json")).build();
NovaClient clientWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, listSecurityGroups,
listSecurityGroupsResponse);
@ -82,7 +82,7 @@ public class FindSecurityGroupWithNameAndReturnTrueExpectTest extends BaseNovaCl
HttpResponse listSecurityGroupsResponse = HttpResponse.builder().statusCode(200).payload(
payloadFromResource("/securitygroup_list.json")).build();
NovaClient clientWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
NovaClient clientWhenSecurityGroupsExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse, listSecurityGroups,
listSecurityGroupsResponse);

View File

@ -37,7 +37,8 @@ import com.google.common.collect.ImmutableMultimap;
*/
public class BaseNovaExpectTest<T> extends BaseRestClientExpectTest<T> {
protected HttpRequest keystoneAuthWithUsernameAndPassword;
protected HttpRequest keystoneAuthWithAccessKeyAndSecretKey;
protected HttpRequest keystoneAuthWithUsernameAndPasswordAndTenantName;
protected HttpRequest keystoneAuthWithAccessKeyAndSecretKeyAndTenantName;
protected String authToken;
protected HttpResponse responseWithKeystoneAccess;
protected HttpRequest extensionsOfNovaRequest;
@ -50,7 +51,9 @@ public class BaseNovaExpectTest<T> extends BaseRestClientExpectTest<T> {
provider = "openstack-nova";
keystoneAuthWithUsernameAndPassword = KeystoneFixture.INSTANCE.initialAuthWithUsernameAndPassword(identity,
credential);
keystoneAuthWithAccessKeyAndSecretKey = KeystoneFixture.INSTANCE.initialAuthWithAccessKeyAndSecretKey(identity,
keystoneAuthWithUsernameAndPasswordAndTenantName = KeystoneFixture.INSTANCE.initialAuthWithUsernameAndPasswordAndTenantName(identity,
credential);
keystoneAuthWithAccessKeyAndSecretKeyAndTenantName = KeystoneFixture.INSTANCE.initialAuthWithAccessKeyAndSecretKeyAndTenantName(identity,
credential);
keystoneAuthWithAccessKeyAndSecretKeyAndTenantId = KeystoneFixture.INSTANCE.initialAuthWithAccessKeyAndSecretKeyAndTenantId(identity,
credential);

View File

@ -39,9 +39,9 @@ public class BaseGlanceExpectTest<T> extends BaseRestClientExpectTest<T> {
public BaseGlanceExpectTest() {
provider = "openstack-glance";
keystoneAuthWithUsernameAndPassword = KeystoneFixture.INSTANCE.initialAuthWithUsernameAndPassword(identity,
keystoneAuthWithUsernameAndPassword = KeystoneFixture.INSTANCE.initialAuthWithUsernameAndPasswordAndTenantName(identity,
credential);
keystoneAuthWithAccessKeyAndSecretKey = KeystoneFixture.INSTANCE.initialAuthWithAccessKeyAndSecretKey(identity,
keystoneAuthWithAccessKeyAndSecretKey = KeystoneFixture.INSTANCE.initialAuthWithAccessKeyAndSecretKeyAndTenantName(identity,
credential);
authToken = KeystoneFixture.INSTANCE.getAuthToken();

View File

@ -36,9 +36,9 @@ public class BaseQuantumExpectTest<T> extends BaseRestClientExpectTest<T> {
public BaseQuantumExpectTest() {
provider = "openstack-quantum";
keystoneAuthWithUsernameAndPassword = KeystoneFixture.INSTANCE.initialAuthWithUsernameAndPassword(identity,
keystoneAuthWithUsernameAndPassword = KeystoneFixture.INSTANCE.initialAuthWithUsernameAndPasswordAndTenantName(identity,
credential);
keystoneAuthWithAccessKeyAndSecretKey = KeystoneFixture.INSTANCE.initialAuthWithAccessKeyAndSecretKey(identity,
keystoneAuthWithAccessKeyAndSecretKey = KeystoneFixture.INSTANCE.initialAuthWithAccessKeyAndSecretKeyAndTenantName(identity,
credential);
authToken = KeystoneFixture.INSTANCE.getAuthToken();

View File

@ -39,9 +39,9 @@ public class BaseSwiftExpectTest<T> extends BaseRestClientExpectTest<T> {
public BaseSwiftExpectTest() {
provider = "openstack-swift";
keystoneAuthWithUsernameAndPassword = KeystoneFixture.INSTANCE.initialAuthWithUsernameAndPassword(identity,
keystoneAuthWithUsernameAndPassword = KeystoneFixture.INSTANCE.initialAuthWithUsernameAndPasswordAndTenantName(identity,
credential);
keystoneAuthWithAccessKeyAndSecretKey = KeystoneFixture.INSTANCE.initialAuthWithAccessKeyAndSecretKey(identity,
keystoneAuthWithAccessKeyAndSecretKey = KeystoneFixture.INSTANCE.initialAuthWithAccessKeyAndSecretKeyAndTenantName(identity,
credential);
authToken = KeystoneFixture.INSTANCE.getAuthToken();

View File

@ -28,6 +28,8 @@ import org.jclouds.rackspace.cloudidentity.v2_0.CloudIdentityAuthenticationClien
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityCredentialTypes;
import org.jclouds.rackspace.cloudidentity.v2_0.domain.ApiKeyCredentials;
import com.google.common.base.Optional;
/**
*
* @author Adrian Cole
@ -45,13 +47,13 @@ public class AuthenticateApiKeyCredentials extends BaseAuthenticator<ApiKeyCrede
}
@Override
protected Access authenticateWithTenantNameOrNull(String tenantId, ApiKeyCredentials apiKeyCredentials) {
return client.authenticateWithTenantNameAndCredentials(tenantId, apiKeyCredentials);
protected Access authenticateWithTenantName(Optional<String> tenantId, ApiKeyCredentials apiKeyCredentials) {
return client.authenticateWithTenantNameAndCredentials(tenantId.orNull(), apiKeyCredentials);
}
@Override
protected Access authenticateWithTenantId(String tenantId, ApiKeyCredentials apiKeyCredentials) {
return client.authenticateWithTenantIdAndCredentials(tenantId, apiKeyCredentials);
protected Access authenticateWithTenantId(Optional<String> tenantId, ApiKeyCredentials apiKeyCredentials) {
return client.authenticateWithTenantIdAndCredentials(tenantId.orNull(), apiKeyCredentials);
}
@Override

View File

@ -20,7 +20,9 @@ package org.jclouds.hpcloud.compute;
import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_TERMINATED;
import static org.jclouds.openstack.keystone.v2_0.config.CredentialTypes.API_ACCESS_KEY_CREDENTIALS;
import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE;
import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.REQUIRES_TENANT;
import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.AUTO_ALLOCATE_FLOATING_IPS;
import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.AUTO_GENERATE_KEYPAIRS;
@ -28,7 +30,6 @@ import java.net.URI;
import java.util.Properties;
import org.jclouds.hpcloud.compute.config.HPCloudComputeServiceContextModule;
import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.KeystoneAuthenticationModuleForZones;
import org.jclouds.openstack.nova.v2_0.NovaApiMetadata;
import org.jclouds.openstack.nova.v2_0.config.NovaRestClientModule;
@ -70,7 +71,8 @@ public class HPCloudComputeProviderMetadata extends BaseProviderMetadata {
// deallocating ip addresses can take a while
properties.setProperty(TIMEOUT_NODE_TERMINATED, 60 * 1000 + "");
properties.setProperty(CREDENTIAL_TYPE, CredentialTypes.API_ACCESS_KEY_CREDENTIALS);
properties.setProperty(CREDENTIAL_TYPE, API_ACCESS_KEY_CREDENTIALS);
properties.setProperty(REQUIRES_TENANT, "true");
properties.setProperty(AUTO_ALLOCATE_FLOATING_IPS, "true");
properties.setProperty(AUTO_GENERATE_KEYPAIRS, "true");
properties.setProperty(TEMPLATE, "osFamily=UBUNTU,osVersionMatches=1[012].[01][04],os64Bit=true,locationId=az-2.region-a.geo-1");
@ -83,7 +85,7 @@ public class HPCloudComputeProviderMetadata extends BaseProviderMetadata {
id("hpcloud-compute")
.name("HP Cloud Compute Services")
.apiMetadata(new NovaApiMetadata().toBuilder()
.identityName("tenantIdOrName:accessKey")
.identityName("tenantName:accessKey or accessKey")
.credentialName("secretKey")
.defaultModules(ImmutableSet.<Class<? extends Module>>of(KeystoneAuthenticationModuleForZones.class,NovaRestClientModule.class, HPCloudComputeServiceContextModule.class))
.build())

View File

@ -75,7 +75,7 @@ public class HPCloudObjectStorageApiMetadata extends SwiftApiMetadata {
super(HPCloudObjectStorageClient.class, HPCloudObjectStorageAsyncClient.class);
id("hpcloud-objectstorage")
.name("HP Cloud Services Object Storage API")
.identityName("tenantName:accessKey")
.identityName("tenantName:accessKey or accessKey")
.credentialName("secretKey")
.documentation(URI.create("https://build.hpcloud.com/object-storage/api"))
.defaultProperties(HPCloudObjectStorageApiMetadata.defaultProperties())

View File

@ -18,6 +18,10 @@
*/
package org.jclouds.hpcloud.objectstorage;
import static org.jclouds.openstack.keystone.v2_0.config.CredentialTypes.API_ACCESS_KEY_CREDENTIALS;
import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE;
import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.REQUIRES_TENANT;
import java.net.URI;
import java.util.Properties;
@ -53,6 +57,8 @@ public class HPCloudObjectStorageProviderMetadata extends BaseProviderMetadata {
public static Properties defaultProperties() {
Properties properties = new Properties();
properties.setProperty(CREDENTIAL_TYPE, API_ACCESS_KEY_CREDENTIALS);
properties.setProperty(REQUIRES_TENANT, "true");
return properties;
}

View File

@ -67,7 +67,7 @@ public enum KeystoneFixture {
.payload(
payloadFromStringWithContentType(
format(
"{\"auth\":{\"apiAccessKeyCredentials\":{\"accessKey\":\"%s\",\"secretKey\":\"%s\"},\"tenantId\":\"%s\"}}",
"{\"auth\":{\"apiAccessKeyCredentials\":{\"accessKey\":\"%s\",\"secretKey\":\"%s\"},\"tenantName\":\"%s\"}}",
accessKey, secretKey, getTenantName()), "application/json")).build();
}