Merge pull request #535 from danikov/vcloud-director-admin-refactor2

Issue 830: vCloud director Bugfix
This commit is contained in:
Adrian Cole 2012-03-30 11:36:15 -07:00
commit 59fe35f91c
2 changed files with 4 additions and 10 deletions

View File

@ -217,15 +217,7 @@ public class UserClientLiveTest extends BaseVCloudDirectorClientLiveTest {
dependsOnMethods = { "testCreateUser" } )
public void testDeleteUser() {
// Create a user to be deleted (so we remove dependencies on test ordering)
String name = name("a");
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 newUser = randomTestUser("testDeleteUser");
User userToBeDeleted = userClient.createUser(orgRef.getHref(), newUser);
// Delete the user

View File

@ -169,6 +169,7 @@ public abstract class BaseVCloudDirectorClientLiveTest extends BaseVersionedServ
VCloudDirectorContext rootContext = VCloudDirectorContext.class.cast(
new RestContextFactory().createContext(provider, identity, credential, ImmutableSet.<Module> of(
new Log4JLoggingModule(), new SshjSshClientModule()), overrides));
adminContext = rootContext.getAdminContext();
rootContext.utils().injector().injectMembers(this);
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) {
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) {