diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminAsyncClient.java new file mode 100644 index 0000000000..e9331ea1fc --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminAsyncClient.java @@ -0,0 +1,91 @@ +/** + * 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.vcloud.director.v1_5.admin; + +import org.jclouds.rest.annotations.Delegate; +import org.jclouds.vcloud.director.v1_5.domain.AdminOrg; +import org.jclouds.vcloud.director.v1_5.domain.AdminVdc; +import org.jclouds.vcloud.director.v1_5.domain.Catalog; +import org.jclouds.vcloud.director.v1_5.domain.Group; +import org.jclouds.vcloud.director.v1_5.domain.User; +import org.jclouds.vcloud.director.v1_5.domain.ovf.Network; +import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.admin.AdminQueryAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.admin.AdminVdcAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.admin.GroupAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.admin.UserAsyncClient; +import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserAsyncClient; + +/** + * Provides asynchronous access to VCloudDirector Admin via their REST API. + * + * @see VCloudDirectorAdminClient + * @author danikov + */ +public interface VCloudDirectorAdminAsyncClient extends VCloudDirectorUserAsyncClient { + /** + * @return asynchronous access to admin query features + */ + @Override + @Delegate + AdminQueryAsyncClient getQueryClient(); + + + /** + * @return asynchronous access to {@link Catalog} admin features + */ + @Override + @Delegate + AdminCatalogAsyncClient getCatalogClient(); + + /** + * @return asynchronous access to admin {@link Group} features + */ + @Delegate + GroupAsyncClient getGroupClient(); + + /** + * @return asynchronous access to {@link AdminOrg} features + */ + @Override + @Delegate + AdminOrgAsyncClient getOrgClient(); + + /** + * @return asynchronous access to {@link User} features + */ + @Delegate + UserAsyncClient getUserClient(); + + /** + * @return asynchronous access to {@link AdminVdc} features + */ + @Override + @Delegate + AdminVdcAsyncClient getVdcClient(); + + /** + * @return asynchronous access to admin {@link Network} features + */ + @Override + @Delegate + AdminNetworkAsyncClient getNetworkClient(); +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminClient.java new file mode 100644 index 0000000000..de3e43beed --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/admin/VCloudDirectorAdminClient.java @@ -0,0 +1,94 @@ +/** + * 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.vcloud.director.v1_5.admin; + +import java.util.concurrent.TimeUnit; + +import org.jclouds.concurrent.Timeout; +import org.jclouds.rest.annotations.Delegate; +import org.jclouds.vcloud.director.v1_5.domain.AdminOrg; +import org.jclouds.vcloud.director.v1_5.domain.AdminVdc; +import org.jclouds.vcloud.director.v1_5.domain.Catalog; +import org.jclouds.vcloud.director.v1_5.domain.Group; +import org.jclouds.vcloud.director.v1_5.domain.User; +import org.jclouds.vcloud.director.v1_5.domain.ovf.Network; +import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogClient; +import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkClient; +import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgClient; +import org.jclouds.vcloud.director.v1_5.features.admin.AdminQueryClient; +import org.jclouds.vcloud.director.v1_5.features.admin.AdminVdcClient; +import org.jclouds.vcloud.director.v1_5.features.admin.GroupClient; +import org.jclouds.vcloud.director.v1_5.features.admin.UserClient; +import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserAsyncClient; +import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserClient; + +/** + * Provides synchronous access to VCloudDirector Admin. + * + * @see VCloudDirectorUserAsyncClient + * @author Adrian Cole + */ +@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) +public interface VCloudDirectorAdminClient extends VCloudDirectorUserClient { + /** + * @return asynchronous access to admin query features + */ + @Override + @Delegate + AdminQueryClient getQueryClient(); + + /** + * @return synchronous access to {@link Catalog} admin features + */ + @Override + @Delegate + AdminCatalogClient getCatalogClient(); + + /** + * @return synchronous access to admin {@link Group} features + */ + @Delegate + GroupClient getGroupClient(); + + /** + * @return synchronous access to {@link AdminOrg} features + */ + @Override + @Delegate + AdminOrgClient getOrgClient(); + + /** + * @return synchronous access to {@link User} features + */ + @Delegate + UserClient getUserClient(); + + /** + * @return synchronous access to {@link AdminVdc} features + */ + @Delegate + AdminVdcClient getVdcClient(); + + /** + * @return synchronous access to admin {@link Network} features + */ + @Override + @Delegate + AdminNetworkClient getNetworkClient(); +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Role.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Role.java new file mode 100644 index 0000000000..1616f0ce1e --- /dev/null +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Role.java @@ -0,0 +1,27 @@ +package org.jclouds.vcloud.director.v1_5.domain; + +import java.util.Arrays; +import java.util.List; + +import org.jclouds.vcloud.director.v1_5.features.admin.AdminQueryClient; + +public class Role { //TODO: placeholder for implementation + + public static final class DefaultRoles { + public static final String USER = "vApp User"; + public static final String AUTHOR = "vApp Author"; + public static final String CATALOG_AUTHOR = "Catalog Author"; + public static final String CONSOLE = "Console Access Only"; + public static final String ORG_ADMIN = "Organization Administrator"; + + /** + * All default {@link AdminQueryClient#roleReferencesQueryAll()} values. + *

+ * This list must be updated whenever a new default role is added. + */ + public static final List ALL = Arrays.asList( + USER, AUTHOR, CATALOG_AUTHOR, CONSOLE, ORG_ADMIN + ); + } + +} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogAsyncClient.java similarity index 94% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogAsyncClient.java rename to labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogAsyncClient.java index 71e7572a8b..3915319f35 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogAsyncClient.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.features; +package org.jclouds.vcloud.director.v1_5.features.admin; import java.net.URI; @@ -40,6 +40,9 @@ import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog; import org.jclouds.vcloud.director.v1_5.domain.Metadata; import org.jclouds.vcloud.director.v1_5.domain.Owner; import org.jclouds.vcloud.director.v1_5.domain.PublishCatalogParams; +import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient.Writeable; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogClient.java similarity index 93% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClient.java rename to labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogClient.java index 6ffa9cde0e..ae3727c564 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminCatalogClient.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.features; +package org.jclouds.vcloud.director.v1_5.features.admin; import java.net.URI; import java.util.concurrent.TimeUnit; @@ -28,6 +28,9 @@ import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog; import org.jclouds.vcloud.director.v1_5.domain.Metadata; import org.jclouds.vcloud.director.v1_5.domain.Owner; import org.jclouds.vcloud.director.v1_5.domain.PublishCatalogParams; +import org.jclouds.vcloud.director.v1_5.features.CatalogClient; +import org.jclouds.vcloud.director.v1_5.features.MetadataClient; +import org.jclouds.vcloud.director.v1_5.features.MetadataClient.Writeable; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; /** diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminNetworkAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkAsyncClient.java similarity index 91% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminNetworkAsyncClient.java rename to labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkAsyncClient.java index 2842d11400..a0c2476dc5 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminNetworkAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkAsyncClient.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.features; +package org.jclouds.vcloud.director.v1_5.features.admin; import java.net.URI; @@ -38,6 +38,9 @@ import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.domain.ExternalNetwork; import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork; import org.jclouds.vcloud.director.v1_5.domain.Task; +import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient.Writeable; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminNetworkClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkClient.java similarity index 91% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminNetworkClient.java rename to labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkClient.java index 486e2f1e5a..44fca80ede 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminNetworkClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminNetworkClient.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.features; +package org.jclouds.vcloud.director.v1_5.features.admin; import java.net.URI; import java.util.concurrent.TimeUnit; @@ -26,6 +26,9 @@ import org.jclouds.rest.annotations.Delegate; import org.jclouds.vcloud.director.v1_5.domain.Network; import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork; import org.jclouds.vcloud.director.v1_5.domain.Task; +import org.jclouds.vcloud.director.v1_5.features.MetadataClient; +import org.jclouds.vcloud.director.v1_5.features.NetworkClient; +import org.jclouds.vcloud.director.v1_5.features.MetadataClient.Writeable; /** * Provides synchronous access to admin {@link Network} objects. diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgAsyncClient.java similarity index 96% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgAsyncClient.java rename to labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgAsyncClient.java index f5da05318b..1ccc010dd9 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgAsyncClient.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.features; +package org.jclouds.vcloud.director.v1_5.features.admin; import java.net.URI; @@ -42,6 +42,9 @@ import org.jclouds.vcloud.director.v1_5.domain.OrgLeaseSettings; import org.jclouds.vcloud.director.v1_5.domain.OrgPasswordPolicySettings; import org.jclouds.vcloud.director.v1_5.domain.OrgSettings; import org.jclouds.vcloud.director.v1_5.domain.OrgVAppTemplateLeaseSettings; +import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient.Writeable; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgClient.java similarity index 96% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClient.java rename to labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgClient.java index 1c300fe022..0b78baac20 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminOrgClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminOrgClient.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.features; +package org.jclouds.vcloud.director.v1_5.features.admin; import java.net.URI; import java.util.concurrent.TimeUnit; @@ -32,6 +32,9 @@ import org.jclouds.vcloud.director.v1_5.domain.OrgLeaseSettings; import org.jclouds.vcloud.director.v1_5.domain.OrgPasswordPolicySettings; import org.jclouds.vcloud.director.v1_5.domain.OrgSettings; import org.jclouds.vcloud.director.v1_5.domain.OrgVAppTemplateLeaseSettings; +import org.jclouds.vcloud.director.v1_5.features.MetadataClient; +import org.jclouds.vcloud.director.v1_5.features.OrgClient; +import org.jclouds.vcloud.director.v1_5.features.MetadataClient.Writeable; /** * Provides synchronous access to {@link Group} objects. diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminQueryAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminQueryAsyncClient.java similarity index 97% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminQueryAsyncClient.java rename to labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminQueryAsyncClient.java index 613641ff2d..1ab90dbf4f 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminQueryAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminQueryAsyncClient.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.features; +package org.jclouds.vcloud.director.v1_5.features.admin; import java.util.concurrent.TimeUnit; @@ -32,6 +32,7 @@ import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.vcloud.director.v1_5.domain.RoleReferences; import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords; +import org.jclouds.vcloud.director.v1_5.features.QueryAsyncClient; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminQueryClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminQueryClient.java similarity index 97% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminQueryClient.java rename to labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminQueryClient.java index 2b6c4982a1..977b88b1e8 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminQueryClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminQueryClient.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.features; +package org.jclouds.vcloud.director.v1_5.features.admin; import java.util.concurrent.TimeUnit; @@ -30,6 +30,7 @@ import org.jclouds.vcloud.director.v1_5.domain.User; import org.jclouds.vcloud.director.v1_5.domain.Vdc; import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecordType; import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords; +import org.jclouds.vcloud.director.v1_5.features.QueryClient; /** * Provides synchronous access to {@link AdminQuery} objects. diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminVdcAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcAsyncClient.java similarity index 94% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminVdcAsyncClient.java rename to labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcAsyncClient.java index 4f2126f936..4087ac1128 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminVdcAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcAsyncClient.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.features; +package org.jclouds.vcloud.director.v1_5.features.admin; import java.net.URI; @@ -36,6 +36,8 @@ import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.domain.AdminVdc; import org.jclouds.vcloud.director.v1_5.domain.Task; +import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.VdcAsyncClient; import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient.Writeable; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminVdcClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcClient.java similarity index 90% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminVdcClient.java rename to labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcClient.java index 0959d89bd2..05110045cc 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminVdcClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/AdminVdcClient.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.features; +package org.jclouds.vcloud.director.v1_5.features.admin; import java.net.URI; import java.util.concurrent.TimeUnit; @@ -26,6 +26,10 @@ import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.vcloud.director.v1_5.domain.AdminVdc; import org.jclouds.vcloud.director.v1_5.domain.Task; +import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.MetadataClient; +import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.VdcClient; import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient.Writeable; /** diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/GroupAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/GroupAsyncClient.java similarity index 98% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/GroupAsyncClient.java rename to labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/GroupAsyncClient.java index 77393fb11b..12f52d4865 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/GroupAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/GroupAsyncClient.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.features; +package org.jclouds.vcloud.director.v1_5.features.admin; import java.net.URI; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/GroupClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/GroupClient.java similarity index 97% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/GroupClient.java rename to labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/GroupClient.java index b28ee34dfd..5804b2bfd9 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/GroupClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/GroupClient.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.features; +package org.jclouds.vcloud.director.v1_5.features.admin; import java.net.URI; import java.util.concurrent.TimeUnit; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/UserAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/UserAsyncClient.java similarity index 98% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/UserAsyncClient.java rename to labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/UserAsyncClient.java index 82c41560b3..73d3386532 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/UserAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/UserAsyncClient.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.features; +package org.jclouds.vcloud.director.v1_5.features.admin; import java.net.URI; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/UserClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/UserClient.java similarity index 97% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/UserClient.java rename to labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/UserClient.java index 350e03af21..a7cd86c3c3 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/UserClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/admin/UserClient.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5.features; +package org.jclouds.vcloud.director.v1_5.features.admin; import java.net.URI; import java.util.concurrent.TimeUnit; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorUserAsyncClient.java similarity index 65% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorAsyncClient.java rename to labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorUserAsyncClient.java index 25c7ff5967..429cd82d3d 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorUserAsyncClient.java @@ -16,35 +16,24 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5; +package org.jclouds.vcloud.director.v1_5.user; import org.jclouds.rest.annotations.Delegate; -import org.jclouds.vcloud.director.v1_5.domain.AdminOrg; -import org.jclouds.vcloud.director.v1_5.domain.AdminVdc; import org.jclouds.vcloud.director.v1_5.domain.Catalog; -import org.jclouds.vcloud.director.v1_5.domain.Group; import org.jclouds.vcloud.director.v1_5.domain.Media; import org.jclouds.vcloud.director.v1_5.domain.Org; import org.jclouds.vcloud.director.v1_5.domain.Session; import org.jclouds.vcloud.director.v1_5.domain.Task; -import org.jclouds.vcloud.director.v1_5.domain.User; import org.jclouds.vcloud.director.v1_5.domain.VApp; import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate; import org.jclouds.vcloud.director.v1_5.domain.Vdc; import org.jclouds.vcloud.director.v1_5.domain.ovf.Network; -import org.jclouds.vcloud.director.v1_5.features.AdminCatalogAsyncClient; -import org.jclouds.vcloud.director.v1_5.features.AdminNetworkAsyncClient; -import org.jclouds.vcloud.director.v1_5.features.AdminOrgAsyncClient; -import org.jclouds.vcloud.director.v1_5.features.AdminQueryAsyncClient; -import org.jclouds.vcloud.director.v1_5.features.AdminVdcAsyncClient; import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncClient; -import org.jclouds.vcloud.director.v1_5.features.GroupAsyncClient; import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient; import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient; import org.jclouds.vcloud.director.v1_5.features.QueryAsyncClient; import org.jclouds.vcloud.director.v1_5.features.TaskAsyncClient; import org.jclouds.vcloud.director.v1_5.features.UploadAsyncClient; -import org.jclouds.vcloud.director.v1_5.features.UserAsyncClient; import org.jclouds.vcloud.director.v1_5.features.VAppAsyncClient; import org.jclouds.vcloud.director.v1_5.features.VAppTemplateAsyncClient; import org.jclouds.vcloud.director.v1_5.features.VdcAsyncClient; @@ -54,10 +43,10 @@ import com.google.inject.Provides; /** * Provides asynchronous access to VCloudDirector via their REST API. * - * @see VCloudDirectorClient + * @see VCloudDirectorUserClient * @author Adrian Cole */ -public interface VCloudDirectorAsyncClient { +public interface VCloudDirectorUserAsyncClient { /** * * @return the current login session @@ -71,12 +60,6 @@ public interface VCloudDirectorAsyncClient { @Delegate QueryAsyncClient getQueryClient(); - /** - * @return asynchronous access to admin query features - */ - @Delegate - AdminQueryAsyncClient getAdminQueryClient(); - /** * @return asynchronous access to {@link Org} features */ @@ -130,40 +113,4 @@ public interface VCloudDirectorAsyncClient { */ @Delegate VAppTemplateAsyncClient getVAppTemplateClient(); - - /** - * @return asynchronous access to {@link Catalog} admin features - */ - @Delegate - AdminCatalogAsyncClient getAdminCatalogClient(); - - /** - * @return asynchronous access to admin {@link Group} features - */ - @Delegate - GroupAsyncClient getGroupClient(); - - /** - * @return asynchronous access to {@link AdminOrg} features - */ - @Delegate - AdminOrgAsyncClient getAdminOrgClient(); - - /** - * @return asynchronous access to {@link User} features - */ - @Delegate - UserAsyncClient getUserClient(); - - /** - * @return asynchronous access to {@link AdminVdc} features - */ - @Delegate - AdminVdcAsyncClient getAdminVdcClient(); - - /** - * @return asynchronous access to admin {@link Network} features - */ - @Delegate - AdminNetworkAsyncClient getAdminNetworkClient(); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorUserClient.java similarity index 66% rename from labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClient.java rename to labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorUserClient.java index 01c8329235..4431be8626 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/user/VCloudDirectorUserClient.java @@ -16,39 +16,29 @@ * specific language governing permissions and limitations * under the License. */ -package org.jclouds.vcloud.director.v1_5; +package org.jclouds.vcloud.director.v1_5.user; import java.util.concurrent.TimeUnit; import org.jclouds.concurrent.Timeout; import org.jclouds.rest.annotations.Delegate; -import org.jclouds.vcloud.director.v1_5.domain.AdminOrg; -import org.jclouds.vcloud.director.v1_5.domain.AdminVdc; +import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminAsyncClient; import org.jclouds.vcloud.director.v1_5.domain.Catalog; -import org.jclouds.vcloud.director.v1_5.domain.Group; import org.jclouds.vcloud.director.v1_5.domain.Media; import org.jclouds.vcloud.director.v1_5.domain.Org; import org.jclouds.vcloud.director.v1_5.domain.Session; import org.jclouds.vcloud.director.v1_5.domain.Task; -import org.jclouds.vcloud.director.v1_5.domain.User; import org.jclouds.vcloud.director.v1_5.domain.VApp; import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate; import org.jclouds.vcloud.director.v1_5.domain.Vdc; import org.jclouds.vcloud.director.v1_5.domain.ovf.Network; -import org.jclouds.vcloud.director.v1_5.features.AdminCatalogClient; -import org.jclouds.vcloud.director.v1_5.features.AdminNetworkClient; -import org.jclouds.vcloud.director.v1_5.features.AdminOrgClient; -import org.jclouds.vcloud.director.v1_5.features.AdminQueryClient; -import org.jclouds.vcloud.director.v1_5.features.AdminVdcClient; import org.jclouds.vcloud.director.v1_5.features.CatalogClient; -import org.jclouds.vcloud.director.v1_5.features.GroupClient; import org.jclouds.vcloud.director.v1_5.features.MediaClient; import org.jclouds.vcloud.director.v1_5.features.NetworkClient; import org.jclouds.vcloud.director.v1_5.features.OrgClient; import org.jclouds.vcloud.director.v1_5.features.QueryClient; import org.jclouds.vcloud.director.v1_5.features.TaskClient; import org.jclouds.vcloud.director.v1_5.features.UploadClient; -import org.jclouds.vcloud.director.v1_5.features.UserClient; import org.jclouds.vcloud.director.v1_5.features.VAppClient; import org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient; import org.jclouds.vcloud.director.v1_5.features.VdcClient; @@ -58,11 +48,11 @@ import com.google.inject.Provides; /** * Provides synchronous access to VCloudDirector. * - * @see VCloudDirectorAsyncClient - * @author Adrian Cole + * @see VCloudDirectorAdminAsyncClient + * @author danikov */ @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) -public interface VCloudDirectorClient { +public interface VCloudDirectorUserClient { /** * @return the current login session */ @@ -75,12 +65,6 @@ public interface VCloudDirectorClient { @Delegate QueryClient getQueryClient(); - /** - * @return asynchronous access to admin query features - */ - @Delegate - AdminQueryClient getAdminQueryClient(); - /** * @return synchronous access to {@link Org} features */ @@ -134,40 +118,4 @@ public interface VCloudDirectorClient { */ @Delegate VAppTemplateClient getVAppTemplateClient(); - - /** - * @return synchronous access to {@link Catalog} admin features - */ - @Delegate - AdminCatalogClient getAdminCatalogClient(); - - /** - * @return synchronous access to admin {@link Group} features - */ - @Delegate - GroupClient getGroupClient(); - - /** - * @return synchronous access to {@link AdminOrg} features - */ - @Delegate - AdminOrgClient getAdminOrgClient(); - - /** - * @return synchronous access to {@link User} features - */ - @Delegate - UserClient getUserClient(); - - /** - * @return synchronous access to {@link AdminVdc} features - */ - @Delegate - AdminVdcClient getAdminVdcClient(); - - /** - * @return synchronous access to admin {@link Network} features - */ - @Delegate - AdminNetworkClient getAdminNetworkClient(); } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/NonClientOperationsLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/NonClientOperationsLiveTest.java index 60a08918a2..b5ad53292c 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/NonClientOperationsLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/NonClientOperationsLiveTest.java @@ -33,7 +33,7 @@ import org.jclouds.http.HttpResponse; import org.jclouds.util.Strings2; import org.jclouds.vcloud.director.v1_5.domain.OrgList; import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken; -import org.jclouds.vcloud.director.v1_5.features.AdminCatalogClient; +import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogClient; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.jclouds.xml.internal.JAXBParser; import org.testng.annotations.Test; diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClientExpectTest.java index 9306a3c754..10c58bb354 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClientExpectTest.java @@ -22,17 +22,18 @@ import static org.testng.Assert.assertEquals; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; import org.jclouds.vcloud.director.v1_5.login.SessionClientExpectTest; +import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserClient; import org.testng.annotations.Test; /** * @author Adrian Cole */ @Test(groups = "unit", testName = "VCloudDirectorClient") -public class VCloudDirectorClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { +public class VCloudDirectorClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public void testRestClientModuleWorksProperly() throws Exception { - VCloudDirectorClient clientWhenSessionsExist = requestSendsResponse(loginRequest, sessionResponse); + VCloudDirectorUserClient clientWhenSessionsExist = requestSendsResponse(loginRequest, sessionResponse); assertEquals(clientWhenSessionsExist.getCurrentSession(), SessionClientExpectTest.SESSION); } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClientExpectTest.java index 9921d41933..74ecbec3a1 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClientExpectTest.java @@ -22,8 +22,8 @@ import static org.testng.Assert.assertEquals; import java.net.URI; -import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; +import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient; import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog; import org.jclouds.vcloud.director.v1_5.domain.CatalogItems; import org.jclouds.vcloud.director.v1_5.domain.Link; @@ -42,13 +42,7 @@ import com.google.common.collect.ImmutableSet; * @author grkvlt@apache.org */ @Test(groups = { "unit", "admin", "catalog" }, singleThreaded = true, testName = "CatalogClientExpectTest") -public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { - - private Reference orgRef = Reference.builder() - .type("application/vnd.vmware.vcloud.catalog+xml") - .name("QunyingTestCatalog") - .href(URI.create(endpoint + "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4")) - .build(); +public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { private Reference catalogRef = Reference.builder() .type("application/vnd.vmware.vcloud.catalog+xml") @@ -58,7 +52,7 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx @Test public void testCreateCatalog() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", "/admin/org/???/catalogs") .xmlFilePayload("/catalog/admin/createCatalogSource.xml", VCloudDirectorMediaType.ADMIN_CATALOG) @@ -71,7 +65,7 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx AdminCatalog source = createCatalogSource(); AdminCatalog expected = createCatalog(); - assertEquals(client.getAdminCatalogClient().createCatalog(catalogRef.getHref(), source), expected); + assertEquals(client.getCatalogClient().createCatalog(catalogRef.getHref(), source), expected); } // FIXME temporarily disabling this test due to JAXB error: @@ -82,7 +76,7 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx // <{http://www.vmware.com/vcloud/v1.5}Task> @Test(enabled = false) public void testGetCatalog() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4") .acceptAnyMedia() @@ -93,7 +87,7 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx AdminCatalog expected = catalog(); - AdminCatalog actual = client.getAdminCatalogClient().getCatalog(catalogRef.getHref()); + AdminCatalog actual = client.getCatalogClient().getCatalog(catalogRef.getHref()); assertEquals(actual.getHref(), expected.getHref()); assertEquals(actual.getLinks(), expected.getLinks()); assertEquals(actual.getTasks(), expected.getTasks()); @@ -107,12 +101,12 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx assertEquals(actual.getOwner(), expected.getOwner()); - assertEquals(client.getAdminCatalogClient().getCatalog(catalogRef.getHref()), expected); + assertEquals(client.getCatalogClient().getCatalog(catalogRef.getHref()), expected); } @Test public void testModifyCatalog() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4") .xmlFilePayload("/catalog/admin/updateCatalogSource.xml", VCloudDirectorMediaType.ADMIN_CATALOG) @@ -124,12 +118,12 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx AdminCatalog expected = modifyCatalog(); - assertEquals(client.getAdminCatalogClient().updateCatalog(catalogRef.getHref(), expected), expected); + assertEquals(client.getCatalogClient().updateCatalog(catalogRef.getHref(), expected), expected); } @Test public void testGetOwner() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner") .acceptAnyMedia() @@ -151,12 +145,12 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx .build()) .build(); - assertEquals(client.getAdminCatalogClient().getOwner(catalogRef.getHref()), expected); + assertEquals(client.getCatalogClient().getOwner(catalogRef.getHref()), expected); } @Test public void testSetOwner() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner") .xmlFilePayload("/catalog/admin/updateOwnerSource.xml", VCloudDirectorMediaType.OWNER) @@ -174,12 +168,12 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx .build()) .build(); - client.getAdminCatalogClient().setOwner(catalogRef.getHref(), newOwner); + client.getCatalogClient().setOwner(catalogRef.getHref(), newOwner); } @Test public void testPublishCatalog() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/action/publish") .xmlFilePayload("/catalog/admin/publishCatalogParams.xml", VCloudDirectorMediaType.PUBLISH_CATALOG_PARAMS) @@ -192,12 +186,12 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx .isPublished(true) .build(); - client.getAdminCatalogClient().publishCatalog(catalogRef.getHref(), params); + client.getCatalogClient().publishCatalog(catalogRef.getHref(), params); } @Test public void testDeleteCatalog() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("DELETE", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4") .acceptAnyMedia() @@ -205,7 +199,7 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx new VcloudHttpResponsePrimer() .httpResponseBuilder().statusCode(204).build()); - client.getAdminCatalogClient().deleteCatalog(catalogRef.getHref()); + client.getCatalogClient().deleteCatalog(catalogRef.getHref()); } public static final AdminCatalog createCatalogSource() { diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClientLiveTest.java index add04a608b..1c652cb350 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClientLiveTest.java @@ -40,6 +40,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Owner; import org.jclouds.vcloud.director.v1_5.domain.PublishCatalogParams; import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.User; +import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogClient; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; @@ -74,7 +75,7 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest @Override @BeforeClass(alwaysRun = true) protected void setupRequiredClients() { - catalogClient = context.getApi().getAdminCatalogClient(); + catalogClient = adminContext.getApi().getCatalogClient(); orgRef = Iterables.getFirst(context.getApi().getOrgClient().getOrgList().getOrgs(), null).toAdminReference(endpoint); } @@ -109,8 +110,8 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest @Test(testName = "PUT /admin/catalog/{id}/owner", dependsOnMethods = { "testGetCatalog" }) public void updateCatalogOwner() { - User newOwnerUser = UserClientLiveTest.randomTestUser("testUpdateCatalogOwner", context); - newOwnerUser = context.getApi().getUserClient().createUser(orgRef.getHref(), newOwnerUser); + User newOwnerUser = randomTestUser("testUpdateCatalogOwner"); + newOwnerUser = adminContext.getApi().getUserClient().createUser(orgRef.getHref(), newOwnerUser); assertNotNull(newOwnerUser, "failed to create temp user to test updateCatalogOwner"); Owner oldOwner = owner; @@ -129,7 +130,7 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest } finally { catalogClient.setOwner(catalog.getHref(), oldOwner); owner = catalogClient.getOwner(catalog.getHref()); - context.getApi().getUserClient().deleteUser(newOwnerUser.getHref()); + adminContext.getApi().getUserClient().deleteUser(newOwnerUser.getHref()); } } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminNetworkClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminNetworkClientExpectTest.java index 5d7d8bb3a4..498f473852 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminNetworkClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminNetworkClientExpectTest.java @@ -22,12 +22,13 @@ import static org.testng.Assert.assertEquals; import java.net.URI; -import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; +import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient; import org.jclouds.vcloud.director.v1_5.domain.Link; import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork; import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.Task; +import org.jclouds.vcloud.director.v1_5.features.admin.GroupClient; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; import org.testng.annotations.Test; @@ -39,7 +40,7 @@ import com.google.common.collect.ImmutableSet; * @author danikov */ @Test(groups = { "unit", "admin", "network"}, singleThreaded = true, testName = "AdminNetworkClientExpectTest") -public class AdminNetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { +public class AdminNetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { Reference networkRef = Reference.builder() .href(URI.create(endpoint+"/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1")) @@ -47,7 +48,7 @@ public class AdminNetworkClientExpectTest extends BaseVCloudDirectorRestClientEx @Test public void testGetNetworkWithOrgNetwork() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1") .acceptAnyMedia() @@ -58,12 +59,12 @@ public class AdminNetworkClientExpectTest extends BaseVCloudDirectorRestClientEx OrgNetwork expected = orgNetwork(); - assertEquals(client.getAdminNetworkClient().getNetwork(networkRef.getHref()), expected); + assertEquals(client.getNetworkClient().getNetwork(networkRef.getHref()), expected); } @Test public void testUpdateNetwork() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1") .xmlFilePayload("/network/admin/updateNetworkSource.xml", VCloudDirectorMediaType.ORG_NETWORK) @@ -75,12 +76,12 @@ public class AdminNetworkClientExpectTest extends BaseVCloudDirectorRestClientEx Task expected = updateNetworkTask(); - assertEquals(client.getAdminNetworkClient().updateNetwork(networkRef.getHref(), updateNetwork()), expected); + assertEquals(client.getNetworkClient().updateNetwork(networkRef.getHref(), updateNetwork()), expected); } @Test(enabled = false) public void testResetNetwork() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", "/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1/action/reset") .acceptMedia(VCloudDirectorMediaType.TASK) @@ -91,7 +92,7 @@ public class AdminNetworkClientExpectTest extends BaseVCloudDirectorRestClientEx Task expected = resetNetworkTask(); - assertEquals(client.getAdminNetworkClient().resetNetwork(networkRef.getHref()), expected); + assertEquals(client.getNetworkClient().resetNetwork(networkRef.getHref()), expected); } public final OrgNetwork orgNetwork() { diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminNetworkClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminNetworkClientLiveTest.java index b51db728c1..6818430fc2 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminNetworkClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminNetworkClientLiveTest.java @@ -39,6 +39,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.RouterInfo; import org.jclouds.vcloud.director.v1_5.domain.SyslogServerSettings; import org.jclouds.vcloud.director.v1_5.domain.Task; +import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkClient; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -67,7 +68,7 @@ public class AdminNetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest @Override @BeforeClass(alwaysRun = true) protected void setupRequiredClients() { - networkClient = context.getApi().getAdminNetworkClient(); + networkClient = adminContext.getApi().getNetworkClient(); networkRef = Reference.builder().href(networkURI).build().toAdminReference(endpoint); } 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 f2cd65ddf8..75729c42f2 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 @@ -22,8 +22,8 @@ import static org.testng.Assert.assertEquals; import java.net.URI; -import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; +import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient; import org.jclouds.vcloud.director.v1_5.domain.AdminOrg; import org.jclouds.vcloud.director.v1_5.domain.CatalogsList; import org.jclouds.vcloud.director.v1_5.domain.GroupsList; @@ -40,6 +40,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.SmtpServerSettings; import org.jclouds.vcloud.director.v1_5.domain.UsersList; import org.jclouds.vcloud.director.v1_5.domain.Vdcs; +import org.jclouds.vcloud.director.v1_5.features.admin.GroupClient; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; import org.testng.annotations.Test; @@ -49,7 +50,7 @@ import org.testng.annotations.Test; * @author danikov */ @Test(groups = { "unit", "user", "org"}, singleThreaded = true, testName = "AdminOrgClientExpectTest") -public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { +public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { private Reference orgRef = Reference.builder() .href(URI.create(endpoint + "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")) @@ -57,7 +58,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect @Test public void testGetOrg() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0") .acceptAnyMedia() @@ -69,7 +70,335 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect AdminOrg expected = adminOrg(); - assertEquals(client.getAdminOrgClient().getOrg(orgRef.getHref()), expected); + assertEquals(client.getOrgClient().getOrg(orgRef.getHref()), expected); + } + + @Test(enabled = false) + public void testGetSettings() { + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/org/admin/settings.xml", + VCloudDirectorMediaType.ORG_SETTINGS) + .httpResponseBuilder().build()); + + OrgSettings expected = settings(); + + assertEquals(client.getOrgClient().getSettings(orgRef.getHref()), expected); + } + + @Test(enabled = false) + public void testUpdateSettings() { + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/") + .xmlFilePayload("/org/admin/updateSettingsSource.xml", + VCloudDirectorMediaType.ORG_SETTINGS) + .acceptMedia(VCloudDirectorMediaType.ORG_SETTINGS) + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/org/admin/updateSettings.xml", + VCloudDirectorMediaType.ORG_SETTINGS) + .httpResponseBuilder().build()); + + OrgSettings expected = updateSettings(); + + assertEquals(client.getOrgClient().updateSettings(orgRef.getHref(), expected), expected); + } + + @Test + public void testGetEmailSettings() { + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/org/admin/emailSettings.xml", + VCloudDirectorMediaType.ORG_GENERAL_SETTINGS) + .httpResponseBuilder().build()); + + OrgEmailSettings expected = emailSettings(); + + assertEquals(client.getOrgClient().getEmailSettings(orgRef.getHref()), expected); + } + + @Test + public void testUpdateEmailSettings() { + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email") + .xmlFilePayload("/org/admin/updateEmailSettingsSource.xml", + VCloudDirectorMediaType.ORG_EMAIL_SETTINGS) + .acceptMedia(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS) + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/org/admin/updateEmailSettings.xml", + VCloudDirectorMediaType.ORG_EMAIL_SETTINGS) + .httpResponseBuilder().build()); + + OrgEmailSettings expected = updateEmailSettings(); + + assertEquals(client.getOrgClient().updateEmailSettings(orgRef.getHref(), expected), expected); + } + + @Test(enabled = false) + public void testGetGeneralSettings() { + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/general") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/org/admin/generalSettings.xml", + VCloudDirectorMediaType.ORG_GENERAL_SETTINGS) + .httpResponseBuilder().build()); + + OrgGeneralSettings expected = generalSettings(); + + assertEquals(client.getOrgClient().getGeneralSettings(orgRef.getHref()), expected); + } + + public static final OrgGeneralSettings generalSettings() { + return OrgGeneralSettings.builder() + .type("application/vnd.vmware.admin.organizationGeneralSettings+xml") + .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/general")) + .link(Link.builder() + .rel("edit") + .type("application/vnd.vmware.admin.organizationGeneralSettings+xml") + .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/general")) + .build()) + .canPublishCatalogs(false) + .deployedVMQuota(0) + .storedVmQuota(0) + .useServerBootSequence(false) + .delayAfterPowerOnSeconds(0) + .build(); + } + + @Test(enabled = false) + public void testUpdateGeneralSettings() { + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/general") + .xmlFilePayload("/org/admin/updateGeneralSettingsSource.xml", + VCloudDirectorMediaType.ORG_GENERAL_SETTINGS) + .acceptMedia(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS) + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/org/admin/updateGeneralSettings.xml", + VCloudDirectorMediaType.ORG_GENERAL_SETTINGS) + .httpResponseBuilder().build()); + + OrgGeneralSettings expected = updateGeneralSettings(); + + assertEquals(client.getOrgClient().updateGeneralSettings(orgRef.getHref(), expected), expected); + } + + public static final OrgGeneralSettings updateGeneralSettings() { + return generalSettings().toBuilder() + + .build(); + } + + @Test + public void testGetLdapSettings() { + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/ldap") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/org/admin/ldapSettings.xml", + VCloudDirectorMediaType.ORG_LDAP_SETTINGS) + .httpResponseBuilder().build()); + + OrgLdapSettings expected = ldapSettings(); + + assertEquals(client.getOrgClient().getLdapSettings(orgRef.getHref()), expected); + } + + public static final OrgLdapSettings ldapSettings() { + return OrgLdapSettings.builder() + .type("application/vnd.vmware.admin.organizationLdapSettings+xml") + .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/ldap")) + .ldapMode("NONE") + .build(); + } + + @Test + public void testGetPasswordPolicy() { + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/org/admin/passwordPolicy.xml", + VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS) + .httpResponseBuilder().build()); + + OrgPasswordPolicySettings expected = passwordPolicy(); + + assertEquals(client.getOrgClient().getPasswordPolicy(orgRef.getHref()), expected); + } + + public static final OrgPasswordPolicySettings passwordPolicy() { + return OrgPasswordPolicySettings.builder() + .type("application/vnd.vmware.admin.organizationPasswordPolicySettings+xml") + .link(Link.builder() + .rel("edit") + .type("application/vnd.vmware.admin.organizationPasswordPolicySettings+xml") + .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy")) + .build()) + .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy")) + .accountLockoutEnabled(false) + .invalidLoginsBeforeLockout(5) + .accountLockoutIntervalMinutes(10) + .build(); + } + + @Test + public void testUpdatePasswordPolicy() { + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy") + .xmlFilePayload("/org/admin/updatePasswordPolicySource.xml", + VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS) + .acceptMedia(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS) + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/org/admin/updatePasswordPolicy.xml", + VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS) + .httpResponseBuilder().build()); + + OrgPasswordPolicySettings expected = updateOrgPasswordPolicy(); + + assertEquals(client.getOrgClient().updatePasswordPolicy(orgRef.getHref(), expected), expected); + } + + public static final OrgPasswordPolicySettings updateOrgPasswordPolicy() { + return passwordPolicy().toBuilder() + .accountLockoutEnabled(true) + .invalidLoginsBeforeLockout(6) + .accountLockoutIntervalMinutes(11) + .build(); + } + + @Test(enabled = false) + public void testGetVAppLeaseSettings() { + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppLeaseSettings") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/org/admin/vAppLeaseSettings.xml", + VCloudDirectorMediaType.ORG_LEASE_SETTINGS) + .httpResponseBuilder().build()); + + OrgLeaseSettings expected = vAppLeaseSettings(); + + assertEquals(client.getOrgClient().getVAppLeaseSettings(orgRef.getHref()), expected); + } + + public static final OrgLeaseSettings vAppLeaseSettings() { + return OrgLeaseSettings.builder() + .type("application/vnd.vmware.admin.vAppLeaseSettings+xml") + .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppLeaseSettings")) + .link(Link.builder() + .rel("edit") + .type("application/vnd.vmware.admin.vAppLeaseSettings+xml") + .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppLeaseSettings")) + .build()) + .deleteOnStorageLeaseExpiration(false) + .deploymentLeaseSeconds(0) + .storageLeaseSeconds(0) + .build(); + } + + @Test(enabled = false) + public void testUpdateOrgVAppLeaseSettings() { + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppLeaseSettings") + .xmlFilePayload("/org/admin/updateVAppLeaseSettingsSource.xml", + VCloudDirectorMediaType.ORG_LEASE_SETTINGS) + .acceptMedia(VCloudDirectorMediaType.ORG_LEASE_SETTINGS) + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/org/admin/updateVAppLeaseSettings.xml", + VCloudDirectorMediaType.ORG_LEASE_SETTINGS) + .httpResponseBuilder().build()); + + OrgLeaseSettings expected = updateVAppLeaseSettings(); + + assertEquals(client.getOrgClient().updateVAppLeaseSettings(orgRef.getHref(), expected), expected); + } + + public static final OrgLeaseSettings updateVAppLeaseSettings() { + return vAppLeaseSettings().toBuilder() + + .build(); + } + + @Test(enabled = false) + public void testGetVAppTemplateLeaseSettings() { + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppTemplateLeaseSettings") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/org/admin/vAppTemplateLeaseSettings.xml", + VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS) + .httpResponseBuilder().build()); + + OrgVAppTemplateLeaseSettings expected = vAppTemplateLeaseSettings(); + + assertEquals(client.getOrgClient().getVAppTemplateLeaseSettings(orgRef.getHref()), expected); + } + + public static final OrgVAppTemplateLeaseSettings vAppTemplateLeaseSettings() { + return OrgVAppTemplateLeaseSettings.builder() + .type("application/vnd.vmware.admin.vAppTemplateLeaseSettings+xml") + .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppTemplateLeaseSettings")) + .link(Link.builder() + .rel("edit") + .type("application/vnd.vmware.admin.vAppTemplateLeaseSettings+xml") + .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppTemplateLeaseSettings")) + .build()) + .deleteOnStorageLeaseExpiration(false) + .storageLeaseSeconds(0) + .build(); + } + + @Test(enabled = false) + public void testUpdateOrgVAppTemplateLeaseSettings() { + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppTemplateLeaseSettings") + .xmlFilePayload("/org/admin/updateVAppLeaseSettingsSource.xml", + VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS) + .acceptMedia(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS) + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/org/admin/updateVAppLeaseSettings.xml", + VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS) + .httpResponseBuilder().build()); + + OrgVAppTemplateLeaseSettings expected = updateVAppTemplateLeaseSettings(); + + assertEquals(client.getOrgClient().updateVAppTemplateLeaseSettings(orgRef.getHref(), expected), expected); + } + + public static final OrgVAppTemplateLeaseSettings updateVAppTemplateLeaseSettings() { + return vAppTemplateLeaseSettings().toBuilder() + + .build(); } public static final AdminOrg adminOrg() { @@ -199,23 +528,6 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect .build(); } - @Test(enabled = false) - public void testGetSettings() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, - new VcloudHttpRequestPrimer() - .apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/") - .acceptAnyMedia() - .httpRequestBuilder().build(), - new VcloudHttpResponsePrimer() - .xmlFilePayload("/org/admin/settings.xml", - VCloudDirectorMediaType.ORG_SETTINGS) - .httpResponseBuilder().build()); - - OrgSettings expected = settings(); - - assertEquals(client.getAdminOrgClient().getSettings(orgRef.getHref()), expected); - } - public static final OrgSettings settings() { return OrgSettings.builder() .type("application/vnd.vmware.admin.orgSettings+xml") @@ -264,47 +576,11 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect .build(); } - @Test(enabled = false) - public void testUpdateSettings() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, - new VcloudHttpRequestPrimer() - .apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/") - .xmlFilePayload("/org/admin/updateSettingsSource.xml", - VCloudDirectorMediaType.ORG_SETTINGS) - .acceptMedia(VCloudDirectorMediaType.ORG_SETTINGS) - .httpRequestBuilder().build(), - new VcloudHttpResponsePrimer() - .xmlFilePayload("/org/admin/updateSettings.xml", - VCloudDirectorMediaType.ORG_SETTINGS) - .httpResponseBuilder().build()); - - OrgSettings expected = updateSettings(); - - assertEquals(client.getAdminOrgClient().updateSettings(orgRef.getHref(), expected), expected); - } - @Test public static final OrgSettings updateSettings() { return settings().toBuilder() .build(); } - - @Test - public void testGetEmailSettings() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, - new VcloudHttpRequestPrimer() - .apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email") - .acceptAnyMedia() - .httpRequestBuilder().build(), - new VcloudHttpResponsePrimer() - .xmlFilePayload("/org/admin/emailSettings.xml", - VCloudDirectorMediaType.ORG_GENERAL_SETTINGS) - .httpResponseBuilder().build()); - - OrgEmailSettings expected = emailSettings(); - - assertEquals(client.getAdminOrgClient().getEmailSettings(orgRef.getHref()), expected); - } public static final OrgEmailSettings emailSettings() { return OrgEmailSettings.builder() @@ -329,25 +605,6 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect .build(); } - @Test - public void testUpdateEmailSettings() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, - new VcloudHttpRequestPrimer() - .apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/email") - .xmlFilePayload("/org/admin/updateEmailSettingsSource.xml", - VCloudDirectorMediaType.ORG_EMAIL_SETTINGS) - .acceptMedia(VCloudDirectorMediaType.ORG_EMAIL_SETTINGS) - .httpRequestBuilder().build(), - new VcloudHttpResponsePrimer() - .xmlFilePayload("/org/admin/updateEmailSettings.xml", - VCloudDirectorMediaType.ORG_EMAIL_SETTINGS) - .httpResponseBuilder().build()); - - OrgEmailSettings expected = updateEmailSettings(); - - assertEquals(client.getAdminOrgClient().updateEmailSettings(orgRef.getHref(), expected), expected); - } - @Test public static final OrgEmailSettings updateEmailSettings() { return emailSettings().toBuilder() @@ -364,259 +621,4 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect .build(); } - @Test(enabled = false) - public void testGetGeneralSettings() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, - new VcloudHttpRequestPrimer() - .apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/general") - .acceptAnyMedia() - .httpRequestBuilder().build(), - new VcloudHttpResponsePrimer() - .xmlFilePayload("/org/admin/generalSettings.xml", - VCloudDirectorMediaType.ORG_GENERAL_SETTINGS) - .httpResponseBuilder().build()); - - OrgGeneralSettings expected = generalSettings(); - - assertEquals(client.getAdminOrgClient().getGeneralSettings(orgRef.getHref()), expected); - } - - public static final OrgGeneralSettings generalSettings() { - return OrgGeneralSettings.builder() - .type("application/vnd.vmware.admin.organizationGeneralSettings+xml") - .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/general")) - .link(Link.builder() - .rel("edit") - .type("application/vnd.vmware.admin.organizationGeneralSettings+xml") - .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/general")) - .build()) - .canPublishCatalogs(false) - .deployedVMQuota(0) - .storedVmQuota(0) - .useServerBootSequence(false) - .delayAfterPowerOnSeconds(0) - .build(); - } - - @Test(enabled = false) - public void testUpdateGeneralSettings() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, - new VcloudHttpRequestPrimer() - .apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/general") - .xmlFilePayload("/org/admin/updateGeneralSettingsSource.xml", - VCloudDirectorMediaType.ORG_GENERAL_SETTINGS) - .acceptMedia(VCloudDirectorMediaType.ORG_GENERAL_SETTINGS) - .httpRequestBuilder().build(), - new VcloudHttpResponsePrimer() - .xmlFilePayload("/org/admin/updateGeneralSettings.xml", - VCloudDirectorMediaType.ORG_GENERAL_SETTINGS) - .httpResponseBuilder().build()); - - OrgGeneralSettings expected = updateGeneralSettings(); - - assertEquals(client.getAdminOrgClient().updateGeneralSettings(orgRef.getHref(), expected), expected); - } - - public static final OrgGeneralSettings updateGeneralSettings() { - return generalSettings().toBuilder() - - .build(); - } - - @Test - public void testGetLdapSettings() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, - new VcloudHttpRequestPrimer() - .apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/ldap") - .acceptAnyMedia() - .httpRequestBuilder().build(), - new VcloudHttpResponsePrimer() - .xmlFilePayload("/org/admin/ldapSettings.xml", - VCloudDirectorMediaType.ORG_LDAP_SETTINGS) - .httpResponseBuilder().build()); - - OrgLdapSettings expected = ldapSettings(); - - assertEquals(client.getAdminOrgClient().getLdapSettings(orgRef.getHref()), expected); - } - - public static final OrgLdapSettings ldapSettings() { - return OrgLdapSettings.builder() - .type("application/vnd.vmware.admin.organizationLdapSettings+xml") - .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/ldap")) - .ldapMode("NONE") - .build(); - } - - @Test - public void testGetPasswordPolicy() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, - new VcloudHttpRequestPrimer() - .apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy") - .acceptAnyMedia() - .httpRequestBuilder().build(), - new VcloudHttpResponsePrimer() - .xmlFilePayload("/org/admin/passwordPolicy.xml", - VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS) - .httpResponseBuilder().build()); - - OrgPasswordPolicySettings expected = passwordPolicy(); - - assertEquals(client.getAdminOrgClient().getPasswordPolicy(orgRef.getHref()), expected); - } - - public static final OrgPasswordPolicySettings passwordPolicy() { - return OrgPasswordPolicySettings.builder() - .type("application/vnd.vmware.admin.organizationPasswordPolicySettings+xml") - .link(Link.builder() - .rel("edit") - .type("application/vnd.vmware.admin.organizationPasswordPolicySettings+xml") - .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy")) - .build()) - .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy")) - .accountLockoutEnabled(false) - .invalidLoginsBeforeLockout(5) - .accountLockoutIntervalMinutes(10) - .build(); - } - - @Test - public void testUpdatePasswordPolicy() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, - new VcloudHttpRequestPrimer() - .apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/passwordPolicy") - .xmlFilePayload("/org/admin/updatePasswordPolicySource.xml", - VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS) - .acceptMedia(VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS) - .httpRequestBuilder().build(), - new VcloudHttpResponsePrimer() - .xmlFilePayload("/org/admin/updatePasswordPolicy.xml", - VCloudDirectorMediaType.ORG_PASSWORD_POLICY_SETTINGS) - .httpResponseBuilder().build()); - - OrgPasswordPolicySettings expected = updateOrgPasswordPolicy(); - - assertEquals(client.getAdminOrgClient().updatePasswordPolicy(orgRef.getHref(), expected), expected); - } - - public static final OrgPasswordPolicySettings updateOrgPasswordPolicy() { - return passwordPolicy().toBuilder() - .accountLockoutEnabled(true) - .invalidLoginsBeforeLockout(6) - .accountLockoutIntervalMinutes(11) - .build(); - } - - @Test(enabled = false) - public void testGetVAppLeaseSettings() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, - new VcloudHttpRequestPrimer() - .apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppLeaseSettings") - .acceptAnyMedia() - .httpRequestBuilder().build(), - new VcloudHttpResponsePrimer() - .xmlFilePayload("/org/admin/vAppLeaseSettings.xml", - VCloudDirectorMediaType.ORG_LEASE_SETTINGS) - .httpResponseBuilder().build()); - - OrgLeaseSettings expected = vAppLeaseSettings(); - - assertEquals(client.getAdminOrgClient().getVAppLeaseSettings(orgRef.getHref()), expected); - } - - public static final OrgLeaseSettings vAppLeaseSettings() { - return OrgLeaseSettings.builder() - .type("application/vnd.vmware.admin.vAppLeaseSettings+xml") - .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppLeaseSettings")) - .link(Link.builder() - .rel("edit") - .type("application/vnd.vmware.admin.vAppLeaseSettings+xml") - .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppLeaseSettings")) - .build()) - .deleteOnStorageLeaseExpiration(false) - .deploymentLeaseSeconds(0) - .storageLeaseSeconds(0) - .build(); - } - - @Test(enabled = false) - public void testUpdateOrgVAppLeaseSettings() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, - new VcloudHttpRequestPrimer() - .apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppLeaseSettings") - .xmlFilePayload("/org/admin/updateVAppLeaseSettingsSource.xml", - VCloudDirectorMediaType.ORG_LEASE_SETTINGS) - .acceptMedia(VCloudDirectorMediaType.ORG_LEASE_SETTINGS) - .httpRequestBuilder().build(), - new VcloudHttpResponsePrimer() - .xmlFilePayload("/org/admin/updateVAppLeaseSettings.xml", - VCloudDirectorMediaType.ORG_LEASE_SETTINGS) - .httpResponseBuilder().build()); - - OrgLeaseSettings expected = updateVAppLeaseSettings(); - - assertEquals(client.getAdminOrgClient().updateVAppLeaseSettings(orgRef.getHref(), expected), expected); - } - - public static final OrgLeaseSettings updateVAppLeaseSettings() { - return vAppLeaseSettings().toBuilder() - - .build(); - } - - @Test(enabled = false) - public void testGetVAppTemplateLeaseSettings() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, - new VcloudHttpRequestPrimer() - .apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppTemplateLeaseSettings") - .acceptAnyMedia() - .httpRequestBuilder().build(), - new VcloudHttpResponsePrimer() - .xmlFilePayload("/org/admin/vAppTemplateLeaseSettings.xml", - VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS) - .httpResponseBuilder().build()); - - OrgVAppTemplateLeaseSettings expected = vAppTemplateLeaseSettings(); - - assertEquals(client.getAdminOrgClient().getVAppTemplateLeaseSettings(orgRef.getHref()), expected); - } - - public static final OrgVAppTemplateLeaseSettings vAppTemplateLeaseSettings() { - return OrgVAppTemplateLeaseSettings.builder() - .type("application/vnd.vmware.admin.vAppTemplateLeaseSettings+xml") - .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppTemplateLeaseSettings")) - .link(Link.builder() - .rel("edit") - .type("application/vnd.vmware.admin.vAppTemplateLeaseSettings+xml") - .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppTemplateLeaseSettings")) - .build()) - .deleteOnStorageLeaseExpiration(false) - .storageLeaseSeconds(0) - .build(); - } - - @Test(enabled = false) - public void testUpdateOrgVAppTemplateLeaseSettings() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, - new VcloudHttpRequestPrimer() - .apiCommand("PUT", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/vAppTemplateLeaseSettings") - .xmlFilePayload("/org/admin/updateVAppLeaseSettingsSource.xml", - VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS) - .acceptMedia(VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS) - .httpRequestBuilder().build(), - new VcloudHttpResponsePrimer() - .xmlFilePayload("/org/admin/updateVAppLeaseSettings.xml", - VCloudDirectorMediaType.ORG_VAPP_TEMPLATE_LEASE_SETTINGS) - .httpResponseBuilder().build()); - - OrgVAppTemplateLeaseSettings expected = updateVAppTemplateLeaseSettings(); - - assertEquals(client.getAdminOrgClient().updateVAppTemplateLeaseSettings(orgRef.getHref(), expected), expected); - } - - public static final OrgVAppTemplateLeaseSettings updateVAppTemplateLeaseSettings() { - return vAppTemplateLeaseSettings().toBuilder() - - .build(); - } } 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 def0438b7f..df4964adce 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 @@ -35,6 +35,7 @@ import org.jclouds.vcloud.director.v1_5.domain.OrgSettings; import org.jclouds.vcloud.director.v1_5.domain.OrgVAppTemplateLeaseSettings; import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.SmtpServerSettings; +import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgClient; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -72,7 +73,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest { @Override @BeforeClass(alwaysRun = true) public void setupRequiredClients() { - orgClient = context.getApi().getAdminOrgClient(); + orgClient = adminContext.getApi().getOrgClient(); orgRef = Iterables.getFirst(orgClient.getOrgList().getOrgs(), null).toAdminReference(endpoint); assertNotNull(orgRef, String.format(REF_REQ_LIVE, "admin org")); } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminQueryClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminQueryClientExpectTest.java index 89c007bf35..d9f5b1331e 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminQueryClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminQueryClientExpectTest.java @@ -24,12 +24,12 @@ import java.net.URI; import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpResponse; -import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; +import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient; import org.jclouds.vcloud.director.v1_5.domain.Link; -import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecordType; import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords; import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRoleRecord; +import org.jclouds.vcloud.director.v1_5.features.admin.AdminQueryClient; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; import org.testng.annotations.Test; @@ -41,7 +41,7 @@ import com.google.common.collect.ImmutableMultimap; * @author Aled Sage */ @Test(groups = { "unit", "admin", "query" }, singleThreaded = true, testName = "AdminQueryClientExpectTest") -public class AdminQueryClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { +public class AdminQueryClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { // TODO Write expect tests for all other admin-query operations @@ -64,7 +64,7 @@ public class AdminQueryClientExpectTest extends BaseVCloudDirectorRestClientExpe .payload(payloadFromResourceWithContentType("/query/admin/allGroups.xml", VCloudDirectorMediaType.QUERY_RESULT_RECORDS + ";version=1.5")) .build(); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse); + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse); QueryResultRecords expected = QueryResultRecords.builder() .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/groups/query?page=1&pageSize=25&format=records")) @@ -85,7 +85,7 @@ public class AdminQueryClientExpectTest extends BaseVCloudDirectorRestClientExpe .build()) .build(); - assertEquals(client.getAdminQueryClient().groupsQueryAll(), expected); + assertEquals(client.getQueryClient().groupsQueryAll(), expected); } // @@ -112,7 +112,7 @@ public class AdminQueryClientExpectTest extends BaseVCloudDirectorRestClientExpe .payload(payloadFromResourceWithContentType("/query/admin/allRoles.xml", VCloudDirectorMediaType.QUERY_RESULT_RECORDS + ";version=1.5")) .build(); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse); + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse); QueryResultRecords expected = QueryResultRecords.builder() .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/roles/query?page=1&pageSize=25&format=records")) @@ -138,7 +138,7 @@ public class AdminQueryClientExpectTest extends BaseVCloudDirectorRestClientExpe .build()) .build(); - assertEquals(client.getAdminQueryClient().rolesQueryAll(), expected); + assertEquals(client.getQueryClient().rolesQueryAll(), expected); } } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminQueryClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminQueryClientLiveTest.java index cf49f5ede7..94dd70cc5e 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminQueryClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminQueryClientLiveTest.java @@ -30,6 +30,7 @@ import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords; import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRightRecord; import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRoleRecord; import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultStrandedUserRecord; +import org.jclouds.vcloud.director.v1_5.features.admin.AdminQueryClient; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -51,7 +52,7 @@ public class AdminQueryClientLiveTest extends BaseVCloudDirectorClientLiveTest { @Override @BeforeClass(alwaysRun = true) public void setupRequiredClients() { - queryClient = context.getApi().getAdminQueryClient(); + queryClient = adminContext.getApi().getQueryClient(); } @Test(testName = "GET /admin/groups/query") diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminVdcClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminVdcClientExpectTest.java index 2977902615..7a57aa7da5 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminVdcClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminVdcClientExpectTest.java @@ -22,8 +22,8 @@ import static org.testng.Assert.assertEquals; import java.net.URI; -import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; +import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient; import org.jclouds.vcloud.director.v1_5.domain.AdminVdc; import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; @@ -35,7 +35,7 @@ import org.testng.annotations.Test; * @author danikov */ @Test(groups = { "unit", "admin", "vdc" }, singleThreaded = true, testName = "AdminVdcClientExpectTest") -public class AdminVdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { +public class AdminVdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { private Reference vdcRef = Reference.builder() .href(URI.create(endpoint + "???")) @@ -43,7 +43,7 @@ public class AdminVdcClientExpectTest extends BaseVCloudDirectorRestClientExpect @Test( enabled = false ) public void testGetVdc() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/admin/vdc/???") .acceptAnyMedia() @@ -55,7 +55,7 @@ public class AdminVdcClientExpectTest extends BaseVCloudDirectorRestClientExpect AdminVdc expected = adminVdc(); - assertEquals(client.getAdminVdcClient().getVdc(vdcRef.getHref()), expected); + assertEquals(client.getVdcClient().getVdc(vdcRef.getHref()), expected); } public static final AdminVdc adminVdc() { diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminVdcClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminVdcClientLiveTest.java index 7eb335c44c..5b86e24142 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminVdcClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminVdcClientLiveTest.java @@ -33,6 +33,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Metadata; import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry; import org.jclouds.vcloud.director.v1_5.domain.MetadataValue; import org.jclouds.vcloud.director.v1_5.domain.Task; +import org.jclouds.vcloud.director.v1_5.features.admin.AdminVdcClient; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; @@ -62,7 +63,7 @@ public class AdminVdcClientLiveTest extends BaseVCloudDirectorClientLiveTest { @Override @BeforeClass(alwaysRun = true) public void setupRequiredClients() { - vdcClient = context.getApi().getAdminVdcClient(); + vdcClient = adminContext.getApi().getVdcClient(); metadataClient = vdcClient.getMetadataClient(); assertNotNull(vdcURI, String.format(REF_REQ_LIVE, VDC)); adminVdcUri = toAdminUri(vdcURI); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogClientExpectTest.java index 2d202cdc6a..1488b8254c 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogClientExpectTest.java @@ -24,8 +24,8 @@ import java.net.URI; import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpResponse; -import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; +import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient; import org.jclouds.vcloud.director.v1_5.domain.CatalogItem; import org.jclouds.vcloud.director.v1_5.domain.CatalogItems; import org.jclouds.vcloud.director.v1_5.domain.CatalogType; @@ -47,7 +47,7 @@ import com.google.common.collect.ImmutableSet; * @author grkvlt@apache.org */ @Test(groups = { "unit", "user", "catalog" }, singleThreaded = true, testName = "CatalogClientExpectTest") -public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { +public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { @Test public void testGetCatalog() { @@ -65,7 +65,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT .payload(payloadFromResourceWithContentType("/catalog/catalog.xml", VCloudDirectorMediaType.CATALOG + ";version=1.5")) .build(); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogRequest, catalogResponse); + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, catalogRequest, catalogResponse); CatalogType expected = catalog(); @@ -90,7 +90,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT .payload(payloadFromResourceWithContentType("/catalog/createdCatalogItem.xml", VCloudDirectorMediaType.CATALOG_ITEM + ";version=1.5")) .build(); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse); + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse); URI catalogURI = URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"); @@ -121,7 +121,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT .payload(payloadFromResourceWithContentType("/catalog/catalogMetadata.xml", VCloudDirectorMediaType.METADATA)) .build(); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogRequest, catalogResponse); + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, catalogRequest, catalogResponse); URI catalogURI = URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"); @@ -155,7 +155,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT .payload(payloadFromResourceWithContentType("/catalog/catalogMetadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE)) .build(); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogRequest, catalogResponse); + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, catalogRequest, catalogResponse); URI catalogURI = URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"); @@ -180,13 +180,13 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT .payload(payloadFromResourceWithContentType("/catalog/catalogItem.xml", VCloudDirectorMediaType.CATALOG_ITEM)) .build(); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse); + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse); - URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"); - - CatalogItem expected = catalogItem(); - - assertEquals(client.getCatalogClient().getCatalogItem(catalogItemURI), expected); + URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"); + + CatalogItem expected = catalogItem(); + + assertEquals(client.getCatalogClient().getCatalogItem(catalogItemURI), expected); } @Test @@ -206,7 +206,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT .payload(payloadFromResourceWithContentType("/catalog/updateCatalogItem.xml", VCloudDirectorMediaType.CATALOG_ITEM + ";version=1.5")) .build(); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse); + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse); URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"); CatalogItem expected = catalogItem(); @@ -229,7 +229,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT .statusCode(200) .build(); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse); + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse); URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"); @@ -252,7 +252,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT .payload(payloadFromResourceWithContentType("/catalog/catalogItemMetadata.xml", VCloudDirectorMediaType.METADATA)) .build(); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse); + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse); URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"); @@ -287,7 +287,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT .payload(payloadFromResourceWithContentType("/catalog/mergeMetadataTask.xml", VCloudDirectorMediaType.TASK + ";version=1.5")) .build(); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse); + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse); URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"); @@ -314,7 +314,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT .payload(payloadFromResourceWithContentType("/catalog/catalogItemMetadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE + ";version=1.5")) .build(); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse); + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse); URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"); @@ -340,7 +340,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT .payload(payloadFromResourceWithContentType("/catalog/setMetadataValueTask.xml", VCloudDirectorMediaType.TASK + ";version=1.5")) .build(); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse); + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse); URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"); @@ -367,7 +367,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT .payload(payloadFromResourceWithContentType("/catalog/deleteMetadataEntryTask.xml", VCloudDirectorMediaType.TASK)) .build(); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse); + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse); URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"); @@ -376,43 +376,42 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT assertEquals(client.getCatalogClient().getCatalogItemMetadataClient().deleteMetadataEntry(catalogItemURI, "KEY"), expected); } - @SuppressWarnings("unchecked") public static final CatalogType catalog() { return CatalogType.builder() - .name("QunyingTestCatalog") - .type("application/vnd.vmware.vcloud.catalog+xml") - .id("urn:vcloud:catalog:7212e451-76e1-4631-b2de-ba1dfd8080e4") - .href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4")) - .link(Link.builder() - .rel("up") - .type("application/vnd.vmware.vcloud.org+xml") - .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")) - .build()) - .link(Link.builder() - .rel("add") - .type("application/vnd.vmware.vcloud.catalogItem+xml") - .href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/catalogItems")) - .build()) - .link(Link.builder() - .rel("down") - .type("application/vnd.vmware.vcloud.metadata+xml") - .href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata")) - .build()) - .catalogItems(CatalogItems.builder() - .item(Reference.builder() - .type("application/vnd.vmware.vcloud.catalogItem+xml") - .name("ubuntu10") - .href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df")) - .build()) - .item(Reference.builder() - .type("application/vnd.vmware.vcloud.catalogItem+xml") - .name("imageTesting") - .href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a9e0afdb-a42b-4688-8409-2ac68cf22939")) - .build()) - .build()) - .description("Testing") - .isPublished(false) - .build(); + .name("QunyingTestCatalog") + .type("application/vnd.vmware.vcloud.catalog+xml") + .id("urn:vcloud:catalog:7212e451-76e1-4631-b2de-ba1dfd8080e4") + .href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4")) + .link(Link.builder() + .rel("up") + .type("application/vnd.vmware.vcloud.org+xml") + .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")) + .build()) + .link(Link.builder() + .rel("add") + .type("application/vnd.vmware.vcloud.catalogItem+xml") + .href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/catalogItems")) + .build()) + .link(Link.builder() + .rel("down") + .type("application/vnd.vmware.vcloud.metadata+xml") + .href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata")) + .build()) + .catalogItems(CatalogItems.builder() + .item(Reference.builder() + .type("application/vnd.vmware.vcloud.catalogItem+xml") + .name("ubuntu10") + .href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df")) + .build()) + .item(Reference.builder() + .type("application/vnd.vmware.vcloud.catalogItem+xml") + .name("imageTesting") + .href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a9e0afdb-a42b-4688-8409-2ac68cf22939")) + .build()) + .build()) + .description("Testing") + .isPublished(false) + .build(); } public static CatalogItem createdCatalogItem() { @@ -447,10 +446,10 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT public static Reference ubuntuVappTemplateReference() { return Reference.builder() - .type("application/vnd.vmware.vcloud.vAppTemplate+xml") - .name("ubuntu10") - .href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9")) - .build(); + .type("application/vnd.vmware.vcloud.vAppTemplate+xml") + .name("ubuntu10") + .href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9")) + .build(); } public static MetadataEntry metadataEntry() { @@ -630,4 +629,4 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT .build(); } } - + diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogClientLiveTest.java index c07b6627e8..6c69ef4088 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogClientLiveTest.java @@ -24,7 +24,11 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.C import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_REQ_LIVE; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REF_REQ_LIVE; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.TASK_COMPLETE_TIMELY; -import static org.jclouds.vcloud.director.v1_5.domain.Checks.*; +import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkCatalogItem; +import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkError; +import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadata; +import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadataValue; +import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkTask; import static org.jclouds.vcloud.director.v1_5.predicates.LinkPredicates.relEquals; import static org.jclouds.vcloud.director.v1_5.predicates.LinkPredicates.typeEquals; import static org.testng.Assert.assertEquals; @@ -34,8 +38,20 @@ import static org.testng.Assert.fail; import org.jclouds.vcloud.director.v1_5.VCloudDirectorException; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; -import org.jclouds.vcloud.director.v1_5.domain.*; +import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog; +import org.jclouds.vcloud.director.v1_5.domain.CatalogItem; +import org.jclouds.vcloud.director.v1_5.domain.CatalogType; +import org.jclouds.vcloud.director.v1_5.domain.Checks; import org.jclouds.vcloud.director.v1_5.domain.Error; +import org.jclouds.vcloud.director.v1_5.domain.Link; +import org.jclouds.vcloud.director.v1_5.domain.Media; +import org.jclouds.vcloud.director.v1_5.domain.Metadata; +import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry; +import org.jclouds.vcloud.director.v1_5.domain.MetadataValue; +import org.jclouds.vcloud.director.v1_5.domain.Reference; +import org.jclouds.vcloud.director.v1_5.domain.Task; +import org.jclouds.vcloud.director.v1_5.domain.Vdc; +import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogClient; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.testng.annotations.AfterClass; import org.testng.annotations.Test; @@ -77,7 +93,7 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest { .description("created by CatalogClientLiveTest") .build(); - AdminCatalogClient adminCatalogClient = context.getApi().getAdminCatalogClient(); + AdminCatalogClient adminCatalogClient = adminContext.getApi().getCatalogClient(); adminCatalog = adminCatalogClient.createCatalog(orgRef.getHref(), newCatalog); catalogRef = find(adminCatalog.getLinks(), and(relEquals("alternate"), typeEquals(VCloudDirectorMediaType.CATALOG))); @@ -99,7 +115,7 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest { context.getApi().getMediaClient().deleteMedia(media.getHref()); if (adminCatalog != null) { - context.getApi().getAdminCatalogClient().deleteCatalog(adminCatalog.getHref()); + adminContext.getApi().getCatalogClient().deleteCatalog(adminCatalog.getHref()); try { catalogClient.getCatalog(catalogRef.getHref()); fail("The Catalog should have been deleted"); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/GroupClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/GroupClientExpectTest.java index 3db50f235d..8b1957c28e 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/GroupClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/GroupClientExpectTest.java @@ -22,10 +22,11 @@ import static org.testng.Assert.assertEquals; import java.net.URI; -import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; +import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient; import org.jclouds.vcloud.director.v1_5.domain.Group; import org.jclouds.vcloud.director.v1_5.domain.Reference; +import org.jclouds.vcloud.director.v1_5.features.admin.GroupClient; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; import org.testng.annotations.Test; @@ -35,7 +36,7 @@ import org.testng.annotations.Test; * @author danikov */ @Test(groups = { "unit", "admin", "group"}, singleThreaded = true, testName = "GroupClientExpectTest") -public class GroupClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { +public class GroupClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { private Reference groupRef = Reference.builder() .type("application/vnd.vmware.admin.group+xml") @@ -45,7 +46,7 @@ public class GroupClientExpectTest extends BaseVCloudDirectorRestClientExpectTes @Test(enabled = false) public void testGetGroup() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/admin/group/???") .acceptAnyMedia() @@ -67,7 +68,7 @@ public class GroupClientExpectTest extends BaseVCloudDirectorRestClientExpectTes @Test(enabled = false) public void testUpdateGroup() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", "/admin/group/???") .xmlFilePayload("/group/updateGroupSource.xml", VCloudDirectorMediaType.GROUP) @@ -88,7 +89,7 @@ public class GroupClientExpectTest extends BaseVCloudDirectorRestClientExpectTes @Test public void testDeleteGroup() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("DELETE", "/admin/group/???") .acceptAnyMedia() @@ -96,6 +97,6 @@ public class GroupClientExpectTest extends BaseVCloudDirectorRestClientExpectTes new VcloudHttpResponsePrimer() .httpResponseBuilder().statusCode(204).build()); - client.getAdminCatalogClient().deleteCatalog(groupRef.getHref()); + client.getCatalogClient().deleteCatalog(groupRef.getHref()); } } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/GroupClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/GroupClientLiveTest.java index f0aa95b01e..262f8012c6 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/GroupClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/GroupClientLiveTest.java @@ -28,6 +28,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Checks; import org.jclouds.vcloud.director.v1_5.domain.Group; import org.jclouds.vcloud.director.v1_5.domain.OrgLdapSettings; import org.jclouds.vcloud.director.v1_5.domain.Reference; +import org.jclouds.vcloud.director.v1_5.features.admin.GroupClient; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -45,7 +46,6 @@ public class GroupClientLiveTest extends BaseVCloudDirectorClientLiveTest { /* * Convenience references to API clients. */ - private GroupClient groupClient; /* @@ -58,11 +58,11 @@ public class GroupClientLiveTest extends BaseVCloudDirectorClientLiveTest { @Override @BeforeClass(alwaysRun = true) public void setupRequiredClients() { - groupClient = context.getApi().getGroupClient(); + groupClient = adminContext.getApi().getGroupClient(); Reference orgRef = null; // TODO: requisite LDAP settings -// oldLdapSettings = context.getApi().getAdminOrgClient().getLdapSettings(orgRef.getHref()); +// oldLdapSettings = adminContext.getApi().getAdminOrgClient().getLdapSettings(orgRef.getHref()); // OrgLdapSettings newLdapSettings = oldLdapSettings.toBuilder() // .ldapMode(OrgLdapSettings.LdapMode.SYSTEM) // .build(); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaClientExpectTest.java index c9f1324876..5d9050dcc0 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaClientExpectTest.java @@ -23,7 +23,6 @@ import static org.testng.Assert.fail; import java.net.URI; -import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient; import org.jclouds.vcloud.director.v1_5.VCloudDirectorException; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.domain.CloneMediaParams; @@ -38,6 +37,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Owner; import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; +import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserClient; import org.testng.annotations.Test; import com.google.common.collect.ImmutableSet; @@ -48,13 +48,13 @@ import com.google.common.collect.ImmutableSet; * @author danikov */ @Test(groups = { "unit", "user", "media" }, singleThreaded = true, testName = "MediaClientExpectTest") -public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { +public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { @Test public void testCreateMedia() { URI uploadLink = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media") .acceptMedia(VCloudDirectorMediaType.MEDIA) @@ -80,7 +80,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes public void testCloneMedia() { URI cloneUri = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneMedia"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneMedia") .acceptMedia(VCloudDirectorMediaType.MEDIA) @@ -110,7 +110,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes public void testGetMedia() { URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1") .acceptAnyMedia() @@ -127,7 +127,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes public void testResponse400ForInvalidMedia() { URI mediaUri = URI.create(endpoint + "/media/NOTAUUID"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/media/NOTAUUID") .acceptAnyMedia() @@ -156,7 +156,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes public void testResponse403ForCatalogIdUsedAsMediaId() { URI mediaUri = URI.create(endpoint + "/media/e9cd3387-ac57-4d27-a481-9bee75e0690f"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/media/e9cd3387-ac57-4d27-a481-9bee75e0690f") .acceptAnyMedia() @@ -185,7 +185,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes public void testResponse403ForFakeMediaId() { URI mediaUri = URI.create(endpoint + "/media/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/media/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") .acceptAnyMedia() @@ -214,7 +214,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes public void testUpdateMedia() { URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1") .xmlFilePayload("/media/updateMedia.xml", VCloudDirectorMediaType.MEDIA) @@ -234,7 +234,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes public void testDeleteMedia() { URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("DELETE", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1") .acceptMedia(VCloudDirectorMediaType.TASK) @@ -252,7 +252,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes public void testGetMetadata() { URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata") .acceptAnyMedia() @@ -271,7 +271,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes public void testMergeMetadata() { URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata") .xmlFilePayload("/media/mergeMetadata.xml", VCloudDirectorMediaType.METADATA) @@ -290,7 +290,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes public void testGetMetadataValue() { URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata/key") .acceptAnyMedia() @@ -309,7 +309,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes public void testSetMetadataValue() { URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata/key") .xmlFilePayload("/media/setMetadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE) @@ -330,7 +330,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes public void testDeleteMetadataValue() { URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("DELETE", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata/key") .acceptMedia(VCloudDirectorMediaType.TASK) @@ -348,7 +348,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes public void testGetOwner() { URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/owner") .acceptAnyMedia() diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientExpectTest.java index b0f7056439..b1319787e5 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientExpectTest.java @@ -23,7 +23,6 @@ import static org.testng.Assert.fail; import java.net.URI; -import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient; import org.jclouds.vcloud.director.v1_5.VCloudDirectorException; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.domain.DhcpService; @@ -42,6 +41,7 @@ import org.jclouds.vcloud.director.v1_5.domain.NetworkFeatures; import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork; import org.jclouds.vcloud.director.v1_5.domain.SyslogServerSettings; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; +import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserClient; import org.testng.annotations.Test; import com.google.common.collect.ImmutableSet; @@ -52,13 +52,13 @@ import com.google.common.collect.ImmutableSet; * @author danikov */ @Test(groups = { "unit", "user", "network" }, singleThreaded = true, testName = "NetworkClientExpectTest") -public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { +public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { @Test public void testGetNetwork() { URI networkUri = URI.create(endpoint + "/network/f3ba8256-6f48-4512-aad6-600e85b4dc38"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/network/f3ba8256-6f48-4512-aad6-600e85b4dc38") .acceptAnyMedia() @@ -75,7 +75,7 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT public void testGetNetworkWithInvalidId() { URI networkUri = URI.create(endpoint + "/network/NOTAUUID"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/network/NOTAUUID") .acceptAnyMedia() @@ -104,7 +104,7 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT public void testGetNetworkWithCatalogId() { URI networkUri = URI.create(endpoint + "/network/9e08c2f6-077a-42ce-bece-d5332e2ebb5c"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/network/9e08c2f6-077a-42ce-bece-d5332e2ebb5c") .acceptAnyMedia() @@ -133,7 +133,7 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT public void testGetNetworkWithFakeId() { URI networkUri = URI.create(endpoint + "/network/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/network/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") .acceptAnyMedia() @@ -162,7 +162,7 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT public void testGetMetadata() { URI networkUri = URI.create(endpoint + "/network/55a677cf-ab3f-48ae-b880-fab90421980c"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata") .acceptAnyMedia() @@ -189,7 +189,7 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT public void testGetMetadataValue() { URI networkUri = URI.create("https://vcloudbeta.bluelock.com/api/network/55a677cf-ab3f-48ae-b880-fab90421980c"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata/KEY") .acceptAnyMedia() diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientLiveTest.java index 21100a6410..8456ffed8f 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientLiveTest.java @@ -62,13 +62,13 @@ public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest { @BeforeClass(alwaysRun = true) public void setupRequiredClients() { networkClient = context.getApi().getNetworkClient(); - context.getApi().getAdminNetworkClient().getMetadataClient().setMetadata(toAdminUri(networkURI), + adminContext.getApi().getNetworkClient().getMetadataClient().setMetadata(toAdminUri(networkURI), "key", MetadataValue.builder().value("value").build()); } @AfterClass(groups = { "live" }) public void cleanUp() throws Exception { - context.getApi().getAdminNetworkClient().getMetadataClient() + adminContext.getApi().getNetworkClient().getMetadataClient() .deleteMetadataEntry(toAdminUri(networkURI), "key"); } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientExpectTest.java index 4dfa409e9b..53ba73acda 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientExpectTest.java @@ -23,7 +23,6 @@ import static org.testng.Assert.fail; import java.net.URI; -import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient; import org.jclouds.vcloud.director.v1_5.VCloudDirectorException; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.domain.Error; @@ -35,6 +34,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Org; import org.jclouds.vcloud.director.v1_5.domain.OrgList; import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; +import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserClient; import org.testng.annotations.Test; import com.google.common.collect.ImmutableSet; @@ -46,11 +46,11 @@ import com.google.common.collect.Iterables; * @author Adrian Cole */ @Test(groups = { "unit", "user", "org" }, singleThreaded = true, testName = "OrgClientExpectTest") -public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { +public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { @Test public void testGetOrgList() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, getStandardRequest("GET", "/org/"), getStandardPayloadResponse("/org/orglist.xml", VCloudDirectorMediaType.ORG_LIST)); @@ -67,7 +67,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test public void testGetOrgFromOrgListReference() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, getStandardRequest("GET", "/org/"), getStandardPayloadResponse("/org/orglist.xml", VCloudDirectorMediaType.ORG_LIST)); @@ -86,7 +86,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest public void testGetOrg() { URI orgUri = URI.create(endpoint + "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, getStandardRequest("GET", "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"), getStandardPayloadResponse("/org/org.xml", VCloudDirectorMediaType.ORG)); @@ -99,7 +99,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest public void testGetOrgFailOnInvalidOrgId() { URI orgUri = URI.create(endpoint + "/org/NOTAUUID"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, getStandardRequest("GET", "/org/NOTAUUID"), getStandardPayloadResponse(400, "/org/error400.xml", VCloudDirectorMediaType.ERROR)); @@ -123,7 +123,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest public void testGetOrgFailOnWrongOrgId() { URI orgUri = URI.create(endpoint + "/org/9e08c2f6-077a-42ce-bece-d5332e2ebb5c"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, getStandardRequest("GET", "/org/9e08c2f6-077a-42ce-bece-d5332e2ebb5c"), getStandardPayloadResponse(403, "/org/error403-catalog.xml", VCloudDirectorMediaType.ERROR)); @@ -147,7 +147,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest public void testGetOrgFailOnFakeOrgId() { URI orgUri = URI.create(endpoint + "/org/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, getStandardRequest("GET", "/org/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), getStandardPayloadResponse(403, "/org/error403-fake.xml", VCloudDirectorMediaType.ERROR)); @@ -171,7 +171,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest public void testGetOrgMetadata() { URI orgUri = URI.create(endpoint + "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata") .acceptAnyMedia() @@ -198,7 +198,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest public void testGetOrgMetadataValue() { URI orgUri = URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata/KEY") .acceptAnyMedia() diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientLiveTest.java index b53b9e71db..d84f71ca15 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientLiveTest.java @@ -21,11 +21,11 @@ package org.jclouds.vcloud.director.v1_5.features; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.CONDITION_FMT; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.CORRECT_VALUE_OBJECT_FMT; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.NOT_EMPTY_OBJECT_FMT; +import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkControlAccessParams; import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadata; import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadataValue; import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkOrg; import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkReferenceType; -import static org.jclouds.vcloud.director.v1_5.domain.Checks.*; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotNull; @@ -69,7 +69,7 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest { @AfterClass(groups = { "live" }) public void cleanUp() throws Exception { if (metadataSet) { - context.getApi().getAdminOrgClient().getMetadataClient() + adminContext.getApi().getOrgClient().getMetadataClient() .deleteMetadataEntry(toAdminUri(orgURI), "key"); } } @@ -114,7 +114,7 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest { @Test(testName = "orgClient admin metadata setup", dependsOnMethods = { "testGetOrg" }) public void testSetupMetadata() { - context.getApi().getAdminOrgClient().getMetadataClient().setMetadata(toAdminUri(orgURI), + adminContext.getApi().getOrgClient().getMetadataClient().setMetadata(toAdminUri(orgURI), "KEY", MetadataValue.builder().value("VALUE").build()); metadataSet = true; } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/QueryClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/QueryClientExpectTest.java index 9bbbb4d5a2..7c0915ee8f 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/QueryClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/QueryClientExpectTest.java @@ -24,7 +24,6 @@ import java.net.URI; import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpResponse; -import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.domain.CatalogReference; import org.jclouds.vcloud.director.v1_5.domain.Link; @@ -33,6 +32,7 @@ import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultCatalogRecord; import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecordType; import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; +import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserClient; import org.testng.annotations.Test; import com.google.common.collect.ImmutableMultimap; @@ -43,7 +43,7 @@ import com.google.common.collect.ImmutableMultimap; * @author grkvlt@apache.org */ @Test(groups = { "unit", "user", "query" }, singleThreaded = true, testName = "QueryClientExpectTest") -public class QueryClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { +public class QueryClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { @Test public void testQueryAllCatalogs() { @@ -61,7 +61,7 @@ public class QueryClientExpectTest extends BaseVCloudDirectorRestClientExpectTes .payload(payloadFromResourceWithContentType("/query/allCatalogs.xml", VCloudDirectorMediaType.QUERY_RESULT_RECORDS + ";version=1.5")) .build(); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse); + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse); QueryResultRecords expected = QueryResultRecords.builder() .href(URI.create("https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=records")) @@ -137,7 +137,7 @@ public class QueryClientExpectTest extends BaseVCloudDirectorRestClientExpectTes .payload(payloadFromResourceWithContentType("/query/allCatalogReferences.xml", VCloudDirectorMediaType.QUERY_RESULT_RECORDS + ";version=1.5")) .build(); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse); + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse); CatalogReferences expected = CatalogReferences.builder() .href(URI.create("https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=references")) diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/TaskClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/TaskClientExpectTest.java index 327d588f39..eee7fd33ac 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/TaskClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/TaskClientExpectTest.java @@ -25,7 +25,6 @@ import java.net.URI; import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpResponse; -import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient; import org.jclouds.vcloud.director.v1_5.VCloudDirectorException; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.domain.Error; @@ -33,6 +32,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.TasksList; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; +import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserClient; import org.testng.annotations.Test; import com.google.common.collect.ImmutableMultimap; @@ -43,7 +43,7 @@ import com.google.common.collect.ImmutableMultimap; * @author grkvlt@apache.org */ @Test(groups = { "unit", "user", "task" }, singleThreaded = true, testName = "TaskClientExpectTest") -public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { +public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { @Test public void testTaskListForValidOrg() { @@ -75,7 +75,7 @@ public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest .payload(payloadFromResourceWithContentType("/org/org.xml", VCloudDirectorMediaType.TASKS_LIST + ";version=1.5")) .build(); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse, orgRequest, orgResponse); + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse, orgRequest, orgResponse); TasksList expected = TasksList.builder() .name("Tasks Lists") @@ -115,7 +115,7 @@ public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest .payload(payloadFromResourceWithContentType("/org/error400.xml", VCloudDirectorMediaType.ERROR + ";version=1.5")) .build(); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse, orgRequest, orgResponse); + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse, orgRequest, orgResponse); Error expected = Error.builder() .message("validation error on field 'id': String value has invalid format or length") @@ -160,7 +160,7 @@ public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest .payload(payloadFromResourceWithContentType("/org/error403-fake.xml", VCloudDirectorMediaType.ERROR + ";version=1.5")) .build(); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse, orgRequest, orgResponse); + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse, orgRequest, orgResponse); Error expected = Error.builder() .message("No access to entity \"com.vmware.vcloud.entity.org:aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee\".") @@ -194,7 +194,7 @@ public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest .payload(payloadFromResourceWithContentType("/task/task.xml", VCloudDirectorMediaType.TASK + ";version=1.5")) .build(); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse); + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse); URI taskUri = URI.create(endpoint + "/task/5fcd2af3-d0ec-45ce-9451-8c585a2c766b"); @@ -219,7 +219,7 @@ public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest .statusCode(200) .build(); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse); + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse); URI taskUri = URI.create(endpoint + "/task/5fcd2af3-d0ec-45ce-9451-8c585a2c766b"); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/UserClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/UserClientExpectTest.java index e42c064c4d..2f908b5786 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/UserClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/UserClientExpectTest.java @@ -23,22 +23,23 @@ import static org.testng.Assert.assertEquals; import java.net.URI; import java.util.Collections; -import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient; import org.jclouds.vcloud.director.v1_5.VCloudDirectorException; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; +import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient; import org.jclouds.vcloud.director.v1_5.domain.Link; import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.User; +import org.jclouds.vcloud.director.v1_5.features.admin.UserClient; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; import org.testng.annotations.Test; /** - * Test the {@link GroupClient} by observing its side effects. + * Test the {@link UserClient} by observing its side effects. * * @author danikov */ @Test(groups = { "unit", "admin", "adminUser"}, singleThreaded = true, testName = "UserClientExpectTest") -public class UserClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { +public class UserClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { private Reference orgRef = Reference.builder() .href(URI.create(endpoint + "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")) @@ -50,7 +51,7 @@ public class UserClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test public void testCreateUser() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/catalogs") .xmlFilePayload("/user/createUserSource.xml", VCloudDirectorMediaType.USER) @@ -113,7 +114,7 @@ public class UserClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test public void testGetUser() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/admin/user/b37223f3-8792-477a-820f-334998f61cd6") .acceptAnyMedia() @@ -135,7 +136,7 @@ public class UserClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test public void testUpdateUser() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", "/admin/user/b37223f3-8792-477a-820f-334998f61cd6") .xmlFilePayload("/user/updateUserSource.xml", VCloudDirectorMediaType.USER) @@ -175,7 +176,7 @@ public class UserClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test public void testDeleteUser() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("DELETE", "/admin/user/b37223f3-8792-477a-820f-334998f61cd6") .acceptAnyMedia() @@ -188,7 +189,7 @@ public class UserClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test public void testUnlockUser() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", "/admin/user/b37223f3-8792-477a-820f-334998f61cd6/action/unlock") .acceptAnyMedia() @@ -201,7 +202,7 @@ public class UserClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(expectedExceptions = VCloudDirectorException.class) public void testUnlockUserFailNotFound() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", "/admin/user/b37223f3-8792-477a-820f-334998f61cd6/action/unlock") .acceptAnyMedia() diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/UserClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/UserClientLiveTest.java index 442c9b8167..635faa8199 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/UserClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/UserClientLiveTest.java @@ -27,20 +27,18 @@ import static org.testng.Assert.fail; import static org.testng.AssertJUnit.assertFalse; import java.net.URI; -import java.util.Random; import org.jclouds.rest.AuthorizationException; -import org.jclouds.rest.RestContext; -import org.jclouds.vcloud.director.v1_5.VCloudDirectorAsyncClient; -import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient; import org.jclouds.vcloud.director.v1_5.VCloudDirectorException; import org.jclouds.vcloud.director.v1_5.domain.Checks; import org.jclouds.vcloud.director.v1_5.domain.Error; import org.jclouds.vcloud.director.v1_5.domain.OrgPasswordPolicySettings; import org.jclouds.vcloud.director.v1_5.domain.Reference; -import org.jclouds.vcloud.director.v1_5.domain.RoleReferences; +import org.jclouds.vcloud.director.v1_5.domain.Role.DefaultRoles; import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken; import org.jclouds.vcloud.director.v1_5.domain.User; +import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgClient; +import org.jclouds.vcloud.director.v1_5.features.admin.UserClient; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.jclouds.vcloud.director.v1_5.login.SessionClient; import org.testng.annotations.AfterClass; @@ -69,12 +67,11 @@ public class UserClientLiveTest extends BaseVCloudDirectorClientLiveTest { */ private Reference orgRef; private User user; - private static Random random = new Random(); @Override @BeforeClass(alwaysRun = true) public void setupRequiredClients() { - userClient = context.getApi().getUserClient(); + userClient = adminContext.getApi().getUserClient(); orgRef = Iterables.getFirst(context.getApi().getOrgClient().getOrgList().getOrgs(), null).toAdminReference(endpoint); } @@ -91,7 +88,7 @@ public class UserClientLiveTest extends BaseVCloudDirectorClientLiveTest { @Test(testName = "POST /admin/org/{id}/users") public void testCreateUser() { - User newUser = randomTestUser("testCreateUser", context); + User newUser = randomTestUser("testCreateUser"); user = userClient.createUser(orgRef.getHref(), newUser); Checks.checkUser(newUser); } @@ -122,7 +119,7 @@ public class UserClientLiveTest extends BaseVCloudDirectorClientLiveTest { .password("newPassword") // TODO test setting other fields? // .name("new"+oldUser.getName()) - .role(nonVAppUserRole(context)) + .role(getRoleReferenceFor(DefaultRoles.AUTHOR)) .build(); userClient.updateUser(user.getHref(), newUser); @@ -165,7 +162,7 @@ public class UserClientLiveTest extends BaseVCloudDirectorClientLiveTest { @Test(testName = "POST /admin/user/{id}/action/unlock", dependsOnMethods = { "testUpdateUser" }) public void testUnlockUser() { // Need to know how many times to fail login to lock account - AdminOrgClient adminOrgClient = context.getApi().getAdminOrgClient(); + AdminOrgClient adminOrgClient = adminContext.getApi().getOrgClient(); OrgPasswordPolicySettings settingsToRevertTo = null; // session client isn't typically exposed to the user, as it is implicit @@ -249,48 +246,4 @@ public class UserClientLiveTest extends BaseVCloudDirectorClientLiveTest { assertEquals(vde.getError(), expected); } } - - public static Reference vAppUserRole(RestContext context) { - RoleReferences roles = context.getApi().getAdminQueryClient().roleReferencesQueryAll(); - for (Reference role : roles.getReferences()) { - if (equal(role.getName(), "vApp User")) { - return Reference.builder().fromReference(role).build(); - } - } - - return null; - } - - public static Reference nonVAppUserRole(RestContext context) { - RoleReferences roles = context.getApi().getAdminQueryClient().roleReferencesQueryAll(); - for (Reference role : roles.getReferences()) { - if (!equal(role.getName(), "vApp User")) { - return Reference.builder().fromReference(role).build(); - } - } - - return null; - } - - public static User randomTestUser(String prefix, RestContext context) { - return randomTestUser(prefix, vAppUserRole(context)); - } - - public static User randomTestUser(String prefix, Reference role) { - return User.builder() - .name(name(prefix)+random.nextInt(999999)) - .fullName("testFullName") - .emailAddress("test@test.com") - .telephone("555-1234") - .isEnabled(false) - .im("testIM") - .isAlertEnabled(false) - .alertEmailPrefix("testPrefix") - .alertEmail("testAlert@test.com") - .isExternal(false) - .isGroupRole(false) - .role(role) - .password("password") - .build(); - } } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientExpectTest.java index 612f913b0e..676efb7f7e 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppClientExpectTest.java @@ -22,7 +22,6 @@ import static org.testng.Assert.assertEquals; import java.net.URI; -import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.domain.ControlAccessParams; import org.jclouds.vcloud.director.v1_5.domain.DeployVAppParams; @@ -52,6 +51,7 @@ import org.jclouds.vcloud.director.v1_5.domain.ovf.OperatingSystemSection; import org.jclouds.vcloud.director.v1_5.domain.ovf.StartupSection; import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; +import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserClient; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.testng.internal.annotations.Sets; @@ -65,7 +65,7 @@ import com.google.common.collect.Multimaps; * @author grkvlt@apache.org */ @Test(groups = { "unit", "user", "vapp" }, singleThreaded = true, testName = "VAppClientExpectTest") -public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { +public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { private String vAppId = "vapp-d0e2b6b9-4381-4ddc-9572-cdfae54059be"; private URI vAppURI = URI.create(endpoint + vAppId); @@ -76,7 +76,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false)//TODO public void testGetVapp() { - VCloudDirectorClient client = orderedRequestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = orderedRequestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", vAppId) .acceptMedia(VCloudDirectorMediaType.VAPP) @@ -92,7 +92,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testModifyVApp() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", vAppId) .xmlFilePayload("/vApp/modifyVApp.xml", VCloudDirectorMediaType.VAPP) @@ -113,7 +113,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testDeleteVApp() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("DELETE", vAppId) .acceptAnyMedia() @@ -129,7 +129,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testConsolidateVApp() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", vAppId + "/action/consolidate") .acceptAnyMedia() @@ -145,7 +145,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testControlAccess() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", vAppId + "/action/controlAccess") .xmlFilePayload("/vApp/controlAccessParams.xml", VCloudDirectorMediaType.CONTROL_ACCESS) @@ -164,7 +164,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testDeploy() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", vAppId + "/action/deploy") .xmlFilePayload("/vApp/deployParams.xml", VCloudDirectorMediaType.DEPLOY_VAPP_PARAMS) @@ -184,7 +184,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testDiscardSuspendedState() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", vAppId + "/action/discardSuspendedState") .acceptAnyMedia() @@ -200,7 +200,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testEnterMaintenanceMode() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", vAppId + "/action/enterMaintenanceMode") .acceptAnyMedia() @@ -214,7 +214,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testExitMaintenanceMode() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", vAppId + "/action/exitMaintenanceMode") .acceptAnyMedia() @@ -228,7 +228,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testInstallVMwareTools() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", vAppId + "/action/installVMwareTools") .acceptAnyMedia() @@ -244,7 +244,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testRecomposeVApp() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", vAppId + "/action/recomposeVApp") .xmlFilePayload("/vApp/recomposeVAppParams.xml", VCloudDirectorMediaType.RECOMPOSE_VAPP_PARAMS) @@ -264,7 +264,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testRelocate() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", vAppId + "/action/relocate") .xmlFilePayload("/vApp/relocateParams.xml", VCloudDirectorMediaType.RELOCATE_VM_PARAMS) @@ -284,7 +284,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testUndeploy() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", vAppId + "/action/undeploy") .xmlFilePayload("/vApp/undeployParams.xml", VCloudDirectorMediaType.UNDEPLOY_VAPP_PARAMS) @@ -304,7 +304,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testUpgradeHardwareVersion() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", vAppId + "/action/upgradeHardwareVersion") .acceptAnyMedia() @@ -320,7 +320,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testPowerOff() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", vAppId + "/power/action/powerOff") .acceptAnyMedia() @@ -336,7 +336,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testPowerOn() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", vAppId + "/power/action/powerOn") .acceptAnyMedia() @@ -352,7 +352,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testReboot() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", vAppId + "/power/action/reboot") .acceptAnyMedia() @@ -368,7 +368,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testReset() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", vAppId + "/power/action/reset") .acceptAnyMedia() @@ -384,7 +384,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testShutdown() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", vAppId + "/power/action/shutdown") .acceptAnyMedia() @@ -400,7 +400,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testSuspend() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", vAppId + "/power/action/suspend") .acceptAnyMedia() @@ -416,7 +416,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testGetControlAccesss() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", vAppId + "/controlAccess") .acceptAnyMedia() @@ -432,7 +432,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testGetGuestCustomizationSection() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", vAppId + "/guestCustomizationSection") .acceptAnyMedia() @@ -448,7 +448,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testModifyGuestCustomizationSection() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", vAppId + "/guestCustomizationSection") .xmlFilePayload("/vApp/modifyGuestCustomizationSection.xml", VCloudDirectorMediaType.GUEST_CUSTOMIZATION_SECTION) @@ -468,7 +468,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testGetLeaseSettingsSection() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", vAppId + "/leaseSettingsSection") .acceptAnyMedia() @@ -484,7 +484,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testModifyLeaseSettingsSection() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", vAppId + "/leaseSettingsSection") .xmlFilePayload("/vApp/modifyLeaseSettingsSection.xml", VCloudDirectorMediaType.LEASE_SETTINGS_SECTION) @@ -504,7 +504,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testEjectMedia() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", vAppId + "/media/action/ejectMedia") .xmlFilePayload("/vApp/ejectMediaParams.xml", VCloudDirectorMediaType.MEDIA_PARAMS) @@ -524,7 +524,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testInsertMedia() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", vAppId + "/media/action/insertMedia") .xmlFilePayload("/vApp/insertMediaParams.xml", VCloudDirectorMediaType.MEDIA_PARAMS) @@ -544,7 +544,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testGetNetworkConfigSection() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", vAppId + "/networkConfigSection") .acceptAnyMedia() @@ -560,7 +560,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testModifyNetworkConfigSection() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", vAppId + "/networkConfigSection") .xmlFilePayload("/vApp/modifyNetworkConfigSection.xml", VCloudDirectorMediaType.NETWORK_CONFIG_SECTION) @@ -580,7 +580,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testGetNetworkConnectionSection() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", vAppId + "/networkConnectionSection") .acceptAnyMedia() @@ -596,7 +596,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testModifyNetworkConnectionSection() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", vAppId + "/networkConnectionSection") .xmlFilePayload("/vApp/modifyNetworkConnectionSection.xml", VCloudDirectorMediaType.NETWORK_CONNECTION_SECTION) @@ -616,7 +616,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testGetNetworkSection() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", vAppId + "/networkSection") .acceptAnyMedia() @@ -632,7 +632,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testGetOperatingSystemSection() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", vAppId + "/operatingSystemSection") .acceptAnyMedia() @@ -648,7 +648,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testModifyOperatingSystemSection() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", vAppId + "/operatingSystemSection") .xmlFilePayload("/vApp/modifyOperatingSystemSection.xml", VCloudDirectorMediaType.OPERATING_SYSTEM_SECTION) @@ -668,7 +668,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testGetOwner() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", vAppId + "/owner") .acceptAnyMedia() @@ -684,7 +684,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testModifyOwner() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", vAppId + "/owner") .xmlFilePayload("/vApp/modifyOwner.xml", VCloudDirectorMediaType.OWNER) @@ -701,7 +701,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testGetProductSections() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", vAppId + "/productSections") .acceptAnyMedia() @@ -717,7 +717,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testModifyProductSections() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", vAppId + "/productSections") .xmlFilePayload("/vApp/modifyProductSections.xml", VCloudDirectorMediaType.PRODUCT_SECTION_LIST) @@ -734,7 +734,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testGetPendingQuestion() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", vAppId + "/question") .acceptAnyMedia() @@ -750,7 +750,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testAnswerQuestion() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", vAppId + "/question/action/answer") .xmlFilePayload("/vApp/answerQuestion.xml", VCloudDirectorMediaType.VM_PENDING_ANSWER) @@ -767,7 +767,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testGetRuntimeInfoSection() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", vAppId + "/runtimeInfoSection") .acceptAnyMedia() @@ -783,7 +783,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testGetScreenImage() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", vAppId + "/screen") .acceptMedia(VCloudDirectorMediaType.ANY_IMAGE) @@ -801,7 +801,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testGetScreenTicket() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", vAppId + "/screen/action/acquireTicket") .acceptAnyMedia() @@ -817,7 +817,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testGetStartupSection() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", vAppId + "/startupSection") .acceptAnyMedia() @@ -833,7 +833,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testModifyStartupSection() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", vAppId + "/startupSection") .xmlFilePayload("/vApp/modifyStartupSection.xml", VCloudDirectorMediaType.STARTUP_SECTION) @@ -853,7 +853,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testGetVirtualHardwareSection() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", vAppId + "/virtualHardwareSection") .acceptAnyMedia() @@ -869,7 +869,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testModifyVirtualHardwareSection() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", vAppId + "/virtualHardwareSection") .xmlFilePayload("/vApp/modifyVirtualHardwareSection.xml", VCloudDirectorMediaType.VIRTUAL_HARDWARE_SECTION) @@ -889,7 +889,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testGetVirtualHardwareSectionCpu() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", vAppId + "/virtualHardwareSection/cpu") .acceptAnyMedia() @@ -905,7 +905,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testModifyVirtualHardwareSectionCpu() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("", vAppId + "/virtualHardwareSection/cpu") .xmlFilePayload("/vApp/modifyVirtualHardwareSectionCpu.xml", VCloudDirectorMediaType.OVF_RASD_ITEM) @@ -925,7 +925,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testGetVirtualHardwareSectionDisks() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", vAppId + "/virtualHardwareSection/disks") .acceptAnyMedia() @@ -941,7 +941,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testModifyVirtualHardwareSectionDisks() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", vAppId + "/virtualHardwareSection/disks") .xmlFilePayload("/vApp/modifyVirtualHardwareSectionDisks.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST) @@ -961,7 +961,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testGetVirtualHardwareSectionMedia() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", vAppId + "/virtualHardwareSection/media") .acceptAnyMedia() @@ -977,7 +977,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testGetVirtualHardwareSectionMemory() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", vAppId + "/virtualHardwareSection/memory") .acceptAnyMedia() @@ -993,7 +993,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testModifyVirtualHardwareSectionMemory() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", vAppId + "/virtualHardwareSection/memory") .xmlFilePayload("/vApp/modifyVirtualHardwareSectionMemory.xml", VCloudDirectorMediaType.VAPP) @@ -1013,7 +1013,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testGetVirtualHardwareSectionNetworkCards() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", vAppId + "/virtualHardwareSection/networkCards") .acceptAnyMedia() @@ -1029,7 +1029,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testModifyVirtualHardwareSectionNetworkCards() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", vAppId + "/virtualHardwareSection/networkCards") .xmlFilePayload("/vApp/modifyVirtualHardwareSectionNetworkCards.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST) @@ -1049,7 +1049,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testGetVirtualHardwareSectionSerialPorts() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", vAppId + "/virtualHardwareSection/serialPorts") .acceptAnyMedia() @@ -1065,7 +1065,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testModifyVirtualHardwareSectionSerialPorts() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("PUT", vAppId + "/virtualHardwareSection/serialPorts") .xmlFilePayload("/vApp/modifyVirtualHardwareSectionSerialPorts.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST) diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientExpectTest.java index 8c826f18a1..3e75e92b5d 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VAppTemplateClientExpectTest.java @@ -65,6 +65,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.VAppNetworkConfiguration; import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; +import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserClient; import org.testng.annotations.Test; import com.google.common.collect.ImmutableSet; @@ -75,7 +76,7 @@ import com.google.common.collect.ImmutableSet; * @author Adam Lowe */ @Test(groups = { "unit", "user", "vapptemplate" }, testName = "VAppTemplateClientExpectTest") -public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { +public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public VAppTemplateClientExpectTest() { TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles")); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcClientExpectTest.java index 90240a667f..f52d1ce5ae 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcClientExpectTest.java @@ -23,7 +23,6 @@ import static org.testng.Assert.fail; import java.net.URI; -import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient; import org.jclouds.vcloud.director.v1_5.VCloudDirectorException; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.domain.Capabilities; @@ -46,6 +45,7 @@ import org.jclouds.vcloud.director.v1_5.domain.VApp; import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate; import org.jclouds.vcloud.director.v1_5.domain.Vdc; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; +import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserClient; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -55,7 +55,7 @@ import org.testng.annotations.Test; * @author danikov */ @Test(groups = { "unit", "user", "vdc" }, singleThreaded = true, testName = "VdcClientExpectTest") -public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { +public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { private URI vdcURI; @@ -67,7 +67,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test public void testGetVdc() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f") .acceptAnyMedia() @@ -84,7 +84,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test public void testResponse400ForInvalidVdcId() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/vdc/NOTAUUID") .acceptAnyMedia() @@ -110,7 +110,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test public void testResponse403ForFakeVdcId() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/vdc/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") .acceptAnyMedia() @@ -135,7 +135,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testCaptureVApp() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/captureVApp") .xmlFilePayload("/vdc/params/captureVApp.xml", VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS) @@ -157,7 +157,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testResponse4xxForCaptureVAppNoParams() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/captureVApp") .xmlFilePayload("/vdc/params/captureVApp.xml", VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS) @@ -183,7 +183,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testCloneVApp() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneVAppTemplate") .xmlFilePayload("/vdc/params/cloneVApp.xml", VCloudDirectorMediaType.CLONE_VAPP_PARAMS) @@ -205,7 +205,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testCloneVAppTemplate() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneVAppTemplate") .xmlFilePayload("/vdc/params/cloneVAppTemplate.xml", VCloudDirectorMediaType.CLONE_VAPP_TEMPLATE_PARAMS) @@ -227,7 +227,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testComposeVApp() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/composeVApp") .xmlFilePayload("/vdc/params/composeVApp.xml", VCloudDirectorMediaType.COMPOSE_VAPP_PARAMS) @@ -249,7 +249,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testInstantiateVAppTemplate() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/instantiateVAppTemplate") .xmlFilePayload("/vdc/params/instantiateVAppTemplate.xml", VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS) @@ -271,7 +271,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest @Test(enabled = false) public void testUploadVAppTemplate() { - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/uploadVAppTemplate") .xmlFilePayload("/vdc/params/uploadVAppTemplate.xml", VCloudDirectorMediaType.UPLOAD_VAPP_TEMPLATE_PARAMS) @@ -295,7 +295,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest public void testCreateMedia() { URI vdcUri = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media") .acceptMedia(VCloudDirectorMediaType.MEDIA) @@ -321,7 +321,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest public void testCloneMedia() { URI vdcUri = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneMedia") .acceptMedia(VCloudDirectorMediaType.MEDIA) @@ -351,7 +351,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest public void testGetMetadata() { URI vdcUri = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/metadata") .acceptAnyMedia() @@ -369,7 +369,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest public void testGetMetadataValue() { URI vdcUri = URI.create("https://vcloudbeta.bluelock.com/api/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, new VcloudHttpRequestPrimer() .apiCommand("GET", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/metadata/key") .acceptAnyMedia() diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcClientLiveTest.java index 4214aae07e..01bbad6d4b 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/VdcClientLiveTest.java @@ -105,7 +105,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest { cleanUpVApp(composedVApp); } - context.getApi().getAdminVdcClient().getMetadataClient() + adminContext.getApi().getVdcClient().getMetadataClient() .deleteMetadataEntry(toAdminUri(vdcURI), "key"); } @@ -309,7 +309,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest { @Test(testName = "vdcClient admin metadata configuration", dependsOnMethods = { "testGetVdc" } ) public void testSetupMetadata() { - context.getApi().getAdminVdcClient().getMetadataClient().setMetadata(toAdminUri(vdcURI), + adminContext.getApi().getVdcClient().getMetadataClient().setMetadata(toAdminUri(vdcURI), "key", MetadataValue.builder().value("value").build()); } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorRestClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorRestClientExpectTest.java index cd3b01f8e4..cf9601e2a3 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorRestClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorRestClientExpectTest.java @@ -29,9 +29,9 @@ import org.jclouds.date.DateService; import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpResponse; import org.jclouds.rest.BaseRestClientExpectTest; -import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.domain.Reference; +import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserClient; import org.testng.annotations.BeforeGroups; import com.google.common.collect.ImmutableMultimap; @@ -44,7 +44,8 @@ import com.google.inject.Guice; * * @author Adrian Cole */ -public class BaseVCloudDirectorRestClientExpectTest extends BaseRestClientExpectTest { +public abstract class BaseVCloudDirectorRestClientExpectTest + extends BaseRestClientExpectTest { public static final String user = "adrian@jclouds.org"; public static final String org = "JClouds";