Package com.cloud.utils.db

Examples of com.cloud.utils.db.TransactionLegacy


     * Given a certificate signed by a CA and a valid CA chain, upload should succeed
     */
    public void runUploadSslCertWithCAChain() throws Exception {
        Assume.assumeTrue(isOpenJdk() || isJCEInstalled());

        TransactionLegacy txn = TransactionLegacy.open("runUploadSslCertWithCAChain");

        String certFile = getClass().getResource("/certs/rsa_ca_signed.crt").getFile();
        String keyFile = getClass().getResource("/certs/rsa_ca_signed.key").getFile();
        String chainFile = getClass().getResource("/certs/root_chain.crt").getFile();
        String password = "user";
View Full Code Here


    /**
     * Given a Self-signed Certificate with non-encrypted key, upload should succeed
     */
    public void runUploadSslCertSelfSignedWithPassword() throws Exception {

        TransactionLegacy txn = TransactionLegacy.open("runUploadSslCertSelfSignedWithPassword");

        String certFile = getClass().getResource("/certs/rsa_self_signed_with_pwd.crt").getFile();
        String keyFile = getClass().getResource("/certs/rsa_self_signed_with_pwd.key").getFile();
        String password = "test";

View Full Code Here

    /**
     * Given a Self-signed Certificate with encrypted key, upload should succeed
     */
    public void runUploadSslCertSelfSignedNoPassword() throws Exception {

        TransactionLegacy txn = TransactionLegacy.open("runUploadSslCertSelfSignedNoPassword");

        String certFile = getClass().getResource("/certs/rsa_self_signed.crt").getFile();
        String keyFile = getClass().getResource("/certs/rsa_self_signed.key").getFile();

        String cert = readFileToString(new File(certFile));
View Full Code Here

    /**
     * Delete with a valid Id should succeed
     */
    public void runDeleteSslCertValid() throws Exception {

        TransactionLegacy txn = TransactionLegacy.open("runDeleteSslCertValid");

        CertServiceImpl certService = new CertServiceImpl();
        long certId = 1;

        //setting mock objects
View Full Code Here

    }

    @Test
    public void runDeleteSslCertBoundCert() throws NoSuchFieldException, IllegalAccessException {

        TransactionLegacy txn = TransactionLegacy.open("runDeleteSslCertBoundCert");

        CertServiceImpl certService = new CertServiceImpl();

        //setting mock objects
        long certId = 1;
View Full Code Here

    }

    @Test
    public void runDeleteSslCertInvalidId() throws NoSuchFieldException, IllegalAccessException {

        TransactionLegacy txn = TransactionLegacy.open("runDeleteSslCertInvalidId");

        long certId = 1;
        CertServiceImpl certService = new CertServiceImpl();

        certService._accountMgr = Mockito.mock(AccountManager.class);
View Full Code Here

    @Override
    public void deletePrimaryRecordsForStore(long id) {
        SearchCriteria<TemplateDataStoreVO> sc = storeSearch.create();
        sc.setParameters("store_id", id);
        TransactionLegacy txn = TransactionLegacy.currentTxn();
        txn.start();
        remove(sc);
        txn.commit();
    }
View Full Code Here

    @Override
    public void deletePrimaryRecordsForTemplate(long templateId) {
        SearchCriteria<TemplateDataStoreVO> sc = templateSearch.create();
        sc.setParameters("template_id", templateId);
        TransactionLegacy txn = TransactionLegacy.currentTxn();
        txn.start();
        expunge(sc);
        txn.commit();
    }
View Full Code Here

        return networkService;
    }

    @Test
    public void updatePhysicalNetworkTest() {
        TransactionLegacy txn = TransactionLegacy.open("updatePhysicalNetworkTest");
        NetworkServiceImpl networkService = setUp();
        existingRange.add("524");
        when(_physicalNetworkDao.findById(anyLong())).thenReturn(physicalNetworkVO);
        when(_datacenterDao.findById(anyLong())).thenReturn(datacentervo);
        when(_physicalNetworkDao.update(anyLong(), any(physicalNetworkVO.getClass()))).thenReturn(true);
        when(_datacenterVnetDao.listVnetsByPhysicalNetworkAndDataCenter(anyLong(), anyLong())).thenReturn(existingRange);
        networkService.updatePhysicalNetwork(1l, null, null, "524-524,525-530", null);
        txn.close("updatePhysicalNetworkTest");
        verify(physicalNetworkVO).setVnet(argumentCaptor.capture());
        assertEquals("524-530", argumentCaptor.getValue());
    }
View Full Code Here

         */
        runReleaseNonDedicatedPublicIpRange();
    }

    void runDedicatePublicIpRangePostiveTest() throws Exception {
        TransactionLegacy txn = TransactionLegacy.open("runDedicatePublicIpRangePostiveTest");

        when(configurationMgr._vlanDao.findById(anyLong())).thenReturn(vlan);

        when(configurationMgr._accountVlanMapDao.listAccountVlanMapsByAccount(anyLong())).thenReturn(null);

        DataCenterVO dc =
            new DataCenterVO(UUID.randomUUID().toString(), "test", "8.8.8.8", null, "10.0.0.1", null, "10.0.0.1/24", null, null, NetworkType.Advanced, null, null, true,
                true, null, null);
        when(configurationMgr._zoneDao.findById(anyLong())).thenReturn(dc);

        List<IPAddressVO> ipAddressList = new ArrayList<IPAddressVO>();
        IPAddressVO ipAddress = new IPAddressVO(new Ip("75.75.75.75"), 1, 0xaabbccddeeffL, 10, false);
        ipAddressList.add(ipAddress);
        when(configurationMgr._publicIpAddressDao.listByVlanId(anyLong())).thenReturn(ipAddressList);

        try {
            Vlan result = configurationMgr.dedicatePublicIpRange(dedicatePublicIpRangesCmd);
            Assert.assertNotNull(result);
        } catch (Exception e) {
            s_logger.info("exception in testing runDedicatePublicIpRangePostiveTest message: " + e.toString());
        } finally {
            txn.close("runDedicatePublicIpRangePostiveTest");
        }
    }
View Full Code Here

TOP

Related Classes of com.cloud.utils.db.TransactionLegacy

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.