Package com.cloud.network.vpc

Examples of com.cloud.network.vpc.NetworkACLItemVO


            .thenReturn(vpcGateways);

        // Create 4 rules to test all 4 scenarios: only revoke should
        // be deleted, only add should update
        List<NetworkACLItemVO> rules = new ArrayList<NetworkACLItemVO>();
        NetworkACLItemVO ruleActive = Mockito.mock(NetworkACLItemVO.class);
        NetworkACLItemVO ruleStaged = Mockito.mock(NetworkACLItemVO.class);
        NetworkACLItemVO rule2Revoke = Mockito.mock(NetworkACLItemVO.class);
        NetworkACLItemVO rule2Add = Mockito.mock(NetworkACLItemVO.class);
        Mockito.when(ruleActive.getState()).thenReturn(NetworkACLItem.State.Active);
        Mockito.when(ruleStaged.getState()).thenReturn(NetworkACLItem.State.Staged);
        Mockito.when(rule2Add.getState()).thenReturn(NetworkACLItem.State.Add);
        Mockito.when(rule2Revoke.getState()).thenReturn(NetworkACLItem.State.Revoke);
        rules.add(ruleActive);
        rules.add(ruleStaged);
        rules.add(rule2Add);
        rules.add(rule2Revoke);

        long revokeId = 8;
        Mockito.when(rule2Revoke.getId()).thenReturn(revokeId);

        long addId = 9;
        Mockito.when(rule2Add.getId()).thenReturn(addId);
        Mockito.when(_networkACLItemDao.findById(addId)).thenReturn(rule2Add);

        Mockito.when(_networkACLItemDao.listByACL(aclId))
            .thenReturn(rules);
        // Mock methods to avoid
View Full Code Here


                return 1L;
            }

        };

        aclItem = new NetworkACLItemVO() {
            @Override
            public long getAclId() {
                return 4L;
            }
        };
View Full Code Here

        Mockito.when(_entityMgr.findById(Matchers.eq(Vpc.class), Matchers.anyLong())).thenReturn(new VpcVO());
        Mockito.when(_networkAclMgr.getNetworkACL(Matchers.anyLong())).thenReturn(acl);
        Mockito.when(
            _networkAclMgr.createNetworkACLItem(Matchers.anyInt(), Matchers.anyInt(), Matchers.anyString(), Matchers.anyList(), Matchers.anyInt(), Matchers.anyInt(),
                        Matchers.any(NetworkACLItem.TrafficType.class), Matchers.anyLong(), Matchers.anyString(), Matchers.anyInt(), Matchers.anyBoolean())).thenReturn(
                new NetworkACLItemVO());
        Mockito.when(_networkACLItemDao.findByAclAndNumber(Matchers.anyLong(), Matchers.anyInt())).thenReturn(null);
        assertNotNull(_aclService.createNetworkACLItem(createACLItemCmd));
    }
View Full Code Here

    @Test(expected = InvalidParameterValueException.class)
    public void testCreateACLItemDuplicateNumber() throws Exception {
        Mockito.when(_entityMgr.findById(Matchers.eq(Vpc.class), Matchers.anyLong())).thenReturn(new VpcVO());
        Mockito.when(_networkAclMgr.getNetworkACL(Matchers.anyLong())).thenReturn(acl);
        Mockito.when(_networkACLItemDao.findByAclAndNumber(Matchers.anyLong(), Matchers.anyInt())).thenReturn(new NetworkACLItemVO());
        _aclService.createNetworkACLItem(createACLItemCmd);
    }
View Full Code Here

        MaxNumberSearch.done();
    }

    @Override
    public NetworkACLItemVO findById(Long id) {
        NetworkACLItemVO item = super.findById(id);
        loadCidrs(item);
        return item;
    }
View Full Code Here

    @Override
    public NetworkACLItemVO findByAclAndNumber(long aclId, int number) {
        SearchCriteria<NetworkACLItemVO> sc = AllFieldsSearch.create();
        sc.setParameters("aclId", aclId);
        sc.setParameters("number", number);
        NetworkACLItemVO vo = findOneBy(sc);
        if(vo != null) {
            loadCidrs(vo);
        }
        return vo;
    }
View Full Code Here

    @DB
    public NetworkACLItemVO persist(NetworkACLItemVO networkAclItem) {
        TransactionLegacy txn = TransactionLegacy.currentTxn();
        txn.start();

        NetworkACLItemVO dbNetworkACLItem = super.persist(networkAclItem);
        saveCidrs(networkAclItem, networkAclItem.getSourceCidrList());
        loadCidrs(dbNetworkACLItem);

        txn.commit();
        return dbNetworkACLItem;
View Full Code Here

TOP

Related Classes of com.cloud.network.vpc.NetworkACLItemVO

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.