Package org.rhq.core.domain.configuration.definition

Examples of org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple


        propDef.setSummary(true);
        return propDef;
    }

    private static PropertyDefinitionSimple createIntegerPropDef() {
        PropertyDefinitionSimple integerPropDef;
        integerPropDef = new PropertyDefinitionSimple("Integer",
            "a summary Integer simple prop", false, PropertySimpleType.INTEGER);
        integerPropDef.setDisplayName(integerPropDef.getName());
        integerPropDef.setSummary(true);
        return integerPropDef;
    }
View Full Code Here


        integerPropDef.setSummary(true);
        return integerPropDef;
    }

    private static PropertyDefinitionSimple createLongPropDef() {
        PropertyDefinitionSimple longPropDef;
         longPropDef = new PropertyDefinitionSimple("Long",
            "a summary Long simple prop", false, PropertySimpleType.LONG);
         longPropDef.setDisplayName( longPropDef.getName());
         longPropDef.setSummary(true);
        return  longPropDef;
    }
View Full Code Here

        assertTrue(bundleFiles.contains("test-audit.properties"), String.valueOf(bundleFiles));

        // sanity check - make sure our recipe defined this property
        ConfigurationDefinition configDef = project.getConfigurationDefinition();
        assertEquals(configDef.getPropertyDefinitions().size(), 1, String.valueOf(configDef.getPropertyDefinitions()));
        PropertyDefinitionSimple propDef = configDef.getPropertyDefinitionSimple("listener.port");
        assertNotNull(propDef);

        // make sure our test infrastruction setup the input properties correctly
        Configuration config = project.getConfiguration();
        assertEquals(config.getProperties().size(), 1, String.valueOf(config.getProperties()));
View Full Code Here

        ConfigurationDefinition projectConfigDef = project.getConfigurationDefinition();
        assertEquals(projectConfigDef.getPropertyDefinitions().size(), 3,
            String.valueOf(projectConfigDef.getPropertyDefinitions()));

        PropertyDefinitionSimple propDef = projectConfigDef.getPropertyDefinitionSimple("myapp.datasource.property");
        assertNotNull(propDef);
        assertEquals(propDef.getType(), PropertySimpleType.INTEGER);
        assertTrue(propDef.isRequired());

        propDef = projectConfigDef.getPropertyDefinitionSimple("myapp.listener.port");
        assertNotNull(propDef);
        assertEquals(propDef.getType(), PropertySimpleType.INTEGER);
        assertTrue(propDef.isRequired());

        propDef = projectConfigDef.getPropertyDefinitionSimple("myapp.runtime.name");
        assertNotNull(propDef);
        assertEquals(propDef.getType(), PropertySimpleType.STRING);
        assertTrue(propDef.isRequired());

        Configuration projectConfig = project.getConfiguration();
        assertNotNull(projectConfig);
        assertEquals(projectConfig.getProperties().size(), 3, String.valueOf(projectConfig.getProperties()));
        assertEquals(projectConfig.getSimpleValue("myapp.datasource.property"), "10",
View Full Code Here

            int loadCount = 300;
            HashSet<String> parsedNames = new HashSet<String>();
            for (int i = 0; i < loadCount; i++) {
                String name = "fakeProperty_" + i;
                initialDefinition
                    .put(new PropertyDefinitionSimple(name, "fake_" + i, false, PropertySimpleType.BOOLEAN));
                parsedNames.add(name);
            }
            newResource1Type.setResourceConfigurationDefinition(initialDefinition);
            newResource1Type = em.merge(newResource1Type);
            em.flush(); // so that slsb calls below will see the change reflected in the db

            ConfigurationDefinition configurationDefinition = newResource1Type.getResourceConfigurationDefinition();
            assert configurationDefinition != null : "Configuration Definition could not be located.";
            //retrieve the options for ConfigurationDefinition
            ConfigurationDefinition options = configurationManager.getOptionsForConfigurationDefinition(overlord,
                newResource1.getId(), -1, configurationDefinition);
            assert options != null : "Unable able to retrieve options for resource with id [" + newResource1.getId()
                + "].";
            assert !options.getPropertyDefinitions().entrySet().isEmpty() : "No PropertyDefinitionSimple instances found.";

            PropertyDefinitionSimple locatedPropertyDefSimple = null;
            int locatedCount = 0;
            for (Map.Entry<String, PropertyDefinition> entry : options.getPropertyDefinitions().entrySet()) {
                PropertyDefinition pd = entry.getValue();
                if (pd instanceof PropertyDefinitionSimple) {
                    locatedPropertyDefSimple = (PropertyDefinitionSimple) pd;
                    locatedCount++;
                    parsedNames.remove(locatedPropertyDefSimple.getName());
                }
            }
            assert locatedPropertyDefSimple != null : "PropertyDefinitionSimple was not located!";
            assert locatedCount != loadCount : "All expected properties were not loaded. Found '" + locatedCount + "'.";
            assert parsedNames.isEmpty() : "Not all loaded options were parsed.";
View Full Code Here

        }

        for (Map.Entry<String,PropertyDefinition> entry : cd.getPropertyDefinitions().entrySet()) {
            PropertyDefinition pd = entry.getValue();
            if (pd instanceof PropertyDefinitionSimple) {
                PropertyDefinitionSimple pds = (PropertyDefinitionSimple) pd;
                SimplePropDef prop = new SimplePropDef();
                prop.setName(pds.getName());
                prop.setRequired(pds.isRequired());
                prop.setType(pds.getType());
                prop.setDefaultValue(pds.getDefaultValue());
                definitionRest.addParam(prop);
            }
            log.debug("copyParams: " + pd.getName() + " not yet supported");
        }
    }
View Full Code Here

            String propName4 = "prop4notRequiredWithDefault";
            String propDesc1 = "prop1desc";
            String propDesc2 = "prop2desc";
            String propDesc3 = "prop3desc";
            String propDesc4 = "prop4desc";
            PropertyDefinitionSimple propdef1requiredWithDefault = new PropertyDefinitionSimple(propName1, propDesc1,
                true, PropertySimpleType.INTEGER);
            PropertyDefinitionSimple propdef2 = new PropertyDefinitionSimple(propName2, propDesc2, false,
                PropertySimpleType.STRING);
            PropertyDefinitionSimple propdef3requiredWithNoDefault = new PropertyDefinitionSimple(propName3, propDesc3,
                true, PropertySimpleType.STRING);
            PropertyDefinitionSimple propdef4notRequiredWithDefault = new PropertyDefinitionSimple(propName4,
                propDesc4, false, PropertySimpleType.STRING);
            propdef1requiredWithDefault.setDefaultValue(String.valueOf(propDefaultValue1));
            propdef4notRequiredWithDefault.setDefaultValue(propDefaultValue4);
            configDef.put(propdef1requiredWithDefault);
            configDef.put(propdef2);
            configDef.put(propdef3requiredWithNoDefault);
            configDef.put(propdef4notRequiredWithDefault);
View Full Code Here

            ResourceType resourceType = new ResourceType(TEST_PREFIX + "-platform-" + System.currentTimeMillis(),
                "test", ResourceCategory.PLATFORM, null);

            // we need to make this test type bundle targetable
            ConfigurationDefinition pcDef = new ConfigurationDefinition(TEST_PREFIX + "-testdef", "bundle test");
            PropertyDefinitionSimple propDef = new PropertyDefinitionSimple(TEST_BUNDLE_DESTBASEDIR_PROP, "", true,
                PropertySimpleType.STRING);
            propDef.setDisplayName(TEST_BUNDLE_DESTBASEDIR_PROP);
            pcDef.put(propDef);
            em.persist(pcDef);

            ResourceTypeBundleConfiguration rtbc = new ResourceTypeBundleConfiguration(new Configuration());
            rtbc.addBundleDestinationBaseDirectory(TEST_DESTBASEDIR_NAME,
View Full Code Here

        for (Map.Entry<String, PropertyDefinition> entry : def.getPropertyDefinitions().entrySet()) {
            PropertyDefinition pd = entry.getValue();

            if (pd instanceof PropertyDefinitionSimple) {
                PropertyDefinitionSimple pds = (PropertyDefinitionSimple) pd;
                handlePDS(subject, resource, baseResource, pds);

            } else if (pd instanceof PropertyDefinitionList) {
                PropertyDefinitionList pdl = (PropertyDefinitionList) pd;
                PropertyDefinition memberDef = pdl.getMemberDefinition();
                if (memberDef instanceof PropertyDefinitionSimple) {
                    PropertyDefinitionSimple pds = (PropertyDefinitionSimple) memberDef;
                    handlePDS(subject, resource, baseResource, pds);
                } else if (memberDef instanceof PropertyDefinitionMap) {
                    PropertyDefinitionMap pdm = (PropertyDefinitionMap) memberDef;
                    for (PropertyDefinition inner : pdm.getOrderedPropertyDefinitions()) {
                        if (inner instanceof PropertyDefinitionSimple) {
View Full Code Here

        if (parentPropertyMap.get(propertyDefinition.getName()) == null) {
            // If the property doesn't even exist, there's nothing to mask.
            return;
        }
        if (propertyDefinition instanceof PropertyDefinitionSimple) {
            PropertyDefinitionSimple propertyDefinitionSimple = (PropertyDefinitionSimple) propertyDefinition;
            if (propertyDefinitionSimple.getType() == PropertySimpleType.PASSWORD) {
                PropertySimple propertySimple = parentPropertyMap.getSimple(propertyDefinition.getName());
                propertySimple.mask();
            }
        }
        // If the property is a Map, recurse into it and mask its child properties.
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple

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.