Package org.rhq.bundle.ant.type

Examples of org.rhq.bundle.ant.type.DeploymentUnitType


        assertNotNull(project);
        BundleTask bundleTask = findBundleTask(project);
        assertNotNull(bundleTask);
        assertNotNull(bundleTask.getDeploymentUnits());
        assertEquals(bundleTask.getDeploymentUnits().size(), 1);
        DeploymentUnitType deploymentUnit = bundleTask.getDeploymentUnits().values().iterator().next();
        assertNotNull(deploymentUnit);

        //assert the compatibility with the legacy attribute
        //noinspection deprecation
        assertEquals(deploymentUnit.getManageRootDir(), "false");
        assertEquals(DestinationComplianceMode.filesAndDirectories, deploymentUnit.getCompliance());

        // all we did was parse, nothing should really have been extracted or installed
        assertFalse(DEPLOY_DIR.exists(), "Nothing should have been installed to the deploy dir");
    }
View Full Code Here


        Collection<DeploymentUnitType> deployments = bundleTask.getDeploymentUnits().values();
        if (deployments.isEmpty()) {
            throw new InvalidBuildFileException(
                "The bundle task must contain exactly one rhq:deploymentUnit child element.");
        }
        DeploymentUnitType deployment = deployments.iterator().next();

        if (requireExplicitCompliance && deployment.getCompliance() == null) {
            throw new InvalidBuildFileException(
                "The deployment unit must specifically declare compliance mode of the destination directory.");
        }

        project.setDestinationCompliance(deployment.getCompliance());

        Map<File, String> files = deployment.getLocalFileNames();
        for (String file : files.values()) {
            project.getBundleFileNames().add(file);
        }

        Map<File, String> archives = deployment.getLocalArchiveNames();
        for (String archive : archives.values()) {
            project.getBundleFileNames().add(archive);
        }

        List<String> propertyFiles = bundleTask.getLocalPropertyFiles();
View Full Code Here

        }

        if (this.deploymentUnits.size() != 1) {
            throw new BuildException("The rhq:bundle task must contain exactly one rhq:deploymentUnit element.");
        }
        DeploymentUnitType deploymentUnit = this.deploymentUnits.values().iterator().next();

        String deploymentPhaseName = (String) projectProps.get(DeployPropertyNames.DEPLOY_PHASE);
        if (deploymentPhaseName == null) {
            throw new BuildException("Required property [" + DeployPropertyNames.DEPLOY_PHASE + "] was not specified.");
        }
        DeploymentPhase deploymentPhase;
        try {
            deploymentPhase = DeploymentPhase.valueOf(deploymentPhaseName.toUpperCase());
        } catch (IllegalArgumentException e) {
            DeploymentPhase[] phases = DeploymentPhase.values();
            List<String> validPhaseNames = new ArrayList<String>(phases.length);
            for (DeploymentPhase phase : phases) {
                validPhaseNames.add(phase.name().toLowerCase());
            }
            throw new BuildException("Value of property '" + DeployPropertyNames.DEPLOY_PHASE + "' ("
                + deploymentPhaseName + ") is not a valid deployment phase - the valid phases are " + validPhaseNames
                + ".");
        }
        getProject().setDeploymentPhase(deploymentPhase);

        String dryRunString = (String) projectProps.get(DeployPropertyNames.DEPLOY_DRY_RUN);
        boolean dryRun = Boolean.valueOf(dryRunString);
        getProject().setDryRun(dryRun);
        String revertString = (String) projectProps.get(DeployPropertyNames.DEPLOY_REVERT);
        boolean revert = Boolean.valueOf(revertString);
        String cleanString = (String) projectProps.get(DeployPropertyNames.DEPLOY_CLEAN);
        boolean clean = Boolean.valueOf(cleanString);

        log("Executing '" + deploymentPhase + "' phase for deployment with id [" + deploymentId + "] from bundle '"
            + this.name + "' version " + this.version + " using config "
            + getProject().getConfiguration().toString(true) + " [dryRun=" + dryRun + ", revert=" + revert + ", clean="
            + clean + "]...");
        deploymentUnit.init();
        switch (deploymentPhase) {
        case INSTALL:
            // TODO: Revert doesn't really make sense for an initial install.
            deploymentUnit.install(revert, clean);
            break;
        case START:
            deploymentUnit.start();
            break;
        case STOP:
            deploymentUnit.stop();
            break;
        case UPGRADE:
            deploymentUnit.upgrade(revert, clean);
            break;
        case UNINSTALL:
            deploymentUnit.uninstall();
            break;
        }
    }
View Full Code Here

TOP

Related Classes of org.rhq.bundle.ant.type.DeploymentUnitType

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.