This commit is contained in:
danikov 2012-03-12 03:20:32 +00:00
parent 8e46d9e9ec
commit 24db1774eb
4 changed files with 42 additions and 40 deletions

View File

@ -148,7 +148,7 @@ public class AdminOrg extends Org {
} }
public AdminOrg build() { 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); 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<Link> links, String description, protected AdminOrg(URI href, String type, Set<Link> links, String description,
TasksInProgress tasksInProgress, String id, String name, String fullName, Set<Task> tasks, String id, String name, String fullName,
Boolean enabled, OrgSettings settings, UsersList users, GroupsList groups, Boolean enabled, OrgSettings settings, UsersList users, GroupsList groups,
CatalogsList catalogs, Vdcs vdcs, Networks networks) { 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.settings = settings;
this.users = users; this.users = users;
this.groups = groups; this.groups = groups;

View File

@ -233,7 +233,7 @@ public class Org extends EntityType<Org> {
} }
public Org(URI href, String type, Set<Link> links, String description, public Org(URI href, String type, Set<Link> links, String description,
TasksInProgress tasksInProgress, String id, String name, Set<Task> tasksInProgress, String id, String name,
String fullName, Boolean enabled) { String fullName, Boolean enabled) {
super(href, type, links, description, tasksInProgress, id, name); super(href, type, links, description, tasksInProgress, id, name);
this.fullName = fullName; this.fullName = fullName;

View File

@ -69,7 +69,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
AdminOrg expected = adminOrg(); AdminOrg expected = adminOrg();
assertEquals(client.getAdminOrgClient().getOrg(orgRef.getURI()), expected); assertEquals(client.getAdminOrgClient().getOrg(orgRef.getHref()), expected);
} }
public static final AdminOrg adminOrg() { public static final AdminOrg adminOrg() {
@ -213,7 +213,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
OrgSettings expected = settings(); OrgSettings expected = settings();
assertEquals(client.getAdminOrgClient().getSettings(orgRef.getURI()), expected); assertEquals(client.getAdminOrgClient().getSettings(orgRef.getHref()), expected);
} }
public static final OrgSettings settings() { public static final OrgSettings settings() {
@ -280,7 +280,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
OrgSettings expected = updateSettings(); OrgSettings expected = updateSettings();
assertEquals(client.getAdminOrgClient().updateSettings(orgRef.getURI(), expected), expected); assertEquals(client.getAdminOrgClient().updateSettings(orgRef.getHref(), expected), expected);
} }
@Test @Test
@ -303,7 +303,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
OrgEmailSettings expected = emailSettings(); OrgEmailSettings expected = emailSettings();
assertEquals(client.getAdminOrgClient().getEmailSettings(orgRef.getURI()), expected); assertEquals(client.getAdminOrgClient().getEmailSettings(orgRef.getHref()), expected);
} }
public static final OrgEmailSettings emailSettings() { public static final OrgEmailSettings emailSettings() {
@ -345,7 +345,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
OrgEmailSettings expected = updateEmailSettings(); OrgEmailSettings expected = updateEmailSettings();
assertEquals(client.getAdminOrgClient().updateEmailSettings(orgRef.getURI(), expected), expected); assertEquals(client.getAdminOrgClient().updateEmailSettings(orgRef.getHref(), expected), expected);
} }
@Test @Test
@ -378,7 +378,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
OrgGeneralSettings expected = generalSettings(); OrgGeneralSettings expected = generalSettings();
assertEquals(client.getAdminOrgClient().getGeneralSettings(orgRef.getURI()), expected); assertEquals(client.getAdminOrgClient().getGeneralSettings(orgRef.getHref()), expected);
} }
public static final OrgGeneralSettings generalSettings() { public static final OrgGeneralSettings generalSettings() {
@ -414,7 +414,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
OrgGeneralSettings expected = updateGeneralSettings(); OrgGeneralSettings expected = updateGeneralSettings();
assertEquals(client.getAdminOrgClient().updateGeneralSettings(orgRef.getURI(), expected), expected); assertEquals(client.getAdminOrgClient().updateGeneralSettings(orgRef.getHref(), expected), expected);
} }
public static final OrgGeneralSettings updateGeneralSettings() { public static final OrgGeneralSettings updateGeneralSettings() {
@ -437,7 +437,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
OrgLdapSettings expected = ldapSettings(); OrgLdapSettings expected = ldapSettings();
assertEquals(client.getAdminOrgClient().getLdapSettings(orgRef.getURI()), expected); assertEquals(client.getAdminOrgClient().getLdapSettings(orgRef.getHref()), expected);
} }
public static final OrgLdapSettings ldapSettings() { public static final OrgLdapSettings ldapSettings() {
@ -462,7 +462,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
OrgPasswordPolicySettings expected = passwordPolicy(); OrgPasswordPolicySettings expected = passwordPolicy();
assertEquals(client.getAdminOrgClient().getPasswordPolicy(orgRef.getURI()), expected); assertEquals(client.getAdminOrgClient().getPasswordPolicy(orgRef.getHref()), expected);
} }
public static final OrgPasswordPolicySettings passwordPolicy() { public static final OrgPasswordPolicySettings passwordPolicy() {
@ -496,7 +496,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
OrgPasswordPolicySettings expected = updateOrgPasswordPolicy(); OrgPasswordPolicySettings expected = updateOrgPasswordPolicy();
assertEquals(client.getAdminOrgClient().updatePasswordPolicy(orgRef.getURI(), expected), expected); assertEquals(client.getAdminOrgClient().updatePasswordPolicy(orgRef.getHref(), expected), expected);
} }
public static final OrgPasswordPolicySettings updateOrgPasswordPolicy() { public static final OrgPasswordPolicySettings updateOrgPasswordPolicy() {
@ -521,7 +521,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
OrgLeaseSettings expected = vAppLeaseSettings(); OrgLeaseSettings expected = vAppLeaseSettings();
assertEquals(client.getAdminOrgClient().getVAppLeaseSettings(orgRef.getURI()), expected); assertEquals(client.getAdminOrgClient().getVAppLeaseSettings(orgRef.getHref()), expected);
} }
public static final OrgLeaseSettings vAppLeaseSettings() { public static final OrgLeaseSettings vAppLeaseSettings() {
@ -555,7 +555,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
OrgLeaseSettings expected = updateVAppLeaseSettings(); OrgLeaseSettings expected = updateVAppLeaseSettings();
assertEquals(client.getAdminOrgClient().updateVAppLeaseSettings(orgRef.getURI(), expected), expected); assertEquals(client.getAdminOrgClient().updateVAppLeaseSettings(orgRef.getHref(), expected), expected);
} }
public static final OrgLeaseSettings updateVAppLeaseSettings() { public static final OrgLeaseSettings updateVAppLeaseSettings() {
@ -578,7 +578,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
OrgVAppTemplateLeaseSettings expected = vAppTemplateLeaseSettings(); OrgVAppTemplateLeaseSettings expected = vAppTemplateLeaseSettings();
assertEquals(client.getAdminOrgClient().getVAppTemplateLeaseSettings(orgRef.getURI()), expected); assertEquals(client.getAdminOrgClient().getVAppTemplateLeaseSettings(orgRef.getHref()), expected);
} }
public static final OrgVAppTemplateLeaseSettings vAppTemplateLeaseSettings() { public static final OrgVAppTemplateLeaseSettings vAppTemplateLeaseSettings() {
@ -611,7 +611,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
OrgVAppTemplateLeaseSettings expected = updateVAppTemplateLeaseSettings(); OrgVAppTemplateLeaseSettings expected = updateVAppTemplateLeaseSettings();
assertEquals(client.getAdminOrgClient().updateVAppTemplateLeaseSettings(orgRef.getURI(), expected), expected); assertEquals(client.getAdminOrgClient().updateVAppTemplateLeaseSettings(orgRef.getHref(), expected), expected);
} }
public static final OrgVAppTemplateLeaseSettings updateVAppTemplateLeaseSettings() { public static final OrgVAppTemplateLeaseSettings updateVAppTemplateLeaseSettings() {

View File

@ -18,11 +18,13 @@
*/ */
package org.jclouds.vcloud.director.v1_5.features; 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.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REF_REQ_LIVE;
import static org.testng.Assert.assertNotNull; 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.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.Checks;
import org.jclouds.vcloud.director.v1_5.domain.OrgEmailSettings; import org.jclouds.vcloud.director.v1_5.domain.OrgEmailSettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgGeneralSettings; import org.jclouds.vcloud.director.v1_5.domain.OrgGeneralSettings;
@ -77,14 +79,14 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(testName = "GET /admin/org/{id}") @Test(testName = "GET /admin/org/{id}")
public void testGetAdminOrg() { public void testGetAdminOrg() {
AdminOrg adminOrg = orgClient.getOrg(orgRef.getURI()); AdminOrg adminOrg = orgClient.getOrg(orgRef.getHref());
Checks.checkAdminOrg(adminOrg); Checks.checkAdminOrg(adminOrg);
} }
@Test(testName = "GET /admin/org/{id}/settings/emailSettings") @Test(testName = "GET /admin/org/{id}/settings/emailSettings")
public void testGetEmailSettings() { public void testGetEmailSettings() {
emailSettings = orgClient.getEmailSettings(orgRef.getURI()); emailSettings = orgClient.getEmailSettings(orgRef.getHref());
Checks.checkEmailSettings(emailSettings); Checks.checkEmailSettings(emailSettings);
} }
@ -118,7 +120,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.build(); .build();
emailSettings = orgClient.updateEmailSettings( emailSettings = orgClient.updateEmailSettings(
orgRef.getURI(), newEmailSettings); orgRef.getHref(), newEmailSettings);
assertTrue(equal(emailSettings.isDefaultSmtpServer(), !isDefaultSmtpServer), assertTrue(equal(emailSettings.isDefaultSmtpServer(), !isDefaultSmtpServer),
String.format(OBJ_FIELD_UPDATABLE, String.format(OBJ_FIELD_UPDATABLE,
@ -153,13 +155,13 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.build(); .build();
emailSettings = orgClient.updateEmailSettings( emailSettings = orgClient.updateEmailSettings(
orgRef.getURI(), emailSettings); orgRef.getHref(), emailSettings);
} }
} }
@Test(testName = "GET /admin/org/{id}/settings/generalSettings") @Test(testName = "GET /admin/org/{id}/settings/generalSettings")
public void testGetGeneralSettings() { public void testGetGeneralSettings() {
generalSettings = orgClient.getGeneralSettings(orgRef.getURI()); generalSettings = orgClient.getGeneralSettings(orgRef.getHref());
Checks.checkGeneralSettings(generalSettings); Checks.checkGeneralSettings(generalSettings);
} }
@ -183,7 +185,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.build(); .build();
generalSettings = orgClient.updateGeneralSettings( generalSettings = orgClient.updateGeneralSettings(
orgRef.getURI(), newGeneralSettings); orgRef.getHref(), newGeneralSettings);
// assertTrue(equal(generalSettings.canPublishCatalogs(), !canPublishCatalogs), // assertTrue(equal(generalSettings.canPublishCatalogs(), !canPublishCatalogs),
// String.format(OBJ_FIELD_UPDATABLE, // String.format(OBJ_FIELD_UPDATABLE,
@ -214,20 +216,20 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.build(); .build();
generalSettings = orgClient.updateGeneralSettings( generalSettings = orgClient.updateGeneralSettings(
orgRef.getURI(), generalSettings); orgRef.getHref(), generalSettings);
} }
} }
@Test(testName = "GET /admin/org/{id}/settings/ldap") @Test(testName = "GET /admin/org/{id}/settings/ldap")
public void testGetLdapSettings() { public void testGetLdapSettings() {
ldapSettings = orgClient.getLdapSettings(orgRef.getURI()); ldapSettings = orgClient.getLdapSettings(orgRef.getHref());
Checks.checkLdapSettings(ldapSettings); Checks.checkLdapSettings(ldapSettings);
} }
@Test(testName = "GET /admin/org/{id}/settings/passwordPolicy") @Test(testName = "GET /admin/org/{id}/settings/passwordPolicy")
public void testGetPasswordPolicy() { public void testGetPasswordPolicy() {
passwordPolicy = orgClient.getPasswordPolicy(orgRef.getURI()); passwordPolicy = orgClient.getPasswordPolicy(orgRef.getHref());
Checks.checkPasswordPolicySettings(passwordPolicy); Checks.checkPasswordPolicySettings(passwordPolicy);
} }
@ -247,7 +249,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.build(); .build();
passwordPolicy = orgClient.updatePasswordPolicy( passwordPolicy = orgClient.updatePasswordPolicy(
orgRef.getURI(), newPasswordPolicy); orgRef.getHref(), newPasswordPolicy);
assertTrue(equal(passwordPolicy.isAccountLockoutEnabled(), !accountLockoutEnabled), assertTrue(equal(passwordPolicy.isAccountLockoutEnabled(), !accountLockoutEnabled),
String.format(OBJ_FIELD_UPDATABLE, String.format(OBJ_FIELD_UPDATABLE,
@ -270,13 +272,13 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.build(); .build();
passwordPolicy = orgClient.updatePasswordPolicy( passwordPolicy = orgClient.updatePasswordPolicy(
orgRef.getURI(), passwordPolicy); orgRef.getHref(), passwordPolicy);
} }
} }
@Test(testName = "GET /admin/org/{id}/settings/vAppLeaseSettings") @Test(testName = "GET /admin/org/{id}/settings/vAppLeaseSettings")
public void testGetVAppLeaseSettings() { public void testGetVAppLeaseSettings() {
vAppLeaseSettings = orgClient.getVAppLeaseSettings(orgRef.getURI()); vAppLeaseSettings = orgClient.getVAppLeaseSettings(orgRef.getHref());
Checks.checkVAppLeaseSettings(vAppLeaseSettings); Checks.checkVAppLeaseSettings(vAppLeaseSettings);
} }
@ -296,7 +298,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.build(); .build();
vAppLeaseSettings = orgClient.updateVAppLeaseSettings( vAppLeaseSettings = orgClient.updateVAppLeaseSettings(
orgRef.getURI(), newVAppLeaseSettings); orgRef.getHref(), newVAppLeaseSettings);
assertTrue(equal(vAppLeaseSettings.deleteOnStorageLeaseExpiration(), !deleteOnStorageLeaseExpiration), assertTrue(equal(vAppLeaseSettings.deleteOnStorageLeaseExpiration(), !deleteOnStorageLeaseExpiration),
String.format(OBJ_FIELD_UPDATABLE, String.format(OBJ_FIELD_UPDATABLE,
@ -319,13 +321,13 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.build(); .build();
vAppLeaseSettings = orgClient.updateVAppLeaseSettings( vAppLeaseSettings = orgClient.updateVAppLeaseSettings(
orgRef.getURI(), vAppLeaseSettings); orgRef.getHref(), vAppLeaseSettings);
} }
} }
@Test(testName = "GET /admin/org/{id}/settings/vAppTemplateLeaseSettings") @Test(testName = "GET /admin/org/{id}/settings/vAppTemplateLeaseSettings")
public void testGetVAppTemplateLeaseSettings() { public void testGetVAppTemplateLeaseSettings() {
vAppTemplateLeaseSettings = orgClient.getVAppTemplateLeaseSettings(orgRef.getURI()); vAppTemplateLeaseSettings = orgClient.getVAppTemplateLeaseSettings(orgRef.getHref());
Checks.checkVAppTemplateLeaseSettings(vAppTemplateLeaseSettings); Checks.checkVAppTemplateLeaseSettings(vAppTemplateLeaseSettings);
} }
@ -343,7 +345,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.build(); .build();
vAppTemplateLeaseSettings = orgClient.updateVAppTemplateLeaseSettings( vAppTemplateLeaseSettings = orgClient.updateVAppTemplateLeaseSettings(
orgRef.getURI(), newVAppTemplateLeaseSettings); orgRef.getHref(), newVAppTemplateLeaseSettings);
assertTrue(equal(vAppTemplateLeaseSettings.deleteOnStorageLeaseExpiration(), !deleteOnStorageLeaseExpiration), assertTrue(equal(vAppTemplateLeaseSettings.deleteOnStorageLeaseExpiration(), !deleteOnStorageLeaseExpiration),
String.format(OBJ_FIELD_UPDATABLE, String.format(OBJ_FIELD_UPDATABLE,
@ -362,7 +364,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.build(); .build();
vAppTemplateLeaseSettings = orgClient.updateVAppTemplateLeaseSettings( vAppTemplateLeaseSettings = orgClient.updateVAppTemplateLeaseSettings(
orgRef.getURI(), vAppTemplateLeaseSettings); orgRef.getHref(), vAppTemplateLeaseSettings);
} }
} }
@ -374,7 +376,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
"testGetEmailSettings", "testGetEmailSettings",
"testGetPasswordPolicy"}) "testGetPasswordPolicy"})
public void testGetSettings() { public void testGetSettings() {
settings = orgClient.getSettings(orgRef.getURI()); settings = orgClient.getSettings(orgRef.getHref());
Checks.checkOrgSettings(settings); Checks.checkOrgSettings(settings);
} }
@ -398,7 +400,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.build(); .build();
settings = orgClient.updateSettings( settings = orgClient.updateSettings(
orgRef.getURI(), newSettings); orgRef.getHref(), newSettings);
assertTrue(equal(settings.getGeneralSettings(), newGeneralSettings), assertTrue(equal(settings.getGeneralSettings(), newGeneralSettings),
String.format(OBJ_FIELD_UPDATABLE, String.format(OBJ_FIELD_UPDATABLE,
@ -433,7 +435,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.build(); .build();
settings = orgClient.updateSettings( settings = orgClient.updateSettings(
orgRef.getURI(), settings); orgRef.getHref(), settings);
} }
} }
} }