From: <rm...@hy...> - 2008-12-23 23:21:29
|
Author: rmorgan Date: 2008-12-23 14:28:28 -0800 (Tue, 23 Dec 2008) New Revision: 393 URL: http://svn.hyperic.org/?view=rev&root=HQApi&revision=393 Modified: trunk/hqu/hqapi1/app/GroupController.groovy trunk/src/org/hyperic/hq/hqapi1/test/Group_test.java trunk/xsd/Group.xsd Log: Add roles and resources to group listing. Modified: trunk/hqu/hqapi1/app/GroupController.groovy =================================================================== --- trunk/hqu/hqapi1/app/GroupController.groovy 2008-12-23 19:14:37 UTC (rev 392) +++ trunk/hqu/hqapi1/app/GroupController.groovy 2008-12-23 22:28:28 UTC (rev 393) @@ -12,7 +12,14 @@ ResourcePrototype(id : g.resourcePrototype.id, name : g.resourcePrototype.name) } - // TODO: Roles, Criteria + for (r in g.resources) { + Resource(id : r.id, + name : r.name) + } + for (r in g.roles) { + Role(id : r.id, + name : r.name) + } } } } Modified: trunk/src/org/hyperic/hq/hqapi1/test/Group_test.java =================================================================== --- trunk/src/org/hyperic/hq/hqapi1/test/Group_test.java 2008-12-23 19:14:37 UTC (rev 392) +++ trunk/src/org/hyperic/hq/hqapi1/test/Group_test.java 2008-12-23 22:28:28 UTC (rev 393) @@ -8,6 +8,7 @@ import org.hyperic.hq.hqapi1.types.GroupResponse; import org.hyperic.hq.hqapi1.types.GroupsResponse; import org.hyperic.hq.hqapi1.types.ResourcesResponse; +import org.hyperic.hq.hqapi1.types.Role; import java.util.List; @@ -28,6 +29,21 @@ assertTrue("Invalid prototype name for group " + g.getName(), pt.getName().length() > 0); } + + if (g.getResource().size() > 0) { + for (Resource r : g.getResource()) { + assertTrue("Invalid resource id for group member", r.getId() > 0); + assertTrue("Invalid resource name for group member", + r.getName().length() > 0); + } + } + + if (g.getRole().size() > 0) { + for (Role r : g.getRole()) { + assertTrue("Invalid role id", r.getId() > 0); + assertTrue("Invalid role name", r.getName().length() > 0); + } + } } public void testCreate() throws Exception { Modified: trunk/xsd/Group.xsd =================================================================== --- trunk/xsd/Group.xsd 2008-12-23 19:14:37 UTC (rev 392) +++ trunk/xsd/Group.xsd 2008-12-23 22:28:28 UTC (rev 393) @@ -16,9 +16,10 @@ <xs:complexType name="Group"> <xs:sequence> - <!-- xs:element name="Role" type="Role" minOccurs="0" maxOccurs="unbounded"/ --> <!-- xs:element name="Criteria" type="Criteria" minOccurs="0"/ --> - <xs:element name="ResourcePrototype" type="ResourcePrototype" maxOccurs="1"/> + <xs:element name="ResourcePrototype" type="ResourcePrototype" maxOccurs="1"/> + <xs:element name="Resource" type="Resource" maxOccurs="unbounded"/> + <xs:element name="Role" type="Role" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="id" type="xs:int" use="required"/> <xs:attribute name="name" type="xs:string" use="required"/> |