Examples of BundleDestinationBaseDirectory


Examples of org.rhq.core.domain.bundle.ResourceTypeBundleConfiguration.BundleDestinationBaseDirectory

            assert bundleConfig2 != null : "server should have been a bundle target";

            Set<BundleDestinationBaseDirectory> baseDirs2 = bundleConfig2.getBundleDestinationBaseDirectories();
            assert baseDirs2.size() == 1 : "should have been 1 bundle dest base dir: " + baseDirs2;

            BundleDestinationBaseDirectory baseDir = baseDirs2.iterator().next();
            assert baseDir.getName().equals("thirdDestBaseDir");
            assert baseDir.getValueContext() == Context.resourceConfiguration : "bad context: " + baseDir;
            assert baseDir.getValueName().equals("resourceProp1") : "bad value" + baseDir;

            // make sure the old bundle config was deleted when we upgraded and overwrite it with the new config
            assert null == em.find(Configuration.class, bundleConfig1.getBundleConfiguration().getId()) : "The configuration "
                + bundleConfig1 + " should have been deleted";
View Full Code Here

Examples of org.rhq.core.domain.bundle.ResourceTypeBundleConfiguration.BundleDestinationBaseDirectory

            // make sure the bundle config is ok
            rtbc = resourceType.getResourceTypeBundleConfiguration();
            assert rtbc != null;
            assert rtbc.getBundleDestinationBaseDirectories().size() == 1;
            BundleDestinationBaseDirectory bdbd = rtbc.getBundleDestinationBaseDirectories().iterator().next();
            assert bdbd.getName().equals(TEST_DESTBASEDIR_NAME);
            assert bdbd.getValueContext() == ResourceTypeBundleConfiguration.BundleDestinationBaseDirectory.Context.pluginConfiguration;
            assert bdbd.getValueName().equals(TEST_BUNDLE_DESTBASEDIR_PROP);

            Agent agent = new Agent(TEST_PREFIX + "-testagent", "testaddress", 1, "", "testtoken");
            em.persist(agent);
            em.flush();
View Full Code Here

Examples of org.rhq.core.domain.bundle.ResourceTypeBundleConfiguration.BundleDestinationBaseDirectory

        MeasurementDefinition metric;
        EventDefinition event;
        DriftDefinitionTemplate drift;
        BaseDirectory driftBasedir;
        ResourceTypeBundleConfiguration bundle;
        BundleDestinationBaseDirectory bundleBasedir;

        assert resourceType.getChildSubCategories() == null;

        assert resourceType.getPluginConfigurationDefinition().getGroupDefinitions().size() == 1;
        group = resourceType.getPluginConfigurationDefinition().getGroupDefinitions().get(0);
        assert group.getName().equals(PC_GROUP);
        assert group.isDefaultHidden() == PC_GROUP_HIDDEN;
        prop = resourceType.getPluginConfigurationDefinition().get(PC_PROP);
        assert prop != null;
        assert prop.getName().equals(PC_PROP);
        assert prop.isRequired() == PC_PROP_REQUIRED;
        assert prop.getPropertyGroupDefinition().getName().equals(PC_GROUP);

        assert resourceType.getProcessScans().size() == 1;
        processScan = resourceType.getProcessScans().iterator().next();
        assert processScan.getName().equals(PROCESS_SCAN_NAME);
        assert processScan.getQuery().equals(PROCESS_SCAN_QUERY);

        assert resourceType.getOperationDefinitions().size() == 1;
        op = resourceType.getOperationDefinitions().iterator().next();
        assert op.getName().equals(OP_NAME);
        assert op.getTimeout().intValue() == OP_TIMEOUT;
        assert op.getDescription().equals(OP_DESC);

        assert resourceType.getMetricDefinitions().size() == 2; // include built-in Availability metric
        metric = resourceType.getMetricDefinitions().iterator().next();
        assert metric.getName().equals(METRIC_PROP);
        assert metric.getDefaultInterval() == METRIC_DEFAULT_INTERVAL;

        assert resourceType.getEventDefinitions().size() == 1;
        event = resourceType.getEventDefinitions().iterator().next();
        assert event.getName().equals(EVENT_NAME);
        assert event.getDescription().equals(EVENT_DESC);

        assert resourceType.getResourceConfigurationDefinition().getGroupDefinitions().size() == 0;
        prop = resourceType.getResourceConfigurationDefinition().get(RC_PROP);
        assert prop != null;
        assert prop.getName().equals(RC_PROP);
        assert prop.isRequired() == RC_PROP_REQUIRED;

        assert resourceType.getDriftDefinitionTemplates().size() == 1;
        drift = resourceType.getDriftDefinitionTemplates().iterator().next();
        assert drift.getTemplateDefinition().getName().equals(DRIFT_DEF_NAME);
        driftBasedir = drift.getTemplateDefinition().getBasedir();
        assert driftBasedir.getValueContext().equals(DRIFT_DEF_BASEDIR_CONTEXT);
        assert driftBasedir.getValueName().equals(DRIFT_DEF_BASEDIR_VALUE);

        bundle = resourceType.getResourceTypeBundleConfiguration();
        assert bundle.getBundleDestinationBaseDirectories().size() == 1;
        bundleBasedir = bundle.getBundleDestinationBaseDirectories().iterator().next();
        assert bundleBasedir.getName().equals(BUNDLE_TARGET_NAME);
        assert bundleBasedir.getValueContext().equals(BUNDLE_BASEDIR_CONTEXT);
        assert bundleBasedir.getValueName().equals(BUNDLE_BASEDIR_VALUE);
    }
View Full Code Here

Examples of org.rhq.core.domain.bundle.ResourceTypeBundleConfiguration.BundleDestinationBaseDirectory

        Resource resource = bundleResourceDeployment.getResource();
        ResourceContainer container = inventoryManager.getResourceContainer(resource);
        resource = container.getResource();

        // find out the type of base location that is specified by the bundle destination
        BundleDestinationBaseDirectory bundleDestBaseDir = null;
        ResourceTypeBundleConfiguration rtbc = resource.getResourceType().getResourceTypeBundleConfiguration();
        if (rtbc == null) {
            throw new IllegalArgumentException("The resource type doesn't support bundle deployments: " + resource);
        }
        for (BundleDestinationBaseDirectory bdbd : rtbc.getBundleDestinationBaseDirectories()) {
            if (bdbd.getName().equals(destBaseDirName)) {
                bundleDestBaseDir = bdbd;
                break;
            }
        }
        if (bundleDestBaseDir == null) {
            return null;
        }

        // based on the type of destination base location, determine the root base directory
        String destBaseDirValueName = bundleDestBaseDir.getValueName(); // the name we look up in the given context
        String baseLocation;
        switch (bundleDestBaseDir.getValueContext()) {
        case fileSystem: {
            if (!new File(relativeDeployDir).isAbsolute()) {
                // the deploy dir is not absolute; since we need to pin it to something, we assume the top root directory
                // unless the descriptor told us to go somewhere else differently
                baseLocation = destBaseDirValueName; // ultimately this came from the plugin descriptor
                if (baseLocation == null || baseLocation.trim().length() == 0) {
                    baseLocation = File.separator; // paranoia, if the plugin descriptor didn't specify, assume the top root directory
                }
            } else {
                baseLocation = null; // so the relativeDeployDir is processed as an absolute dir
            }
            break;
        }
        case pluginConfiguration: {
            baseLocation = resource.getPluginConfiguration().getSimpleValue(destBaseDirValueName, null);
            if (baseLocation == null) {
                throw new IllegalArgumentException("Cannot determine the bundle base deployment location - "
                    + "there is no plugin configuration setting for [" + destBaseDirValueName + "]");
            }
            break;
        }
        case resourceConfiguration: {
            baseLocation = InventoryManager.getResourceConfiguration(resource).getSimpleValue(destBaseDirValueName,
                null);
            if (baseLocation == null) {
                throw new IllegalArgumentException("Cannot determine the bundle base deployment location - "
                    + "there is no resource configuration setting for [" + destBaseDirValueName + "]");
            }
            break;
        }
        case measurementTrait: {
            baseLocation = measurementManager.getTraitValue(container, destBaseDirValueName);
            if (baseLocation == null) {
                throw new IllegalArgumentException("Cannot obtain trait [" + destBaseDirName + "] for resource ["
                    + resource.getName() + "]");
            }
            break;
        }
        default: {
            throw new IllegalArgumentException("Unknown bundle destination location context: " + bundleDestBaseDir);
        }
        }

        File destDir = new File(baseLocation, relativeDeployDir);

        if (!destDir.isAbsolute()) {
            throw new IllegalArgumentException("The base location path specified by [" + destBaseDirValueName
                + "] in the context [" + bundleDestBaseDir.getValueContext()
                + "] along with the destination directory of [" + relativeDeployDir
                + "] did not resolve to an absolute path [" + destDir.getPath()
                + "] so there is no way to know where to put the bundle.");
        }
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.