Package org.rhq.core.domain.shared

Examples of org.rhq.core.domain.shared.TransactionCallback


    protected void afterMethod() {
        purgeDB();
    }

    private void purgeDB() {
        executeInTransaction(false, new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                List<?> results = em.createQuery("select t from ResourceType t where t.name = :name")
                    .setParameter("name", RESOURCE_TYPE_NAME).getResultList();
                if (results.isEmpty()) {
View Full Code Here


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

        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                em.persist(template);
                em.flush();
                em.clear();
View Full Code Here

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

        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                em.persist(template);
                em.flush();
                em.clear();
View Full Code Here

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

        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                resourceType.addDriftDefinitionTemplate(template);
                resourceType = em.merge(resourceType);
                em.flush();
View Full Code Here

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

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

                em.persist(template);
                em.flush();
View Full Code Here

        template.setDescription("Testing save and load");
        template.setResourceType(resourceType);
        template.setChangeSetId("1");
        template.setTemplateDefinition(driftDef);

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

                template.addDriftDefinition(driftDef);
                em.persist(template);
View Full Code Here

        template.setDescription("Testing save and load");
        template.setResourceType(resourceType);
        template.setChangeSetId("1");
        template.setTemplateDefinition(driftDef);

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

                em.persist(template);
View Full Code Here

        final JPADriftFileBits df1 = new JPADriftFileBits(hashId);
        df1.setDataSize((long) content.length());
        Session session = (Session) em.getDelegate();
        df1.setData(session.getLobHelper().createBlob(toInputStream(content), content.length()));

        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() {
                em.persist(df1);

                // Make the update
View Full Code Here

    // Because of the amount data involved is very large the test is long
    // running and should be moved to an integration test suite.
    @Test(groups = { "driftFile", "drift.ejb" })
    public void loadMultipleDriftFilesWithoutLoadingData() throws Exception {

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

                int numDriftFiles = 3;
                final List<String> driftFileHashIds = new ArrayList<String>();
View Full Code Here

            driftFiles.add(driftFile);
            dataFile.delete();
        }

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

                    for (JPADriftFileBits driftFile : driftFiles) {
                        try {
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.shared.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.