Examples of BundleType


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

    @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

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

    }

    // 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

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

    @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

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

    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

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

    @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

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

        ResourceType resourceType = resourceTypeMgr.getResourceTypeByNameAndPlugin(resourceTypeName, pluginName);

        assertNotNull("Cannot create bundle. Unable to find resource type for [name: " + resourceTypeName
            + ", plugin: " + pluginName + "]", resourceType);

        BundleType bundleType = bundleMgr.getBundleType(subjectMgr.getOverlord(), bundleTypeName);
        assertNotNull("Cannot create bundle. Unable to find bundle type for [name: " + bundleTypeName + "]", bundleType);
        Bundle bundle = bundleMgr.createBundle(subjectMgr.getOverlord(), bundleName, "test bundle: " + bundleName,
            bundleType.getId(), null);

        assertNotNull("Failed create bundle for [name: " + bundleName + "]", bundle);
    }
View Full Code Here

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

        return SessionTestHelper.createNewCompatibleGroupForRole(em, role, getRandomString());
    }

    private Bundle createBundle() throws Exception {
        ResourceType resourceType = SessionTestHelper.createNewResourceType(em);
        BundleType bundleType = bundleManager.createBundleType(overlord, getRandomString(), resourceType.getId());
        return bundleManager.createBundle(overlord, getRandomString(), getRandomString(), bundleType.getId(), null);
    }
View Full Code Here

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

        checkCreateBundleVersionAuthz(subject, bundleVersion.getBundle().getId());

        // parse the recipe (validation occurs here) and get the config def and list of files
        try {
            BundleType bundleType = bundleVersion.getBundle().getBundleType();
            RecipeParseResults parseResults = BundleManagerHelper.getPluginContainer().getBundleServerPluginManager()
                .parseRecipe(bundleType.getName(), bundleVersion.getRecipe());

            Set<String> filenames = parseResults.getBundleFileNames();
            HashMap<String, Boolean> result = new HashMap<String, Boolean>(filenames == null ? 0 : filenames.size());

            if (filenames != null && !filenames.isEmpty()) {
View Full Code Here

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

    @Override
    public BundleType getBundleType(Subject subject, String bundleTypeName) {
        // the list of types will be small, no need to support paging
        Query q = entityManager.createNamedQuery(BundleType.QUERY_FIND_BY_NAME);
        q.setParameter("name", bundleTypeName);
        BundleType type = (BundleType) q.getSingleResult();
        return type;
    }
View Full Code Here

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

        throws Exception {
        if (null == name || "".equals(name.trim())) {
            throw new IllegalArgumentException("Invalid bundleName: " + name);
        }

        BundleType bundleType = entityManager.find(BundleType.class, bundleTypeId);
        if (null == bundleType) {
            throw new IllegalArgumentException("Invalid bundleTypeId: " + bundleTypeId);
        }

        bundleGroupIds = (null != bundleGroupIds) ? bundleGroupIds : new int[0];
        List<BundleGroup> bundleGroups = new ArrayList<BundleGroup>(bundleGroupIds.length);
        for (int bundleGroupId : bundleGroupIds) {
            BundleGroup bundleGroup = entityManager.find(BundleGroup.class, bundleGroupId);
            if (null == bundleGroup) {
                throw new IllegalArgumentException("Invalid bundleGroupId: " + bundleGroupId);
            }
            bundleGroups.add(bundleGroup);
        }

        checkCreateInitialBundleVersionAuthz(subject, bundleGroupIds);

        // create and add the required Repo. the Repo is a detached object which helps in its eventual removal.
        Repo repo = new Repo(name);
        repo.setCandidate(false);
        repo.setSyncSchedule(null);

        // create the repo as overlord, this allows users without MANAGE_INVENTORY permission to create bundles
        repo = repoManager.createRepo(subjectManager.getOverlord(), repo);

        // add the required PackageType. the PackageType is an attached object which helps in cascade removal
        // of packages in the bundle's repo.
        ResourceType resourceType = entityManager.find(ResourceType.class, bundleType.getResourceType().getId());
        PackageType packageType = new PackageType(name, resourceType);
        packageType.setDescription("Package type for content of bundle " + name);
        packageType.setCategory(PackageCategory.BUNDLE);
        packageType.setSupportsArchitecture(false);
        packageType.setDisplayName(StringUtils.deCamelCase(name));
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.