Search in sources :

Example 6 with IAMGroupVO

use of org.apache.cloudstack.iam.server.IAMGroupVO in project cloudstack by apache.

the class IAMApiServiceTest method listIAMGroupTest.

@Test
public void listIAMGroupTest() {
    IAMGroup group = new IAMGroupVO("group1", "tester group1");
    List<IAMGroup> groups = new ArrayList<IAMGroup>();
    groups.add(group);
    when(_iamSrv.listIAMGroups(callerId)).thenReturn(groups);
    List<IAMGroup> grps = _aclSrv.listIAMGroups(callerId);
    assertTrue(grps != null && grps.size() == 1);
    IAMGroup grp = grps.get(0);
    assertEquals("Error to retrieve group", "group1", grp.getName());
}
Also used : IAMGroupVO(org.apache.cloudstack.iam.server.IAMGroupVO) IAMGroup(org.apache.cloudstack.iam.api.IAMGroup) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 7 with IAMGroupVO

use of org.apache.cloudstack.iam.server.IAMGroupVO in project cloudstack by apache.

the class IAMServiceUnitTest method accountGroupMaptest.

@Test
public void accountGroupMaptest() {
    // create group
    IAMGroupVO group = new IAMGroupVO("group1", "my first group");
    // add account to group
    List<Long> accountIds = new ArrayList<Long>();
    accountIds.add(100L);
    when(_aclGroupDao.findById(20L)).thenReturn(group);
    _iamService.addAccountsToGroup(accountIds, 20L);
    _iamService.removeAccountsFromGroup(accountIds, 20L);
}
Also used : IAMGroupVO(org.apache.cloudstack.iam.server.IAMGroupVO) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

IAMGroupVO (org.apache.cloudstack.iam.server.IAMGroupVO)7 ArrayList (java.util.ArrayList)6 Test (org.junit.Test)6 IAMGroup (org.apache.cloudstack.iam.api.IAMGroup)5 Pair (com.cloud.utils.Pair)3 List (java.util.List)3 IAMGroupResponse (org.apache.cloudstack.api.response.iam.IAMGroupResponse)3 IAMPolicyVO (org.apache.cloudstack.iam.server.IAMPolicyVO)2 AccountVO (com.cloud.user.AccountVO)1 SearchCriteria (com.cloud.utils.db.SearchCriteria)1 IAMPolicy (org.apache.cloudstack.iam.api.IAMPolicy)1 Before (org.junit.Before)1 Filter (org.springframework.context.annotation.ComponentScan.Filter)1 TypeFilter (org.springframework.core.type.filter.TypeFilter)1