Package org.apache.cloudstack.iam.server

Examples of org.apache.cloudstack.iam.server.IAMPolicyVO


        assertFalse("account2 should not belong to the group anymore", acctNames.contains("account2"));
    }

    @Test
    public void createIAMPolicyTest() {
        IAMPolicy policy = new IAMPolicyVO("policy1", "tester policy1");
        List<IAMPolicy> policies = new ArrayList<IAMPolicy>();
        policies.add(policy);
        Pair<List<IAMPolicy>, Integer> policyList = new Pair<List<IAMPolicy>, Integer>(policies, 1);
        when(_iamSrv.createIAMPolicy("policy1", "tester policy1", null, callerDomainPath)).thenReturn(policy);
        when(_iamSrv.listIAMPolicies(null, null, callerDomainPath, 0L, 20L)).thenReturn(policyList);
View Full Code Here


        assertTrue("failed to delete acl policy 1", _aclSrv.deleteIAMPolicy(1L));
    }

    @Test
    public void listIAMPolicyTest() {
        IAMPolicy policy = new IAMPolicyVO("policy1", "tester policy1");
        List<IAMPolicy> policies = new ArrayList<IAMPolicy>();
        policies.add(policy);
        when(_iamSrv.listIAMPolicies(callerId)).thenReturn(policies);
        List<IAMPolicy> polys = _aclSrv.listIAMPolicies(callerId);
        assertTrue(polys != null && polys.size() == 1);
View Full Code Here

        groups.add(group);
        Long groupId = group.getId();
        List<Long> policyIds = new ArrayList<Long>();
        policyIds.add(100L);
        policyIds.add(200L);
        IAMPolicy policy1 = new IAMPolicyVO("policy1", "my first policy");
        IAMPolicy policy2 = new IAMPolicyVO("policy2", "my second policy");
        List<IAMPolicy> policies = new ArrayList<IAMPolicy>();
        policies.add(policy1);
        policies.add(policy2);
        when(_iamSrv.attachIAMPoliciesToGroup(policyIds, groupId)).thenReturn(group);
        when(_iamSrv.listIAMPoliciesByGroup(groupId)).thenReturn(policies);
View Full Code Here

        assertFalse("policy2 should not belong to the group anymore", policyNames.contains("policy2"));
    }

    @Test
    public void addRemovePermissionToPolicyTest() {
        IAMPolicy policy = new IAMPolicyVO("policy1", "tester policy1");
        List<IAMPolicy> policies = new ArrayList<IAMPolicy>();
        policies.add(policy);
        Long policyId = policy.getId();
        Long resId = 200L;
        Class clz = ListVMsCmd.class;
        when(_apiServer.getCmdClass("listVirtualMachines")).thenReturn(clz);
        when(
                _iamSrv.addIAMPermissionToIAMPolicy(policyId, VirtualMachine.class.getSimpleName(),
View Full Code Here

        List<IAMGroupVO> groups = new ArrayList<IAMGroupVO>();
        groups.add(group);
        when(_aclGroupDao.search(Mockito.any(SearchCriteria.class), Mockito.any(com.cloud.utils.db.Filter.class)))
                .thenReturn(groups);

        IAMPolicyVO policy = new IAMPolicyVO("policy1", "my first policy");
        Mockito.when(_aclPolicyDao.persist(Mockito.any(IAMPolicyVO.class))).thenReturn(policy);

    }
View Full Code Here

    @Test(expected = InvalidParameterValueException.class)
    public void createAclPolicyTest() {
        IAMPolicy policy = _iamService.createIAMPolicy("policy1", "my first policy", null, "/root/mydomain");
        assertNotNull("Acl policy 'policy1' failed to create ", policy);

        IAMPolicyVO rvo = new IAMPolicyVO("policy2", "second policy");
        when(_aclPolicyDao.findByName(eq("policy2"))).thenReturn(rvo);

        _iamService.createIAMPolicy("policy2", "second policy", null, "/root/mydomain");
    }
View Full Code Here

TOP

Related Classes of org.apache.cloudstack.iam.server.IAMPolicyVO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.