Package org.rhq.enterprise.server.content

Examples of org.rhq.enterprise.server.content.ContentSourceManagerLocal


            tx.begin();
            EntityManager entityManager = getEntityManager();

            Query query;

            ContentSourceManagerLocal contentSourceManagerLocal = LookupUtil.getContentSourceManager();
            RepoManagerLocal repoManager = LookupUtil.getRepoManagerLocal();
            DistributionManagerLocal distroManager = LookupUtil.getDistributionManagerLocal();
            SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
            Subject overlord = subjectManager.getOverlord();

            // Delete all distributions
            distroManager.deleteDistributionMappingsForRepo(overlord, repoToSync.getId());

            for (String distroLabel : TestContentProvider.DISTRIBUTIONS.keySet()) {
                Distribution distro = distroManager.getDistributionByLabel(distroLabel);
                if (distro != null) {
                    // Delete the files
                    query = entityManager.createNamedQuery(DistributionFile.DELETE_BY_DIST_ID);
                    query.setParameter("distId", distro.getId());
                    query.executeUpdate();

                    // Delete the actual distro
                    distroManager.deleteDistributionByDistId(overlord, distro.getId());
                }
            }

            // Delete all package version <-> content source mappings
            for (ContentSource source : repoContentSources) {
                contentSourceManagerLocal.deleteContentSource(overlord, source.getId());
            }
            repoContentSources.clear();

            // Delete the repo
            repoManager.deleteRepo(overlord, repoToSync.getId());
View Full Code Here


        // transaction at the end.
        TransactionManager tx = getTransactionManager();
        tx.begin();
        EntityManager entityManager = getEntityManager();

        ContentSourceManagerLocal contentManager = LookupUtil.getContentSourceManager();
        RepoManagerLocal repoManager = LookupUtil.getRepoManagerLocal();
        SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
        Subject overlord = subjectManager.getOverlord();

        // Create a sample content source type that will be used in this test
        testSourceType = new ContentSourceType("testType");
        entityManager.persist(testSourceType);
        entityManager.flush();
       
        //need to actually commit the tx so that the subsequent code can see the new entry in
        //the database
        tx.commit();
       
        tx.begin();
        //new entity manager associated with the new tx
        entityManager = getEntityManager();
       
        // Add a content source to sync in this test
        syncSource = new ContentSource("testSource1", testSourceType);
        contentManager.simpleCreateContentSource(overlord, syncSource);
        entityManager.flush();

        // Add an extra content source that isn't being syncced
        nonSyncSource = new ContentSource("testSource2", testSourceType);
        contentManager.simpleCreateContentSource(overlord, nonSyncSource);
        entityManager.flush();

        // Add existing repo against other source (this shouldn't show up in the request for packages)
        nonCandidateOnOtherSource = new Repo("nonCandidateOnOtherSource");
        nonCandidateOnOtherSource.setCandidate(false);
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.server.content.ContentSourceManagerLocal

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.