Examples of BundleVersion


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

        addRolePermissions(role, Permission.CREATE_BUNDLES_IN_GROUP);

        // allow bundle creation in bg (has create perm)
        Bundle b1 = createBundle(subject, "one", bundleGroup.getId());
        assertNotNull(b1);
        BundleVersion bv1 = createBundleVersion(subject, b1.getName() + "-1", null, b1);
        assertNotNull(bv1);
        ResourceGroup platformResourceGroup = createTestResourceGroup();
        assertNotNull(platformResourceGroup);
        LookupUtil.getRoleManager().addResourceGroupsToRole(overlord, role.getId(),
            new int[] { platformResourceGroup.getId() });
View Full Code Here

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

    // subject must have create bundle version permission
    private void deleteBundleVersion(Subject subject, Bundle b1) throws Exception {
        assertNotNull(b1);

        BundleVersion bv1 = createBundleVersion(subject, b1.getName() + "-1", null, b1);
        assertNotNull(bv1);
        assertEquals("1.0", bv1.getVersion());
        BundleVersion bv2 = createBundleVersion(subject, b1.getName() + "-2", null, b1);
        assertNotNull(bv2);
        assertEquals("1.1", bv2.getVersion());

        // let's add a bundle file so we can ensure our deletion will also delete the file too
        bundleManager.addBundleFileViaByteArray(subject, bv2.getId(), "testDeleteBundleVersion", "1.0",
            new Architecture("noarch"), "content".getBytes());
        BundleFileCriteria bfCriteria = new BundleFileCriteria();
        bfCriteria.addFilterBundleVersionId(bv2.getId());
        bfCriteria.fetchPackageVersion(true);
        PageList<BundleFile> files = bundleManager.findBundleFilesByCriteria(overlord, bfCriteria);
        assert files.size() == 1 : files;
        assert files.get(0).getPackageVersion().getGeneralPackage().getName().equals("testDeleteBundleVersion") : files;

        BundleVersionCriteria bvCriteria = new BundleVersionCriteria();
        BundleCriteria bCriteria = new BundleCriteria();

        // delete the first one - this deletes the BV but the bundle should remain intact
        bundleManager.deleteBundleVersion(subject, bv2.getId(), true);
        bvCriteria.addFilterId(bv2.getId());
        PageList<BundleVersion> bvResults = bundleManager.findBundleVersionsByCriteria(subject, bvCriteria);
        assert bvResults.size() == 0;
        bCriteria.addFilterId(b1.getId());
        PageList<Bundle> bResults = bundleManager.findBundlesByCriteria(subject, bCriteria);
        assert bResults.size() == 1 : "Should not have deleted bundle yet, 1 version still exists";
View Full Code Here

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

    private BundleVersion createBundleVersion(Subject subject, String name, String version, Bundle bundle)
        throws Exception {
        final String fullName = TEST_PREFIX + "-bundleversion-" + version + "-" + name;
        final String recipe = "deploy -f " + TEST_PREFIX + ".zip -d @@ test.path @@";
        BundleVersion bv = bundleManager.createBundleVersion(subject, bundle.getId(), fullName, fullName + "-desc",
            version, recipe);

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

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

    @Override
    public BundleVersion createOrStoreBundleVersionViaURL(String url, String username, String password)
        throws RuntimeException {
        try {
            BundleVersion results = bundleManager.createBundleVersionViaURL(getSessionSubject(), url, username,
                password);
            return SerialUtility.prepare(results, "createOrStoreBundleVersionViaURL");
        } catch (Throwable t) {
            throw getExceptionToThrowToClient(t);
        }
View Full Code Here

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

    }

    @Override
    public BundleVersion createBundleVersionViaRecipe(String recipe) throws RuntimeException {
        try {
            BundleVersion results = bundleManager.createBundleVersionViaRecipe(getSessionSubject(), recipe);
            return SerialUtility.prepare(results, "createBundleVersionViaRecipe");
        } catch (Throwable t) {
            throw getExceptionToThrowToClient(t);
        }
    }
View Full Code Here

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

    @Override
    public BundleVersion createInitialBundleVersionViaRecipe(int[] bundleGroupIds, String recipe)
        throws RuntimeException {
        try {
            BundleVersion results = bundleManager.createInitialBundleVersionViaRecipe(getSessionSubject(),
                bundleGroupIds, recipe);
            return SerialUtility.prepare(results, "createInitialBundleVersionViaRecipe");
        } catch (Throwable t) {
            throw getExceptionToThrowToClient(t);
        }
View Full Code Here

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

    }

    @Override
    public BundleVersion createInitialBundleVersionViaToken(int[] bundleGroupIds, String token) throws RuntimeException {
        try {
            BundleVersion results = bundleManager.createInitialBundleVersionViaToken(getSessionSubject(),
                bundleGroupIds, token);
            return SerialUtility.prepare(results, "createInitialBundleVersionViaToken");
        } catch (Throwable t) {
            throw getExceptionToThrowToClient(t);
        }
View Full Code Here

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

        try {
            // note that this assumes 1 and only 1 file is uploaded
            File file = files.values().iterator().next();

            BundleManagerLocal bundleManager = LookupUtil.getBundleManager();
            BundleVersion bundleVersion = bundleManager.createOrStoreBundleVersionViaFile(subject, file);
            successMsg = "success [" + bundleVersion.getId() + "]";

        } catch (BundleNotFoundException e) {
            writeExceptionResponse(response, "BundleNotFoundException " + e.getMessage(), e); // clients will look for this string!
            return;
        } catch (Exception e) {
View Full Code Here

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

    public void testUpdateBundleVersionTags() {
        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                Set<Tag> tags = generateTagSet(7);
                BundleVersion bundleVersion = createBundleVersion();
                bundleVersion.setTags(emptyTagSet());
                tagManager.updateBundleVersionTags(overlord, bundleVersion.getId(), tags);
                assertEquals(tags, bundleVersion.getTags());
            }
        });
    }
View Full Code Here

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

    private BundleDeployment createBundleDeployment() throws Exception {
        BundleDestination bundleDestination = createBundleDestination();
        Configuration configuration = new Configuration();
        configuration.put(new PropertySimple("bundletest.property", "bundletest.property value"));
        BundleVersion bundleVersion = createBundleVersion(bundleDestination.getBundle());
        return bundleManager.createBundleDeployment(overlord, bundleVersion.getId(), bundleDestination.getId(),
            getRandomString(), configuration);
    }
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.