From 24db1774eb441fddafc55e66133aa1ed0aea147a Mon Sep 17 00:00:00 2001 From: danikov Date: Mon, 12 Mar 2012 03:20:32 +0000 Subject: [PATCH] org fix --- .../vcloud/director/v1_5/domain/AdminOrg.java | 6 +-- .../vcloud/director/v1_5/domain/Org.java | 2 +- .../features/AdminOrgClientExpectTest.java | 28 +++++------ .../v1_5/features/AdminOrgClientLiveTest.java | 46 ++++++++++--------- 4 files changed, 42 insertions(+), 40 deletions(-) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminOrg.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminOrg.java index 3caf989887..d515889d09 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminOrg.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminOrg.java @@ -148,7 +148,7 @@ public class AdminOrg extends Org { } public AdminOrg build() { - return new AdminOrg(href, type, links, description, tasksInProgress, id, + return new AdminOrg(href, type, links, description, tasks, id, name, fullName, isEnabled, settings, users, groups, catalogs, vdcs, networks); } @@ -180,10 +180,10 @@ public class AdminOrg extends Org { } protected AdminOrg(URI href, String type, Set links, String description, - TasksInProgress tasksInProgress, String id, String name, String fullName, + Set tasks, String id, String name, String fullName, Boolean enabled, OrgSettings settings, UsersList users, GroupsList groups, CatalogsList catalogs, Vdcs vdcs, Networks networks) { - super(href, type, links, description, tasksInProgress, id, name, fullName, enabled); + super(href, type, links, description, tasks, id, name, fullName, enabled); this.settings = settings; this.users = users; this.groups = groups; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Org.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Org.java index 06e54d5852..368d8024f1 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Org.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Org.java @@ -233,7 +233,7 @@ public class Org extends EntityType { } public Org(URI href, String type, Set links, String description, - TasksInProgress tasksInProgress, String id, String name, + Set tasksInProgress, String id, String name, String fullName, Boolean enabled) { super(href, type, links, description, tasksInProgress, id, name); this.fullName = fullName; diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClientExpectTest.java index 0ec249dfce..f2cd65ddf8 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClientExpectTest.java @@ -69,7 +69,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect AdminOrg expected = adminOrg(); - assertEquals(client.getAdminOrgClient().getOrg(orgRef.getURI()), expected); + assertEquals(client.getAdminOrgClient().getOrg(orgRef.getHref()), expected); } public static final AdminOrg adminOrg() { @@ -213,7 +213,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect OrgSettings expected = settings(); - assertEquals(client.getAdminOrgClient().getSettings(orgRef.getURI()), expected); + assertEquals(client.getAdminOrgClient().getSettings(orgRef.getHref()), expected); } public static final OrgSettings settings() { @@ -280,7 +280,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect OrgSettings expected = updateSettings(); - assertEquals(client.getAdminOrgClient().updateSettings(orgRef.getURI(), expected), expected); + assertEquals(client.getAdminOrgClient().updateSettings(orgRef.getHref(), expected), expected); } @Test @@ -303,7 +303,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect OrgEmailSettings expected = emailSettings(); - assertEquals(client.getAdminOrgClient().getEmailSettings(orgRef.getURI()), expected); + assertEquals(client.getAdminOrgClient().getEmailSettings(orgRef.getHref()), expected); } public static final OrgEmailSettings emailSettings() { @@ -345,7 +345,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect OrgEmailSettings expected = updateEmailSettings(); - assertEquals(client.getAdminOrgClient().updateEmailSettings(orgRef.getURI(), expected), expected); + assertEquals(client.getAdminOrgClient().updateEmailSettings(orgRef.getHref(), expected), expected); } @Test @@ -378,7 +378,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect OrgGeneralSettings expected = generalSettings(); - assertEquals(client.getAdminOrgClient().getGeneralSettings(orgRef.getURI()), expected); + assertEquals(client.getAdminOrgClient().getGeneralSettings(orgRef.getHref()), expected); } public static final OrgGeneralSettings generalSettings() { @@ -414,7 +414,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect OrgGeneralSettings expected = updateGeneralSettings(); - assertEquals(client.getAdminOrgClient().updateGeneralSettings(orgRef.getURI(), expected), expected); + assertEquals(client.getAdminOrgClient().updateGeneralSettings(orgRef.getHref(), expected), expected); } public static final OrgGeneralSettings updateGeneralSettings() { @@ -437,7 +437,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect OrgLdapSettings expected = ldapSettings(); - assertEquals(client.getAdminOrgClient().getLdapSettings(orgRef.getURI()), expected); + assertEquals(client.getAdminOrgClient().getLdapSettings(orgRef.getHref()), expected); } public static final OrgLdapSettings ldapSettings() { @@ -462,7 +462,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect OrgPasswordPolicySettings expected = passwordPolicy(); - assertEquals(client.getAdminOrgClient().getPasswordPolicy(orgRef.getURI()), expected); + assertEquals(client.getAdminOrgClient().getPasswordPolicy(orgRef.getHref()), expected); } public static final OrgPasswordPolicySettings passwordPolicy() { @@ -496,7 +496,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect OrgPasswordPolicySettings expected = updateOrgPasswordPolicy(); - assertEquals(client.getAdminOrgClient().updatePasswordPolicy(orgRef.getURI(), expected), expected); + assertEquals(client.getAdminOrgClient().updatePasswordPolicy(orgRef.getHref(), expected), expected); } public static final OrgPasswordPolicySettings updateOrgPasswordPolicy() { @@ -521,7 +521,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect OrgLeaseSettings expected = vAppLeaseSettings(); - assertEquals(client.getAdminOrgClient().getVAppLeaseSettings(orgRef.getURI()), expected); + assertEquals(client.getAdminOrgClient().getVAppLeaseSettings(orgRef.getHref()), expected); } public static final OrgLeaseSettings vAppLeaseSettings() { @@ -555,7 +555,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect OrgLeaseSettings expected = updateVAppLeaseSettings(); - assertEquals(client.getAdminOrgClient().updateVAppLeaseSettings(orgRef.getURI(), expected), expected); + assertEquals(client.getAdminOrgClient().updateVAppLeaseSettings(orgRef.getHref(), expected), expected); } public static final OrgLeaseSettings updateVAppLeaseSettings() { @@ -578,7 +578,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect OrgVAppTemplateLeaseSettings expected = vAppTemplateLeaseSettings(); - assertEquals(client.getAdminOrgClient().getVAppTemplateLeaseSettings(orgRef.getURI()), expected); + assertEquals(client.getAdminOrgClient().getVAppTemplateLeaseSettings(orgRef.getHref()), expected); } public static final OrgVAppTemplateLeaseSettings vAppTemplateLeaseSettings() { @@ -611,7 +611,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect OrgVAppTemplateLeaseSettings expected = updateVAppTemplateLeaseSettings(); - assertEquals(client.getAdminOrgClient().updateVAppTemplateLeaseSettings(orgRef.getURI(), expected), expected); + assertEquals(client.getAdminOrgClient().updateVAppTemplateLeaseSettings(orgRef.getHref(), expected), expected); } public static final OrgVAppTemplateLeaseSettings updateVAppTemplateLeaseSettings() { diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClientLiveTest.java index d174978356..5ce9522ec4 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClientLiveTest.java @@ -18,11 +18,13 @@ */ package org.jclouds.vcloud.director.v1_5.features; +import static com.google.common.base.Objects.equal; +import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_UPDATABLE; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REF_REQ_LIVE; import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; + import org.jclouds.vcloud.director.v1_5.domain.AdminOrg; -import org.jclouds.vcloud.director.v1_5.domain.Error; -import org.jclouds.vcloud.director.v1_5.domain.Group; import org.jclouds.vcloud.director.v1_5.domain.Checks; import org.jclouds.vcloud.director.v1_5.domain.OrgEmailSettings; import org.jclouds.vcloud.director.v1_5.domain.OrgGeneralSettings; @@ -77,14 +79,14 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest { @Test(testName = "GET /admin/org/{id}") public void testGetAdminOrg() { - AdminOrg adminOrg = orgClient.getOrg(orgRef.getURI()); + AdminOrg adminOrg = orgClient.getOrg(orgRef.getHref()); Checks.checkAdminOrg(adminOrg); } @Test(testName = "GET /admin/org/{id}/settings/emailSettings") public void testGetEmailSettings() { - emailSettings = orgClient.getEmailSettings(orgRef.getURI()); + emailSettings = orgClient.getEmailSettings(orgRef.getHref()); Checks.checkEmailSettings(emailSettings); } @@ -118,7 +120,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest { .build(); emailSettings = orgClient.updateEmailSettings( - orgRef.getURI(), newEmailSettings); + orgRef.getHref(), newEmailSettings); assertTrue(equal(emailSettings.isDefaultSmtpServer(), !isDefaultSmtpServer), String.format(OBJ_FIELD_UPDATABLE, @@ -153,13 +155,13 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest { .build(); emailSettings = orgClient.updateEmailSettings( - orgRef.getURI(), emailSettings); + orgRef.getHref(), emailSettings); } } @Test(testName = "GET /admin/org/{id}/settings/generalSettings") public void testGetGeneralSettings() { - generalSettings = orgClient.getGeneralSettings(orgRef.getURI()); + generalSettings = orgClient.getGeneralSettings(orgRef.getHref()); Checks.checkGeneralSettings(generalSettings); } @@ -183,7 +185,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest { .build(); generalSettings = orgClient.updateGeneralSettings( - orgRef.getURI(), newGeneralSettings); + orgRef.getHref(), newGeneralSettings); // assertTrue(equal(generalSettings.canPublishCatalogs(), !canPublishCatalogs), // String.format(OBJ_FIELD_UPDATABLE, @@ -214,20 +216,20 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest { .build(); generalSettings = orgClient.updateGeneralSettings( - orgRef.getURI(), generalSettings); + orgRef.getHref(), generalSettings); } } @Test(testName = "GET /admin/org/{id}/settings/ldap") public void testGetLdapSettings() { - ldapSettings = orgClient.getLdapSettings(orgRef.getURI()); + ldapSettings = orgClient.getLdapSettings(orgRef.getHref()); Checks.checkLdapSettings(ldapSettings); } @Test(testName = "GET /admin/org/{id}/settings/passwordPolicy") public void testGetPasswordPolicy() { - passwordPolicy = orgClient.getPasswordPolicy(orgRef.getURI()); + passwordPolicy = orgClient.getPasswordPolicy(orgRef.getHref()); Checks.checkPasswordPolicySettings(passwordPolicy); } @@ -247,7 +249,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest { .build(); passwordPolicy = orgClient.updatePasswordPolicy( - orgRef.getURI(), newPasswordPolicy); + orgRef.getHref(), newPasswordPolicy); assertTrue(equal(passwordPolicy.isAccountLockoutEnabled(), !accountLockoutEnabled), String.format(OBJ_FIELD_UPDATABLE, @@ -270,13 +272,13 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest { .build(); passwordPolicy = orgClient.updatePasswordPolicy( - orgRef.getURI(), passwordPolicy); + orgRef.getHref(), passwordPolicy); } } @Test(testName = "GET /admin/org/{id}/settings/vAppLeaseSettings") public void testGetVAppLeaseSettings() { - vAppLeaseSettings = orgClient.getVAppLeaseSettings(orgRef.getURI()); + vAppLeaseSettings = orgClient.getVAppLeaseSettings(orgRef.getHref()); Checks.checkVAppLeaseSettings(vAppLeaseSettings); } @@ -296,7 +298,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest { .build(); vAppLeaseSettings = orgClient.updateVAppLeaseSettings( - orgRef.getURI(), newVAppLeaseSettings); + orgRef.getHref(), newVAppLeaseSettings); assertTrue(equal(vAppLeaseSettings.deleteOnStorageLeaseExpiration(), !deleteOnStorageLeaseExpiration), String.format(OBJ_FIELD_UPDATABLE, @@ -319,13 +321,13 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest { .build(); vAppLeaseSettings = orgClient.updateVAppLeaseSettings( - orgRef.getURI(), vAppLeaseSettings); + orgRef.getHref(), vAppLeaseSettings); } } @Test(testName = "GET /admin/org/{id}/settings/vAppTemplateLeaseSettings") public void testGetVAppTemplateLeaseSettings() { - vAppTemplateLeaseSettings = orgClient.getVAppTemplateLeaseSettings(orgRef.getURI()); + vAppTemplateLeaseSettings = orgClient.getVAppTemplateLeaseSettings(orgRef.getHref()); Checks.checkVAppTemplateLeaseSettings(vAppTemplateLeaseSettings); } @@ -343,7 +345,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest { .build(); vAppTemplateLeaseSettings = orgClient.updateVAppTemplateLeaseSettings( - orgRef.getURI(), newVAppTemplateLeaseSettings); + orgRef.getHref(), newVAppTemplateLeaseSettings); assertTrue(equal(vAppTemplateLeaseSettings.deleteOnStorageLeaseExpiration(), !deleteOnStorageLeaseExpiration), String.format(OBJ_FIELD_UPDATABLE, @@ -362,7 +364,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest { .build(); vAppTemplateLeaseSettings = orgClient.updateVAppTemplateLeaseSettings( - orgRef.getURI(), vAppTemplateLeaseSettings); + orgRef.getHref(), vAppTemplateLeaseSettings); } } @@ -374,7 +376,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest { "testGetEmailSettings", "testGetPasswordPolicy"}) public void testGetSettings() { - settings = orgClient.getSettings(orgRef.getURI()); + settings = orgClient.getSettings(orgRef.getHref()); Checks.checkOrgSettings(settings); } @@ -398,7 +400,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest { .build(); settings = orgClient.updateSettings( - orgRef.getURI(), newSettings); + orgRef.getHref(), newSettings); assertTrue(equal(settings.getGeneralSettings(), newGeneralSettings), String.format(OBJ_FIELD_UPDATABLE, @@ -433,7 +435,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest { .build(); settings = orgClient.updateSettings( - orgRef.getURI(), settings); + orgRef.getHref(), settings); } } }