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

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



        ConfigurationDefinition definition = new ConfigurationDefinition("bla",null);
        definition.put(new PropertyDefinitionMap("aMap",null,false,
            new PropertyDefinitionList("aList",null,false,
                new PropertyDefinitionSimple("string",null,false,PropertySimpleType.STRING)),
            new PropertyDefinitionSimple("aString",null,false,PropertySimpleType.STRING)));

        Map<String,Object> map = ConfigurationHelper.configurationToMap(config,definition, true);

        assert map != null;
        assert map.entrySet().size()==1;
View Full Code Here



        ConfigurationDefinition definition = new ConfigurationDefinition("bla",null);
        definition.put(new PropertyDefinitionMap("aMap",null,false,
            new PropertyDefinitionList("aBla",null,false,
                new PropertyDefinitionSimple("string",null,false,PropertySimpleType.STRING)),
            new PropertyDefinitionSimple("aFoo",null,false,PropertySimpleType.STRING)));

        try {
            ConfigurationHelper.configurationToMap(config,definition, true);
            assert false;
        } catch (IllegalArgumentException iae ) {
View Full Code Here


        ConfigurationDefinition definition = new ConfigurationDefinition("bla",null);
        definition.put(new PropertyDefinitionMap("aMap",null,false,
            new PropertyDefinitionList("aBla",null,false,
                new PropertyDefinitionSimple("string",null,false,PropertySimpleType.STRING)),
            new PropertyDefinitionSimple("aFoo",null,false,PropertySimpleType.STRING)));

        Map<String,Object> map = ConfigurationHelper.configurationToMap(config,definition, false);

        assert map != null;
        assert map.entrySet().size()==1;
View Full Code Here

    }

    @Test
    public void testConvertSingleValueNoProperty() throws Exception {

        Object o = ConfigurationHelper.convertSimplePropertyValue(null, new PropertyDefinitionSimple("dummy", null,
            false, PropertySimpleType.STRING), true);

        assert o == null;

    }
View Full Code Here

        defaultTemplate.setConfiguration(defaultConfiguration);

        Map<String, PropertyDefinition> propertyDefinitions = new HashMap<String, PropertyDefinition>();
        configurationDefinition.setPropertyDefinitions(propertyDefinitions);

        PropertyDefinitionSimple simplePropDef;

        simplePropDef = createStringPropDef1();
        propertyDefinitions.put(simplePropDef.getName(), simplePropDef);

        simplePropDef = createStringPropDef2();
        propertyDefinitions.put(simplePropDef.getName(), simplePropDef);

        simplePropDef = new PropertyDefinitionSimple("LongString", "a Long String simple prop", false,
            PropertySimpleType.LONG_STRING);
        simplePropDef.setDisplayName(simplePropDef.getName());
        propertyDefinitions.put(simplePropDef.getName(), simplePropDef);

        simplePropDef = new PropertyDefinitionSimple("Password", "a Password simple prop", false,
            PropertySimpleType.PASSWORD);
        simplePropDef.setDisplayName(simplePropDef.getName());
        propertyDefinitions.put(simplePropDef.getName(), simplePropDef);

        simplePropDef = new PropertyDefinitionSimple("Boolean", "a required Boolean simple prop", true,
            PropertySimpleType.BOOLEAN);
        simplePropDef.setDisplayName(simplePropDef.getName());
        propertyDefinitions.put(simplePropDef.getName(), simplePropDef);
        simplePropDef.setRequired(true);

        simplePropDef = createIntegerPropDef();
        propertyDefinitions.put(simplePropDef.getName(), simplePropDef);

        simplePropDef = new PropertyDefinitionSimple("Float", "a Float simple prop", false, PropertySimpleType.FLOAT);
        simplePropDef.setDisplayName(simplePropDef.getName());
        propertyDefinitions.put(simplePropDef.getName(), simplePropDef);

        simplePropDef = new PropertyDefinitionSimple("StringEnum1",
            "a String enum prop with <=5 items - should be rendered as radio buttons", false, PropertySimpleType.STRING);
        simplePropDef.setDisplayName(simplePropDef.getName());
        defaultConfiguration.put(new PropertySimple("StringEnum1", "NJ"));
        ArrayList<PropertyDefinitionEnumeration> propDefEnums = new ArrayList<PropertyDefinitionEnumeration>();
        propDefEnums.add(new PropertyDefinitionEnumeration("NY", "NY"));
        propDefEnums.add(new PropertyDefinitionEnumeration("NJ", "NJ"));
        propDefEnums.add(new PropertyDefinitionEnumeration("PA", "PA"));
        simplePropDef.setEnumeratedValues(propDefEnums, false);
        propertyDefinitions.put(simplePropDef.getName(), simplePropDef);

        simplePropDef = new PropertyDefinitionSimple("StringEnum2",
            "a String enum prop with >5 items - should be rendered as a popup menu", false, PropertySimpleType.STRING);
        simplePropDef.setDisplayName(simplePropDef.getName());
        defaultConfiguration.put(new PropertySimple("StringEnum2", "blue"));
        propDefEnums = new ArrayList<PropertyDefinitionEnumeration>();
        propDefEnums.add(new PropertyDefinitionEnumeration("red", "red"));
        propDefEnums.add(new PropertyDefinitionEnumeration("orange", "orange"));
        propDefEnums.add(new PropertyDefinitionEnumeration("yellow", "yellow"));
        propDefEnums.add(new PropertyDefinitionEnumeration("green", "green"));
        propDefEnums.add(new PropertyDefinitionEnumeration("blue", "blue"));
        propDefEnums.add(new PropertyDefinitionEnumeration("purple", "purple"));
        simplePropDef.setEnumeratedValues(propDefEnums, false);
        propertyDefinitions.put(simplePropDef.getName(), simplePropDef);

        PropertyDefinitionMap mapPropDef = new PropertyDefinitionMap("MapOfSimples", "a map of simples", false);
        mapPropDef.put(createStringPropDef1());
        mapPropDef.put(createStringPropDef2());
        mapPropDef.put(createIntegerPropDef());
        mapPropDef.setDisplayName(mapPropDef.getName());
        propertyDefinitions.put(mapPropDef.getName(), mapPropDef);

        PropertyDefinitionMap openMapPropDef = new PropertyDefinitionMap("OpenMapOfSimples", "an open map of simples",
            false);
        openMapPropDef.setDisplayName(openMapPropDef.getName());
        propertyDefinitions.put(openMapPropDef.getName(), openMapPropDef);

        PropertyDefinitionMap readOnlyOpenMapPropDef = new PropertyDefinitionMap("ReadOnlyOpenMapOfSimples",
            "a read-only open map of simples", false);
        readOnlyOpenMapPropDef.setDisplayName(readOnlyOpenMapPropDef.getName());
        readOnlyOpenMapPropDef.setReadOnly(true);
        propertyDefinitions.put(readOnlyOpenMapPropDef.getName(), readOnlyOpenMapPropDef);

        PropertyDefinitionList listOfSimplesPropDef = new PropertyDefinitionList("ListOfStrings",
            "another list of Strings", true, new PropertyDefinitionSimple("note", "a note", false,
                PropertySimpleType.STRING));
        listOfSimplesPropDef.setDisplayName(listOfSimplesPropDef.getName());
        propertyDefinitions.put(listOfSimplesPropDef.getName(), listOfSimplesPropDef);

        PropertyDefinitionMap mapInListPropDef = new PropertyDefinitionMap("MapOfSimplesInList", "a map of simples in a list", false);
        mapInListPropDef.put(createStringPropDef1());
        mapInListPropDef.put(createStringPropDef2());
        mapInListPropDef.put(createIntegerPropDef());
        mapInListPropDef.setDisplayName(mapInListPropDef.getName());

        PropertyDefinitionList listPropDef = new PropertyDefinitionList("ListOfMaps", "a list of maps", true,
            mapInListPropDef);
        listPropDef.setDisplayName(listPropDef.getName());
        propertyDefinitions.put(listPropDef.getName(), listPropDef);

        PropertyDefinitionMap mapInReadOnlyListPropDef = new PropertyDefinitionMap("MapOfSimplesInReadOnlyList", "a map of simples in a list", false);
        mapInReadOnlyListPropDef.put(createStringPropDef1());
        mapInReadOnlyListPropDef.put(createStringPropDef2());
        mapInReadOnlyListPropDef.put(createIntegerPropDef());
        mapInReadOnlyListPropDef.setDisplayName(mapInReadOnlyListPropDef.getName());

        PropertyDefinitionList readOnlyListPropDef = new PropertyDefinitionList("ReadOnlyListOfMaps",
            "a read-only list of maps", true, mapInReadOnlyListPropDef);
        readOnlyListPropDef.setDisplayName(readOnlyListPropDef.getName());
        readOnlyListPropDef.setReadOnly(true);
        propertyDefinitions.put(readOnlyListPropDef.getName(), readOnlyListPropDef);

        PropertyGroupDefinition propertyGroupDefinition = new PropertyGroupDefinition("myGroup");
        propertyGroupDefinition.setDisplayName(propertyGroupDefinition.getName());
        propertyGroupDefinition.setDescription("this is an example group");

        PropertyDefinitionSimple myString = new PropertyDefinitionSimple("myString1", "my little string", true,
            PropertySimpleType.STRING);
        myString.setDisplayName(myString.getName());
        myString.setSummary(true);
        propertyDefinitions.put(myString.getName(), myString);
        myString.setPropertyGroupDefinition(propertyGroupDefinition);

        PropertyDefinitionSimple myString2 = new PropertyDefinitionSimple("myString2", "my other little string", true,
            PropertySimpleType.STRING);
        myString2.setDisplayName(myString2.getName());
        myString2.setSummary(true);
        propertyDefinitions.put(myString2.getName(), myString2);
        myString2.setPropertyGroupDefinition(propertyGroupDefinition);

        PropertyGroupDefinition propertyGroupDefinition2 = new PropertyGroupDefinition("myGroup2");
        propertyGroupDefinition2.setDisplayName(propertyGroupDefinition2.getName());
        propertyGroupDefinition2.setDescription("this is another example group");

        PropertyDefinitionSimple myString3 = new PropertyDefinitionSimple("myString3", "my third string", true,
            PropertySimpleType.STRING);
        myString3.setDisplayName((myString3.getName()));
        myString3.setSummary(true);
        propertyDefinitions.put(myString3.getName(), myString3);
        myString3.setPropertyGroupDefinition(propertyGroupDefinition2);

        PropertyDefinitionSimple enumExample = new PropertyDefinitionSimple("myEnum",
            "a grouped enum prop with <=5 items", false, PropertySimpleType.STRING);
        enumExample.setDisplayName(enumExample.getName());
        defaultConfiguration.put(new PropertySimple("myEnum", "Burlington"));
        ArrayList<PropertyDefinitionEnumeration> myEnums = new ArrayList<PropertyDefinitionEnumeration>();
        myEnums.add(new PropertyDefinitionEnumeration("Burlington", "Burlington"));
        myEnums.add(new PropertyDefinitionEnumeration("Camden", "Camden"));
        myEnums.add(new PropertyDefinitionEnumeration("Gloucester", "Gloucester"));
        enumExample.setEnumeratedValues(myEnums, false);
        propertyDefinitions.put(enumExample.getName(), enumExample);
        enumExample.setPropertyGroupDefinition(propertyGroupDefinition2);

        return configurationDefinition;
    }
View Full Code Here

        return configuration;
    }

    private static PropertyDefinitionSimple createStringPropDef1()
    {
        PropertyDefinitionSimple stringPropDef1;
        stringPropDef1 = new PropertyDefinitionSimple("String1",
            "an optional String simple prop", false, PropertySimpleType.STRING);
        stringPropDef1.setDisplayName(stringPropDef1.getName());
        return stringPropDef1;
    }
View Full Code Here

        return stringPropDef1;
    }

    private static PropertyDefinitionSimple createStringPropDef2()
    {
        PropertyDefinitionSimple stringPropDef2;
        stringPropDef2 = new PropertyDefinitionSimple("String2",
            "a read-only String simple prop", false, PropertySimpleType.STRING);
        stringPropDef2.setDisplayName(stringPropDef2.getName());
        stringPropDef2.setReadOnly(true);
        return stringPropDef2;
    }
View Full Code Here

        return stringPropDef2;
    }

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

        }
    }

    public void testSimplePropertyConversion() throws Exception {
        ConfigurationDefinition def = new ConfigurationDefinition("null", null);
        PropertyDefinitionSimple propDef =
            new PropertyDefinitionSimple("prop", "prop descr", true, PropertySimpleType.BOOLEAN);
        def.put(propDef);

        Configuration config = new Configuration();
        PropertySimple prop = new PropertySimple("prop", "true");
        config.put(prop);
View Full Code Here

    }

    public void testListOfSimplesPropertyConversion() throws Exception {
        ConfigurationDefinition def = new ConfigurationDefinition("null", null);
        PropertyDefinitionList listDef =
            new PropertyDefinitionList("list", "list descr", true, new PropertyDefinitionSimple("prop", "prop descr",
                false, PropertySimpleType.FLOAT));
        def.put(listDef);

        Configuration config = new Configuration();
        PropertyList list =
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.