Examples of BundleType


Examples of org.rhq.core.domain.bundle.BundleType

            int id;

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

            BundleType bundleType = createBundleType(em, name + "-Type", createResourceType(em));
            Bundle bundle = createBundle(em, name + "-Bundle", bundleType);
            id = bundle.getId();
            assert id > 0;
            assert bundle.getBundleType().getId() != 0 : "bundleType should have been cascade persisted too";
View Full Code Here

Examples of org.rhq.core.domain.bundle.BundleType

            Query q = em.createNamedQuery(Bundle.QUERY_FIND_BY_NAME);
            q.setParameter("name", name);
            assert q.getResultList().size() == 0; // not in the db yet

            BundleType bundleType = createBundleType(em, name + "-Type", createResourceType(em));
            Bundle b = createBundle(em, name, bundleType);
            id = b.getId();
            assert id > 0;
            assert b.getBundleType().getId() != 0 : "bundleType should have been persisted independently";
            assert b.getRepo().getId() != 0 : "bundle's repo should have been cascade persisted with the bundle";
            assert b.getName().equals(b.getRepo().getName()) : "bundle's repo should have same name as bundle";

            q = em.createNamedQuery(Bundle.QUERY_FIND_BY_NAME);
            q.setParameter("name", name);
            assert q.getResultList().size() == 1;
            assert ((Bundle) q.getSingleResult()).getName().equals(b.getName());

            Bundle bFind = em.find(Bundle.class, id);
            assert bFind != null;
            assert bFind.getId() == b.getId();
            assert bFind.getName().equals(b.getName());
            assert bFind.getBundleType().equals(b.getBundleType());
            assert bFind.equals(b);
            assert bFind.hashCode() == b.hashCode();

            // clean up - delete our test entity
            em.clear();

            q = em.createNamedQuery(Bundle.QUERY_FIND_BY_NAME);
            q.setParameter("name", b.getName());
            Bundle doomed = (Bundle) q.getSingleResult();
            doomed = em.getReference(Bundle.class, doomed.getId());
            em.remove(doomed);
            assert q.getResultList().size() == 0 : "didn't remove the entity";
            em.clear();

            // make sure we didn't delete the bundle type - it should not be cascade deleted
            q = em.createNamedQuery(BundleType.QUERY_FIND_BY_NAME);
            q.setParameter("name", bFind.getBundleType().getName());
            assert q.getResultList().size() == 1;
            BundleType bt = (BundleType) q.getSingleResult();
            em.remove(bt);
            assert q.getResultList().size() == 0 : "didn't clean up test bundle type";

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

Examples of org.rhq.core.domain.bundle.BundleType

            Query q = em.createNamedQuery(BundleType.QUERY_FIND_BY_NAME);
            q.setParameter("name", name);
            assert q.getResultList().size() == 0; // not in the db yet

            BundleType bt = createBundleType(em, name, createResourceType(em));

            id = bt.getId();
            assert id > 0;

            q = em.createNamedQuery(BundleType.QUERY_FIND_BY_NAME);
            q.setParameter("name", name);
            assert q.getResultList().size() == 1;
            assert ((BundleType) q.getSingleResult()).getName().equals(bt.getName());

            BundleType btFind = em.find(BundleType.class, id);
            assert btFind != null;
            assert btFind.getId() == bt.getId();
            assert btFind.getName().equals(bt.getName());
            assert btFind.equals(bt);
            assert btFind.hashCode() == bt.hashCode();

            // clean up - delete our test entity
            em.clear();

            q = em.createNamedQuery(BundleType.QUERY_FIND_BY_NAME);
            q.setParameter("name", bt.getName());
            BundleType doomed = (BundleType) q.getSingleResult();
            doomed = em.getReference(BundleType.class, doomed.getId());
            em.remove(doomed);
            assert q.getResultList().size() == 0 : "didn't remove the entity";

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

Examples of org.rhq.core.domain.bundle.BundleType

        em.persist(rt);
        return rt;
    }

    private BundleType createBundleType(EntityManager em, String name, ResourceType rt) throws Exception {
        BundleType bt = new BundleType(name, rt);
        em.persist(bt);
        return bt;
    }
View Full Code Here

Examples of org.rhq.core.domain.bundle.BundleType

        prepareBeforeTestMethod(); // prepare for our new test

        // we installed version 2.5 then upgraded to 3.0
        // now we want to revert back to 2.5
        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", "2.5", bundle,
            getRecipeFromFile("test-bundle-two.xml"));
View Full Code Here

Examples of org.rhq.core.domain.bundle.BundleType

     * @param startClean if true, the destination directory will be non-existent and thus clean
     *                   if false, this will put some junk files in the dest directory
     */
    private void doAntBundleInitialInstall(boolean startClean) throws Exception {
        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", "2.5", bundle,
            getRecipeFromFile("test-bundle-two.xml"));
View Full Code Here

Examples of org.rhq.core.domain.bundle.BundleType

     * Test deployment of an RHQ bundle recipe.
     */
    @Test(enabled = ENABLE_TESTS)
    public void testAntBundle() 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"));
View Full Code Here

Examples of org.rhq.core.domain.bundle.BundleType

    public void testRawFilesWithDotDotPaths() throws Exception {
        // our test bundle's relative raw file paths that resolve above dest dir will resolve to here
        final File externalDir = new File(this.testFilesBaseDir, "ext");

        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-dotdot.xml"));
View Full Code Here

Examples of org.rhq.core.domain.bundle.BundleType

     * Test realizing of replacement tokens of resource tags.
     */
    @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"));
View Full Code Here

Examples of org.rhq.core.domain.bundle.BundleType

     */
    @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"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.