mirror of https://github.com/apache/jclouds.git
Merge pull request #535 from danikov/vcloud-director-admin-refactor2
Issue 830: vCloud director Bugfix
This commit is contained in:
commit
59fe35f91c
|
@ -217,15 +217,7 @@ public class UserClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
dependsOnMethods = { "testCreateUser" } )
|
dependsOnMethods = { "testCreateUser" } )
|
||||||
public void testDeleteUser() {
|
public void testDeleteUser() {
|
||||||
// Create a user to be deleted (so we remove dependencies on test ordering)
|
// Create a user to be deleted (so we remove dependencies on test ordering)
|
||||||
String name = name("a");
|
User newUser = randomTestUser("testDeleteUser");
|
||||||
User newUser = User.builder()
|
|
||||||
.name(name)
|
|
||||||
.role(Reference.builder() // FIXME: auto-fetch a role? or inject
|
|
||||||
.name("vApp User")
|
|
||||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/role/ff1e0c91-1288-3664-82b7-a6fa303af4d1"))
|
|
||||||
.build())
|
|
||||||
.password("password")
|
|
||||||
.build();
|
|
||||||
User userToBeDeleted = userClient.createUser(orgRef.getHref(), newUser);
|
User userToBeDeleted = userClient.createUser(orgRef.getHref(), newUser);
|
||||||
|
|
||||||
// Delete the user
|
// Delete the user
|
||||||
|
|
|
@ -169,6 +169,7 @@ public abstract class BaseVCloudDirectorClientLiveTest extends BaseVersionedServ
|
||||||
VCloudDirectorContext rootContext = VCloudDirectorContext.class.cast(
|
VCloudDirectorContext rootContext = VCloudDirectorContext.class.cast(
|
||||||
new RestContextFactory().createContext(provider, identity, credential, ImmutableSet.<Module> of(
|
new RestContextFactory().createContext(provider, identity, credential, ImmutableSet.<Module> of(
|
||||||
new Log4JLoggingModule(), new SshjSshClientModule()), overrides));
|
new Log4JLoggingModule(), new SshjSshClientModule()), overrides));
|
||||||
|
adminContext = rootContext.getAdminContext();
|
||||||
|
|
||||||
rootContext.utils().injector().injectMembers(this);
|
rootContext.utils().injector().injectMembers(this);
|
||||||
Reference orgRef = Iterables.getFirst(rootContext.getApi().getOrgClient().getOrgList().getOrgs(), null)
|
Reference orgRef = Iterables.getFirst(rootContext.getApi().getOrgClient().getOrgList().getOrgs(), null)
|
||||||
|
@ -215,7 +216,8 @@ public abstract class BaseVCloudDirectorClientLiveTest extends BaseVersionedServ
|
||||||
|
|
||||||
public Reference getRoleReferenceFor(String name) {
|
public Reference getRoleReferenceFor(String name) {
|
||||||
RoleReferences roles = adminContext.getApi().getQueryClient().roleReferencesQueryAll();
|
RoleReferences roles = adminContext.getApi().getQueryClient().roleReferencesQueryAll();
|
||||||
return Iterables.find(roles.getReferences(), ReferencePredicates.nameEquals(name));
|
// wrapped in a builder to strip out unwanted xml cruft that the api chokes on
|
||||||
|
return Reference.builder().fromReference(Iterables.find(roles.getReferences(), ReferencePredicates.nameEquals(name))).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public User randomTestUser(String prefix) {
|
public User randomTestUser(String prefix) {
|
||||||
|
|
Loading…
Reference in New Issue