Examples of findById()


Examples of com.cloud.network.dao.IPAddressDao.findById()

        PublicIpAddress answer = modelImpl.getSourceNatIpAddressForGuestNetwork(fakeAccount, fakeNetwork);
        Assert.assertNull(answer);
        IPAddressVO fakeIp2 = new IPAddressVO(new Ip("76.75.75.75"), 1, 0xaabb10ddeeffL, 10, true);
        fakeList.add(fakeIp2);
        when (
                ipAddressDao.findById(anyLong())
                ).thenReturn(fakeIp2);
        answer = modelImpl.getSourceNatIpAddressForGuestNetwork(fakeAccount, fakeNetwork);
        Assert.assertNotNull(answer);
        Assert.assertEquals(answer.getAddress().addr(), "76.75.75.75");
View Full Code Here

Examples of com.cloud.network.dao.LoadBalancerDao.findById()

        Map<Long, List<String>> emptyMap = new HashMap<Long, List<String>>();

        LoadBalancerDao lbdao = Mockito.mock(LoadBalancerDao.class);
        _lbMgr._lbDao =  lbdao;

        when(lbdao.findById(anyLong())).thenReturn(Mockito.mock(LoadBalancerVO.class));

        _lbMgr.assignToLoadBalancer(1L, null, emptyMap);

    }
View Full Code Here

Examples of com.cloud.network.dao.NetworkDao.findById()

            VMInterfaceModel vmiModel = getVMInterface(nic.getUuid());
            if (vmiModel == null) {
                vmiModel = new VMInterfaceModel(nic.getUuid());
                vmiModel.addToVirtualMachine(this);
                NetworkVO network = networkDao.findById(nic.getNetworkId());
                VirtualNetworkModel vnModel = manager.getDatabase().lookupVirtualNetwork(network.getUuid(), manager.getCanonicalName(network), network.getTrafficType());
                assert vnModel != null;
                vmiModel.addToVirtualNetwork(vnModel);
            }
            vmiModel.setProperties(controller, instance, nic);
View Full Code Here

Examples of com.cloud.storage.dao.VolumeDao.findById()

    Transaction txn = Transaction.open(Transaction.CLOUD_DB);

    try {
      txn.start();
      for (Long volumeId : _volumesIds) {
        VolumeVO volume = volDao.findById(volumeId);
        if (volume == null) {
          continue;
        }
        vmInstanceId = volume.getInstanceId();
        if (_migrateState == StorageMigrationState.MIGRATING && volume.getState() == Volume.State.Migrating) {
View Full Code Here

Examples of com.cloud.user.dao.AccountDao.findById()

        when(mockNetwork.getTrafficType()).thenReturn(Networks.TrafficType.Guest);

        //mockAccountDao
        AccountDao mockAccountDao = mock(AccountDao.class);
        AccountVO mockAccountVO = mock(AccountVO.class);
        when(mockAccountDao.findById(anyLong())).thenReturn(mockAccountVO);
        when(mockAccountVO.getUuid()).thenReturn("1");

        //mockNic
        NicProfile mockNic = mock(NicProfile.class);
        when(mockNic.getIp4Address()).thenReturn("10.10.10.170");
View Full Code Here

Examples of com.cloud.user.dao.AccountDao.findById()

        MidonetApi api = mock(MidonetApi.class, RETURNS_DEEP_STUBS);

        //mockAccountDao
        AccountDao mockAccountDao = mock(AccountDao.class);
        AccountVO mockAccountVO = mock(AccountVO.class);
        when(mockAccountDao.findById(anyLong())).thenReturn(mockAccountVO);
        when(mockAccountVO.getUuid()).thenReturn("1");
        MidoNetElement elem = new MidoNetElement();

        elem.setMidonetApi(api);
        elem.setAccountDao(mockAccountDao);
View Full Code Here

Examples of com.cloud.utils.db.EntityManager.findById()

    @Bean
    public EntityManager entityManager() {
        EntityManager mock = Mockito.mock(EntityManager.class);
        try {
            Mockito.when(mock.findById(Matchers.same(Account.class), Matchers.anyLong())).thenReturn(_accountDao.findById(Account.ACCOUNT_ID_SYSTEM));
            Mockito.when(mock.findById(Matchers.same(User.class), Matchers.anyLong())).thenReturn(_userDao.findById(User.UID_SYSTEM));
            Mockito.when(mock.findById(Matchers.same(NetworkOffering.class), Matchers.any(Long.class))).thenAnswer(new Answer<NetworkOffering>() {
                @Override
                public NetworkOffering answer(final InvocationOnMock invocation) throws Throwable {
                    Long id = (Long)invocation.getArguments()[1];
View Full Code Here

Examples of com.cloud.vm.dao.UserVmDao.findById()

        _lbvmMapList = new ArrayList<>();
        _lbMgr._rulesMgr = _rulesMgr;
        _lbMgr._networkModel = _networkModel;

        when(lbDao.findById(anyLong())).thenReturn(Mockito.mock(LoadBalancerVO.class));
        when(userVmDao.findById(anyLong())).thenReturn(Mockito.mock(UserVmVO.class));
        when(lb2VmMapDao.listByLoadBalancerId(anyLong(), anyBoolean())).thenReturn(_lbvmMapList);

        _lbMgr.assignToLoadBalancer(1L, null, vmIdIpMap);
    }
View Full Code Here

Examples of com.cloud.vm.dao.VMInstanceDao.findById()

            break;
          }
        }
      }
      if (vmInstanceId != null) {
        VMInstanceVO vm = vmDao.findById(vmInstanceId);
        if (vm != null && vm.getState() == VirtualMachine.State.Migrating) {
          try {
            vmMgr.stateTransitTo(vm, VirtualMachine.Event.AgentReportStopped, null);
          } catch (NoTransitionException e) {
            s_logger.debug("Failed to transit vm state");
View Full Code Here

Examples of com.impetus.kundera.persistence.EntityReader.findById()

        Class<?> nodeDataClass = nodeStateContext.getDataClass();
        EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(nodeStateContext.getPersistenceDelegator().getKunderaMetadata(), nodeDataClass);
        Object entityId = nodeStateContext.getEntityId();

        EntityReader reader = client.getReader();
        EnhanceEntity ee = reader.findById(entityId, entityMetadata, client);

        if (ee != null && ee.getEntity() != null)
        {
            Object nodeData = ee.getEntity();
            nodeStateContext.setData(nodeData);
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.