Package org.rhq.core.domain.content

Examples of org.rhq.core.domain.content.Repo


     */
    @Test(enabled = ENABLE_TESTS)
    public void testTags() throws Exception {
        ResourceType resourceType = new ResourceType("testSimpleBundle", "plugin", ResourceCategory.SERVER, null);
        BundleType bundleType = new BundleType("testSimpleBundle", resourceType);
        Repo repo = new Repo("testSimpleBundle");
        PackageType packageType = new PackageType("testSimpleBundle", resourceType);
        Bundle bundle = new Bundle("testSimpleBundle", bundleType, repo, packageType);
        BundleVersion bundleVersion = new BundleVersion("testSimpleBundle", "1.0", bundle,
            getRecipeFromFile("test-bundle.xml"));
        BundleDestination destination = new BundleDestination(bundle, "testSimpleBundle", new ResourceGroup(
View Full Code Here


    @Test(enabled = ENABLE_TESTS)
    public void testAntBundleNoManageRootDir() throws Exception {
        ResourceType resourceType = new ResourceType("testNoManageRootDirBundle", "plugin", ResourceCategory.SERVER,
            null);
        BundleType bundleType = new BundleType("testNoManageRootDirBundle", resourceType);
        Repo repo = new Repo("testNoManageRootDirBundle");
        PackageType packageType = new PackageType("testNoManageRootDirBundle", resourceType);
        Bundle bundle = new Bundle("testNoManageRootDirBundle", bundleType, repo, packageType);
        BundleVersion bundleVersion = new BundleVersion("testNoManageRootDirBundle", "1.0", bundle,
            getRecipeFromFile("test-bundle-no-manage-root-dir.xml"));
        BundleDestination destination = new BundleDestination(bundle, "testNoManageRootDirBundle", new ResourceGroup(
View Full Code Here

     */
    @Test(enabled = ENABLE_TESTS)
    public void testAntBundleManageRootDir() throws Exception {
        ResourceType resourceType = new ResourceType("testManageRootDirBundle", "plugin", ResourceCategory.SERVER, null);
        BundleType bundleType = new BundleType("testManageRootDirBundle", resourceType);
        Repo repo = new Repo("testManageRootDirBundle");
        PackageType packageType = new PackageType("testManageRootDirBundle", resourceType);
        Bundle bundle = new Bundle("testManageRootDirBundle", bundleType, repo, packageType);
        BundleVersion bundleVersion = new BundleVersion("testManageRootDirBundle", "1.0", bundle,
            getRecipeFromFile("test-bundle-manage-root-dir.xml"));
        BundleDestination destination = new BundleDestination(bundle, "testManageRootDirBundle", new ResourceGroup(
View Full Code Here

        prepareBeforeTestMethod(); // prepare for our new test

        // deploy upgrade and test it
        ResourceType resourceType = new ResourceType("testSimpleBundle2Type", "plugin", ResourceCategory.SERVER, null);
        BundleType bundleType = new BundleType("testSimpleBundle2BType", resourceType);
        Repo repo = new Repo("test-bundle-two");
        PackageType packageType = new PackageType("test-bundle-two", resourceType);
        Bundle bundle = new Bundle("test-bundle-two", bundleType, repo, packageType);
        BundleVersion bundleVersion = new BundleVersion("test-bundle-two", "3.0", bundle,
            getRecipeFromFile("test-bundle-three.xml"));
        BundleDestination destination = new BundleDestination(bundle, "testSimpleBundle2Dest", new ResourceGroup(
View Full Code Here

            int id;

            String name = "BundleTest-testBundleVersionRepo";
            String recipe = "action/script/recipe is here";

            Repo repo1 = new Repo(name + "-Repo1");
            Repo repo2 = new Repo(name + "-Repo2");
            em.persist(repo1);
            em.persist(repo2);
            assert repo1.getId() > 0;
            assert repo2.getId() > 0;

            Query q = em.createNamedQuery(BundleVersionRepo.QUERY_FIND_BY_REPO_ID_NO_FETCH);
            q.setParameter("id", repo1.getId());
            assert q.getResultList().size() == 0 : "should not have repo1 mapping in the db yet";
            q.setParameter("id", repo2.getId());
            assert q.getResultList().size() == 0 : "should not have repo2 mapping in the db yet";

            BundleType bundleType = createBundleType(em, name + "-Type", createResourceType(em));
            Bundle bundle = createBundle(em, name + "-Bundle", bundleType);

            BundleVersion bundleVersion = new BundleVersion(name, "1.0.0.BETA", bundle, recipe);
            bundleVersion.setVersionOrder(0);
            em.persist(bundleVersion);
            id = bundleVersion.getId();
            assert id > 0;
            assert bundleVersion.getBundle().getId() != 0 : "bundle should have been cascade persisted too";
            assert bundleVersion.getBundle().getBundleType().getId() != 0 : "bundleType should have been cascade persisted too";

            BundleVersionRepo bvr1 = new BundleVersionRepo(bundleVersion, repo1);
            BundleVersionRepo bvr2 = new BundleVersionRepo(bundleVersion, repo2);
            em.persist(bvr1);
            em.persist(bvr2);

            q = em.createNamedQuery(BundleVersionRepo.QUERY_FIND_BY_REPO_ID_NO_FETCH);
            q.setParameter("id", repo1.getId());
            assert q.getResultList().size() == 1;
            assert ((BundleVersionRepo) q.getSingleResult()).getBundleVersionRepoPK().getBundleVersion()
                .equals(bundleVersion);
            assert ((BundleVersionRepo) q.getSingleResult()).getBundleVersionRepoPK().getRepo().equals(repo1);

            q.setParameter("id", repo2.getId());
            assert q.getResultList().size() == 1;
            assert ((BundleVersionRepo) q.getSingleResult()).getBundleVersionRepoPK().getBundleVersion()
                .equals(bundleVersion);
            assert ((BundleVersionRepo) q.getSingleResult()).getBundleVersionRepoPK().getRepo().equals(repo2);
View Full Code Here

            q = em.createNamedQuery(Bundle.QUERY_FIND_BY_NAME);
            q.setParameter("name", bundle.getName());
            assert q.getResultList().size() == 1;
            bundle = (Bundle) q.getSingleResult();
            bundleType = bundle.getBundleType();
            Repo repo = bundle.getRepo();
            em.remove(bundle);
            em.remove(repo);

            deleteResourceType(em, bundleType.getResourceType());
View Full Code Here

        return bt;
    }

    private Bundle createBundle(EntityManager em, String name, BundleType bt) throws Exception {
        // implicit Bundle'sRepo
        Repo repo = new Repo(name);
        repo.setCandidate(false);
        repo.setSyncSchedule(null);
        em.persist(repo);

        // Bundle's packageType
        PackageType pt = new PackageType(name, bt.getResourceType());
        pt.setCategory(PackageCategory.BUNDLE);
View Full Code Here

            assert pvcs.getPackageVersionContentSourcePK().getContentSource().getConfiguration().equals(csConfig);
            assert pvcs.getPackageVersionContentSourcePK().getPackageVersion().getGeneralPackage().getPackageType()
                .getResourceType().equals(rt);

            // add repo and subscribe resource to it; test metadata query
            Repo repo = new Repo("testPVCSRepo");
            em.persist(repo);
            RepoContentSource ccsmapping = repo.addContentSource(cs);
            em.persist(ccsmapping);
            ResourceRepo subscription = repo.addResource(resource);
            em.persist(subscription);
            RepoPackageVersion mapping = repo.addPackageVersion(pv);
            em.persist(mapping);
            em.flush();

            repo = em.find(Repo.class, repo.getId());
            assert repo.getResources().contains(resource);
            assert repo.getContentSources().contains(cs);

            q = em.createNamedQuery(PackageVersion.QUERY_FIND_METADATA_BY_RESOURCE_ID);
            q.setParameter("resourceId", resource.getId());
            List<PackageVersionMetadataComposite> metadataList = q.getResultList();
            assert metadataList.size() == 1 : "-->" + metadataList;
View Full Code Here

public class RepoTest extends AbstractEJB3Test {
    public void testInsert() throws Exception {
        getTransactionManager().begin();
        try {
            EntityManager em = getEntityManager();
            Repo repo = new Repo("testRepoTest");
            repo.setSyncSchedule("0 0 5 * * ?");
            em.persist(repo);
            em.flush();

            Repo lookedUp = em.find(Repo.class, repo.getId());
            assert lookedUp != null;
            assert lookedUp.getSyncSchedule().equals("0 0 5 * * ?");

        } finally {
            getTransactionManager().rollback();
        }
    }
View Full Code Here

            Package pkg = new Package("testCSSRInsertPackage", pt);
            PackageVersion pv = new PackageVersion(pkg, "version", arch);
            ContentSourceType cst = new ContentSourceType("testCSSRContentSourceType");
            ContentSource cs = new ContentSource("testCSSRContentSource", cst);
            ContentSourceSyncResults results = new ContentSourceSyncResults(cs);
            Repo repo = new Repo("testCSSRRepo");
            repo.addContentSource(cs);

            em.persist(rt);
            em.persist(resource);
            em.persist(arch);
            em.persist(pt);
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.content.Repo

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.