Package org.rhq.enterprise.server.test

Examples of org.rhq.enterprise.server.test.TransactionCallback


            }
        });
    }

    private void insertOOB(final MeasurementOOB oob) {
        executeInTransaction(false, new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                EntityManager em = getEntityManager();
                em.persist(oob);
            }
View Full Code Here


        oob.setTimestamp(timestamp);
        return oob;
    }

    private void insertBaseline(final MeasurementBaseline baseline) {
        executeInTransaction(false, new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                EntityManager em = getEntityManager();
                em.persist(baseline);
            }
View Full Code Here

        return baseline;
    }

    private void createInventory() throws Exception {
        purgeDB();
        executeInTransaction(false, new TransactionCallback() {
            @Override
            public void execute() throws Exception {

                resourceType = new ResourceType(RESOURCE_TYPE, PLUGIN, SERVER, null);
                em.persist(resourceType);
View Full Code Here

    private void purgeDB() {
        purgeBaselines();
        purgeOOBs();

        executeInTransaction(false, new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                ResourceCriteria c = new ResourceCriteria();
                c.addFilterInventoryStatus(null);
                c.addFilterResourceKey(RESOURCE_KEY);
View Full Code Here

    private void purgeOOBs() {
        purgeTables("rhq_measurement_oob");
    }

    private void purgeTables(final String... tables) {
        executeInTransaction(false, new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                for (String table : tables) {
                    getEntityManager().createNativeQuery("delete from " + table).executeUpdate();
                }
View Full Code Here

    private void deleteTestData() {
        if (testData != null) {
            final TestData testDataToDelete = testData;
            testData = null;
            executeInTransaction(false, new TransactionCallback() {
                @Override
                public void execute() throws Exception {
                    for (SavedSearch savedSearch : testDataToDelete.getSavedSearches()) {
                        savedSearchManager.deleteSavedSearch(savedSearch.getSubject(), savedSearch.getId());
                    }
View Full Code Here

    }

    @Test
    public void testSavedSearchResultCountRecalculation() throws Exception {
        runJobSynchronously();
        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                SavedSearchCriteria criteria = new SavedSearchCriteria();
                criteria.clearPaging();
                criteria.addFilterSubjectId(testData.getSearchesOwner().getId());
View Full Code Here

        }
    }

    @Test
    public void testSetAssignedSubjectRoles() {
        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                Subject subject = SessionTestHelper.createNewSubject(em, "fake subject");
                List<Role> roles = new ArrayList<Role>();
                for (int i = 0; i < 17; i++) {
View Full Code Here

        });
    }

    @Test
    public void testGetPermissions() {
        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                Subject subject = SessionTestHelper.createNewSubject(em, "fake subject");
                Set<Permission> permissions = new HashSet<Permission>();
                permissions.addAll(EnumSet.allOf(Permission.class));
View Full Code Here

        });
    }

    @Test
    public void testUpdateRole() {
        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                Subject subject = SessionTestHelper.createNewSubject(em, "fake subject");
                Set<Permission> originalPermissions = new HashSet<Permission>();
                originalPermissions.addAll(EnumSet.allOf(Permission.class));
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.test.TransactionCallback

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.