Package org.rhq.core.domain.content

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


            Resource resource = new Resource("testCSResource", "testCSResource", rt);
            resource.setUuid("" + new Random().nextInt());
            Architecture arch = new Architecture("testCSInsertArch");
            PackageType pt = new PackageType("testCSInsertPT", resource.getResourceType());
            Package pkg = new Package("testCSInsertPackage", pt);
            PackageVersion pv = new PackageVersion(pkg, "version", arch);
            ContentSourceType cst = new ContentSourceType("testCSContentSourceType");
            cst.setDefaultSyncSchedule("");
            ContentSource cs = new ContentSource("testCSContentSource", cst);
            cs.setSyncSchedule("");
View Full Code Here


            Resource resource = new Resource("testPVCSResource", "testPVCSResource", rt);
            resource.setUuid("" + new Random().nextInt());
            Architecture arch = new Architecture("testPVCSInsertArch");
            PackageType pt = new PackageType("testPVCSInsertPT", resource.getResourceType());
            Package pkg = new Package("testPVCSInsertPackage", pt);
            PackageVersion pv = new PackageVersion(pkg, "version", arch);
            ContentSourceType cst = new ContentSourceType("testPVCSContentSourceType");
            ContentSource cs = new ContentSource("testPVCSContentSource", cst);
            PackageVersionContentSource pvcs = new PackageVersionContentSource(pv, cs, "fooLocation");

            Configuration csConfig = new Configuration();
            csConfig.put(new PropertySimple("csConfig1", "csConfig1Value"));
            cs.setConfiguration(csConfig);

            Configuration pvConfig = new Configuration();
            pvConfig.put(new PropertySimple("pvConfig1", "pvConfig1Value"));
            pv.setExtraProperties(pvConfig);

            String pvMetadata = "testInsertMetadata";
            pv.setMetadata(pvMetadata.getBytes());

            em.persist(rt);
            em.persist(resource);
            em.persist(arch);
            em.persist(pt);
            em.persist(pkg);
            em.persist(pv);
            em.persist(cst);
            em.persist(cs);
            em.persist(pvcs);
            em.flush();
            em.clear();

            PackageVersionContentSourcePK pk = new PackageVersionContentSourcePK(pv, cs);
            PackageVersionContentSource pvcsDup = em.find(PackageVersionContentSource.class, pk);

            em.clear();

            assert pvcsDup != null;
            assert pvcsDup.equals(pvcs);
            assert pvcsDup.getLocation().equals("fooLocation");

            PackageVersionContentSourcePK pkDup = pvcsDup.getPackageVersionContentSourcePK();
            assert pkDup.getContentSource().getName().equals("testPVCSContentSource");
            assert pkDup.getPackageVersion().getGeneralPackage().getName().equals("testPVCSInsertPackage");

            Query q = em.createNamedQuery(PackageVersionContentSource.QUERY_FIND_BY_CONTENT_SOURCE_ID);
            q.setParameter("id", cs.getId());
            List<PackageVersionContentSource> allPvcs = q.getResultList();

            // make sure the fetch joining works by looking deep inside the objects
            assert allPvcs != null;
            assert allPvcs.size() == 1;
            pvcs = allPvcs.get(0);
            assert pvcs.getPackageVersionContentSourcePK() != null;
            assert pvcs.getLocation().equals("fooLocation");
            assert pvcs.getPackageVersionContentSourcePK().getPackageVersion().equals(pv);
            assert pvcs.getPackageVersionContentSourcePK().getPackageVersion().getArchitecture().equals(arch);
            assert pvcs.getPackageVersionContentSourcePK().getPackageVersion().getGeneralPackage().equals(pkg);
            assert pvcs.getPackageVersionContentSourcePK().getPackageVersion().getExtraProperties().equals(pvConfig);
            assert new String(pvcs.getPackageVersionContentSourcePK().getPackageVersion().getMetadata())
                .equals(pvMetadata);
            assert pvcs.getPackageVersionContentSourcePK().getContentSource().equals(cs);
            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;
            PackageVersionMetadataComposite composite = metadataList.get(0);
            assert composite.getPackageVersionId() == pv.getId();
            assert new String(composite.getMetadata()).equals(new String(pv.getMetadata()));
            assert new String(composite.getPackageDetailsKey().getName()).equals(pkg.getName());
            assert new String(composite.getPackageDetailsKey().getVersion()).equals(pv.getVersion());
            assert new String(composite.getPackageDetailsKey().getPackageTypeName()).equals(pt.getName());
            assert new String(composite.getPackageDetailsKey().getArchitectureName()).equals(arch.getName());
            em.clear();

            // remove cs from pv
View Full Code Here

            Resource resource = new Resource("testPVCSResource", "testPVCSResource", rt);
            resource.setUuid("" + new Random().nextInt());
            Architecture arch = new Architecture("testPVCSInsertArch");
            PackageType pt = new PackageType("testPVCSInsertPT", resource.getResourceType());
            Package pkg = new Package("testPVCSInsertPackage", pt);
            PackageVersion pv = new PackageVersion(pkg, "version", arch);
            ContentSourceType cst = new ContentSourceType("testPVCSContentSourceType");
            ContentSource cs = new ContentSource("testPVCSContentSource", cst);
            PackageVersionContentSource pvcs = new PackageVersionContentSource(pv, cs, "fooLocation");

            Configuration csConfig = new Configuration();
            csConfig.put(new PropertySimple("csConfig1", "csConfig1Value"));
            cs.setConfiguration(csConfig);

            Configuration pvConfig = new Configuration();
            pvConfig.put(new PropertySimple("pvConfig1", "pvConfig1Value"));
            pv.setExtraProperties(pvConfig);

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

            resource.setUuid("" + new Random().nextInt());
            Architecture arch = new Architecture("testPVCSInsertArch");
            PackageType pt = new PackageType("testPVCSInsertPT", resource.getResourceType());
            Package pkg = new Package("testPVCSInsertPackage", pt);
            PackageBits bits = createPackageBits(em);
            PackageVersion pv = new PackageVersion(pkg, "version", arch);
            ContentSourceType cst = new ContentSourceType("testPVCSContentSourceType");
            ContentSource cs = new ContentSource("testPVCSContentSource", cst);
            PackageVersionContentSource pvcs = new PackageVersionContentSource(pv, cs, "fooLocation");

            Configuration csConfig = new Configuration();
            csConfig.put(new PropertySimple("csConfig1", "csConfig1Value"));
            cs.setConfiguration(csConfig);

            Configuration pvConfig = new Configuration();
            pvConfig.put(new PropertySimple("pvConfig1", "pvConfig1Value"));
            pv.setExtraProperties(pvConfig);

            bits.getBlob().setBits("testDeleteOrphanedPV".getBytes());
            pv.setPackageBits(bits);

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

            Resource resource = new Resource("testCSSRResource", "testCSSRResource", rt);
            resource.setUuid("uuid");
            Architecture arch = new Architecture("testCSSRInsertArch");
            PackageType pt = new PackageType("testCSSRInsertPT", resource.getResourceType());
            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);
View Full Code Here

TOP

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

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.