Package org.rhq.enterprise.server.test

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


        // Next create a resource-level definition from the template.
        final DriftDefinition driftDef = template.createDefinition();
        driftDef.setResource(resource);

        executeInTransaction(false, new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                EntityManager em = getEntityManager();
                em.merge(template);
                em.persist(driftDef);
View Full Code Here


        driftDef.setEnabled(true);
        driftDef.setDriftHandlingMode(normal);
        driftDef.setInterval(1800L);
        driftDef.setBasedir(new DriftDefinition.BaseDirectory(fileSystem, "/foo/bar/test"));

        executeInTransaction(false, new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                driftDef.setResource(resource);
                getEntityManager().persist(driftDef);
            }
View Full Code Here

        unprepareForTestAgents();
    }

    protected void initDB() throws Exception {
        purgeDB();
        executeInTransaction(false, new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                initResourceType();
                initAgent();
                initResource();
View Full Code Here

            }
        });
    }

    protected void purgeDB() {
        executeInTransaction(false, new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                String name = " '" + NAME_PREFIX + "%' ";

                em.createQuery("delete from JPADrift d where d.newDriftFile like" + name).executeUpdate();
View Full Code Here

        savedSearchManager = LookupUtil.getSavedSearchManager();
    }

    @Test
    public void testCRUD() {
        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                Subject subject = SessionTestHelper.createNewSubject(em, "fake subject");
                int entityId = savedSearchManager.createSavedSearch(subject, new SavedSearch(SearchSubsystem.GROUP,
                    "fake saved search", "pipo", subject));
View Full Code Here

        });
    }

    @Test
    public void testgetSavedSearchByIdPermission() {
        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                Subject subject1 = SessionTestHelper.createNewSubject(em, "fake subject 1");
                SavedSearch savedSearch = new SavedSearch(SearchSubsystem.GROUP, "fake saved search", "pipo", subject1);
                int entityId = savedSearchManager.createSavedSearch(subject1, savedSearch);
View Full Code Here

        });
    }

    @Test
    public void testCreateSavedSearchPermission() {
        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                final Subject subject1 = SessionTestHelper.createNewSubject(em, "fake subject 1");
                final Subject subject2 = SessionTestHelper.createNewSubject(em, "fake subject 2");
                assertManipulatePermissionExceptionThrown(new Runnable() {
View Full Code Here

        });
    }

    @Test
    public void testDeleteSavedSearchPermission() {
        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                final Subject subject1 = SessionTestHelper.createNewSubject(em, "fake subject 1");
                final int entityId = savedSearchManager.createSavedSearch(subject1, new SavedSearch(
                    SearchSubsystem.GROUP, "fake saved search", "pipo", subject1));
View Full Code Here

        });
    }

    @Test
    public void testUpdateSavedSearchPermission() {
        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                final Subject subject1 = SessionTestHelper.createNewSubject(em, "fake subject 1");
                final int entityId = savedSearchManager.createSavedSearch(subject1, new SavedSearch(
                    SearchSubsystem.GROUP, "fake saved search", "pipo", subject1));
View Full Code Here

        }
    }

    @Test
    public void testFindSavedSearchesByCriteria() {
        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {

                Subject subject1 = SessionTestHelper.createNewSubject(em, "fake subject 1");
                Subject subject2 = SessionTestHelper.createNewSubject(em, "fake subject 2");
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.