refractor out admin

This commit is contained in:
danikov 2012-03-28 09:49:20 +01:00
parent ff2982c747
commit 6ddd2072dc
49 changed files with 885 additions and 777 deletions

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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.
* <p/>
* This list must be updated whenever a new default role is added.
*/
public static final List<String> ALL = Arrays.asList(
USER, AUTHOR, CATALOG_AUTHOR, CONSOLE, ORG_ADMIN
);
}
}

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.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.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.Owner; 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.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.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx; import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.net.URI;
import java.util.concurrent.TimeUnit; 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.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.Owner; 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.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; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
/** /**

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.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.ExternalNetwork;
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork; 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.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.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx; import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.net.URI;
import java.util.concurrent.TimeUnit; 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.Network;
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork; 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.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. * Provides synchronous access to admin {@link Network} objects.

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.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.OrgPasswordPolicySettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgSettings; 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.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.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx; import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.net.URI;
import java.util.concurrent.TimeUnit; 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.OrgPasswordPolicySettings;
import org.jclouds.vcloud.director.v1_5.domain.OrgSettings; 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.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. * Provides synchronous access to {@link Group} objects.

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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; import java.util.concurrent.TimeUnit;
@ -32,6 +32,7 @@ import org.jclouds.rest.annotations.QueryParams;
import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.vcloud.director.v1_5.domain.RoleReferences; 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.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.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx; import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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; 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.Vdc;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecordType; 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.QueryResultRecords;
import org.jclouds.vcloud.director.v1_5.features.QueryClient;
/** /**
* Provides synchronous access to {@link AdminQuery} objects. * Provides synchronous access to {@link AdminQuery} objects.

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.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.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.AdminVdc; 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.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.features.MetadataAsyncClient.Writeable;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx; import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.net.URI;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -26,6 +26,10 @@ import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.vcloud.director.v1_5.domain.AdminVdc; 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.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; import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient.Writeable;
/** /**

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.net.URI;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.net.URI;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.net.URI;

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.net.URI;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;

View File

@ -16,35 +16,24 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * 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.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.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.Media;
import org.jclouds.vcloud.director.v1_5.domain.Org; 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.Session;
import org.jclouds.vcloud.director.v1_5.domain.Task; 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.VApp;
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate; 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.Vdc;
import org.jclouds.vcloud.director.v1_5.domain.ovf.Network; 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.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.NetworkAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient; 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.QueryAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.TaskAsyncClient; 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.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.VAppAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateAsyncClient; import org.jclouds.vcloud.director.v1_5.features.VAppTemplateAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VdcAsyncClient; 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. * Provides asynchronous access to VCloudDirector via their REST API.
* *
* @see VCloudDirectorClient * @see VCloudDirectorUserClient
* @author Adrian Cole * @author Adrian Cole
*/ */
public interface VCloudDirectorAsyncClient { public interface VCloudDirectorUserAsyncClient {
/** /**
* *
* @return the current login session * @return the current login session
@ -71,12 +60,6 @@ public interface VCloudDirectorAsyncClient {
@Delegate @Delegate
QueryAsyncClient getQueryClient(); QueryAsyncClient getQueryClient();
/**
* @return asynchronous access to admin query features
*/
@Delegate
AdminQueryAsyncClient getAdminQueryClient();
/** /**
* @return asynchronous access to {@link Org} features * @return asynchronous access to {@link Org} features
*/ */
@ -130,40 +113,4 @@ public interface VCloudDirectorAsyncClient {
*/ */
@Delegate @Delegate
VAppTemplateAsyncClient getVAppTemplateClient(); 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();
} }

View File

@ -16,39 +16,29 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.vcloud.director.v1_5; package org.jclouds.vcloud.director.v1_5.user;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout; import org.jclouds.concurrent.Timeout;
import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.Delegate;
import org.jclouds.vcloud.director.v1_5.domain.AdminOrg; import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminAsyncClient;
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.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.Media;
import org.jclouds.vcloud.director.v1_5.domain.Org; 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.Session;
import org.jclouds.vcloud.director.v1_5.domain.Task; 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.VApp;
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate; 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.Vdc;
import org.jclouds.vcloud.director.v1_5.domain.ovf.Network; 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.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.MediaClient;
import org.jclouds.vcloud.director.v1_5.features.NetworkClient; 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.OrgClient;
import org.jclouds.vcloud.director.v1_5.features.QueryClient; 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.TaskClient;
import org.jclouds.vcloud.director.v1_5.features.UploadClient; 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.VAppClient;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient; import org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient;
import org.jclouds.vcloud.director.v1_5.features.VdcClient; import org.jclouds.vcloud.director.v1_5.features.VdcClient;
@ -58,11 +48,11 @@ import com.google.inject.Provides;
/** /**
* Provides synchronous access to VCloudDirector. * Provides synchronous access to VCloudDirector.
* *
* @see VCloudDirectorAsyncClient * @see VCloudDirectorAdminAsyncClient
* @author Adrian Cole * @author danikov
*/ */
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
public interface VCloudDirectorClient { public interface VCloudDirectorUserClient {
/** /**
* @return the current login session * @return the current login session
*/ */
@ -75,12 +65,6 @@ public interface VCloudDirectorClient {
@Delegate @Delegate
QueryClient getQueryClient(); QueryClient getQueryClient();
/**
* @return asynchronous access to admin query features
*/
@Delegate
AdminQueryClient getAdminQueryClient();
/** /**
* @return synchronous access to {@link Org} features * @return synchronous access to {@link Org} features
*/ */
@ -134,40 +118,4 @@ public interface VCloudDirectorClient {
*/ */
@Delegate @Delegate
VAppTemplateClient getVAppTemplateClient(); 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();
} }

View File

@ -33,7 +33,7 @@ import org.jclouds.http.HttpResponse;
import org.jclouds.util.Strings2; import org.jclouds.util.Strings2;
import org.jclouds.vcloud.director.v1_5.domain.OrgList; 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.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.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.jclouds.xml.internal.JAXBParser; import org.jclouds.xml.internal.JAXBParser;
import org.testng.annotations.Test; import org.testng.annotations.Test;

View File

@ -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.internal.BaseVCloudDirectorRestClientExpectTest;
import org.jclouds.vcloud.director.v1_5.login.SessionClientExpectTest; import org.jclouds.vcloud.director.v1_5.login.SessionClientExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserClient;
import org.testng.annotations.Test; import org.testng.annotations.Test;
/** /**
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = "unit", testName = "VCloudDirectorClient") @Test(groups = "unit", testName = "VCloudDirectorClient")
public class VCloudDirectorClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public class VCloudDirectorClientExpectTest extends BaseVCloudDirectorRestClientExpectTest<VCloudDirectorUserClient> {
public void testRestClientModuleWorksProperly() throws Exception { public void testRestClientModuleWorksProperly() throws Exception {
VCloudDirectorClient clientWhenSessionsExist = requestSendsResponse(loginRequest, sessionResponse); VCloudDirectorUserClient clientWhenSessionsExist = requestSendsResponse(loginRequest, sessionResponse);
assertEquals(clientWhenSessionsExist.getCurrentSession(), SessionClientExpectTest.SESSION); assertEquals(clientWhenSessionsExist.getCurrentSession(), SessionClientExpectTest.SESSION);
} }

View File

@ -22,8 +22,8 @@ import static org.testng.Assert.assertEquals;
import java.net.URI; 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.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.AdminCatalog;
import org.jclouds.vcloud.director.v1_5.domain.CatalogItems; import org.jclouds.vcloud.director.v1_5.domain.CatalogItems;
import org.jclouds.vcloud.director.v1_5.domain.Link; import org.jclouds.vcloud.director.v1_5.domain.Link;
@ -42,13 +42,7 @@ import com.google.common.collect.ImmutableSet;
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@Test(groups = { "unit", "admin", "catalog" }, singleThreaded = true, testName = "CatalogClientExpectTest") @Test(groups = { "unit", "admin", "catalog" }, singleThreaded = true, testName = "CatalogClientExpectTest")
public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectTest<VCloudDirectorAdminClient> {
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();
private Reference catalogRef = Reference.builder() private Reference catalogRef = Reference.builder()
.type("application/vnd.vmware.vcloud.catalog+xml") .type("application/vnd.vmware.vcloud.catalog+xml")
@ -58,7 +52,7 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
@Test @Test
public void testCreateCatalog() { public void testCreateCatalog() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", "/admin/org/???/catalogs") .apiCommand("POST", "/admin/org/???/catalogs")
.xmlFilePayload("/catalog/admin/createCatalogSource.xml", VCloudDirectorMediaType.ADMIN_CATALOG) .xmlFilePayload("/catalog/admin/createCatalogSource.xml", VCloudDirectorMediaType.ADMIN_CATALOG)
@ -71,7 +65,7 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
AdminCatalog source = createCatalogSource(); AdminCatalog source = createCatalogSource();
AdminCatalog expected = createCatalog(); 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: // 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> // <{http://www.vmware.com/vcloud/v1.5}Task>
@Test(enabled = false) @Test(enabled = false)
public void testGetCatalog() { public void testGetCatalog() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4") .apiCommand("GET", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4")
.acceptAnyMedia() .acceptAnyMedia()
@ -93,7 +87,7 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
AdminCatalog expected = catalog(); AdminCatalog expected = catalog();
AdminCatalog actual = client.getAdminCatalogClient().getCatalog(catalogRef.getHref()); AdminCatalog actual = client.getCatalogClient().getCatalog(catalogRef.getHref());
assertEquals(actual.getHref(), expected.getHref()); assertEquals(actual.getHref(), expected.getHref());
assertEquals(actual.getLinks(), expected.getLinks()); assertEquals(actual.getLinks(), expected.getLinks());
assertEquals(actual.getTasks(), expected.getTasks()); assertEquals(actual.getTasks(), expected.getTasks());
@ -107,12 +101,12 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
assertEquals(actual.getOwner(), expected.getOwner()); assertEquals(actual.getOwner(), expected.getOwner());
assertEquals(client.getAdminCatalogClient().getCatalog(catalogRef.getHref()), expected); assertEquals(client.getCatalogClient().getCatalog(catalogRef.getHref()), expected);
} }
@Test @Test
public void testModifyCatalog() { public void testModifyCatalog() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4") .apiCommand("PUT", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4")
.xmlFilePayload("/catalog/admin/updateCatalogSource.xml", VCloudDirectorMediaType.ADMIN_CATALOG) .xmlFilePayload("/catalog/admin/updateCatalogSource.xml", VCloudDirectorMediaType.ADMIN_CATALOG)
@ -124,12 +118,12 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
AdminCatalog expected = modifyCatalog(); AdminCatalog expected = modifyCatalog();
assertEquals(client.getAdminCatalogClient().updateCatalog(catalogRef.getHref(), expected), expected); assertEquals(client.getCatalogClient().updateCatalog(catalogRef.getHref(), expected), expected);
} }
@Test @Test
public void testGetOwner() { public void testGetOwner() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner") .apiCommand("GET", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner")
.acceptAnyMedia() .acceptAnyMedia()
@ -151,12 +145,12 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
.build()) .build())
.build(); .build();
assertEquals(client.getAdminCatalogClient().getOwner(catalogRef.getHref()), expected); assertEquals(client.getCatalogClient().getOwner(catalogRef.getHref()), expected);
} }
@Test @Test
public void testSetOwner() { public void testSetOwner() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner") .apiCommand("PUT", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner")
.xmlFilePayload("/catalog/admin/updateOwnerSource.xml", VCloudDirectorMediaType.OWNER) .xmlFilePayload("/catalog/admin/updateOwnerSource.xml", VCloudDirectorMediaType.OWNER)
@ -174,12 +168,12 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
.build()) .build())
.build(); .build();
client.getAdminCatalogClient().setOwner(catalogRef.getHref(), newOwner); client.getCatalogClient().setOwner(catalogRef.getHref(), newOwner);
} }
@Test @Test
public void testPublishCatalog() { public void testPublishCatalog() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/action/publish") .apiCommand("POST", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/action/publish")
.xmlFilePayload("/catalog/admin/publishCatalogParams.xml", VCloudDirectorMediaType.PUBLISH_CATALOG_PARAMS) .xmlFilePayload("/catalog/admin/publishCatalogParams.xml", VCloudDirectorMediaType.PUBLISH_CATALOG_PARAMS)
@ -192,12 +186,12 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
.isPublished(true) .isPublished(true)
.build(); .build();
client.getAdminCatalogClient().publishCatalog(catalogRef.getHref(), params); client.getCatalogClient().publishCatalog(catalogRef.getHref(), params);
} }
@Test @Test
public void testDeleteCatalog() { public void testDeleteCatalog() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("DELETE", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4") .apiCommand("DELETE", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4")
.acceptAnyMedia() .acceptAnyMedia()
@ -205,7 +199,7 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.httpResponseBuilder().statusCode(204).build()); .httpResponseBuilder().statusCode(204).build());
client.getAdminCatalogClient().deleteCatalog(catalogRef.getHref()); client.getCatalogClient().deleteCatalog(catalogRef.getHref());
} }
public static final AdminCatalog createCatalogSource() { public static final AdminCatalog createCatalogSource() {

View File

@ -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.PublishCatalogParams;
import org.jclouds.vcloud.director.v1_5.domain.Reference; 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.domain.User;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogClient;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
@ -74,7 +75,7 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest
@Override @Override
@BeforeClass(alwaysRun = true) @BeforeClass(alwaysRun = true)
protected void setupRequiredClients() { protected void setupRequiredClients() {
catalogClient = context.getApi().getAdminCatalogClient(); catalogClient = adminContext.getApi().getCatalogClient();
orgRef = Iterables.getFirst(context.getApi().getOrgClient().getOrgList().getOrgs(), null).toAdminReference(endpoint); 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", @Test(testName = "PUT /admin/catalog/{id}/owner",
dependsOnMethods = { "testGetCatalog" }) dependsOnMethods = { "testGetCatalog" })
public void updateCatalogOwner() { public void updateCatalogOwner() {
User newOwnerUser = UserClientLiveTest.randomTestUser("testUpdateCatalogOwner", context); User newOwnerUser = randomTestUser("testUpdateCatalogOwner");
newOwnerUser = context.getApi().getUserClient().createUser(orgRef.getHref(), newOwnerUser); newOwnerUser = adminContext.getApi().getUserClient().createUser(orgRef.getHref(), newOwnerUser);
assertNotNull(newOwnerUser, "failed to create temp user to test updateCatalogOwner"); assertNotNull(newOwnerUser, "failed to create temp user to test updateCatalogOwner");
Owner oldOwner = owner; Owner oldOwner = owner;
@ -129,7 +130,7 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest
} finally { } finally {
catalogClient.setOwner(catalog.getHref(), oldOwner); catalogClient.setOwner(catalog.getHref(), oldOwner);
owner = catalogClient.getOwner(catalog.getHref()); owner = catalogClient.getOwner(catalog.getHref());
context.getApi().getUserClient().deleteUser(newOwnerUser.getHref()); adminContext.getApi().getUserClient().deleteUser(newOwnerUser.getHref());
} }
} }

View File

@ -22,12 +22,13 @@ import static org.testng.Assert.assertEquals;
import java.net.URI; 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.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.Link;
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork; 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.Reference;
import org.jclouds.vcloud.director.v1_5.domain.Task; 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.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -39,7 +40,7 @@ import com.google.common.collect.ImmutableSet;
* @author danikov * @author danikov
*/ */
@Test(groups = { "unit", "admin", "network"}, singleThreaded = true, testName = "AdminNetworkClientExpectTest") @Test(groups = { "unit", "admin", "network"}, singleThreaded = true, testName = "AdminNetworkClientExpectTest")
public class AdminNetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public class AdminNetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectTest<VCloudDirectorAdminClient> {
Reference networkRef = Reference.builder() Reference networkRef = Reference.builder()
.href(URI.create(endpoint+"/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1")) .href(URI.create(endpoint+"/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1"))
@ -47,7 +48,7 @@ public class AdminNetworkClientExpectTest extends BaseVCloudDirectorRestClientEx
@Test @Test
public void testGetNetworkWithOrgNetwork() { public void testGetNetworkWithOrgNetwork() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1") .apiCommand("GET", "/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1")
.acceptAnyMedia() .acceptAnyMedia()
@ -58,12 +59,12 @@ public class AdminNetworkClientExpectTest extends BaseVCloudDirectorRestClientEx
OrgNetwork expected = orgNetwork(); OrgNetwork expected = orgNetwork();
assertEquals(client.getAdminNetworkClient().getNetwork(networkRef.getHref()), expected); assertEquals(client.getNetworkClient().getNetwork(networkRef.getHref()), expected);
} }
@Test @Test
public void testUpdateNetwork() { public void testUpdateNetwork() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1") .apiCommand("GET", "/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1")
.xmlFilePayload("/network/admin/updateNetworkSource.xml", VCloudDirectorMediaType.ORG_NETWORK) .xmlFilePayload("/network/admin/updateNetworkSource.xml", VCloudDirectorMediaType.ORG_NETWORK)
@ -75,12 +76,12 @@ public class AdminNetworkClientExpectTest extends BaseVCloudDirectorRestClientEx
Task expected = updateNetworkTask(); Task expected = updateNetworkTask();
assertEquals(client.getAdminNetworkClient().updateNetwork(networkRef.getHref(), updateNetwork()), expected); assertEquals(client.getNetworkClient().updateNetwork(networkRef.getHref(), updateNetwork()), expected);
} }
@Test(enabled = false) @Test(enabled = false)
public void testResetNetwork() { public void testResetNetwork() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", "/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1/action/reset") .apiCommand("POST", "/admin/network/b466c0c5-8a5c-4335-b703-a2e2e6b5f3e1/action/reset")
.acceptMedia(VCloudDirectorMediaType.TASK) .acceptMedia(VCloudDirectorMediaType.TASK)
@ -91,7 +92,7 @@ public class AdminNetworkClientExpectTest extends BaseVCloudDirectorRestClientEx
Task expected = resetNetworkTask(); Task expected = resetNetworkTask();
assertEquals(client.getAdminNetworkClient().resetNetwork(networkRef.getHref()), expected); assertEquals(client.getNetworkClient().resetNetwork(networkRef.getHref()), expected);
} }
public final OrgNetwork orgNetwork() { public final OrgNetwork orgNetwork() {

View File

@ -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.RouterInfo;
import org.jclouds.vcloud.director.v1_5.domain.SyslogServerSettings; 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.domain.Task;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkClient;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -67,7 +68,7 @@ public class AdminNetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest
@Override @Override
@BeforeClass(alwaysRun = true) @BeforeClass(alwaysRun = true)
protected void setupRequiredClients() { protected void setupRequiredClients() {
networkClient = context.getApi().getAdminNetworkClient(); networkClient = adminContext.getApi().getNetworkClient();
networkRef = Reference.builder().href(networkURI).build().toAdminReference(endpoint); networkRef = Reference.builder().href(networkURI).build().toAdminReference(endpoint);
} }

View File

@ -22,8 +22,8 @@ import static org.testng.Assert.assertEquals;
import java.net.URI; 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.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.AdminOrg;
import org.jclouds.vcloud.director.v1_5.domain.CatalogsList; import org.jclouds.vcloud.director.v1_5.domain.CatalogsList;
import org.jclouds.vcloud.director.v1_5.domain.GroupsList; 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.SmtpServerSettings;
import org.jclouds.vcloud.director.v1_5.domain.UsersList; 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.domain.Vdcs;
import org.jclouds.vcloud.director.v1_5.features.admin.GroupClient;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -49,7 +50,7 @@ import org.testng.annotations.Test;
* @author danikov * @author danikov
*/ */
@Test(groups = { "unit", "user", "org"}, singleThreaded = true, testName = "AdminOrgClientExpectTest") @Test(groups = { "unit", "user", "org"}, singleThreaded = true, testName = "AdminOrgClientExpectTest")
public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest<VCloudDirectorAdminClient> {
private Reference orgRef = Reference.builder() private Reference orgRef = Reference.builder()
.href(URI.create(endpoint + "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")) .href(URI.create(endpoint + "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
@ -57,7 +58,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
@Test @Test
public void testGetOrg() { public void testGetOrg() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0") .apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")
.acceptAnyMedia() .acceptAnyMedia()
@ -69,7 +70,335 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
AdminOrg expected = adminOrg(); 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() { public static final AdminOrg adminOrg() {
@ -199,23 +528,6 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
.build(); .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() { public static final OrgSettings settings() {
return OrgSettings.builder() return OrgSettings.builder()
.type("application/vnd.vmware.admin.orgSettings+xml") .type("application/vnd.vmware.admin.orgSettings+xml")
@ -264,47 +576,11 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
.build(); .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 @Test
public static final OrgSettings updateSettings() { public static final OrgSettings updateSettings() {
return settings().toBuilder() return settings().toBuilder()
.build(); .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() { public static final OrgEmailSettings emailSettings() {
return OrgEmailSettings.builder() return OrgEmailSettings.builder()
@ -329,25 +605,6 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
.build(); .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 @Test
public static final OrgEmailSettings updateEmailSettings() { public static final OrgEmailSettings updateEmailSettings() {
return emailSettings().toBuilder() return emailSettings().toBuilder()
@ -364,259 +621,4 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
.build(); .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();
}
} }

View File

@ -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.OrgVAppTemplateLeaseSettings;
import org.jclouds.vcloud.director.v1_5.domain.Reference; 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.SmtpServerSettings;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgClient;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -72,7 +73,7 @@ public class AdminOrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Override @Override
@BeforeClass(alwaysRun = true) @BeforeClass(alwaysRun = true)
public void setupRequiredClients() { public void setupRequiredClients() {
orgClient = context.getApi().getAdminOrgClient(); orgClient = adminContext.getApi().getOrgClient();
orgRef = Iterables.getFirst(orgClient.getOrgList().getOrgs(), null).toAdminReference(endpoint); orgRef = Iterables.getFirst(orgClient.getOrgList().getOrgs(), null).toAdminReference(endpoint);
assertNotNull(orgRef, String.format(REF_REQ_LIVE, "admin org")); assertNotNull(orgRef, String.format(REF_REQ_LIVE, "admin org"));
} }

View File

@ -24,12 +24,12 @@ import java.net.URI;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse; 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.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.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.QueryResultRecords;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRoleRecord; 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.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -41,7 +41,7 @@ import com.google.common.collect.ImmutableMultimap;
* @author Aled Sage * @author Aled Sage
*/ */
@Test(groups = { "unit", "admin", "query" }, singleThreaded = true, testName = "AdminQueryClientExpectTest") @Test(groups = { "unit", "admin", "query" }, singleThreaded = true, testName = "AdminQueryClientExpectTest")
public class AdminQueryClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public class AdminQueryClientExpectTest extends BaseVCloudDirectorRestClientExpectTest<VCloudDirectorAdminClient> {
// TODO Write expect tests for all other admin-query operations // 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")) .payload(payloadFromResourceWithContentType("/query/admin/allGroups.xml", VCloudDirectorMediaType.QUERY_RESULT_RECORDS + ";version=1.5"))
.build(); .build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse); VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse);
QueryResultRecords expected = QueryResultRecords.builder() QueryResultRecords expected = QueryResultRecords.builder()
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/groups/query?page=1&pageSize=25&format=records")) .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())
.build(); .build();
assertEquals(client.getAdminQueryClient().groupsQueryAll(), expected); assertEquals(client.getQueryClient().groupsQueryAll(), expected);
} }
// <?xml version="1.0" encoding="UTF-8"?> // <?xml version="1.0" encoding="UTF-8"?>
@ -112,7 +112,7 @@ public class AdminQueryClientExpectTest extends BaseVCloudDirectorRestClientExpe
.payload(payloadFromResourceWithContentType("/query/admin/allRoles.xml", VCloudDirectorMediaType.QUERY_RESULT_RECORDS + ";version=1.5")) .payload(payloadFromResourceWithContentType("/query/admin/allRoles.xml", VCloudDirectorMediaType.QUERY_RESULT_RECORDS + ";version=1.5"))
.build(); .build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse); VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse);
QueryResultRecords expected = QueryResultRecords.builder() QueryResultRecords expected = QueryResultRecords.builder()
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/roles/query?page=1&pageSize=25&format=records")) .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())
.build(); .build();
assertEquals(client.getAdminQueryClient().rolesQueryAll(), expected); assertEquals(client.getQueryClient().rolesQueryAll(), expected);
} }
} }

View File

@ -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.QueryResultRightRecord;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRoleRecord; 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.domain.query.QueryResultStrandedUserRecord;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminQueryClient;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -51,7 +52,7 @@ public class AdminQueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Override @Override
@BeforeClass(alwaysRun = true) @BeforeClass(alwaysRun = true)
public void setupRequiredClients() { public void setupRequiredClients() {
queryClient = context.getApi().getAdminQueryClient(); queryClient = adminContext.getApi().getQueryClient();
} }
@Test(testName = "GET /admin/groups/query") @Test(testName = "GET /admin/groups/query")

View File

@ -22,8 +22,8 @@ import static org.testng.Assert.assertEquals;
import java.net.URI; 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.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.AdminVdc;
import org.jclouds.vcloud.director.v1_5.domain.Reference; 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.internal.BaseVCloudDirectorRestClientExpectTest;
@ -35,7 +35,7 @@ import org.testng.annotations.Test;
* @author danikov * @author danikov
*/ */
@Test(groups = { "unit", "admin", "vdc" }, singleThreaded = true, testName = "AdminVdcClientExpectTest") @Test(groups = { "unit", "admin", "vdc" }, singleThreaded = true, testName = "AdminVdcClientExpectTest")
public class AdminVdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public class AdminVdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest<VCloudDirectorAdminClient> {
private Reference vdcRef = Reference.builder() private Reference vdcRef = Reference.builder()
.href(URI.create(endpoint + "???")) .href(URI.create(endpoint + "???"))
@ -43,7 +43,7 @@ public class AdminVdcClientExpectTest extends BaseVCloudDirectorRestClientExpect
@Test( enabled = false ) @Test( enabled = false )
public void testGetVdc() { public void testGetVdc() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/vdc/???") .apiCommand("GET", "/admin/vdc/???")
.acceptAnyMedia() .acceptAnyMedia()
@ -55,7 +55,7 @@ public class AdminVdcClientExpectTest extends BaseVCloudDirectorRestClientExpect
AdminVdc expected = adminVdc(); AdminVdc expected = adminVdc();
assertEquals(client.getAdminVdcClient().getVdc(vdcRef.getHref()), expected); assertEquals(client.getVdcClient().getVdc(vdcRef.getHref()), expected);
} }
public static final AdminVdc adminVdc() { public static final AdminVdc adminVdc() {

View File

@ -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.MetadataEntry;
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue; 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.domain.Task;
import org.jclouds.vcloud.director.v1_5.features.admin.AdminVdcClient;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
@ -62,7 +63,7 @@ public class AdminVdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Override @Override
@BeforeClass(alwaysRun = true) @BeforeClass(alwaysRun = true)
public void setupRequiredClients() { public void setupRequiredClients() {
vdcClient = context.getApi().getAdminVdcClient(); vdcClient = adminContext.getApi().getVdcClient();
metadataClient = vdcClient.getMetadataClient(); metadataClient = vdcClient.getMetadataClient();
assertNotNull(vdcURI, String.format(REF_REQ_LIVE, VDC)); assertNotNull(vdcURI, String.format(REF_REQ_LIVE, VDC));
adminVdcUri = toAdminUri(vdcURI); adminVdcUri = toAdminUri(vdcURI);

View File

@ -24,8 +24,8 @@ import java.net.URI;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse; 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.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.CatalogItem;
import org.jclouds.vcloud.director.v1_5.domain.CatalogItems; import org.jclouds.vcloud.director.v1_5.domain.CatalogItems;
import org.jclouds.vcloud.director.v1_5.domain.CatalogType; import org.jclouds.vcloud.director.v1_5.domain.CatalogType;
@ -47,7 +47,7 @@ import com.google.common.collect.ImmutableSet;
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@Test(groups = { "unit", "user", "catalog" }, singleThreaded = true, testName = "CatalogClientExpectTest") @Test(groups = { "unit", "user", "catalog" }, singleThreaded = true, testName = "CatalogClientExpectTest")
public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectTest<VCloudDirectorAdminClient> {
@Test @Test
public void testGetCatalog() { public void testGetCatalog() {
@ -65,7 +65,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
.payload(payloadFromResourceWithContentType("/catalog/catalog.xml", VCloudDirectorMediaType.CATALOG + ";version=1.5")) .payload(payloadFromResourceWithContentType("/catalog/catalog.xml", VCloudDirectorMediaType.CATALOG + ";version=1.5"))
.build(); .build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogRequest, catalogResponse); VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse, catalogRequest, catalogResponse);
CatalogType expected = catalog(); CatalogType expected = catalog();
@ -90,7 +90,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
.payload(payloadFromResourceWithContentType("/catalog/createdCatalogItem.xml", VCloudDirectorMediaType.CATALOG_ITEM + ";version=1.5")) .payload(payloadFromResourceWithContentType("/catalog/createdCatalogItem.xml", VCloudDirectorMediaType.CATALOG_ITEM + ";version=1.5"))
.build(); .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"); 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)) .payload(payloadFromResourceWithContentType("/catalog/catalogMetadata.xml", VCloudDirectorMediaType.METADATA))
.build(); .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"); 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)) .payload(payloadFromResourceWithContentType("/catalog/catalogMetadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE))
.build(); .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"); 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)) .payload(payloadFromResourceWithContentType("/catalog/catalogItem.xml", VCloudDirectorMediaType.CATALOG_ITEM))
.build(); .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"); URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df");
CatalogItem expected = catalogItem(); CatalogItem expected = catalogItem();
assertEquals(client.getCatalogClient().getCatalogItem(catalogItemURI), expected); assertEquals(client.getCatalogClient().getCatalogItem(catalogItemURI), expected);
} }
@Test @Test
@ -206,7 +206,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
.payload(payloadFromResourceWithContentType("/catalog/updateCatalogItem.xml", VCloudDirectorMediaType.CATALOG_ITEM + ";version=1.5")) .payload(payloadFromResourceWithContentType("/catalog/updateCatalogItem.xml", VCloudDirectorMediaType.CATALOG_ITEM + ";version=1.5"))
.build(); .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"); URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df");
CatalogItem expected = catalogItem(); CatalogItem expected = catalogItem();
@ -229,7 +229,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
.statusCode(200) .statusCode(200)
.build(); .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"); 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)) .payload(payloadFromResourceWithContentType("/catalog/catalogItemMetadata.xml", VCloudDirectorMediaType.METADATA))
.build(); .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"); 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")) .payload(payloadFromResourceWithContentType("/catalog/mergeMetadataTask.xml", VCloudDirectorMediaType.TASK + ";version=1.5"))
.build(); .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"); 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")) .payload(payloadFromResourceWithContentType("/catalog/catalogItemMetadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE + ";version=1.5"))
.build(); .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"); 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")) .payload(payloadFromResourceWithContentType("/catalog/setMetadataValueTask.xml", VCloudDirectorMediaType.TASK + ";version=1.5"))
.build(); .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"); 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)) .payload(payloadFromResourceWithContentType("/catalog/deleteMetadataEntryTask.xml", VCloudDirectorMediaType.TASK))
.build(); .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"); 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); assertEquals(client.getCatalogClient().getCatalogItemMetadataClient().deleteMetadataEntry(catalogItemURI, "KEY"), expected);
} }
@SuppressWarnings("unchecked")
public static final CatalogType catalog() { public static final CatalogType catalog() {
return CatalogType.builder() return CatalogType.builder()
.name("QunyingTestCatalog") .name("QunyingTestCatalog")
.type("application/vnd.vmware.vcloud.catalog+xml") .type("application/vnd.vmware.vcloud.catalog+xml")
.id("urn:vcloud:catalog:7212e451-76e1-4631-b2de-ba1dfd8080e4") .id("urn:vcloud:catalog:7212e451-76e1-4631-b2de-ba1dfd8080e4")
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4")) .href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
.link(Link.builder() .link(Link.builder()
.rel("up") .rel("up")
.type("application/vnd.vmware.vcloud.org+xml") .type("application/vnd.vmware.vcloud.org+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")) .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
.build()) .build())
.link(Link.builder() .link(Link.builder()
.rel("add") .rel("add")
.type("application/vnd.vmware.vcloud.catalogItem+xml") .type("application/vnd.vmware.vcloud.catalogItem+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/catalogItems")) .href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/catalogItems"))
.build()) .build())
.link(Link.builder() .link(Link.builder()
.rel("down") .rel("down")
.type("application/vnd.vmware.vcloud.metadata+xml") .type("application/vnd.vmware.vcloud.metadata+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata")) .href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"))
.build()) .build())
.catalogItems(CatalogItems.builder() .catalogItems(CatalogItems.builder()
.item(Reference.builder() .item(Reference.builder()
.type("application/vnd.vmware.vcloud.catalogItem+xml") .type("application/vnd.vmware.vcloud.catalogItem+xml")
.name("ubuntu10") .name("ubuntu10")
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df")) .href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
.build()) .build())
.item(Reference.builder() .item(Reference.builder()
.type("application/vnd.vmware.vcloud.catalogItem+xml") .type("application/vnd.vmware.vcloud.catalogItem+xml")
.name("imageTesting") .name("imageTesting")
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a9e0afdb-a42b-4688-8409-2ac68cf22939")) .href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a9e0afdb-a42b-4688-8409-2ac68cf22939"))
.build()) .build())
.build()) .build())
.description("Testing") .description("Testing")
.isPublished(false) .isPublished(false)
.build(); .build();
} }
public static CatalogItem createdCatalogItem() { public static CatalogItem createdCatalogItem() {
@ -447,10 +446,10 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
public static Reference ubuntuVappTemplateReference() { public static Reference ubuntuVappTemplateReference() {
return Reference.builder() return Reference.builder()
.type("application/vnd.vmware.vcloud.vAppTemplate+xml") .type("application/vnd.vmware.vcloud.vAppTemplate+xml")
.name("ubuntu10") .name("ubuntu10")
.href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9")) .href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"))
.build(); .build();
} }
public static MetadataEntry metadataEntry() { public static MetadataEntry metadataEntry() {
@ -630,4 +629,4 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
.build(); .build();
} }
} }

View File

@ -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.OBJ_REQ_LIVE;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REF_REQ_LIVE; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REF_REQ_LIVE;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.TASK_COMPLETE_TIMELY; 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.relEquals;
import static org.jclouds.vcloud.director.v1_5.predicates.LinkPredicates.typeEquals; import static org.jclouds.vcloud.director.v1_5.predicates.LinkPredicates.typeEquals;
import static org.testng.Assert.assertEquals; 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.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; 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.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.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -77,7 +93,7 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.description("created by CatalogClientLiveTest") .description("created by CatalogClientLiveTest")
.build(); .build();
AdminCatalogClient adminCatalogClient = context.getApi().getAdminCatalogClient(); AdminCatalogClient adminCatalogClient = adminContext.getApi().getCatalogClient();
adminCatalog = adminCatalogClient.createCatalog(orgRef.getHref(), newCatalog); adminCatalog = adminCatalogClient.createCatalog(orgRef.getHref(), newCatalog);
catalogRef = find(adminCatalog.getLinks(), and(relEquals("alternate"), typeEquals(VCloudDirectorMediaType.CATALOG))); 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()); context.getApi().getMediaClient().deleteMedia(media.getHref());
if (adminCatalog != null) { if (adminCatalog != null) {
context.getApi().getAdminCatalogClient().deleteCatalog(adminCatalog.getHref()); adminContext.getApi().getCatalogClient().deleteCatalog(adminCatalog.getHref());
try { try {
catalogClient.getCatalog(catalogRef.getHref()); catalogClient.getCatalog(catalogRef.getHref());
fail("The Catalog should have been deleted"); fail("The Catalog should have been deleted");

View File

@ -22,10 +22,11 @@ import static org.testng.Assert.assertEquals;
import java.net.URI; 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.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.Group;
import org.jclouds.vcloud.director.v1_5.domain.Reference; 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.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -35,7 +36,7 @@ import org.testng.annotations.Test;
* @author danikov * @author danikov
*/ */
@Test(groups = { "unit", "admin", "group"}, singleThreaded = true, testName = "GroupClientExpectTest") @Test(groups = { "unit", "admin", "group"}, singleThreaded = true, testName = "GroupClientExpectTest")
public class GroupClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public class GroupClientExpectTest extends BaseVCloudDirectorRestClientExpectTest<VCloudDirectorAdminClient> {
private Reference groupRef = Reference.builder() private Reference groupRef = Reference.builder()
.type("application/vnd.vmware.admin.group+xml") .type("application/vnd.vmware.admin.group+xml")
@ -45,7 +46,7 @@ public class GroupClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
@Test(enabled = false) @Test(enabled = false)
public void testGetGroup() { public void testGetGroup() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/group/???") .apiCommand("GET", "/admin/group/???")
.acceptAnyMedia() .acceptAnyMedia()
@ -67,7 +68,7 @@ public class GroupClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
@Test(enabled = false) @Test(enabled = false)
public void testUpdateGroup() { public void testUpdateGroup() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/group/???") .apiCommand("PUT", "/admin/group/???")
.xmlFilePayload("/group/updateGroupSource.xml", VCloudDirectorMediaType.GROUP) .xmlFilePayload("/group/updateGroupSource.xml", VCloudDirectorMediaType.GROUP)
@ -88,7 +89,7 @@ public class GroupClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
@Test @Test
public void testDeleteGroup() { public void testDeleteGroup() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("DELETE", "/admin/group/???") .apiCommand("DELETE", "/admin/group/???")
.acceptAnyMedia() .acceptAnyMedia()
@ -96,6 +97,6 @@ public class GroupClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.httpResponseBuilder().statusCode(204).build()); .httpResponseBuilder().statusCode(204).build());
client.getAdminCatalogClient().deleteCatalog(groupRef.getHref()); client.getCatalogClient().deleteCatalog(groupRef.getHref());
} }
} }

View File

@ -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.Group;
import org.jclouds.vcloud.director.v1_5.domain.OrgLdapSettings; 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.domain.Reference;
import org.jclouds.vcloud.director.v1_5.features.admin.GroupClient;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -45,7 +46,6 @@ public class GroupClientLiveTest extends BaseVCloudDirectorClientLiveTest {
/* /*
* Convenience references to API clients. * Convenience references to API clients.
*/ */
private GroupClient groupClient; private GroupClient groupClient;
/* /*
@ -58,11 +58,11 @@ public class GroupClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Override @Override
@BeforeClass(alwaysRun = true) @BeforeClass(alwaysRun = true)
public void setupRequiredClients() { public void setupRequiredClients() {
groupClient = context.getApi().getGroupClient(); groupClient = adminContext.getApi().getGroupClient();
Reference orgRef = null; Reference orgRef = null;
// TODO: requisite LDAP settings // TODO: requisite LDAP settings
// oldLdapSettings = context.getApi().getAdminOrgClient().getLdapSettings(orgRef.getHref()); // oldLdapSettings = adminContext.getApi().getAdminOrgClient().getLdapSettings(orgRef.getHref());
// OrgLdapSettings newLdapSettings = oldLdapSettings.toBuilder() // OrgLdapSettings newLdapSettings = oldLdapSettings.toBuilder()
// .ldapMode(OrgLdapSettings.LdapMode.SYSTEM) // .ldapMode(OrgLdapSettings.LdapMode.SYSTEM)
// .build(); // .build();

View File

@ -23,7 +23,6 @@ import static org.testng.Assert.fail;
import java.net.URI; 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.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.CloneMediaParams; 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.Reference;
import org.jclouds.vcloud.director.v1_5.domain.Task; 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.internal.BaseVCloudDirectorRestClientExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserClient;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -48,13 +48,13 @@ import com.google.common.collect.ImmutableSet;
* @author danikov * @author danikov
*/ */
@Test(groups = { "unit", "user", "media" }, singleThreaded = true, testName = "MediaClientExpectTest") @Test(groups = { "unit", "user", "media" }, singleThreaded = true, testName = "MediaClientExpectTest")
public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTest<VCloudDirectorUserClient> {
@Test @Test
public void testCreateMedia() { public void testCreateMedia() {
URI uploadLink = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media"); URI uploadLink = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media") .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media")
.acceptMedia(VCloudDirectorMediaType.MEDIA) .acceptMedia(VCloudDirectorMediaType.MEDIA)
@ -80,7 +80,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
public void testCloneMedia() { public void testCloneMedia() {
URI cloneUri = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneMedia"); 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() new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneMedia") .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneMedia")
.acceptMedia(VCloudDirectorMediaType.MEDIA) .acceptMedia(VCloudDirectorMediaType.MEDIA)
@ -110,7 +110,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
public void testGetMedia() { public void testGetMedia() {
URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1") .apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1")
.acceptAnyMedia() .acceptAnyMedia()
@ -127,7 +127,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
public void testResponse400ForInvalidMedia() { public void testResponse400ForInvalidMedia() {
URI mediaUri = URI.create(endpoint + "/media/NOTAUUID"); URI mediaUri = URI.create(endpoint + "/media/NOTAUUID");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/media/NOTAUUID") .apiCommand("GET", "/media/NOTAUUID")
.acceptAnyMedia() .acceptAnyMedia()
@ -156,7 +156,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
public void testResponse403ForCatalogIdUsedAsMediaId() { public void testResponse403ForCatalogIdUsedAsMediaId() {
URI mediaUri = URI.create(endpoint + "/media/e9cd3387-ac57-4d27-a481-9bee75e0690f"); URI mediaUri = URI.create(endpoint + "/media/e9cd3387-ac57-4d27-a481-9bee75e0690f");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/media/e9cd3387-ac57-4d27-a481-9bee75e0690f") .apiCommand("GET", "/media/e9cd3387-ac57-4d27-a481-9bee75e0690f")
.acceptAnyMedia() .acceptAnyMedia()
@ -185,7 +185,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
public void testResponse403ForFakeMediaId() { public void testResponse403ForFakeMediaId() {
URI mediaUri = URI.create(endpoint + "/media/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"); URI mediaUri = URI.create(endpoint + "/media/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/media/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") .apiCommand("GET", "/media/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
.acceptAnyMedia() .acceptAnyMedia()
@ -214,7 +214,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
public void testUpdateMedia() { public void testUpdateMedia() {
URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1") .apiCommand("PUT", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1")
.xmlFilePayload("/media/updateMedia.xml", VCloudDirectorMediaType.MEDIA) .xmlFilePayload("/media/updateMedia.xml", VCloudDirectorMediaType.MEDIA)
@ -234,7 +234,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
public void testDeleteMedia() { public void testDeleteMedia() {
URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("DELETE", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1") .apiCommand("DELETE", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1")
.acceptMedia(VCloudDirectorMediaType.TASK) .acceptMedia(VCloudDirectorMediaType.TASK)
@ -252,7 +252,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
public void testGetMetadata() { public void testGetMetadata() {
URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); 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() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata") .apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata")
.acceptAnyMedia() .acceptAnyMedia()
@ -271,7 +271,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
public void testMergeMetadata() { public void testMergeMetadata() {
URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); 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() new VcloudHttpRequestPrimer()
.apiCommand("POST", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata") .apiCommand("POST", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata")
.xmlFilePayload("/media/mergeMetadata.xml", VCloudDirectorMediaType.METADATA) .xmlFilePayload("/media/mergeMetadata.xml", VCloudDirectorMediaType.METADATA)
@ -290,7 +290,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
public void testGetMetadataValue() { public void testGetMetadataValue() {
URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); 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() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata/key") .apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata/key")
.acceptAnyMedia() .acceptAnyMedia()
@ -309,7 +309,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
public void testSetMetadataValue() { public void testSetMetadataValue() {
URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); 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() new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata/key") .apiCommand("PUT", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata/key")
.xmlFilePayload("/media/setMetadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE) .xmlFilePayload("/media/setMetadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE)
@ -330,7 +330,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
public void testDeleteMetadataValue() { public void testDeleteMetadataValue() {
URI mediaUri = URI.create("https://vcloudbeta.bluelock.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); 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() new VcloudHttpRequestPrimer()
.apiCommand("DELETE", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata/key") .apiCommand("DELETE", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/metadata/key")
.acceptMedia(VCloudDirectorMediaType.TASK) .acceptMedia(VCloudDirectorMediaType.TASK)
@ -348,7 +348,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
public void testGetOwner() { public void testGetOwner() {
URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/owner") .apiCommand("GET", "/media/794eb334-754e-4917-b5a0-5df85cbd61d1/owner")
.acceptAnyMedia() .acceptAnyMedia()

View File

@ -23,7 +23,6 @@ import static org.testng.Assert.fail;
import java.net.URI; 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.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.DhcpService; 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.OrgNetwork;
import org.jclouds.vcloud.director.v1_5.domain.SyslogServerSettings; 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.internal.BaseVCloudDirectorRestClientExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserClient;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -52,13 +52,13 @@ import com.google.common.collect.ImmutableSet;
* @author danikov * @author danikov
*/ */
@Test(groups = { "unit", "user", "network" }, singleThreaded = true, testName = "NetworkClientExpectTest") @Test(groups = { "unit", "user", "network" }, singleThreaded = true, testName = "NetworkClientExpectTest")
public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectTest<VCloudDirectorUserClient> {
@Test @Test
public void testGetNetwork() { public void testGetNetwork() {
URI networkUri = URI.create(endpoint + "/network/f3ba8256-6f48-4512-aad6-600e85b4dc38"); URI networkUri = URI.create(endpoint + "/network/f3ba8256-6f48-4512-aad6-600e85b4dc38");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/network/f3ba8256-6f48-4512-aad6-600e85b4dc38") .apiCommand("GET", "/network/f3ba8256-6f48-4512-aad6-600e85b4dc38")
.acceptAnyMedia() .acceptAnyMedia()
@ -75,7 +75,7 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT
public void testGetNetworkWithInvalidId() { public void testGetNetworkWithInvalidId() {
URI networkUri = URI.create(endpoint + "/network/NOTAUUID"); URI networkUri = URI.create(endpoint + "/network/NOTAUUID");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/network/NOTAUUID") .apiCommand("GET", "/network/NOTAUUID")
.acceptAnyMedia() .acceptAnyMedia()
@ -104,7 +104,7 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT
public void testGetNetworkWithCatalogId() { public void testGetNetworkWithCatalogId() {
URI networkUri = URI.create(endpoint + "/network/9e08c2f6-077a-42ce-bece-d5332e2ebb5c"); URI networkUri = URI.create(endpoint + "/network/9e08c2f6-077a-42ce-bece-d5332e2ebb5c");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/network/9e08c2f6-077a-42ce-bece-d5332e2ebb5c") .apiCommand("GET", "/network/9e08c2f6-077a-42ce-bece-d5332e2ebb5c")
.acceptAnyMedia() .acceptAnyMedia()
@ -133,7 +133,7 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT
public void testGetNetworkWithFakeId() { public void testGetNetworkWithFakeId() {
URI networkUri = URI.create(endpoint + "/network/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"); URI networkUri = URI.create(endpoint + "/network/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/network/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") .apiCommand("GET", "/network/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
.acceptAnyMedia() .acceptAnyMedia()
@ -162,7 +162,7 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT
public void testGetMetadata() { public void testGetMetadata() {
URI networkUri = URI.create(endpoint + "/network/55a677cf-ab3f-48ae-b880-fab90421980c"); URI networkUri = URI.create(endpoint + "/network/55a677cf-ab3f-48ae-b880-fab90421980c");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata") .apiCommand("GET", "/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata")
.acceptAnyMedia() .acceptAnyMedia()
@ -189,7 +189,7 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT
public void testGetMetadataValue() { public void testGetMetadataValue() {
URI networkUri = URI.create("https://vcloudbeta.bluelock.com/api/network/55a677cf-ab3f-48ae-b880-fab90421980c"); 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() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata/KEY") .apiCommand("GET", "/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata/KEY")
.acceptAnyMedia() .acceptAnyMedia()

View File

@ -62,13 +62,13 @@ public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@BeforeClass(alwaysRun = true) @BeforeClass(alwaysRun = true)
public void setupRequiredClients() { public void setupRequiredClients() {
networkClient = context.getApi().getNetworkClient(); networkClient = context.getApi().getNetworkClient();
context.getApi().getAdminNetworkClient().getMetadataClient().setMetadata(toAdminUri(networkURI), adminContext.getApi().getNetworkClient().getMetadataClient().setMetadata(toAdminUri(networkURI),
"key", MetadataValue.builder().value("value").build()); "key", MetadataValue.builder().value("value").build());
} }
@AfterClass(groups = { "live" }) @AfterClass(groups = { "live" })
public void cleanUp() throws Exception { public void cleanUp() throws Exception {
context.getApi().getAdminNetworkClient().getMetadataClient() adminContext.getApi().getNetworkClient().getMetadataClient()
.deleteMetadataEntry(toAdminUri(networkURI), "key"); .deleteMetadataEntry(toAdminUri(networkURI), "key");
} }

View File

@ -23,7 +23,6 @@ import static org.testng.Assert.fail;
import java.net.URI; 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.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Error; 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.OrgList;
import org.jclouds.vcloud.director.v1_5.domain.Reference; 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.internal.BaseVCloudDirectorRestClientExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserClient;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -46,11 +46,11 @@ import com.google.common.collect.Iterables;
* @author Adrian Cole * @author Adrian Cole
*/ */
@Test(groups = { "unit", "user", "org" }, singleThreaded = true, testName = "OrgClientExpectTest") @Test(groups = { "unit", "user", "org" }, singleThreaded = true, testName = "OrgClientExpectTest")
public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest<VCloudDirectorUserClient> {
@Test @Test
public void testGetOrgList() { public void testGetOrgList() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
getStandardRequest("GET", "/org/"), getStandardRequest("GET", "/org/"),
getStandardPayloadResponse("/org/orglist.xml", VCloudDirectorMediaType.ORG_LIST)); getStandardPayloadResponse("/org/orglist.xml", VCloudDirectorMediaType.ORG_LIST));
@ -67,7 +67,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test @Test
public void testGetOrgFromOrgListReference() { public void testGetOrgFromOrgListReference() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
getStandardRequest("GET", "/org/"), getStandardRequest("GET", "/org/"),
getStandardPayloadResponse("/org/orglist.xml", VCloudDirectorMediaType.ORG_LIST)); getStandardPayloadResponse("/org/orglist.xml", VCloudDirectorMediaType.ORG_LIST));
@ -86,7 +86,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
public void testGetOrg() { public void testGetOrg() {
URI orgUri = URI.create(endpoint + "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"); 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"), getStandardRequest("GET", "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"),
getStandardPayloadResponse("/org/org.xml", VCloudDirectorMediaType.ORG)); getStandardPayloadResponse("/org/org.xml", VCloudDirectorMediaType.ORG));
@ -99,7 +99,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
public void testGetOrgFailOnInvalidOrgId() { public void testGetOrgFailOnInvalidOrgId() {
URI orgUri = URI.create(endpoint + "/org/NOTAUUID"); URI orgUri = URI.create(endpoint + "/org/NOTAUUID");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
getStandardRequest("GET", "/org/NOTAUUID"), getStandardRequest("GET", "/org/NOTAUUID"),
getStandardPayloadResponse(400, "/org/error400.xml", VCloudDirectorMediaType.ERROR)); getStandardPayloadResponse(400, "/org/error400.xml", VCloudDirectorMediaType.ERROR));
@ -123,7 +123,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
public void testGetOrgFailOnWrongOrgId() { public void testGetOrgFailOnWrongOrgId() {
URI orgUri = URI.create(endpoint + "/org/9e08c2f6-077a-42ce-bece-d5332e2ebb5c"); 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"), getStandardRequest("GET", "/org/9e08c2f6-077a-42ce-bece-d5332e2ebb5c"),
getStandardPayloadResponse(403, "/org/error403-catalog.xml", VCloudDirectorMediaType.ERROR)); getStandardPayloadResponse(403, "/org/error403-catalog.xml", VCloudDirectorMediaType.ERROR));
@ -147,7 +147,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
public void testGetOrgFailOnFakeOrgId() { public void testGetOrgFailOnFakeOrgId() {
URI orgUri = URI.create(endpoint + "/org/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"); 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"), getStandardRequest("GET", "/org/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"),
getStandardPayloadResponse(403, "/org/error403-fake.xml", VCloudDirectorMediaType.ERROR)); getStandardPayloadResponse(403, "/org/error403-fake.xml", VCloudDirectorMediaType.ERROR));
@ -171,7 +171,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
public void testGetOrgMetadata() { public void testGetOrgMetadata() {
URI orgUri = URI.create(endpoint + "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"); URI orgUri = URI.create(endpoint + "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata") .apiCommand("GET", "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata")
.acceptAnyMedia() .acceptAnyMedia()
@ -198,7 +198,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
public void testGetOrgMetadataValue() { public void testGetOrgMetadataValue() {
URI orgUri = URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"); 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() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata/KEY") .apiCommand("GET", "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata/KEY")
.acceptAnyMedia() .acceptAnyMedia()

View File

@ -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.CONDITION_FMT;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.CORRECT_VALUE_OBJECT_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.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.checkMetadata;
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkMetadataValue; 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.checkOrg;
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkReferenceType; 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.assertEquals;
import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertNotNull;
@ -69,7 +69,7 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@AfterClass(groups = { "live" }) @AfterClass(groups = { "live" })
public void cleanUp() throws Exception { public void cleanUp() throws Exception {
if (metadataSet) { if (metadataSet) {
context.getApi().getAdminOrgClient().getMetadataClient() adminContext.getApi().getOrgClient().getMetadataClient()
.deleteMetadataEntry(toAdminUri(orgURI), "key"); .deleteMetadataEntry(toAdminUri(orgURI), "key");
} }
} }
@ -114,7 +114,7 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(testName = "orgClient admin metadata setup", dependsOnMethods = { "testGetOrg" }) @Test(testName = "orgClient admin metadata setup", dependsOnMethods = { "testGetOrg" })
public void testSetupMetadata() { public void testSetupMetadata() {
context.getApi().getAdminOrgClient().getMetadataClient().setMetadata(toAdminUri(orgURI), adminContext.getApi().getOrgClient().getMetadataClient().setMetadata(toAdminUri(orgURI),
"KEY", MetadataValue.builder().value("VALUE").build()); "KEY", MetadataValue.builder().value("VALUE").build());
metadataSet = true; metadataSet = true;
} }

View File

@ -24,7 +24,6 @@ import java.net.URI;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse; 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.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.CatalogReference; import org.jclouds.vcloud.director.v1_5.domain.CatalogReference;
import org.jclouds.vcloud.director.v1_5.domain.Link; 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.QueryResultRecordType;
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecords; 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.internal.BaseVCloudDirectorRestClientExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserClient;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.ImmutableMultimap;
@ -43,7 +43,7 @@ import com.google.common.collect.ImmutableMultimap;
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@Test(groups = { "unit", "user", "query" }, singleThreaded = true, testName = "QueryClientExpectTest") @Test(groups = { "unit", "user", "query" }, singleThreaded = true, testName = "QueryClientExpectTest")
public class QueryClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public class QueryClientExpectTest extends BaseVCloudDirectorRestClientExpectTest<VCloudDirectorUserClient> {
@Test @Test
public void testQueryAllCatalogs() { public void testQueryAllCatalogs() {
@ -61,7 +61,7 @@ public class QueryClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
.payload(payloadFromResourceWithContentType("/query/allCatalogs.xml", VCloudDirectorMediaType.QUERY_RESULT_RECORDS + ";version=1.5")) .payload(payloadFromResourceWithContentType("/query/allCatalogs.xml", VCloudDirectorMediaType.QUERY_RESULT_RECORDS + ";version=1.5"))
.build(); .build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse); VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse);
QueryResultRecords expected = QueryResultRecords.builder() QueryResultRecords expected = QueryResultRecords.builder()
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=records")) .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")) .payload(payloadFromResourceWithContentType("/query/allCatalogReferences.xml", VCloudDirectorMediaType.QUERY_RESULT_RECORDS + ";version=1.5"))
.build(); .build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse); VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, queryRequest, queryResponse);
CatalogReferences expected = CatalogReferences.builder() CatalogReferences expected = CatalogReferences.builder()
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=references")) .href(URI.create("https://vcloudbeta.bluelock.com/api/catalogs/query?page=1&pageSize=25&format=references"))

View File

@ -25,7 +25,6 @@ import java.net.URI;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse; 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.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Error; 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.Task;
import org.jclouds.vcloud.director.v1_5.domain.TasksList; 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.internal.BaseVCloudDirectorRestClientExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserClient;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.ImmutableMultimap;
@ -43,7 +43,7 @@ import com.google.common.collect.ImmutableMultimap;
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@Test(groups = { "unit", "user", "task" }, singleThreaded = true, testName = "TaskClientExpectTest") @Test(groups = { "unit", "user", "task" }, singleThreaded = true, testName = "TaskClientExpectTest")
public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest<VCloudDirectorUserClient> {
@Test @Test
public void testTaskListForValidOrg() { public void testTaskListForValidOrg() {
@ -75,7 +75,7 @@ public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
.payload(payloadFromResourceWithContentType("/org/org.xml", VCloudDirectorMediaType.TASKS_LIST + ";version=1.5")) .payload(payloadFromResourceWithContentType("/org/org.xml", VCloudDirectorMediaType.TASKS_LIST + ";version=1.5"))
.build(); .build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse, orgRequest, orgResponse); VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse, orgRequest, orgResponse);
TasksList expected = TasksList.builder() TasksList expected = TasksList.builder()
.name("Tasks Lists") .name("Tasks Lists")
@ -115,7 +115,7 @@ public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
.payload(payloadFromResourceWithContentType("/org/error400.xml", VCloudDirectorMediaType.ERROR + ";version=1.5")) .payload(payloadFromResourceWithContentType("/org/error400.xml", VCloudDirectorMediaType.ERROR + ";version=1.5"))
.build(); .build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse, orgRequest, orgResponse); VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse, orgRequest, orgResponse);
Error expected = Error.builder() Error expected = Error.builder()
.message("validation error on field 'id': String value has invalid format or length") .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")) .payload(payloadFromResourceWithContentType("/org/error403-fake.xml", VCloudDirectorMediaType.ERROR + ";version=1.5"))
.build(); .build();
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse, orgRequest, orgResponse); VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse, orgRequest, orgResponse);
Error expected = Error.builder() Error expected = Error.builder()
.message("No access to entity \"com.vmware.vcloud.entity.org:aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee\".") .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")) .payload(payloadFromResourceWithContentType("/task/task.xml", VCloudDirectorMediaType.TASK + ";version=1.5"))
.build(); .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"); URI taskUri = URI.create(endpoint + "/task/5fcd2af3-d0ec-45ce-9451-8c585a2c766b");
@ -219,7 +219,7 @@ public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
.statusCode(200) .statusCode(200)
.build(); .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"); URI taskUri = URI.create(endpoint + "/task/5fcd2af3-d0ec-45ce-9451-8c585a2c766b");

View File

@ -23,22 +23,23 @@ import static org.testng.Assert.assertEquals;
import java.net.URI; import java.net.URI;
import java.util.Collections; 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.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; 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.Link;
import org.jclouds.vcloud.director.v1_5.domain.Reference; 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.domain.User;
import org.jclouds.vcloud.director.v1_5.features.admin.UserClient;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
import org.testng.annotations.Test; 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 * @author danikov
*/ */
@Test(groups = { "unit", "admin", "adminUser"}, singleThreaded = true, testName = "UserClientExpectTest") @Test(groups = { "unit", "admin", "adminUser"}, singleThreaded = true, testName = "UserClientExpectTest")
public class UserClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public class UserClientExpectTest extends BaseVCloudDirectorRestClientExpectTest<VCloudDirectorAdminClient> {
private Reference orgRef = Reference.builder() private Reference orgRef = Reference.builder()
.href(URI.create(endpoint + "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")) .href(URI.create(endpoint + "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
@ -50,7 +51,7 @@ public class UserClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test @Test
public void testCreateUser() { public void testCreateUser() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/catalogs") .apiCommand("POST", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/catalogs")
.xmlFilePayload("/user/createUserSource.xml", VCloudDirectorMediaType.USER) .xmlFilePayload("/user/createUserSource.xml", VCloudDirectorMediaType.USER)
@ -113,7 +114,7 @@ public class UserClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test @Test
public void testGetUser() { public void testGetUser() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/admin/user/b37223f3-8792-477a-820f-334998f61cd6") .apiCommand("GET", "/admin/user/b37223f3-8792-477a-820f-334998f61cd6")
.acceptAnyMedia() .acceptAnyMedia()
@ -135,7 +136,7 @@ public class UserClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test @Test
public void testUpdateUser() { public void testUpdateUser() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", "/admin/user/b37223f3-8792-477a-820f-334998f61cd6") .apiCommand("PUT", "/admin/user/b37223f3-8792-477a-820f-334998f61cd6")
.xmlFilePayload("/user/updateUserSource.xml", VCloudDirectorMediaType.USER) .xmlFilePayload("/user/updateUserSource.xml", VCloudDirectorMediaType.USER)
@ -175,7 +176,7 @@ public class UserClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test @Test
public void testDeleteUser() { public void testDeleteUser() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("DELETE", "/admin/user/b37223f3-8792-477a-820f-334998f61cd6") .apiCommand("DELETE", "/admin/user/b37223f3-8792-477a-820f-334998f61cd6")
.acceptAnyMedia() .acceptAnyMedia()
@ -188,7 +189,7 @@ public class UserClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test @Test
public void testUnlockUser() { public void testUnlockUser() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", "/admin/user/b37223f3-8792-477a-820f-334998f61cd6/action/unlock") .apiCommand("POST", "/admin/user/b37223f3-8792-477a-820f-334998f61cd6/action/unlock")
.acceptAnyMedia() .acceptAnyMedia()
@ -201,7 +202,7 @@ public class UserClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(expectedExceptions = VCloudDirectorException.class) @Test(expectedExceptions = VCloudDirectorException.class)
public void testUnlockUserFailNotFound() { public void testUnlockUserFailNotFound() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", "/admin/user/b37223f3-8792-477a-820f-334998f61cd6/action/unlock") .apiCommand("POST", "/admin/user/b37223f3-8792-477a-820f-334998f61cd6/action/unlock")
.acceptAnyMedia() .acceptAnyMedia()

View File

@ -27,20 +27,18 @@ import static org.testng.Assert.fail;
import static org.testng.AssertJUnit.assertFalse; import static org.testng.AssertJUnit.assertFalse;
import java.net.URI; import java.net.URI;
import java.util.Random;
import org.jclouds.rest.AuthorizationException; 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.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.domain.Checks; import org.jclouds.vcloud.director.v1_5.domain.Checks;
import org.jclouds.vcloud.director.v1_5.domain.Error; 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.OrgPasswordPolicySettings;
import org.jclouds.vcloud.director.v1_5.domain.Reference; 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.SessionWithToken;
import org.jclouds.vcloud.director.v1_5.domain.User; 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.internal.BaseVCloudDirectorClientLiveTest;
import org.jclouds.vcloud.director.v1_5.login.SessionClient; import org.jclouds.vcloud.director.v1_5.login.SessionClient;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
@ -69,12 +67,11 @@ public class UserClientLiveTest extends BaseVCloudDirectorClientLiveTest {
*/ */
private Reference orgRef; private Reference orgRef;
private User user; private User user;
private static Random random = new Random();
@Override @Override
@BeforeClass(alwaysRun = true) @BeforeClass(alwaysRun = true)
public void setupRequiredClients() { public void setupRequiredClients() {
userClient = context.getApi().getUserClient(); userClient = adminContext.getApi().getUserClient();
orgRef = Iterables.getFirst(context.getApi().getOrgClient().getOrgList().getOrgs(), null).toAdminReference(endpoint); 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") @Test(testName = "POST /admin/org/{id}/users")
public void testCreateUser() { public void testCreateUser() {
User newUser = randomTestUser("testCreateUser", context); User newUser = randomTestUser("testCreateUser");
user = userClient.createUser(orgRef.getHref(), newUser); user = userClient.createUser(orgRef.getHref(), newUser);
Checks.checkUser(newUser); Checks.checkUser(newUser);
} }
@ -122,7 +119,7 @@ public class UserClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.password("newPassword") .password("newPassword")
// TODO test setting other fields? // TODO test setting other fields?
// .name("new"+oldUser.getName()) // .name("new"+oldUser.getName())
.role(nonVAppUserRole(context)) .role(getRoleReferenceFor(DefaultRoles.AUTHOR))
.build(); .build();
userClient.updateUser(user.getHref(), newUser); userClient.updateUser(user.getHref(), newUser);
@ -165,7 +162,7 @@ public class UserClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(testName = "POST /admin/user/{id}/action/unlock", dependsOnMethods = { "testUpdateUser" }) @Test(testName = "POST /admin/user/{id}/action/unlock", dependsOnMethods = { "testUpdateUser" })
public void testUnlockUser() { public void testUnlockUser() {
// Need to know how many times to fail login to lock account // 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; OrgPasswordPolicySettings settingsToRevertTo = null;
// session client isn't typically exposed to the user, as it is implicit // 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); assertEquals(vde.getError(), expected);
} }
} }
public static Reference vAppUserRole(RestContext<VCloudDirectorClient, VCloudDirectorAsyncClient> 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<VCloudDirectorClient, VCloudDirectorAsyncClient> 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<VCloudDirectorClient, VCloudDirectorAsyncClient> 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();
}
} }

View File

@ -22,7 +22,6 @@ import static org.testng.Assert.assertEquals;
import java.net.URI; 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.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.ControlAccessParams; import org.jclouds.vcloud.director.v1_5.domain.ControlAccessParams;
import org.jclouds.vcloud.director.v1_5.domain.DeployVAppParams; 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.StartupSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection; 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.internal.BaseVCloudDirectorRestClientExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserClient;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import org.testng.internal.annotations.Sets; import org.testng.internal.annotations.Sets;
@ -65,7 +65,7 @@ import com.google.common.collect.Multimaps;
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@Test(groups = { "unit", "user", "vapp" }, singleThreaded = true, testName = "VAppClientExpectTest") @Test(groups = { "unit", "user", "vapp" }, singleThreaded = true, testName = "VAppClientExpectTest")
public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest<VCloudDirectorUserClient> {
private String vAppId = "vapp-d0e2b6b9-4381-4ddc-9572-cdfae54059be"; private String vAppId = "vapp-d0e2b6b9-4381-4ddc-9572-cdfae54059be";
private URI vAppURI = URI.create(endpoint + vAppId); private URI vAppURI = URI.create(endpoint + vAppId);
@ -76,7 +76,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false)//TODO @Test(enabled = false)//TODO
public void testGetVapp() { public void testGetVapp() {
VCloudDirectorClient client = orderedRequestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId) .apiCommand("GET", vAppId)
.acceptMedia(VCloudDirectorMediaType.VAPP) .acceptMedia(VCloudDirectorMediaType.VAPP)
@ -92,7 +92,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testModifyVApp() { public void testModifyVApp() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId) .apiCommand("PUT", vAppId)
.xmlFilePayload("/vApp/modifyVApp.xml", VCloudDirectorMediaType.VAPP) .xmlFilePayload("/vApp/modifyVApp.xml", VCloudDirectorMediaType.VAPP)
@ -113,7 +113,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testDeleteVApp() { public void testDeleteVApp() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("DELETE", vAppId) .apiCommand("DELETE", vAppId)
.acceptAnyMedia() .acceptAnyMedia()
@ -129,7 +129,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testConsolidateVApp() { public void testConsolidateVApp() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/action/consolidate") .apiCommand("POST", vAppId + "/action/consolidate")
.acceptAnyMedia() .acceptAnyMedia()
@ -145,7 +145,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testControlAccess() { public void testControlAccess() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/action/controlAccess") .apiCommand("POST", vAppId + "/action/controlAccess")
.xmlFilePayload("/vApp/controlAccessParams.xml", VCloudDirectorMediaType.CONTROL_ACCESS) .xmlFilePayload("/vApp/controlAccessParams.xml", VCloudDirectorMediaType.CONTROL_ACCESS)
@ -164,7 +164,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testDeploy() { public void testDeploy() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/action/deploy") .apiCommand("POST", vAppId + "/action/deploy")
.xmlFilePayload("/vApp/deployParams.xml", VCloudDirectorMediaType.DEPLOY_VAPP_PARAMS) .xmlFilePayload("/vApp/deployParams.xml", VCloudDirectorMediaType.DEPLOY_VAPP_PARAMS)
@ -184,7 +184,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testDiscardSuspendedState() { public void testDiscardSuspendedState() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/action/discardSuspendedState") .apiCommand("POST", vAppId + "/action/discardSuspendedState")
.acceptAnyMedia() .acceptAnyMedia()
@ -200,7 +200,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testEnterMaintenanceMode() { public void testEnterMaintenanceMode() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/action/enterMaintenanceMode") .apiCommand("POST", vAppId + "/action/enterMaintenanceMode")
.acceptAnyMedia() .acceptAnyMedia()
@ -214,7 +214,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testExitMaintenanceMode() { public void testExitMaintenanceMode() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/action/exitMaintenanceMode") .apiCommand("POST", vAppId + "/action/exitMaintenanceMode")
.acceptAnyMedia() .acceptAnyMedia()
@ -228,7 +228,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testInstallVMwareTools() { public void testInstallVMwareTools() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/action/installVMwareTools") .apiCommand("POST", vAppId + "/action/installVMwareTools")
.acceptAnyMedia() .acceptAnyMedia()
@ -244,7 +244,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testRecomposeVApp() { public void testRecomposeVApp() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/action/recomposeVApp") .apiCommand("POST", vAppId + "/action/recomposeVApp")
.xmlFilePayload("/vApp/recomposeVAppParams.xml", VCloudDirectorMediaType.RECOMPOSE_VAPP_PARAMS) .xmlFilePayload("/vApp/recomposeVAppParams.xml", VCloudDirectorMediaType.RECOMPOSE_VAPP_PARAMS)
@ -264,7 +264,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testRelocate() { public void testRelocate() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/action/relocate") .apiCommand("POST", vAppId + "/action/relocate")
.xmlFilePayload("/vApp/relocateParams.xml", VCloudDirectorMediaType.RELOCATE_VM_PARAMS) .xmlFilePayload("/vApp/relocateParams.xml", VCloudDirectorMediaType.RELOCATE_VM_PARAMS)
@ -284,7 +284,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testUndeploy() { public void testUndeploy() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/action/undeploy") .apiCommand("POST", vAppId + "/action/undeploy")
.xmlFilePayload("/vApp/undeployParams.xml", VCloudDirectorMediaType.UNDEPLOY_VAPP_PARAMS) .xmlFilePayload("/vApp/undeployParams.xml", VCloudDirectorMediaType.UNDEPLOY_VAPP_PARAMS)
@ -304,7 +304,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testUpgradeHardwareVersion() { public void testUpgradeHardwareVersion() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/action/upgradeHardwareVersion") .apiCommand("POST", vAppId + "/action/upgradeHardwareVersion")
.acceptAnyMedia() .acceptAnyMedia()
@ -320,7 +320,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testPowerOff() { public void testPowerOff() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/power/action/powerOff") .apiCommand("POST", vAppId + "/power/action/powerOff")
.acceptAnyMedia() .acceptAnyMedia()
@ -336,7 +336,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testPowerOn() { public void testPowerOn() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/power/action/powerOn") .apiCommand("POST", vAppId + "/power/action/powerOn")
.acceptAnyMedia() .acceptAnyMedia()
@ -352,7 +352,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testReboot() { public void testReboot() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/power/action/reboot") .apiCommand("POST", vAppId + "/power/action/reboot")
.acceptAnyMedia() .acceptAnyMedia()
@ -368,7 +368,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testReset() { public void testReset() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/power/action/reset") .apiCommand("POST", vAppId + "/power/action/reset")
.acceptAnyMedia() .acceptAnyMedia()
@ -384,7 +384,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testShutdown() { public void testShutdown() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/power/action/shutdown") .apiCommand("POST", vAppId + "/power/action/shutdown")
.acceptAnyMedia() .acceptAnyMedia()
@ -400,7 +400,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testSuspend() { public void testSuspend() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/power/action/suspend") .apiCommand("POST", vAppId + "/power/action/suspend")
.acceptAnyMedia() .acceptAnyMedia()
@ -416,7 +416,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testGetControlAccesss() { public void testGetControlAccesss() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/controlAccess") .apiCommand("GET", vAppId + "/controlAccess")
.acceptAnyMedia() .acceptAnyMedia()
@ -432,7 +432,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testGetGuestCustomizationSection() { public void testGetGuestCustomizationSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/guestCustomizationSection") .apiCommand("GET", vAppId + "/guestCustomizationSection")
.acceptAnyMedia() .acceptAnyMedia()
@ -448,7 +448,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testModifyGuestCustomizationSection() { public void testModifyGuestCustomizationSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/guestCustomizationSection") .apiCommand("PUT", vAppId + "/guestCustomizationSection")
.xmlFilePayload("/vApp/modifyGuestCustomizationSection.xml", VCloudDirectorMediaType.GUEST_CUSTOMIZATION_SECTION) .xmlFilePayload("/vApp/modifyGuestCustomizationSection.xml", VCloudDirectorMediaType.GUEST_CUSTOMIZATION_SECTION)
@ -468,7 +468,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testGetLeaseSettingsSection() { public void testGetLeaseSettingsSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/leaseSettingsSection") .apiCommand("GET", vAppId + "/leaseSettingsSection")
.acceptAnyMedia() .acceptAnyMedia()
@ -484,7 +484,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testModifyLeaseSettingsSection() { public void testModifyLeaseSettingsSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/leaseSettingsSection") .apiCommand("PUT", vAppId + "/leaseSettingsSection")
.xmlFilePayload("/vApp/modifyLeaseSettingsSection.xml", VCloudDirectorMediaType.LEASE_SETTINGS_SECTION) .xmlFilePayload("/vApp/modifyLeaseSettingsSection.xml", VCloudDirectorMediaType.LEASE_SETTINGS_SECTION)
@ -504,7 +504,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testEjectMedia() { public void testEjectMedia() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/media/action/ejectMedia") .apiCommand("PUT", vAppId + "/media/action/ejectMedia")
.xmlFilePayload("/vApp/ejectMediaParams.xml", VCloudDirectorMediaType.MEDIA_PARAMS) .xmlFilePayload("/vApp/ejectMediaParams.xml", VCloudDirectorMediaType.MEDIA_PARAMS)
@ -524,7 +524,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testInsertMedia() { public void testInsertMedia() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/media/action/insertMedia") .apiCommand("PUT", vAppId + "/media/action/insertMedia")
.xmlFilePayload("/vApp/insertMediaParams.xml", VCloudDirectorMediaType.MEDIA_PARAMS) .xmlFilePayload("/vApp/insertMediaParams.xml", VCloudDirectorMediaType.MEDIA_PARAMS)
@ -544,7 +544,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testGetNetworkConfigSection() { public void testGetNetworkConfigSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/networkConfigSection") .apiCommand("GET", vAppId + "/networkConfigSection")
.acceptAnyMedia() .acceptAnyMedia()
@ -560,7 +560,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testModifyNetworkConfigSection() { public void testModifyNetworkConfigSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/networkConfigSection") .apiCommand("PUT", vAppId + "/networkConfigSection")
.xmlFilePayload("/vApp/modifyNetworkConfigSection.xml", VCloudDirectorMediaType.NETWORK_CONFIG_SECTION) .xmlFilePayload("/vApp/modifyNetworkConfigSection.xml", VCloudDirectorMediaType.NETWORK_CONFIG_SECTION)
@ -580,7 +580,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testGetNetworkConnectionSection() { public void testGetNetworkConnectionSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/networkConnectionSection") .apiCommand("GET", vAppId + "/networkConnectionSection")
.acceptAnyMedia() .acceptAnyMedia()
@ -596,7 +596,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testModifyNetworkConnectionSection() { public void testModifyNetworkConnectionSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/networkConnectionSection") .apiCommand("PUT", vAppId + "/networkConnectionSection")
.xmlFilePayload("/vApp/modifyNetworkConnectionSection.xml", VCloudDirectorMediaType.NETWORK_CONNECTION_SECTION) .xmlFilePayload("/vApp/modifyNetworkConnectionSection.xml", VCloudDirectorMediaType.NETWORK_CONNECTION_SECTION)
@ -616,7 +616,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testGetNetworkSection() { public void testGetNetworkSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/networkSection") .apiCommand("GET", vAppId + "/networkSection")
.acceptAnyMedia() .acceptAnyMedia()
@ -632,7 +632,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testGetOperatingSystemSection() { public void testGetOperatingSystemSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/operatingSystemSection") .apiCommand("GET", vAppId + "/operatingSystemSection")
.acceptAnyMedia() .acceptAnyMedia()
@ -648,7 +648,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testModifyOperatingSystemSection() { public void testModifyOperatingSystemSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/operatingSystemSection") .apiCommand("PUT", vAppId + "/operatingSystemSection")
.xmlFilePayload("/vApp/modifyOperatingSystemSection.xml", VCloudDirectorMediaType.OPERATING_SYSTEM_SECTION) .xmlFilePayload("/vApp/modifyOperatingSystemSection.xml", VCloudDirectorMediaType.OPERATING_SYSTEM_SECTION)
@ -668,7 +668,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testGetOwner() { public void testGetOwner() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/owner") .apiCommand("GET", vAppId + "/owner")
.acceptAnyMedia() .acceptAnyMedia()
@ -684,7 +684,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testModifyOwner() { public void testModifyOwner() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/owner") .apiCommand("PUT", vAppId + "/owner")
.xmlFilePayload("/vApp/modifyOwner.xml", VCloudDirectorMediaType.OWNER) .xmlFilePayload("/vApp/modifyOwner.xml", VCloudDirectorMediaType.OWNER)
@ -701,7 +701,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testGetProductSections() { public void testGetProductSections() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/productSections") .apiCommand("GET", vAppId + "/productSections")
.acceptAnyMedia() .acceptAnyMedia()
@ -717,7 +717,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testModifyProductSections() { public void testModifyProductSections() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/productSections") .apiCommand("PUT", vAppId + "/productSections")
.xmlFilePayload("/vApp/modifyProductSections.xml", VCloudDirectorMediaType.PRODUCT_SECTION_LIST) .xmlFilePayload("/vApp/modifyProductSections.xml", VCloudDirectorMediaType.PRODUCT_SECTION_LIST)
@ -734,7 +734,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testGetPendingQuestion() { public void testGetPendingQuestion() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/question") .apiCommand("GET", vAppId + "/question")
.acceptAnyMedia() .acceptAnyMedia()
@ -750,7 +750,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testAnswerQuestion() { public void testAnswerQuestion() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/question/action/answer") .apiCommand("PUT", vAppId + "/question/action/answer")
.xmlFilePayload("/vApp/answerQuestion.xml", VCloudDirectorMediaType.VM_PENDING_ANSWER) .xmlFilePayload("/vApp/answerQuestion.xml", VCloudDirectorMediaType.VM_PENDING_ANSWER)
@ -767,7 +767,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testGetRuntimeInfoSection() { public void testGetRuntimeInfoSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/runtimeInfoSection") .apiCommand("GET", vAppId + "/runtimeInfoSection")
.acceptAnyMedia() .acceptAnyMedia()
@ -783,7 +783,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testGetScreenImage() { public void testGetScreenImage() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/screen") .apiCommand("GET", vAppId + "/screen")
.acceptMedia(VCloudDirectorMediaType.ANY_IMAGE) .acceptMedia(VCloudDirectorMediaType.ANY_IMAGE)
@ -801,7 +801,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testGetScreenTicket() { public void testGetScreenTicket() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", vAppId + "/screen/action/acquireTicket") .apiCommand("POST", vAppId + "/screen/action/acquireTicket")
.acceptAnyMedia() .acceptAnyMedia()
@ -817,7 +817,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testGetStartupSection() { public void testGetStartupSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/startupSection") .apiCommand("GET", vAppId + "/startupSection")
.acceptAnyMedia() .acceptAnyMedia()
@ -833,7 +833,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testModifyStartupSection() { public void testModifyStartupSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/startupSection") .apiCommand("PUT", vAppId + "/startupSection")
.xmlFilePayload("/vApp/modifyStartupSection.xml", VCloudDirectorMediaType.STARTUP_SECTION) .xmlFilePayload("/vApp/modifyStartupSection.xml", VCloudDirectorMediaType.STARTUP_SECTION)
@ -853,7 +853,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testGetVirtualHardwareSection() { public void testGetVirtualHardwareSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/virtualHardwareSection") .apiCommand("GET", vAppId + "/virtualHardwareSection")
.acceptAnyMedia() .acceptAnyMedia()
@ -869,7 +869,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testModifyVirtualHardwareSection() { public void testModifyVirtualHardwareSection() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/virtualHardwareSection") .apiCommand("PUT", vAppId + "/virtualHardwareSection")
.xmlFilePayload("/vApp/modifyVirtualHardwareSection.xml", VCloudDirectorMediaType.VIRTUAL_HARDWARE_SECTION) .xmlFilePayload("/vApp/modifyVirtualHardwareSection.xml", VCloudDirectorMediaType.VIRTUAL_HARDWARE_SECTION)
@ -889,7 +889,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testGetVirtualHardwareSectionCpu() { public void testGetVirtualHardwareSectionCpu() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/virtualHardwareSection/cpu") .apiCommand("GET", vAppId + "/virtualHardwareSection/cpu")
.acceptAnyMedia() .acceptAnyMedia()
@ -905,7 +905,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testModifyVirtualHardwareSectionCpu() { public void testModifyVirtualHardwareSectionCpu() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("", vAppId + "/virtualHardwareSection/cpu") .apiCommand("", vAppId + "/virtualHardwareSection/cpu")
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionCpu.xml", VCloudDirectorMediaType.OVF_RASD_ITEM) .xmlFilePayload("/vApp/modifyVirtualHardwareSectionCpu.xml", VCloudDirectorMediaType.OVF_RASD_ITEM)
@ -925,7 +925,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testGetVirtualHardwareSectionDisks() { public void testGetVirtualHardwareSectionDisks() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/virtualHardwareSection/disks") .apiCommand("GET", vAppId + "/virtualHardwareSection/disks")
.acceptAnyMedia() .acceptAnyMedia()
@ -941,7 +941,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testModifyVirtualHardwareSectionDisks() { public void testModifyVirtualHardwareSectionDisks() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/virtualHardwareSection/disks") .apiCommand("PUT", vAppId + "/virtualHardwareSection/disks")
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionDisks.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST) .xmlFilePayload("/vApp/modifyVirtualHardwareSectionDisks.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST)
@ -961,7 +961,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testGetVirtualHardwareSectionMedia() { public void testGetVirtualHardwareSectionMedia() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/virtualHardwareSection/media") .apiCommand("GET", vAppId + "/virtualHardwareSection/media")
.acceptAnyMedia() .acceptAnyMedia()
@ -977,7 +977,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testGetVirtualHardwareSectionMemory() { public void testGetVirtualHardwareSectionMemory() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/virtualHardwareSection/memory") .apiCommand("GET", vAppId + "/virtualHardwareSection/memory")
.acceptAnyMedia() .acceptAnyMedia()
@ -993,7 +993,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testModifyVirtualHardwareSectionMemory() { public void testModifyVirtualHardwareSectionMemory() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/virtualHardwareSection/memory") .apiCommand("PUT", vAppId + "/virtualHardwareSection/memory")
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionMemory.xml", VCloudDirectorMediaType.VAPP) .xmlFilePayload("/vApp/modifyVirtualHardwareSectionMemory.xml", VCloudDirectorMediaType.VAPP)
@ -1013,7 +1013,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testGetVirtualHardwareSectionNetworkCards() { public void testGetVirtualHardwareSectionNetworkCards() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/virtualHardwareSection/networkCards") .apiCommand("GET", vAppId + "/virtualHardwareSection/networkCards")
.acceptAnyMedia() .acceptAnyMedia()
@ -1029,7 +1029,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testModifyVirtualHardwareSectionNetworkCards() { public void testModifyVirtualHardwareSectionNetworkCards() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/virtualHardwareSection/networkCards") .apiCommand("PUT", vAppId + "/virtualHardwareSection/networkCards")
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionNetworkCards.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST) .xmlFilePayload("/vApp/modifyVirtualHardwareSectionNetworkCards.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST)
@ -1049,7 +1049,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testGetVirtualHardwareSectionSerialPorts() { public void testGetVirtualHardwareSectionSerialPorts() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", vAppId + "/virtualHardwareSection/serialPorts") .apiCommand("GET", vAppId + "/virtualHardwareSection/serialPorts")
.acceptAnyMedia() .acceptAnyMedia()
@ -1065,7 +1065,7 @@ public class VAppClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testModifyVirtualHardwareSectionSerialPorts() { public void testModifyVirtualHardwareSectionSerialPorts() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("PUT", vAppId + "/virtualHardwareSection/serialPorts") .apiCommand("PUT", vAppId + "/virtualHardwareSection/serialPorts")
.xmlFilePayload("/vApp/modifyVirtualHardwareSectionSerialPorts.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST) .xmlFilePayload("/vApp/modifyVirtualHardwareSectionSerialPorts.xml", VCloudDirectorMediaType.OVF_RASD_ITEMS_LIST)

View File

@ -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.VAppNetworkConfiguration;
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate; 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.internal.BaseVCloudDirectorRestClientExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserClient;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -75,7 +76,7 @@ import com.google.common.collect.ImmutableSet;
* @author Adam Lowe * @author Adam Lowe
*/ */
@Test(groups = { "unit", "user", "vapptemplate" }, testName = "VAppTemplateClientExpectTest") @Test(groups = { "unit", "user", "vapptemplate" }, testName = "VAppTemplateClientExpectTest")
public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientExpectTest<VCloudDirectorUserClient> {
public VAppTemplateClientExpectTest() { public VAppTemplateClientExpectTest() {
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles")); TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));

View File

@ -23,7 +23,6 @@ import static org.testng.Assert.fail;
import java.net.URI; 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.VCloudDirectorException;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Capabilities; 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.VAppTemplate;
import org.jclouds.vcloud.director.v1_5.domain.Vdc; 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.internal.BaseVCloudDirectorRestClientExpectTest;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserClient;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -55,7 +55,7 @@ import org.testng.annotations.Test;
* @author danikov * @author danikov
*/ */
@Test(groups = { "unit", "user", "vdc" }, singleThreaded = true, testName = "VdcClientExpectTest") @Test(groups = { "unit", "user", "vdc" }, singleThreaded = true, testName = "VdcClientExpectTest")
public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest<VCloudDirectorUserClient> {
private URI vdcURI; private URI vdcURI;
@ -67,7 +67,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test @Test
public void testGetVdc() { public void testGetVdc() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f") .apiCommand("GET", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f")
.acceptAnyMedia() .acceptAnyMedia()
@ -84,7 +84,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test @Test
public void testResponse400ForInvalidVdcId() { public void testResponse400ForInvalidVdcId() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/vdc/NOTAUUID") .apiCommand("GET", "/vdc/NOTAUUID")
.acceptAnyMedia() .acceptAnyMedia()
@ -110,7 +110,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test @Test
public void testResponse403ForFakeVdcId() { public void testResponse403ForFakeVdcId() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/vdc/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee") .apiCommand("GET", "/vdc/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
.acceptAnyMedia() .acceptAnyMedia()
@ -135,7 +135,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testCaptureVApp() { public void testCaptureVApp() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/captureVApp") .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/captureVApp")
.xmlFilePayload("/vdc/params/captureVApp.xml", VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS) .xmlFilePayload("/vdc/params/captureVApp.xml", VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS)
@ -157,7 +157,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testResponse4xxForCaptureVAppNoParams() { public void testResponse4xxForCaptureVAppNoParams() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/captureVApp") .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/captureVApp")
.xmlFilePayload("/vdc/params/captureVApp.xml", VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS) .xmlFilePayload("/vdc/params/captureVApp.xml", VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS)
@ -183,7 +183,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testCloneVApp() { public void testCloneVApp() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneVAppTemplate") .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneVAppTemplate")
.xmlFilePayload("/vdc/params/cloneVApp.xml", VCloudDirectorMediaType.CLONE_VAPP_PARAMS) .xmlFilePayload("/vdc/params/cloneVApp.xml", VCloudDirectorMediaType.CLONE_VAPP_PARAMS)
@ -205,7 +205,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testCloneVAppTemplate() { public void testCloneVAppTemplate() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneVAppTemplate") .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneVAppTemplate")
.xmlFilePayload("/vdc/params/cloneVAppTemplate.xml", VCloudDirectorMediaType.CLONE_VAPP_TEMPLATE_PARAMS) .xmlFilePayload("/vdc/params/cloneVAppTemplate.xml", VCloudDirectorMediaType.CLONE_VAPP_TEMPLATE_PARAMS)
@ -227,7 +227,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testComposeVApp() { public void testComposeVApp() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/composeVApp") .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/composeVApp")
.xmlFilePayload("/vdc/params/composeVApp.xml", VCloudDirectorMediaType.COMPOSE_VAPP_PARAMS) .xmlFilePayload("/vdc/params/composeVApp.xml", VCloudDirectorMediaType.COMPOSE_VAPP_PARAMS)
@ -249,7 +249,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testInstantiateVAppTemplate() { public void testInstantiateVAppTemplate() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/instantiateVAppTemplate") .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/instantiateVAppTemplate")
.xmlFilePayload("/vdc/params/instantiateVAppTemplate.xml", VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS) .xmlFilePayload("/vdc/params/instantiateVAppTemplate.xml", VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS)
@ -271,7 +271,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
@Test(enabled = false) @Test(enabled = false)
public void testUploadVAppTemplate() { public void testUploadVAppTemplate() {
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/uploadVAppTemplate") .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/uploadVAppTemplate")
.xmlFilePayload("/vdc/params/uploadVAppTemplate.xml", VCloudDirectorMediaType.UPLOAD_VAPP_TEMPLATE_PARAMS) .xmlFilePayload("/vdc/params/uploadVAppTemplate.xml", VCloudDirectorMediaType.UPLOAD_VAPP_TEMPLATE_PARAMS)
@ -295,7 +295,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
public void testCreateMedia() { public void testCreateMedia() {
URI vdcUri = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f"); URI vdcUri = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media") .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/media")
.acceptMedia(VCloudDirectorMediaType.MEDIA) .acceptMedia(VCloudDirectorMediaType.MEDIA)
@ -321,7 +321,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
public void testCloneMedia() { public void testCloneMedia() {
URI vdcUri = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f"); URI vdcUri = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneMedia") .apiCommand("POST", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/action/cloneMedia")
.acceptMedia(VCloudDirectorMediaType.MEDIA) .acceptMedia(VCloudDirectorMediaType.MEDIA)
@ -351,7 +351,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
public void testGetMetadata() { public void testGetMetadata() {
URI vdcUri = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f"); URI vdcUri = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorUserClient client = requestsSendResponses(loginRequest, sessionResponse,
new VcloudHttpRequestPrimer() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/metadata") .apiCommand("GET", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/metadata")
.acceptAnyMedia() .acceptAnyMedia()
@ -369,7 +369,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
public void testGetMetadataValue() { public void testGetMetadataValue() {
URI vdcUri = URI.create("https://vcloudbeta.bluelock.com/api/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f"); 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() new VcloudHttpRequestPrimer()
.apiCommand("GET", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/metadata/key") .apiCommand("GET", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/metadata/key")
.acceptAnyMedia() .acceptAnyMedia()

View File

@ -105,7 +105,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
cleanUpVApp(composedVApp); cleanUpVApp(composedVApp);
} }
context.getApi().getAdminVdcClient().getMetadataClient() adminContext.getApi().getVdcClient().getMetadataClient()
.deleteMetadataEntry(toAdminUri(vdcURI), "key"); .deleteMetadataEntry(toAdminUri(vdcURI), "key");
} }
@ -309,7 +309,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(testName = "vdcClient admin metadata configuration", dependsOnMethods = { "testGetVdc" } ) @Test(testName = "vdcClient admin metadata configuration", dependsOnMethods = { "testGetVdc" } )
public void testSetupMetadata() { public void testSetupMetadata() {
context.getApi().getAdminVdcClient().getMetadataClient().setMetadata(toAdminUri(vdcURI), adminContext.getApi().getVdcClient().getMetadataClient().setMetadata(toAdminUri(vdcURI),
"key", MetadataValue.builder().value("value").build()); "key", MetadataValue.builder().value("value").build());
} }

View File

@ -29,9 +29,9 @@ import org.jclouds.date.DateService;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse; import org.jclouds.http.HttpResponse;
import org.jclouds.rest.BaseRestClientExpectTest; 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.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorUserClient;
import org.testng.annotations.BeforeGroups; import org.testng.annotations.BeforeGroups;
import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.ImmutableMultimap;
@ -44,7 +44,8 @@ import com.google.inject.Guice;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
public class BaseVCloudDirectorRestClientExpectTest extends BaseRestClientExpectTest<VCloudDirectorClient> { public abstract class BaseVCloudDirectorRestClientExpectTest<T extends VCloudDirectorUserClient>
extends BaseRestClientExpectTest<T> {
public static final String user = "adrian@jclouds.org"; public static final String user = "adrian@jclouds.org";
public static final String org = "JClouds"; public static final String org = "JClouds";