Package org.rhq.core.domain.bundle

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


    private void parseBundleTypeTarget(List<? extends ResourceDescriptor> resourceTypes) {
        for (ResourceDescriptor d : resourceTypes) {
            if (d.getBundle() != null) {
                ResourceType rt = getResourceTypeFromPlugin(d.getName(), pluginDescriptor.getName());
                BundleType bt = rt.getBundleType();
                parseBundleTypeTarget(bt, d.getBundle().getTargets());
            }
        }
    }
View Full Code Here


            }

            Bundle bundle = resourceDescriptor.getBundle();
            if (bundle != null) {
                String typeName = bundle.getType();
                resourceType.setBundleType(new BundleType(typeName, resourceType));
                // do NOT parse the target types of bundle type right now so that we don't
                // require the plugin writer to order the types herself
            }

            BundleTargetDescriptor bundleTarget = resourceDescriptor.getBundleTarget();
View Full Code Here

            bundleFiles.put(bundleFile2, new File(tmpDir, bundleFile2));
            bundleFiles.put(bundleFile3, new File(tmpDir, bundleFile3));

            File bundleDistroFile = tmpDir; // not a real distro zip, but its just a simulation anyway - SLSB will pass this to our mock PC
            String recipe = "mock recipe";
            BundleType bt1 = createBundleType("one");

            // prepare our mock bundle PC
            bpc.parseRecipe_returnValue = new RecipeParseResults(bundleMetadata, configDef, new HashSet<String>(
                bundleFiles.keySet()));
            bpc.processBundleDistributionFile_returnValue = new BundleDistributionInfo(recipe,
                bpc.parseRecipe_returnValue, bundleFiles);
            bpc.processBundleDistributionFile_returnValue.setBundleTypeName(bt1.getName());

            // now ask the SLSB to persist our bundle data given our mock distribution
            BundleVersion bv1 = bundleManager.createBundleVersionViaURL(overlord, bundleDistroFile.toURI().toURL()
                .toString());
View Full Code Here

        }
    }

    @Test(enabled = TESTS_ENABLED)
    public void testGetBundleTypes() throws Exception {
        BundleType bt1 = createBundleType("one");
        BundleType bt2 = createBundleType("two");
        List<BundleType> bts = bundleManager.getAllBundleTypes(overlord);
        assert bts.size() >= 2 : "should have at least 2 bundle types";

        List<String> btNames = new ArrayList<String>();
        for (BundleType bundleType : bts) {
            btNames.add(bundleType.getName());
        }

        assert btNames.contains(bt1.getName());
        assert btNames.contains(bt2.getName());
    }
View Full Code Here

    }

    @Test(enabled = TESTS_ENABLED)
    public void testAddBundleFilesToDifferentBundles() throws Exception {
        // create a bundle type to use for both bundles.
        BundleType bt = createBundleType("one");
        Bundle b1 = createBundle(overlord, "one", bt, null);
        assertNotNull(b1);
        BundleVersion bv1 = createBundleVersion(b1.getName(), "1.0", b1);
        assertNotNull(bv1);
        BundleFile b1f1 = bundleManager.addBundleFileViaByteArray(overlord, bv1.getId(), TEST_PREFIX + "-file1", "1.0",
View Full Code Here

    @Test(enabled = TESTS_ENABLED)
    public void testCreateBundleAndBundleVersionStrictName1() throws Exception {
        final Bundle b1 = createBundle("one");
        final String name = "on";
        final String fullName = TEST_PREFIX + "-bundle-" + name;
        final BundleType type = createBundleType(name);
        final String recipe = "deploy -f " + TEST_PREFIX + ".zip -d @@ test.path @@";
        final BundleVersion bundleVerison = bundleManager.createBundleAndBundleVersion(overlord, fullName,
            "description", type.getId(), null, fullName, fullName + "-desc", "3.0", recipe);
        assertNotNull(bundleVerison);

        // find the previously created bundle
        BundleCriteria c = new BundleCriteria();
        c.addFilterName(TEST_PREFIX + "-bundle-one");
View Full Code Here

    }

    // helper methods
    private BundleType createBundleType(String name) throws Exception {
        final String fullName = TEST_PREFIX + "-type-" + name;
        BundleType bt = null;

        getTransactionManager().begin();
        try {
            Query q = em.createQuery("SELECT bt FROM BundleType bt WHERE bt.name = '" + fullName + "'");
            bt = (BundleType) q.getSingleResult();
        } catch (Throwable t) {
            // nothing
        } finally {
            getTransactionManager().commit();
        }

        if (null == bt) {
            ResourceType rt = createResourceTypeForBundleType(name);
            bt = bundleManager.createBundleType(overlord, fullName, rt.getId());
        }

        assert bt.getId() > 0;
        assert bt.getName().endsWith(fullName);
        return bt;
    }
View Full Code Here

    @Test(groups = { "plugin.metadata", "Content.UpgradePlugin" }, dependsOnMethods = { "upgradeContentPlugin" })
    public void updateBundleType() {
        ResourceType resourceType = loadResourceTypeWithBundleType("ContentServer7",
            "ContentMetadataManagerBeanTestPlugin");
        BundleType bundleType = resourceType.getBundleType();

        assertNotNull("Failed to upgrade bundle type", bundleType);
        assertEquals("Failed to upgrade bundle type correctly. The bundle type name is wrong",
            "ContentServer.Bundle.2", bundleType.getName());
    }
View Full Code Here

    private Bundle createBundle(Subject subject, String name, int bundleGroupId) throws Exception {
        return createBundle(subject, name, new int[] { bundleGroupId });
    }

    private Bundle createBundle(Subject subject, String name, int[] bundleGroupIds) throws Exception {
        BundleType bt = createBundleType(name);
        return createBundle(subject, name, bt, bundleGroupIds);
    }
View Full Code Here

    @Test(groups = { "plugin.metadata", "Content.UpgradePlugin" }, dependsOnMethods = { "upgradeContentPlugin" })
    public void addBundleTypeThatOnlyExistsInNewResourceType() {
        ResourceType resourceType = loadResourceTypeWithBundleType("ContentServer6",
            "ContentMetadataManagerBeanTestPlugin");
        BundleType bundleType = resourceType.getBundleType();

        assertNotNull("Expected to find bundle type added during upgrade", bundleType);
        assertEquals("Failed to correctly add bundle type during upgrade", "ContentServer6.Bundle.1",
            bundleType.getName());
    }
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.bundle.BundleType

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.