Examples of BundleDestination


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

        BundleVersion bv1 = createBundleVersion(b1.getName() + "-1", null, b1);
        assertNotNull("Instance of newly created bundle version should not be null", bv1);

        ResourceGroup platformResourceGroup = createTestResourceGroup();
        assertNotNull("Instance of newly created resource group should not be null", platformResourceGroup);
        BundleDestination dest1 = createDestination(b1, "one", "/test", platformResourceGroup);
        assertNotNull("Instance of newly created bundle destination should not be null", dest1);

        BundleDeployment deployment1 = createDeployment("one", bv1, dest1,
            Configuration.builder().addSimple("bundletest.property", "bundletest.property value").build());
        assertNotNull("Instance of newly created bundle deployment should not be null", deployment1);
View Full Code Here

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

        assertNotNull(b1);
        BundleVersion bv1 = createBundleVersion(b1.getName() + "-1", null, b1);
        assertNotNull(bv1);
        ResourceGroup platformResourceGroup = createTestResourceGroup();
        assertNotNull(platformResourceGroup);
        BundleDestination dest1 = createDestination(b1, "one", "/test", platformResourceGroup);
        assertNotNull(dest1);
        Configuration config = new Configuration();
        try {
            createDeployment("one", bv1, dest1, config);
            fail("Bad config was accepted");
View Full Code Here

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

        assertNotNull(bv1);
        Configuration config = new Configuration();
        config.put(new PropertySimple("bundletest.property", "bundletest.property value"));
        ResourceGroup platformResourceGroup = createTestResourceGroup();
        assertNotNull(platformResourceGroup);
        BundleDestination dest1 = createDestination(b1, "one", "/test", platformResourceGroup);
        assertNotNull(dest1);
        BundleDeployment bd1 = createDeployment("one", bv1, dest1, config);
        assertNotNull(bd1);
        assertEquals(BundleDeploymentStatus.PENDING, bd1.getStatus());

        BundleDeployment bd1d = bundleManager.scheduleBundleDeployment(overlord, bd1.getId(), false);
        assertNotNull(bd1d);
        assertEquals(bd1.getId(), bd1d.getId());

        BundleDeploymentCriteria bdc = new BundleDeploymentCriteria();
        bdc.addFilterId(bd1d.getId());
        bdc.fetchBundleVersion(true);
        bdc.fetchDestination(true);
        bdc.fetchResourceDeployments(true);
        bdc.fetchTags(true);
        List<BundleDeployment> bds = bundleManager.findBundleDeploymentsByCriteria(overlord, bdc);
        assertEquals(1, bds.size());
        bd1d = bds.get(0);

        assertEquals(platformResourceGroup, bd1d.getDestination().getGroup());
        assertEquals(dest1.getId(), bd1d.getDestination().getId());

        BundleResourceDeploymentCriteria c = new BundleResourceDeploymentCriteria();
        c.addFilterBundleDeploymentId(bd1d.getId());
        c.fetchBundleDeployment(true);
        c.fetchHistories(true);
View Full Code Here

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

        ResourceGroup platformResourceGroup = createTestResourceGroup();
        assertNotNull(platformResourceGroup);

        // deny destination create (no view of resource group)
        try {
            BundleDestination dest1 = createDestination(subject, b1, "one", "/test", platformResourceGroup);
            fail("Should have thrown IllegalArgumentException");
        } catch (EJBException e) {
            assert e.getCause() instanceof IllegalArgumentException
                && e.getCause().getMessage().contains("Invalid groupId") : "Should have not had group visibility";
            // expected
        }

        // deny destination create (no deploy perm)
        LookupUtil.getRoleManager().addResourceGroupsToRole(overlord, role.getId(),
            new int[] { platformResourceGroup.getId() });
        try {
            BundleDestination dest1 = createDestination(subject, b1, "one", "/test", platformResourceGroup);
            fail("Should have thrown PermissionException");
        } catch (PermissionException e) {
            // expected
        }

        // allow global
        addRolePermissions(role, Permission.DEPLOY_BUNDLES);
        BundleDestination dest1 = createDestination(subject, b1, "one", "/test", platformResourceGroup);
        assertNotNull(dest1);
        Configuration config = new Configuration();
        config.put(new PropertySimple("bundletest.property", "bundletest.property value"));
        BundleDeployment bd1;
        bd1 = createDeployment(subject, "one", bv1, dest1, config);
        assertNotNull(bd1);

        // allow group
        removeRolePermissions(role, Permission.DEPLOY_BUNDLES);
        addRolePermissions(role, Permission.DEPLOY_BUNDLES_TO_GROUP);
        BundleDestination dest2 = createDestination(subject, b1, "two", "/test2", platformResourceGroup);
        assertNotNull(dest2);
        Configuration config2 = new Configuration();
        config2.put(new PropertySimple("bundletest.property", "bundletest.property value"));
        BundleDeployment bd2;
        bd2 = createDeployment(subject, "two", bv1, dest2, config2);
        assertNotNull(bd1);

        // deny delete deployment
        removeRolePermissions(role, Permission.DEPLOY_BUNDLES_TO_GROUP);
        try {
            bundleManager.deleteBundleDeployment(subject, bd2.getId());
            fail("Should have thrown PermissionException");
        } catch (PermissionException e) {
            // expected
        }

        // allow delete deployment
        addRolePermissions(role, Permission.DEPLOY_BUNDLES);
        bundleManager.deleteBundleDeployment(subject, bd2.getId());

        // deny delete destination
        removeRolePermissions(role, Permission.DEPLOY_BUNDLES);
        try {
            bundleManager.deleteBundleDestination(subject, dest2.getId());
            fail("Should have thrown PermissionException");
        } catch (PermissionException e) {
            // expected
        }

        // allow delete destination
        addRolePermissions(role, Permission.DEPLOY_BUNDLES_TO_GROUP);
        bundleManager.deleteBundleDestination(subject, dest2.getId());
    }
View Full Code Here

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

        LookupUtil.getRoleManager().addResourceGroupsToRole(overlord, role.getId(),
            new int[] { platformResourceGroup.getId() });

        // allow dest/deploy create (global)
        addRolePermissions(role, Permission.DEPLOY_BUNDLES);
        BundleDestination dest1 = createDestination(subject, b1, "one", "/test", platformResourceGroup);
        assertNotNull(dest1);
        Configuration config = new Configuration();
        config.put(new PropertySimple("bundletest.property", "bundletest.property value"));
        BundleDeployment bd1;
        bd1 = createDeployment(subject, "one", bv1, dest1, config);
View Full Code Here

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

    }

    private BundleDestination createDestination(Subject subject, Bundle bundle, String name, String deployDir,
        ResourceGroup group) throws Exception {
        final String fullName = TEST_PREFIX + "-bundledestination-" + name;
        BundleDestination bd = bundleManager.createBundleDestination(subject, bundle.getId(), fullName, fullName,
            TEST_DESTBASEDIR_NAME, deployDir, group.getId());

        assert bd.getId() > 0;
        assert bd.getName().endsWith(fullName);
        assert bd.getDestinationBaseDirectoryName().equals(TEST_DESTBASEDIR_NAME);
        return bd;
    }
View Full Code Here

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

    @Override
    public BundleDestination createBundleDestination(int bundleId, String name, String description,
        String destBaseDirName, String deployDir, int groupId) throws RuntimeException {

        try {
            BundleDestination result = bundleManager.createBundleDestination(getSessionSubject(), bundleId, name,
                description, destBaseDirName, deployDir, groupId);
            return SerialUtility.prepare(result, "createBundleDestination");
        } catch (Throwable t) {
            throw getExceptionToThrowToClient(t);
        }
View Full Code Here

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

    public void testUpdateBundleDestinationTags() {
        executeInTransaction(new TransactionCallback() {
            @Override
            public void execute() throws Exception {
                Set<Tag> tags = generateTagSet(7);
                BundleDestination bundleDestination = createBundleDestination();
                bundleDestination.setTags(emptyTagSet());
                tagManager.updateBundleDestinationTags(overlord, bundleDestination.getId(), tags);
                assertEquals(tags, bundleDestination.getTags());
            }
        });
    }
View Full Code Here

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

        return bundleManager.createBundleDestination(overlord, bundle.getId(), getRandomString(), getRandomString(),
            destName, getRandomString(), resourceGroup.getId());
    }

    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

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

    @RequiredPermission(Permission.MANAGE_BUNDLE)
    public void updateBundleDestinationTags(Subject subject, int bundleDestinationId, Set<Tag> tags) {

        Set<Tag> definedTags = addTags(subject, tags);
        BundleDestination bundleDestination = entityManager.find(BundleDestination.class, bundleDestinationId);

        Set<Tag> previousTags = new HashSet<Tag>(bundleDestination.getTags());
        previousTags.removeAll(definedTags);
        for (Tag tag : previousTags) {
            tag.removeBundleDestination(bundleDestination);
        }
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.