mirror of https://github.com/apache/jclouds.git
merged with latest vcloud-director lists-gone stuff
This commit is contained in:
commit
73ec8a66ff
|
@ -0,0 +1,37 @@
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
import org.jclouds.rest.RestContext;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminAsyncClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorContextImpl;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
|
||||||
|
|
||||||
|
import com.google.inject.ImplementedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author danikov
|
||||||
|
*/
|
||||||
|
@ImplementedBy(VCloudDirectorContextImpl.class)
|
||||||
|
public interface VCloudDirectorContext extends RestContext<VCloudDirectorClient, VCloudDirectorAsyncClient> {
|
||||||
|
|
||||||
|
RestContext<VCloudDirectorAdminClient, VCloudDirectorAdminAsyncClient> getAdminContext();
|
||||||
|
}
|
|
@ -23,6 +23,9 @@ import java.util.Properties;
|
||||||
|
|
||||||
import org.jclouds.rest.RestContextBuilder;
|
import org.jclouds.rest.RestContextBuilder;
|
||||||
import org.jclouds.vcloud.director.v1_5.config.VCloudDirectorRestClientModule;
|
import org.jclouds.vcloud.director.v1_5.config.VCloudDirectorRestClientModule;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.internal.VCloudDirectorContextImpl;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
|
||||||
|
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
|
|
||||||
|
@ -39,5 +42,10 @@ public class VCloudDirectorContextBuilder extends RestContextBuilder<VCloudDirec
|
||||||
protected void addClientModule(List<Module> modules) {
|
protected void addClientModule(List<Module> modules) {
|
||||||
modules.add(new VCloudDirectorRestClientModule());
|
modules.add(new VCloudDirectorRestClientModule());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public VCloudDirectorContext buildContext() {
|
||||||
|
return buildInjector().getInstance(VCloudDirectorContextImpl.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.VCloudDirectorAsyncClient;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides asynchronous access to VCloudDirector Admin via their REST API.
|
||||||
|
*
|
||||||
|
* @see VCloudDirectorAdminClient
|
||||||
|
* @author danikov
|
||||||
|
*/
|
||||||
|
public interface VCloudDirectorAdminAsyncClient extends VCloudDirectorAsyncClient {
|
||||||
|
/**
|
||||||
|
* @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();
|
||||||
|
}
|
|
@ -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.VCloudDirectorAsyncClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides synchronous access to VCloudDirector Admin.
|
||||||
|
*
|
||||||
|
* @see VCloudDirectorAsyncClient
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Timeout(duration = 60, timeUnit = TimeUnit.SECONDS)
|
||||||
|
public interface VCloudDirectorAdminClient extends VCloudDirectorClient {
|
||||||
|
/**
|
||||||
|
* @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();
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
/**
|
/**
|
||||||
|
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||||
* contributor license agreements. See the NOTICE file
|
* contributor license agreements. See the NOTICE file
|
||||||
* distributed with this work for additional information
|
* distributed with this work for additional information
|
||||||
* regarding copyright ownership. jclouds licenses this file
|
* regarding copyright ownership. jclouds licenses this file
|
||||||
|
@ -36,26 +37,17 @@ import org.jclouds.http.annotation.Redirection;
|
||||||
import org.jclouds.http.annotation.ServerError;
|
import org.jclouds.http.annotation.ServerError;
|
||||||
import org.jclouds.location.Provider;
|
import org.jclouds.location.Provider;
|
||||||
import org.jclouds.rest.ConfiguresRestClient;
|
import org.jclouds.rest.ConfiguresRestClient;
|
||||||
|
import org.jclouds.rest.RestContext;
|
||||||
|
import org.jclouds.rest.config.BinderUtils;
|
||||||
import org.jclouds.rest.config.RestClientModule;
|
import org.jclouds.rest.config.RestClientModule;
|
||||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorAsyncClient;
|
import org.jclouds.rest.internal.RestContextImpl;
|
||||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
|
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminAsyncClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient;
|
||||||
import org.jclouds.vcloud.director.v1_5.annotations.Login;
|
import org.jclouds.vcloud.director.v1_5.annotations.Login;
|
||||||
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.SessionWithToken;
|
import org.jclouds.vcloud.director.v1_5.domain.SessionWithToken;
|
||||||
import org.jclouds.vcloud.director.v1_5.features.AdminCatalogAsyncClient;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.features.AdminCatalogClient;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.features.AdminNetworkAsyncClient;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.features.AdminNetworkClient;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.features.AdminOrgAsyncClient;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.features.AdminOrgClient;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.features.AdminQueryAsyncClient;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.features.AdminQueryClient;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.features.AdminVdcAsyncClient;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.features.AdminVdcClient;
|
|
||||||
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.CatalogClient;
|
import org.jclouds.vcloud.director.v1_5.features.CatalogClient;
|
||||||
import org.jclouds.vcloud.director.v1_5.features.GroupAsyncClient;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.features.GroupClient;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.features.MediaAsyncClient;
|
import org.jclouds.vcloud.director.v1_5.features.MediaAsyncClient;
|
||||||
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.MetadataAsyncClient;
|
import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient;
|
||||||
|
@ -70,19 +62,33 @@ import org.jclouds.vcloud.director.v1_5.features.TaskAsyncClient;
|
||||||
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.UploadAsyncClient;
|
import org.jclouds.vcloud.director.v1_5.features.UploadAsyncClient;
|
||||||
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.UserAsyncClient;
|
|
||||||
import org.jclouds.vcloud.director.v1_5.features.UserClient;
|
|
||||||
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.VAppClient;
|
import org.jclouds.vcloud.director.v1_5.features.VAppClient;
|
||||||
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.VAppTemplateClient;
|
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient;
|
||||||
import org.jclouds.vcloud.director.v1_5.features.VdcAsyncClient;
|
import org.jclouds.vcloud.director.v1_5.features.VdcAsyncClient;
|
||||||
import org.jclouds.vcloud.director.v1_5.features.VdcClient;
|
import org.jclouds.vcloud.director.v1_5.features.VdcClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogAsyncClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.admin.AdminCatalogClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkAsyncClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.admin.AdminNetworkClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgAsyncClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.admin.AdminOrgClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.admin.AdminQueryAsyncClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.admin.AdminQueryClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.admin.AdminVdcAsyncClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.admin.AdminVdcClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.admin.GroupAsyncClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.admin.GroupClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.admin.UserAsyncClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.admin.UserClient;
|
||||||
import org.jclouds.vcloud.director.v1_5.functions.LoginUserInOrgWithPassword;
|
import org.jclouds.vcloud.director.v1_5.functions.LoginUserInOrgWithPassword;
|
||||||
import org.jclouds.vcloud.director.v1_5.handlers.InvalidateSessionAndRetryOn401AndLogoutOnClose;
|
import org.jclouds.vcloud.director.v1_5.handlers.InvalidateSessionAndRetryOn401AndLogoutOnClose;
|
||||||
import org.jclouds.vcloud.director.v1_5.handlers.VCloudDirectorErrorHandler;
|
import org.jclouds.vcloud.director.v1_5.handlers.VCloudDirectorErrorHandler;
|
||||||
import org.jclouds.vcloud.director.v1_5.login.SessionAsyncClient;
|
import org.jclouds.vcloud.director.v1_5.login.SessionAsyncClient;
|
||||||
import org.jclouds.vcloud.director.v1_5.login.SessionClient;
|
import org.jclouds.vcloud.director.v1_5.login.SessionClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
|
@ -93,128 +99,153 @@ import com.google.common.cache.LoadingCache;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
import com.google.inject.TypeLiteral;
|
||||||
import com.google.inject.name.Named;
|
import com.google.inject.name.Named;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the VCloudDirector connection.
|
* Configures the cloudstack connection.
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
@RequiresHttp
|
@RequiresHttp
|
||||||
@ConfiguresRestClient
|
@ConfiguresRestClient
|
||||||
public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirectorClient, VCloudDirectorAsyncClient> {
|
public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirectorClient, VCloudDirectorAsyncClient> {
|
||||||
|
|
||||||
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>>builder()
|
public static final Map<Class<?>, Class<?>> USER_DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>>builder()
|
||||||
.put(AdminCatalogClient.class, AdminCatalogAsyncClient.class)
|
.put(CatalogClient.class, CatalogAsyncClient.class)
|
||||||
.put(AdminOrgClient.class, AdminOrgAsyncClient.class)
|
.put(MediaClient.class, MediaAsyncClient.class)
|
||||||
.put(AdminVdcClient.class, AdminVdcAsyncClient.class)
|
.put(MetadataClient.Readable.class, MetadataAsyncClient.Readable.class)
|
||||||
.put(CatalogClient.class, CatalogAsyncClient.class)
|
.put(MetadataClient.Writeable.class, MetadataAsyncClient.Writeable.class)
|
||||||
.put(NetworkClient.class, NetworkAsyncClient.class)
|
.put(NetworkClient.class, NetworkAsyncClient.class)
|
||||||
.put(OrgClient.class, OrgAsyncClient.class)
|
.put(OrgClient.class, OrgAsyncClient.class)
|
||||||
.put(QueryClient.class, QueryAsyncClient.class)
|
.put(QueryClient.class, QueryAsyncClient.class)
|
||||||
.put(AdminQueryClient.class, AdminQueryAsyncClient.class)
|
.put(TaskClient.class, TaskAsyncClient.class)
|
||||||
.put(MediaClient.class, MediaAsyncClient.class)
|
.put(UploadClient.class, UploadAsyncClient.class)
|
||||||
.put(TaskClient.class, TaskAsyncClient.class)
|
.put(VAppClient.class, VAppAsyncClient.class)
|
||||||
.put(VdcClient.class, VdcAsyncClient.class)
|
.put(VAppTemplateClient.class, VAppTemplateAsyncClient.class)
|
||||||
.put(VAppClient.class, VAppAsyncClient.class)
|
.put(VdcClient.class, VdcAsyncClient.class)
|
||||||
.put(VAppTemplateClient.class, VAppTemplateAsyncClient.class)
|
.build();
|
||||||
.put(UploadClient.class, UploadAsyncClient.class)
|
|
||||||
.put(MetadataClient.Readable.class, MetadataAsyncClient.Readable.class)
|
public static final Map<Class<?>, Class<?>> ADMIN_DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>>builder()
|
||||||
.put(MetadataClient.Writeable.class, MetadataAsyncClient.Writeable.class)
|
.putAll(USER_DELEGATE_MAP)
|
||||||
.put(GroupClient.class, GroupAsyncClient.class)
|
.put(AdminCatalogClient.class, AdminCatalogAsyncClient.class)
|
||||||
.put(UserClient.class, UserAsyncClient.class)
|
.put(AdminNetworkClient.class, AdminNetworkAsyncClient.class)
|
||||||
.put(AdminNetworkClient.class, AdminNetworkAsyncClient.class)
|
.put(AdminOrgClient.class, AdminOrgAsyncClient.class)
|
||||||
.build();
|
.put(AdminQueryClient.class, AdminQueryAsyncClient.class)
|
||||||
|
.put(AdminVdcClient.class, AdminVdcAsyncClient.class)
|
||||||
public VCloudDirectorRestClientModule() {
|
.put(GroupClient.class, GroupAsyncClient.class)
|
||||||
super(VCloudDirectorClient.class, VCloudDirectorAsyncClient.class, DELEGATE_MAP);
|
.put(UserClient.class, UserAsyncClient.class)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void bindAsyncClient() {
|
||||||
|
// bind the user client (default)
|
||||||
|
super.bindAsyncClient();
|
||||||
|
// bind the admin client
|
||||||
|
BinderUtils.bindAsyncClient(binder(), VCloudDirectorAdminAsyncClient.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void bindClient() {
|
||||||
|
// bind the user client (default)
|
||||||
|
super.bindClient();
|
||||||
|
// bind the admin client
|
||||||
|
BinderUtils.bindClient(binder(), VCloudDirectorAdminClient.class, VCloudDirectorAdminAsyncClient.class, ADMIN_DELEGATE_MAP);
|
||||||
|
}
|
||||||
|
|
||||||
|
public VCloudDirectorRestClientModule() {
|
||||||
|
super(VCloudDirectorClient.class, VCloudDirectorAsyncClient.class, ADMIN_DELEGATE_MAP);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
|
bind(new TypeLiteral<RestContext<VCloudDirectorAdminClient, VCloudDirectorAdminAsyncClient>>() {
|
||||||
|
}).to(new TypeLiteral<RestContextImpl<VCloudDirectorAdminClient, VCloudDirectorAdminAsyncClient>>() {
|
||||||
|
});
|
||||||
|
|
||||||
// Bind clients that are used directly in Functions, Predicates and other circumstances
|
// Bind clients that are used directly in Functions, Predicates and other circumstances
|
||||||
bindClientAndAsyncClient(binder(), SessionClient.class, SessionAsyncClient.class);
|
|
||||||
bindClientAndAsyncClient(binder(), OrgClient.class, OrgAsyncClient.class);
|
bindClientAndAsyncClient(binder(), OrgClient.class, OrgAsyncClient.class);
|
||||||
|
bindClientAndAsyncClient(binder(), SessionClient.class, SessionAsyncClient.class);
|
||||||
bindClientAndAsyncClient(binder(), TaskClient.class, TaskAsyncClient.class);
|
bindClientAndAsyncClient(binder(), TaskClient.class, TaskAsyncClient.class);
|
||||||
bindClientAndAsyncClient(binder(), VAppClient.class, VAppAsyncClient.class);
|
bindClientAndAsyncClient(binder(), VAppClient.class, VAppAsyncClient.class);
|
||||||
|
|
||||||
bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(InvalidateSessionAndRetryOn401AndLogoutOnClose.class);
|
bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(InvalidateSessionAndRetryOn401AndLogoutOnClose.class);
|
||||||
|
|
||||||
super.configure();
|
super.configure();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void bindErrorHandlers() {
|
protected void bindErrorHandlers() {
|
||||||
bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(VCloudDirectorErrorHandler.class);
|
bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(VCloudDirectorErrorHandler.class);
|
||||||
bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(VCloudDirectorErrorHandler.class);
|
bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(VCloudDirectorErrorHandler.class);
|
||||||
bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(VCloudDirectorErrorHandler.class);
|
bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(VCloudDirectorErrorHandler.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Login
|
@Login
|
||||||
protected Supplier<URI> loginUrl(@Provider Supplier<URI> provider) {
|
protected Supplier<URI> loginUrl(@Provider Supplier<URI> provider) {
|
||||||
// TODO: technically, we should implement version client, but this will work
|
// TODO: technically, we should implement version client, but this will work
|
||||||
return Suppliers.compose(new Function<URI, URI>() {
|
return Suppliers.compose(new Function<URI, URI>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URI apply(URI arg0) {
|
public URI apply(URI arg0) {
|
||||||
return URI.create(arg0.toASCIIString() + "/sessions");
|
return URI.create(arg0.toASCIIString() + "/sessions");
|
||||||
}
|
}
|
||||||
|
|
||||||
}, provider);
|
}, provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
protected Supplier<Session> currentSession(Supplier<SessionWithToken> in) {
|
protected Supplier<Session> currentSession(Supplier<SessionWithToken> in) {
|
||||||
return Suppliers.compose(new Function<SessionWithToken, Session>() {
|
return Suppliers.compose(new Function<SessionWithToken, Session>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Session apply(SessionWithToken arg0) {
|
public Session apply(SessionWithToken arg0) {
|
||||||
return arg0.getSession();
|
return arg0.getSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
}, in);
|
}, in);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
@org.jclouds.vcloud.director.v1_5.annotations.Session
|
@org.jclouds.vcloud.director.v1_5.annotations.Session
|
||||||
protected Supplier<String> sessionToken(Supplier<SessionWithToken> in) {
|
protected Supplier<String> sessionToken(Supplier<SessionWithToken> in) {
|
||||||
return Suppliers.compose(new Function<SessionWithToken, String>() {
|
return Suppliers.compose(new Function<SessionWithToken, String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String apply(SessionWithToken arg0) {
|
public String apply(SessionWithToken arg0) {
|
||||||
return arg0.getToken();
|
return arg0.getToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
}, in);
|
}, in);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected Function<Credentials, SessionWithToken> makeSureFilterRetriesOnTimeout(
|
protected Function<Credentials, SessionWithToken> makeSureFilterRetriesOnTimeout(
|
||||||
LoginUserInOrgWithPassword loginWithPasswordCredentials) {
|
LoginUserInOrgWithPassword loginWithPasswordCredentials) {
|
||||||
// we should retry on timeout exception logging in.
|
// we should retry on timeout exception logging in.
|
||||||
return new RetryOnTimeOutExceptionFunction<Credentials, SessionWithToken>(loginWithPasswordCredentials);
|
return new RetryOnTimeOutExceptionFunction<Credentials, SessionWithToken>(loginWithPasswordCredentials);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
public LoadingCache<Credentials, SessionWithToken> provideSessionWithTokenCache(
|
public LoadingCache<Credentials, SessionWithToken> provideSessionWithTokenCache(
|
||||||
Function<Credentials, SessionWithToken> getSessionWithToken,
|
Function<Credentials, SessionWithToken> getSessionWithToken,
|
||||||
@Named(Constants.PROPERTY_SESSION_INTERVAL) int seconds) {
|
@Named(Constants.PROPERTY_SESSION_INTERVAL) int seconds) {
|
||||||
return CacheBuilder.newBuilder().expireAfterWrite(seconds, TimeUnit.SECONDS).build(
|
return CacheBuilder.newBuilder().expireAfterWrite(seconds, TimeUnit.SECONDS).build(
|
||||||
CacheLoader.from(getSessionWithToken));
|
CacheLoader.from(getSessionWithToken));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Temporary conversion of a cache to a supplier until there is a single-element cache
|
// Temporary conversion of a cache to a supplier until there is a single-element cache
|
||||||
// http://code.google.com/p/guava-libraries/issues/detail?id=872
|
// http://code.google.com/p/guava-libraries/issues/detail?id=872
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected Supplier<SessionWithToken> provideSessionWithTokenSupplier(
|
protected Supplier<SessionWithToken> provideSessionWithTokenSupplier(
|
||||||
final LoadingCache<Credentials, SessionWithToken> cache, @Provider final Credentials creds) {
|
final LoadingCache<Credentials, SessionWithToken> cache, @Provider final Credentials creds) {
|
||||||
return new Supplier<SessionWithToken>() {
|
return new Supplier<SessionWithToken>() {
|
||||||
@Override
|
@Override
|
||||||
public SessionWithToken get() {
|
public SessionWithToken get() {
|
||||||
|
|
|
@ -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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -139,7 +139,6 @@ public interface VAppAsyncClient {
|
||||||
@Produces(CONTROL_ACCESS)
|
@Produces(CONTROL_ACCESS)
|
||||||
@Consumes(CONTROL_ACCESS)
|
@Consumes(CONTROL_ACCESS)
|
||||||
@JAXBResponseParser
|
@JAXBResponseParser
|
||||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
|
||||||
ListenableFuture<ControlAccessParams> modifyControlAccess(@EndpointParam URI vAppURI,
|
ListenableFuture<ControlAccessParams> modifyControlAccess(@EndpointParam URI vAppURI,
|
||||||
@BinderParam(BindToXMLPayload.class) ControlAccessParams params);
|
@BinderParam(BindToXMLPayload.class) ControlAccessParams params);
|
||||||
|
|
||||||
|
|
|
@ -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.VCloudDirectorMediaType;
|
||||||
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.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 com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
|
@ -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;
|
||||||
|
@ -24,8 +24,11 @@ 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.AdminCatalog;
|
import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.Owner;
|
import org.jclouds.vcloud.director.v1_5.domain.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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to {@link AdminCatalog} objects.
|
* Provides synchronous access to {@link AdminCatalog} objects.
|
|
@ -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;
|
||||||
|
|
||||||
|
@ -39,6 +39,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 com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
|
@ -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.
|
|
@ -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;
|
||||||
|
|
||||||
|
@ -43,6 +43,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 com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
|
@ -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;
|
||||||
|
@ -31,6 +31,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 Org} objects.
|
* Provides synchronous access to {@link Org} objects.
|
|
@ -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;
|
||||||
|
|
||||||
|
@ -31,6 +31,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 com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
|
@ -16,13 +16,14 @@
|
||||||
* 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;
|
||||||
|
|
||||||
import org.jclouds.concurrent.Timeout;
|
import org.jclouds.concurrent.Timeout;
|
||||||
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.QueryClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to {@link AdminQuery} objects.
|
* Provides synchronous access to {@link AdminQuery} objects.
|
|
@ -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;
|
||||||
|
|
||||||
|
@ -37,6 +37,9 @@ import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||||
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.filters.AddVCloudAuthorizationToRequest;
|
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
|
@ -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.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.MetadataClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.VdcClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient.Writeable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to {@link AdminVdc}.
|
* Provides synchronous access to {@link AdminVdc}.
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
|
@ -0,0 +1,72 @@
|
||||||
|
/**
|
||||||
|
* 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.internal;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.domain.Credentials;
|
||||||
|
import org.jclouds.lifecycle.Closer;
|
||||||
|
import org.jclouds.location.Iso3166;
|
||||||
|
import org.jclouds.location.Provider;
|
||||||
|
import org.jclouds.rest.RestContext;
|
||||||
|
import org.jclouds.rest.Utils;
|
||||||
|
import org.jclouds.rest.annotations.ApiVersion;
|
||||||
|
import org.jclouds.rest.annotations.BuildVersion;
|
||||||
|
import org.jclouds.rest.annotations.Identity;
|
||||||
|
import org.jclouds.rest.internal.RestContextImpl;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.VCloudDirectorContext;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminAsyncClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
|
||||||
|
|
||||||
|
import com.google.common.base.Supplier;
|
||||||
|
import com.google.inject.Injector;
|
||||||
|
import com.google.inject.TypeLiteral;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author danikov
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
public class VCloudDirectorContextImpl extends RestContextImpl<VCloudDirectorClient, VCloudDirectorAsyncClient> implements
|
||||||
|
VCloudDirectorContext {
|
||||||
|
private final RestContext<VCloudDirectorAdminClient, VCloudDirectorAdminAsyncClient> adminContext;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
VCloudDirectorContextImpl(Closer closer, Map<String, Credentials> credentialStore, Utils utils, Injector injector,
|
||||||
|
TypeLiteral<VCloudDirectorClient> syncApi, TypeLiteral<VCloudDirectorAsyncClient> asyncApi,
|
||||||
|
@Provider Supplier<URI> endpoint, @Provider String provider,
|
||||||
|
@Identity String identity, @ApiVersion String apiVersion, @BuildVersion String buildVersion,
|
||||||
|
@Iso3166 Set<String> iso3166Codes,
|
||||||
|
RestContext<VCloudDirectorAdminClient, VCloudDirectorAdminAsyncClient> adminContext) {
|
||||||
|
super(closer, credentialStore, utils, injector, syncApi, asyncApi, endpoint, provider,
|
||||||
|
identity, apiVersion, buildVersion, iso3166Codes);
|
||||||
|
this.adminContext = adminContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RestContext<VCloudDirectorAdminClient, VCloudDirectorAdminAsyncClient> getAdminContext() {
|
||||||
|
return adminContext;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
@ -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();
|
|
||||||
}
|
}
|
|
@ -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,8 +48,8 @@ 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 VCloudDirectorClient {
|
||||||
|
@ -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();
|
|
||||||
}
|
}
|
|
@ -32,7 +32,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;
|
||||||
|
|
|
@ -22,13 +22,14 @@ 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.VCloudDirectorClient;
|
||||||
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<VCloudDirectorClient> {
|
||||||
|
|
||||||
public void testRestClientModuleWorksProperly() throws Exception {
|
public void testRestClientModuleWorksProperly() throws Exception {
|
||||||
|
|
||||||
|
|
|
@ -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.Link;
|
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.Owner;
|
import org.jclouds.vcloud.director.v1_5.domain.Owner;
|
||||||
|
@ -41,13 +41,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/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
|
||||||
.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")
|
||||||
|
@ -57,7 +51,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/6f312e42-cd2b-488d-a2bb-97519cd57ed0/catalogs")
|
.apiCommand("POST", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/catalogs")
|
||||||
.xmlFilePayload("/catalog/admin/createCatalogSource.xml", VCloudDirectorMediaType.ADMIN_CATALOG)
|
.xmlFilePayload("/catalog/admin/createCatalogSource.xml", VCloudDirectorMediaType.ADMIN_CATALOG)
|
||||||
|
@ -70,7 +64,7 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
|
||||||
AdminCatalog source = createCatalogSource();
|
AdminCatalog source = createCatalogSource();
|
||||||
AdminCatalog expected = createCatalog();
|
AdminCatalog expected = createCatalog();
|
||||||
|
|
||||||
assertEquals(client.getAdminCatalogClient().createCatalog(orgRef.getHref(), source), expected);
|
assertEquals(client.getCatalogClient().createCatalog(catalogRef.getHref(), source), expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME disabled due to intermittent JXB error: javax.xml.bind.UnmarshalException:
|
// FIXME disabled due to intermittent JXB error: javax.xml.bind.UnmarshalException:
|
||||||
|
@ -82,7 +76,7 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
|
||||||
// <{http://www.vmware.com/vcloud/v1.5}VAppReference>
|
// <{http://www.vmware.com/vcloud/v1.5}VAppReference>
|
||||||
@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() {
|
||||||
|
|
|
@ -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(description = "PUT /admin/catalog/{id}/owner",
|
@Test(description = "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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.Link;
|
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.OrgEmailSettings;
|
import org.jclouds.vcloud.director.v1_5.domain.OrgEmailSettings;
|
||||||
|
@ -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.BaseVCloudDirectorRestClientExpectTest;
|
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -44,7 +45,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"))
|
||||||
|
@ -52,7 +53,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()
|
||||||
|
@ -64,7 +65,7 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final AdminOrg adminOrg() {
|
public static final AdminOrg adminOrg() {
|
||||||
|
@ -186,7 +187,7 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
|
||||||
|
|
||||||
@Test(enabled = false)
|
@Test(enabled = false)
|
||||||
public void testGetSettings() {
|
public void testGetSettings() {
|
||||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
VCloudDirectorAdminClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||||
new VcloudHttpRequestPrimer()
|
new VcloudHttpRequestPrimer()
|
||||||
.apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/")
|
.apiCommand("GET", "/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/settings/")
|
||||||
.acceptAnyMedia()
|
.acceptAnyMedia()
|
||||||
|
@ -198,7 +199,318 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
|
||||||
|
|
||||||
OrgSettings expected = settings();
|
OrgSettings expected = settings();
|
||||||
|
|
||||||
assertEquals(client.getAdminOrgClient().getSettings(orgRef.getHref()), expected);
|
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 OrgSettings settings() {
|
public static final OrgSettings settings() {
|
||||||
|
@ -249,47 +561,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()
|
||||||
|
@ -314,25 +590,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()
|
||||||
|
@ -349,259 +606,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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,11 +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.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;
|
||||||
|
|
||||||
|
@ -40,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
|
||||||
|
|
||||||
|
@ -63,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"))
|
||||||
|
@ -84,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"?>
|
||||||
|
@ -111,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"))
|
||||||
|
@ -137,7 +138,7 @@ public class AdminQueryClientExpectTest extends BaseVCloudDirectorRestClientExpe
|
||||||
.build())
|
.build())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assertEquals(client.getAdminQueryClient().rolesQueryAll(), expected);
|
assertEquals(client.getQueryClient().rolesQueryAll(), expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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(description = "GET /admin/groups/query")
|
@Test(description = "GET /admin/groups/query")
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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.CatalogType;
|
import org.jclouds.vcloud.director.v1_5.domain.CatalogType;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||||
|
@ -46,7 +46,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() {
|
||||||
|
@ -64,7 +64,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();
|
||||||
|
|
||||||
|
@ -89,7 +89,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");
|
||||||
|
|
||||||
|
@ -120,7 +120,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");
|
||||||
|
|
||||||
|
@ -154,7 +154,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");
|
||||||
|
|
||||||
|
@ -179,13 +179,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
|
||||||
|
@ -205,7 +205,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();
|
||||||
|
@ -228,7 +228,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");
|
||||||
|
|
||||||
|
@ -251,7 +251,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");
|
||||||
|
|
||||||
|
@ -286,7 +286,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");
|
||||||
|
|
||||||
|
@ -313,7 +313,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");
|
||||||
|
|
||||||
|
@ -339,7 +339,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");
|
||||||
|
|
||||||
|
@ -366,7 +366,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");
|
||||||
|
|
||||||
|
@ -443,10 +443,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() {
|
||||||
|
@ -626,4 +626,4 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ 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.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.Vdc;
|
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;
|
||||||
|
@ -92,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)));
|
||||||
|
|
||||||
|
@ -114,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");
|
||||||
|
|
|
@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -24,7 +24,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;
|
||||||
|
@ -39,6 +38,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.VCloudDirectorClient;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -49,7 +49,7 @@ 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<VCloudDirectorClient> {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateMedia() {
|
public void testCreateMedia() {
|
||||||
|
|
|
@ -24,7 +24,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;
|
||||||
|
@ -43,6 +42,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.VCloudDirectorClient;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -53,7 +53,7 @@ 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<VCloudDirectorClient> {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetNetwork() {
|
public void testGetNetwork() {
|
||||||
|
|
|
@ -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");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,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;
|
||||||
|
@ -36,6 +35,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.VCloudDirectorClient;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -47,7 +47,7 @@ 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<VCloudDirectorClient> {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetOrgList() {
|
public void testGetOrgList() {
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||||
@AfterClass(alwaysRun = true)
|
@AfterClass(alwaysRun = true)
|
||||||
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(description = "orgClient admin metadata setup", dependsOnMethods = { "testGetOrg" })
|
@Test(description = "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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -32,6 +31,7 @@ import org.jclouds.vcloud.director.v1_5.domain.query.CatalogReferences;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultCatalogRecord;
|
import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultCatalogRecord;
|
||||||
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.VCloudDirectorClient;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMultimap;
|
import com.google.common.collect.ImmutableMultimap;
|
||||||
|
@ -42,7 +42,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<VCloudDirectorClient> {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryAllCatalogs() {
|
public void testQueryAllCatalogs() {
|
||||||
|
|
|
@ -26,7 +26,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;
|
||||||
|
@ -34,6 +33,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.VCloudDirectorClient;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMultimap;
|
import com.google.common.collect.ImmutableMultimap;
|
||||||
|
@ -44,7 +44,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<VCloudDirectorClient> {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTaskListForValidOrg() {
|
public void testTaskListForValidOrg() {
|
||||||
|
|
|
@ -24,11 +24,12 @@ import java.net.URI;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import org.jclouds.rest.ResourceNotFoundException;
|
import org.jclouds.rest.ResourceNotFoundException;
|
||||||
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.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;
|
||||||
|
|
||||||
|
@ -37,8 +38,8 @@ import org.testng.annotations.Test;
|
||||||
*
|
*
|
||||||
* @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 = ResourceNotFoundException.class)
|
@Test(expectedExceptions = ResourceNotFoundException.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()
|
||||||
|
|
|
@ -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(description = "POST /admin/org/{id}/users")
|
@Test(description = "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(description = "POST /admin/user/{id}/action/unlock", dependsOnMethods = { "testUpdateUser" })
|
@Test(description = "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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.VCloudDirectorClient;
|
||||||
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<VCloudDirectorClient> {
|
||||||
|
|
||||||
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);
|
||||||
|
|
|
@ -67,6 +67,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.VCloudDirectorClient;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
@ -77,7 +78,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<VCloudDirectorClient> {
|
||||||
|
|
||||||
public VAppTemplateClientExpectTest() {
|
public VAppTemplateClientExpectTest() {
|
||||||
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
|
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
|
||||||
|
|
|
@ -24,7 +24,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;
|
||||||
|
@ -47,6 +46,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.VCloudDirectorClient;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -56,7 +56,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<VCloudDirectorClient> {
|
||||||
|
|
||||||
private URI vdcURI;
|
private URI vdcURI;
|
||||||
|
|
||||||
|
|
|
@ -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(description = "vdcClient admin metadata configuration", dependsOnMethods = { "testGetVdc" } )
|
@Test(description = "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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,14 +19,17 @@
|
||||||
package org.jclouds.vcloud.director.v1_5.internal;
|
package org.jclouds.vcloud.director.v1_5.internal;
|
||||||
|
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.ENTITY_NON_NULL;
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.ENTITY_NON_NULL;
|
||||||
|
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.testng.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
import static org.testng.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
import static org.testng.Assert.fail;
|
import static org.testng.Assert.fail;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -43,10 +46,11 @@ import org.jclouds.rest.RestContext;
|
||||||
import org.jclouds.rest.RestContextFactory;
|
import org.jclouds.rest.RestContextFactory;
|
||||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||||
import org.jclouds.vcloud.director.testng.FormatApiResultsListener;
|
import org.jclouds.vcloud.director.testng.FormatApiResultsListener;
|
||||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorAsyncClient;
|
import org.jclouds.vcloud.director.v1_5.VCloudDirectorContext;
|
||||||
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.VCloudDirectorAdminAsyncClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.admin.VCloudDirectorAdminClient;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.InstantiateVAppTemplateParams;
|
import org.jclouds.vcloud.director.v1_5.domain.InstantiateVAppTemplateParams;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.InstantiationParams;
|
import org.jclouds.vcloud.director.v1_5.domain.InstantiationParams;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||||
|
@ -56,9 +60,12 @@ import org.jclouds.vcloud.director.v1_5.domain.NetworkConfiguration;
|
||||||
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.Reference;
|
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||||
import org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status;
|
import org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType.Status;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.Role.DefaultRoles;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.domain.RoleReferences;
|
||||||
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.UndeployVAppParams;
|
import org.jclouds.vcloud.director.v1_5.domain.UndeployVAppParams;
|
||||||
|
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.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;
|
||||||
|
@ -70,6 +77,9 @@ import org.jclouds.vcloud.director.v1_5.features.VdcClient;
|
||||||
import org.jclouds.vcloud.director.v1_5.predicates.ReferencePredicates;
|
import org.jclouds.vcloud.director.v1_5.predicates.ReferencePredicates;
|
||||||
import org.jclouds.vcloud.director.v1_5.predicates.TaskStatusEquals;
|
import org.jclouds.vcloud.director.v1_5.predicates.TaskStatusEquals;
|
||||||
import org.jclouds.vcloud.director.v1_5.predicates.TaskSuccess;
|
import org.jclouds.vcloud.director.v1_5.predicates.TaskSuccess;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorAsyncClient;
|
||||||
|
import org.jclouds.vcloud.director.v1_5.user.VCloudDirectorClient;
|
||||||
|
import org.testng.annotations.AfterClass;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Listeners;
|
import org.testng.annotations.Listeners;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -105,11 +115,15 @@ public abstract class BaseVCloudDirectorClientLiveTest extends BaseVersionedServ
|
||||||
public static final String VAPP = "vApp";
|
public static final String VAPP = "vApp";
|
||||||
public static final String VAPP_TEMPLATE = "vAppTemplate";
|
public static final String VAPP_TEMPLATE = "vAppTemplate";
|
||||||
public static final String VDC = "vdc";
|
public static final String VDC = "vdc";
|
||||||
|
public static final int REQUIRED_ADMIN_VM_QUOTA = 0;
|
||||||
|
public static final int REQUIRED_USER_VM_QUOTA = 0;
|
||||||
|
|
||||||
public Predicate<Task> retryTaskSuccess;
|
public Predicate<Task> retryTaskSuccess;
|
||||||
public Predicate<Task> retryTaskSuccessLong;
|
public Predicate<Task> retryTaskSuccessLong;
|
||||||
|
|
||||||
protected RestContext<VCloudDirectorClient, VCloudDirectorAsyncClient> context;
|
protected RestContext<VCloudDirectorAdminClient, VCloudDirectorAdminAsyncClient> adminContext;
|
||||||
|
protected RestContext<VCloudDirectorClient, VCloudDirectorAsyncClient> context; // FIXME: rename to userContext?
|
||||||
|
protected Session adminSession;
|
||||||
protected Session session;
|
protected Session session;
|
||||||
|
|
||||||
protected String catalogId;
|
protected String catalogId;
|
||||||
|
@ -151,14 +165,80 @@ public abstract class BaseVCloudDirectorClientLiveTest extends BaseVersionedServ
|
||||||
protected void setupContext() throws Exception {
|
protected void setupContext() throws Exception {
|
||||||
setupCredentials();
|
setupCredentials();
|
||||||
Properties overrides = setupProperties();
|
Properties overrides = setupProperties();
|
||||||
|
|
||||||
context = new RestContextFactory().createContext(provider, identity, credential, ImmutableSet.<Module> of(
|
VCloudDirectorContext rootContext = VCloudDirectorContext.class.cast(
|
||||||
|
new RestContextFactory().createContext(provider, identity, credential, ImmutableSet.<Module> of(
|
||||||
|
new Log4JLoggingModule(), new SshjSshClientModule()), overrides));
|
||||||
|
|
||||||
|
rootContext.utils().injector().injectMembers(this);
|
||||||
|
Reference orgRef = Iterables.getFirst(rootContext.getApi().getOrgClient().getOrgList().getOrgs(), null)
|
||||||
|
.toAdminReference(endpoint);
|
||||||
|
assertNotNull(orgRef, String.format(REF_REQ_LIVE, "admin org"));
|
||||||
|
|
||||||
|
String adminIdentity = "testAdmin"+new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
|
||||||
|
String adminCredential = "testAdminPassword";
|
||||||
|
rootContext.getAdminContext().getApi().getUserClient().createUser(orgRef.getHref(), User.builder()
|
||||||
|
.name(adminIdentity)
|
||||||
|
.password(adminCredential)
|
||||||
|
.description("test user with user-level privileges") //TODO desc
|
||||||
|
.role(getRoleReferenceFor(DefaultRoles.ORG_ADMIN))
|
||||||
|
.deployedVmQuota(REQUIRED_ADMIN_VM_QUOTA)
|
||||||
|
.isEnabled(true)
|
||||||
|
.build());
|
||||||
|
|
||||||
|
rootContext.close(); rootContext = null;
|
||||||
|
|
||||||
|
adminContext = VCloudDirectorContext.class.cast(new RestContextFactory().createContext(provider, adminIdentity, adminCredential, ImmutableSet.<Module> of(
|
||||||
|
new Log4JLoggingModule(), new SshjSshClientModule()), overrides)).getAdminContext();
|
||||||
|
adminSession = adminContext.getApi().getCurrentSession();
|
||||||
|
adminContext.utils().injector().injectMembers(this);
|
||||||
|
String userIdentity = "test"+new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
|
||||||
|
String userCredential = "testPassword";
|
||||||
|
|
||||||
|
adminContext.getApi().getUserClient().createUser(orgRef.getHref(), User.builder()
|
||||||
|
.name(userIdentity)
|
||||||
|
.password(userCredential)
|
||||||
|
.description("test user with user-level privileges")
|
||||||
|
.role(getRoleReferenceFor(DefaultRoles.USER))
|
||||||
|
.deployedVmQuota(REQUIRED_USER_VM_QUOTA)
|
||||||
|
.isEnabled(true)
|
||||||
|
.build());
|
||||||
|
|
||||||
|
context = new RestContextFactory().createContext(provider, userIdentity, userCredential, ImmutableSet.<Module> of(
|
||||||
new Log4JLoggingModule(), new SshjSshClientModule()), overrides);
|
new Log4JLoggingModule(), new SshjSshClientModule()), overrides);
|
||||||
session = context.getApi().getCurrentSession();
|
session = context.getApi().getCurrentSession();
|
||||||
context.utils().injector().injectMembers(this);
|
context.utils().injector().injectMembers(this);
|
||||||
|
|
||||||
initTestParametersFromPropertiesOrLazyDiscover();
|
initTestParametersFromPropertiesOrLazyDiscover();
|
||||||
setupRequiredClients();
|
setupRequiredClients();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Reference getRoleReferenceFor(String name) {
|
||||||
|
RoleReferences roles = adminContext.getApi().getQueryClient().roleReferencesQueryAll();
|
||||||
|
return Iterables.find(roles.getReferences(), ReferencePredicates.nameEquals(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
public User randomTestUser(String prefix) {
|
||||||
|
return randomTestUser(prefix, getRoleReferenceFor(DefaultRoles.USER));
|
||||||
|
}
|
||||||
|
|
||||||
|
public 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();
|
||||||
|
}
|
||||||
|
|
||||||
// TODO change properties to URI, not id
|
// TODO change properties to URI, not id
|
||||||
protected void initTestParametersFromPropertiesOrLazyDiscover() {
|
protected void initTestParametersFromPropertiesOrLazyDiscover() {
|
||||||
|
@ -206,9 +286,12 @@ public abstract class BaseVCloudDirectorClientLiveTest extends BaseVersionedServ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AfterClass(alwaysRun = true)
|
||||||
protected void tearDown() {
|
protected void tearDown() {
|
||||||
if (context != null)
|
if (context != null)
|
||||||
context.close();
|
context.close();
|
||||||
|
if (adminContext != null)
|
||||||
|
adminContext.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public URI toAdminUri(Reference ref) {
|
public URI toAdminUri(Reference ref) {
|
||||||
|
|
|
@ -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.VCloudDirectorClient;
|
||||||
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 VCloudDirectorClient>
|
||||||
|
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";
|
||||||
|
|
Loading…
Reference in New Issue