groupClient base classes

This commit is contained in:
danikov 2012-03-08 09:11:24 +00:00
parent 88cff6372d
commit fe449cbab3
12 changed files with 813 additions and 4 deletions

View File

@ -20,6 +20,7 @@ package org.jclouds.vcloud.director.v1_5;
import org.jclouds.rest.annotations.Delegate; import org.jclouds.rest.annotations.Delegate;
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;
@ -28,6 +29,7 @@ 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.AdminCatalogAsyncClient;
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;
@ -112,4 +114,10 @@ public interface VCloudDirectorAsyncClient {
*/ */
@Delegate @Delegate
AdminCatalogAsyncClient getAdminCatalogClient(); AdminCatalogAsyncClient getAdminCatalogClient();
/**
* @return asynchronous access to {@link Group} features
*/
@Delegate
GroupAsyncClient getGroupClient();
} }

View File

@ -23,6 +23,7 @@ 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.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;
@ -31,6 +32,7 @@ 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.AdminCatalogClient;
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;
@ -115,5 +117,10 @@ public interface VCloudDirectorClient {
*/ */
@Delegate @Delegate
AdminCatalogClient getAdminCatalogClient(); AdminCatalogClient getAdminCatalogClient();
/**
* @return synchronous access to {@link Group} features
*/
@Delegate
GroupClient getGroupClient();
} }

View File

@ -133,6 +133,8 @@ public class VCloudDirectorMediaType {
public static final String PUBLISH_CATALOG_PARAMS = "application/vnd.vmware.admin.publishCatalogParams+xml"; public static final String PUBLISH_CATALOG_PARAMS = "application/vnd.vmware.admin.publishCatalogParams+xml";
public static final String GROUP = "application/vnd.vmware.admin.group+xml";
/** /**
* *
* All acceptable media types. * All acceptable media types.
@ -151,6 +153,6 @@ public class VCloudDirectorMediaType {
CONTROL_ACCESS, VAPP_TEMPLATE, CUSTOMIZATION_SECTION, GUEST_CUSTOMIZATION_SECTION, CONTROL_ACCESS, VAPP_TEMPLATE, CUSTOMIZATION_SECTION, GUEST_CUSTOMIZATION_SECTION,
NETWORK_SECTION, NETWORK_CONFIG_SECTION, NETWORK_CONNECTION_SECTION, NETWORK_SECTION, NETWORK_CONFIG_SECTION, NETWORK_CONNECTION_SECTION,
CLONE_MEDIA_PARAMS, LEASE_SETTINGS_SECTION, RELOCATE_TEMPLATE, ENVELOPE, CLONE_MEDIA_PARAMS, LEASE_SETTINGS_SECTION, RELOCATE_TEMPLATE, ENVELOPE,
PUBLISH_CATALOG_PARAMS PUBLISH_CATALOG_PARAMS, GROUP
); );
} }

View File

@ -86,6 +86,7 @@ public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirec
.put(MetadataClient.Readable.class, MetadataAsyncClient.Readable.class) .put(MetadataClient.Readable.class, MetadataAsyncClient.Readable.class)
.put(MetadataClient.Writeable.class, MetadataAsyncClient.Writable.class) .put(MetadataClient.Writeable.class, MetadataAsyncClient.Writable.class)
.put(AdminCatalogClient.class, AdminCatalogAsyncClient.class) .put(AdminCatalogClient.class, AdminCatalogAsyncClient.class)
.put(GroupClient.class, GroupAsyncClient.class)
.build(); .build();
public VCloudDirectorRestClientModule() { public VCloudDirectorRestClientModule() {

View File

@ -0,0 +1,265 @@
/**
* 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.domain;
import static com.google.common.base.Objects.equal;
import java.net.URI;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
/**
*
* Represents group in the system.
*
*
* <p>Java class for Group complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="Group">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}EntityType">
* &lt;sequence>
* &lt;element name="NameInSource" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="UsersList" type="{http://www.vmware.com/vcloud/v1.5}UsersListType" minOccurs="0"/>
* &lt;element name="Role" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Group")
@XmlType(propOrder = {
"nameInSource",
"usersList",
"role"
})
public class Group extends EntityType<Group> {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromGroup(this);
}
public static class Builder extends EntityType.Builder<Group> {
private String nameInSource;
private UsersList usersList;
private Reference role;
/**
* @see Group#getNameInSource()
*/
public Builder nameInSource(String nameInSource) {
this.nameInSource = nameInSource;
return this;
}
/**
* @see Group#getUsersList()
*/
public Builder usersList(UsersList usersList) {
this.usersList = usersList;
return this;
}
/**
* @see Group#getRole()
*/
public Builder role(Reference role) {
this.role = role;
return this;
}
public Group build() {
return new Group(href, type, links, description, tasksInProgress, id, name,
nameInSource, usersList, role);
}
/**
* @see EntityType#getId()
*/
@Override
public Builder id(String id) {
super.id(id);
return this;
}
/**
* @see EntityType#getTasksInProgress()
*/
@Override
public Builder tasksInProgress(TasksInProgress tasksInProgress) {
super.tasksInProgress(tasksInProgress);
return this;
}
/**
* @see ReferenceType#getHref()
*/
@Override
public Builder href(URI href) {
super.href(href);
return this;
}
/**
* @see ReferenceType#getType()
*/
@Override
public Builder type(String type) {
super.type(type);
return this;
}
/**
* @see ReferenceType#getLinks()
*/
@Override
public Builder links(Set<Link> links) {
super.links(links);
return this;
}
/**
* @see ReferenceType#getLinks()
*/
@Override
public Builder link(Link link) {
super.link(link);
return this;
}
@Override
public Builder fromEntityType(EntityType<Group> in) {
return Builder.class.cast(super.fromEntityType(in));
}
public Builder fromGroup(Group in) {
return fromEntityType(in)
.nameInSource(in.getNameInSource())
.usersList(in.getUsersList())
.role(in.getRole());
}
}
@SuppressWarnings("unused")
private Group() {
// For JAXB
}
public Group(URI href, String type, Set<Link> links, String description,
TasksInProgress tasksInProgress, String id, String name, String nameInSource,
UsersList usersList, Reference role) {
super(href, type, links, description, tasksInProgress, id, name);
this.nameInSource = nameInSource;
this.usersList = usersList;
this.role = role;
}
@XmlElement(name = "NameInSource")
protected String nameInSource;
@XmlElement(name = "UsersList")
protected UsersList usersList;
@XmlElement(name = "Role")
protected Reference role;
/**
* Gets the value of the nameInSource property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getNameInSource() {
return nameInSource;
}
/**
* Gets the value of the usersList property.
*
* @return
* possible object is
* {@link UsersList }
*
*/
public UsersList getUsersList() {
return usersList;
}
/**
* Gets the value of the role property.
*
* @return
* possible object is
* {@link Reference }
*
*/
public Reference getRole() {
return role;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
Group that = Group.class.cast(o);
return super.equals(that) &&
equal(nameInSource, that.nameInSource) &&
equal(usersList, that.usersList) &&
equal(role, that.role);
}
@Override
public int hashCode() {
return Objects.hashCode(super.hashCode(),
nameInSource,
usersList,
role);
}
@Override
public String toString() {
return super.string()
.add("nameInSource", nameInSource)
.add("usersList", usersList)
.add("role", role).toString();
}
}

View File

@ -0,0 +1,165 @@
/**
* 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.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList;
/**
*
* Container for ReferenceType elements that reference groups.
*
*
* <p>Java class for GroupsList complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="GroupsList">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="GroupReference" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "GroupsList")
@XmlType(propOrder = {
"groupReference"
})
public class GroupsList {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromGroupsList(this);
}
public static class Builder {
private List<Reference> groups;
/**
* @see GroupsList#getGroupReference()
*/
public Builder groups(List<Reference> groups) {
this.groups = ImmutableList.copyOf(groups);
return this;
}
/**
* @see GroupsList#getGroupReference()
*/
public Builder group(Reference group) {
groups.add(checkNotNull(group, "group"));
return this;
}
public GroupsList build() {
return new GroupsList(groups);
}
public Builder fromGroupsList(GroupsList in) {
return groups(in.getGroups());
}
}
private GroupsList() {
// For JAXB
}
private GroupsList(List<Reference> groups) {
this.groups = groups;
}
@XmlElement(name = "GroupReference")
protected List<Reference> groups;
/**
* Gets the value of the groupReference property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the groupReference property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getGroupReference().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ReferenceType }
*
*
*/
public List<Reference> getGroups() {
if (groups == null) {
groups = new ArrayList<Reference>();
}
return this.groups;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
GroupsList that = GroupsList.class.cast(o);
return equal(groups, that.groups);
}
@Override
public int hashCode() {
return Objects.hashCode(groups);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("groups", groups).toString();
}
}

View File

@ -0,0 +1,165 @@
/**
* 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.domain;
import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableList;
/**
*
* Container for ReferenceType elements that reference users.
*
*
* <p>Java class for UsersList complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="UsersList">
* &lt;complexContent>
* &lt;extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
* &lt;sequence>
* &lt;element name="UserReference" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;anyAttribute processContents='lax' namespace='##other'/>
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "UsersList")
@XmlType(propOrder = {
"userReference"
})
public class UsersList {
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().fromUsersList(this);
}
public static class Builder {
private List<Reference> users;
/**
* @see UsersList#getUsers()
*/
public Builder users(List<Reference> users) {
this.users = ImmutableList.copyOf(users);
return this;
}
/**
* @see UsersList#getUsers()
*/
public Builder user(Reference user) {
users.add(checkNotNull(user, "user"));
return this;
}
public UsersList build() {
return new UsersList(users);
}
public Builder fromUsersList(UsersList in) {
return users(in.getUsers());
}
}
private UsersList() {
// For JAXB and builder use
}
private UsersList(List<Reference> users) {
this.users = users;
}
@XmlElement(name = "UserReference")
protected List<Reference> users;
/**
* Gets the value of the userReference property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the userReference property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getUserReference().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ReferenceType }
*
*
*/
public List<Reference> getUsers() {
if (users == null) {
users = new ArrayList<Reference>();
}
return this.users;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
UsersList that = UsersList.class.cast(o);
return equal(users, that.users);
}
@Override
public int hashCode() {
return Objects.hashCode(users);
}
@Override
public String toString() {
return Objects.toStringHelper("")
.add("userReference", users).toString();
}
}

View File

@ -0,0 +1,31 @@
/**
* 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.features;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
/**
* @see GroupClient
* @author danikov
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface GroupAsyncClient {
}

View File

@ -0,0 +1,34 @@
/**
* 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.features;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
/**
* Provides synchronous access to {@link Group} objects.
*
* @see GroupAsyncClient
* @author danikov
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface GroupClient {
}

View File

@ -485,11 +485,43 @@ public class Checks {
public static void checkMediaFor(String client, Media media) { public static void checkMediaFor(String client, Media media) {
// required // required
assertNotNull(media.getImageType(), String.format(OBJ_FIELD_REQ, client, "imageType")); assertNotNull(media.getImageType(), String.format(OBJ_FIELD_REQ, client, "imageType"));
Checks.checkImageType(media.getImageType()); checkImageType(media.getImageType());
assertNotNull(media.getSize(), String.format(OBJ_FIELD_REQ, client, "size")); assertNotNull(media.getSize(), String.format(OBJ_FIELD_REQ, client, "size"));
assertTrue(media.getSize() >= 0, String.format(OBJ_FIELD_GTE_0, client, "size", media.getSize())); assertTrue(media.getSize() >= 0, String.format(OBJ_FIELD_GTE_0, client, "size", media.getSize()));
// parent type // parent type
Checks.checkResourceEntityType(media); checkResourceEntityType(media);
}
public static void checkGroupsList(GroupsList groupsList) {
// Check optional fields
if (groupsList.getGroups() != null) {
for (Reference group : groupsList.getGroups()) {
checkReferenceType(group);
}
}
}
public static void checkGroup(Group group) {
// Check optional fields
// NOTE nameInSource cannot be checked
if (group.getUsersList() != null) {
checkUsersList(group.getUsersList());
}
if (group.getRole() != null) {
checkReferenceType(group.getRole());
}
// parent type
checkEntityType(group);
}
public static void checkUsersList(UsersList usersList) {
// Check optional fields
if (usersList.getUsers() != null) {
for (Reference user : usersList.getUsers()) {
checkReferenceType(user);
}
}
} }
} }

View File

@ -0,0 +1,40 @@
/*
* 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.features;
import java.net.URI;
import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
import org.testng.annotations.Test;
/**
* Test the {@link GroupClient} by observing its side effects.
*
* @author danikov
*/
@Test(groups = { "unit", "user", "group"}, singleThreaded = true, testName = "GroupClientExpectTest")
public class GroupClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
private Reference groupRef = Reference.builder()
.type("application/vnd.vmware.vcloud.catalog+xml")
.name("???")
.href(URI.create(endpoint + "/admin/group/???"))
.build();
}

View File

@ -0,0 +1,59 @@
/*
* 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.features;
import java.net.URI;
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.ReferenceType;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* Tests live behavior of {@link AdminCatalogClient}.
*
* @author danikov
*/
@Test(groups = { "live", "admin", "group" }, singleThreaded = true, testName = "CatalogClientLiveTest")
public class GroupClientLiveTest extends BaseVCloudDirectorClientLiveTest {
public static final String GROUP = "admin group";
/*
* Convenience references to API clients.
*/
private GroupClient groupClient;
/*
* Shared state between dependant tests.
*/
private ReferenceType<?> groupRef;
private Group group;
@BeforeClass(inheritGroups = true)
public void setupRequiredClients() {
groupClient = context.getApi().getGroupClient();
groupRef = Reference.builder()
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/???"))
.build();
}
}