Examples of AccountVO


Examples of com.cloud.user.AccountVO

    private static final Logger s_logger = Logger.getLogger(VpcTest.class);

    @Before
    public void setUp() {
        ComponentContext.initComponentsLifeCycle();
        Account account = new AccountVO("testaccount", 1, "testdomain", (short) 0, UUID.randomUUID().toString());
        UserContext.registerContext(1, account, null, true);
        vpc = new VpcVO(1, "myvpc", "myvpc", 2, 1, 1, "10.0.1.0/16", "mydomain");
    }
View Full Code Here

Examples of com.cloud.user.AccountVO

        Field serviceOfferingIdField = _class.getDeclaredField("serviceOfferingId");
        serviceOfferingIdField.setAccessible(true);
        serviceOfferingIdField.set(cmd, 1L);

       // UserContext.current().setEventDetails("Vm Id: "+getId());
        Account account = (Account) new AccountVO("testaccount", 1L, "networkdomain", (short) 0, "uuid");
        //AccountVO(String accountName, long domainId, String networkDomain, short type, int regionId)
        doReturn(VirtualMachine.State.Running).when(_vmInstance).getState();
        UserContext.registerContext(1, account, null, true);

        when(_vmInstanceDao.findById(anyLong())).thenReturn(_vmInstance);
View Full Code Here

Examples of com.cloud.user.AccountVO

        Field domainIdField = _class.getDeclaredField("domainId");
        domainIdField.setAccessible(true);
        domainIdField.set(cmd, 1L);

        // caller is of type 0
        Account caller = (Account) new AccountVO("testaccount", 1, "networkdomain", (short) 0,
                UUID.randomUUID().toString());
        UserContext.registerContext(1, caller, null, true);

        _userVmMgr.moveVMToUser(cmd);
    }
View Full Code Here

Examples of com.cloud.user.AccountVO

        Field domainIdField = _class.getDeclaredField("domainId");
        domainIdField.setAccessible(true);
        domainIdField.set(cmd, 1L);

        // caller is of type 0
        Account caller = (Account) new AccountVO("testaccount", 1, "networkdomain", (short) 1,
                UUID.randomUUID().toString());
        UserContext.registerContext(1, caller, null, true);

        Account oldAccount = (Account) new AccountVO("testaccount", 1, "networkdomain", (short) 0,
                UUID.randomUUID().toString());
        Account newAccount = (Account) new AccountVO("testaccount", 1, "networkdomain", (short) 1,
                UUID.randomUUID().toString());

        UserVmVO vm = new UserVmVO(10L, "test", "test", 1L, HypervisorType.Any, 1L, false, false, 1L, 1L,
                5L, "test", "test", 1L);
        vm.setState(VirtualMachine.State.Stopped);
View Full Code Here

Examples of com.cloud.user.AccountVO

        networkService._projectMgr = _projectMgr;
        networkService._physicalNetworkDao = _physicalNetworkDao;
        networkService._datacneter_vnet = _dataCenterVnetDao;
        networkService._accountGuestVlanMapDao = _accountGuestVlanMapDao;

        Account account = (Account) new AccountVO("testaccount", 1, "networkdomain", (short) 0, UUID.randomUUID().toString());
        when(networkService._accountMgr.getAccount(anyLong())).thenReturn(account);
        when(networkService._accountDao.findActiveAccount(anyString(), anyLong())).thenReturn(account);

        UserContext.registerContext(1, account, null, true);
View Full Code Here

Examples of com.cloud.user.AccountVO

    private static final Logger s_logger = Logger.getLogger( NetworkACLServiceTest.class);

    @Before
    public void setUp() {
        ComponentContext.initComponentsLifeCycle();
        Account account = new AccountVO("testaccount", 1, "testdomain", (short) 0, UUID.randomUUID().toString());
        UserContext.registerContext(1, account, null, true);

        createACLItemCmd = new CreateNetworkACLCmd(){
            @Override
            public Long getACLId(){
View Full Code Here

Examples of com.cloud.user.AccountVO

    private static final Logger s_logger = Logger.getLogger( NetworkACLManagerTest.class);

    @Before
    public void setUp() {
        ComponentContext.initComponentsLifeCycle();
        Account account = new AccountVO("testaccount", 1, "testdomain", (short) 0, UUID.randomUUID().toString());
        UserContext.registerContext(1, account, null, true);
        acl = Mockito.mock(NetworkACLVO.class);
        aclItem = Mockito.mock(NetworkACLItemVO.class);
    }
View Full Code Here

Examples of com.cloud.user.AccountVO

    @Override
    public void checkNetworkPermissions(Account owner, Network network) {
        // Perform account permission check
        if (network.getGuestType() != Network.GuestType.Shared
                || (network.getGuestType() == Network.GuestType.Shared && network.getAclType() == ACLType.Account)) {
            AccountVO networkOwner = _accountDao.findById(network.getAccountId());
            if(networkOwner == null)
                throw new PermissionDeniedException("Unable to use network with id= " + ((network != null)? ((NetworkVO)network).getUuid() : "") + ", network does not have an owner");
            if(owner.getType() != Account.ACCOUNT_TYPE_PROJECT && networkOwner.getType() == Account.ACCOUNT_TYPE_PROJECT){
                if(!_projectAccountDao.canAccessProjectAccount(owner.getAccountId(), network.getAccountId())){
                    throw new PermissionDeniedException("Unable to use network with id= " + ((network != null)? ((NetworkVO)network).getUuid() : "") + ", permission denied");
                }
            }else{
                List<NetworkVO> networkMap = _networksDao.listBy(owner.getId(), network.getId());
View Full Code Here

Examples of com.cloud.user.AccountVO

    public void validateNtwkOffForVpc() {
        //validate network offering
        //1) correct network offering
        boolean result = false;
        try {
            _vpcService.validateNtwkOffForNtwkInVpc(2L, 1, "0.0.0.0", "111-", _vpcService.getVpc(1), "10.1.1.1", new AccountVO(), null);
            result = true;
        } catch (Exception ex) {
        } finally {
            assertTrue("Validate network offering: Test passed: the offering is valid for vpc creation", result);
        }
       
        //2) invalid offering - source nat is not included
        result = false;
        try {
            _vpcService.validateNtwkOffForNtwkInVpc(2L, 2, "0.0.0.0", "111-", _vpcService.getVpc(1), "10.1.1.1", new AccountVO(), null);
            result = true;
        } catch (InvalidParameterValueException ex) {
        } finally {
            assertFalse("Validate network offering: TEST FAILED, can't use network offering without SourceNat service", result);
        }
       
        //3) invalid offering - conserve mode is off
        result = false;
        try {
            _vpcService.validateNtwkOffForNtwkInVpc(2L, 3, "0.0.0.0", "111-", _vpcService.getVpc(1), "10.1.1.1", new AccountVO(), null);
            result = true;
        } catch (InvalidParameterValueException ex) {
        } finally {
            assertFalse("Validate network offering: TEST FAILED, can't use network offering without conserve mode = true", result);
        }
       
        //4) invalid offering - guest type shared
        result = false;
        try {
            _vpcService.validateNtwkOffForNtwkInVpc(2L, 4, "0.0.0.0", "111-", _vpcService.getVpc(1), "10.1.1.1", new AccountVO(), null);
            result = true;
        } catch (InvalidParameterValueException ex) {
        } finally {
            assertFalse("Validate network offering: TEST FAILED, can't use network offering with guest type = Shared", result);
        }
       
        //5) Invalid offering - no redundant router support
        result = false;
        try {
            _vpcService.validateNtwkOffForNtwkInVpc(2L, 5, "0.0.0.0", "111-", _vpcService.getVpc(1), "10.1.1.1", new AccountVO(), null);
            result = true;
        } catch (InvalidParameterValueException ex) {
        } finally {
            assertFalse("TEST FAILED, can't use network offering with guest type = Shared", result);
        }
View Full Code Here

Examples of com.cloud.user.AccountVO

    }

    @Before
    public void testSetUp() {
        ComponentContext.initComponentsLifeCycle();
        AccountVO acct = new AccountVO(200L);
        acct.setType(Account.ACCOUNT_TYPE_NORMAL);
        acct.setAccountName("user");
        acct.setDomainId(domainId);

        UserContext.registerContext(1, acct, null, true);

        when(_acctMgr.finalizeOwner((Account) anyObject(), anyString(), anyLong(), anyLong())).thenReturn(acct);
        when(_processor.getType()).thenReturn("mock");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.