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

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


        assert config!=null;
        Collection<Property> properties = config.getProperties();
        assert properties.size()==14 : "Expected 14 props but got " + properties.size();

        ConfigurationDefinition definition = new ConfigurationDefinition("bla","For testing");
        definition.put(new PropertyDefinitionSimple("float1","A float",true, PropertySimpleType.FLOAT));
        definition.put(new PropertyDefinitionSimple("float2","A float",true, PropertySimpleType.FLOAT));
        definition.put(new PropertyDefinitionSimple("float3","A float",true, PropertySimpleType.FLOAT));
        definition.put(new PropertyDefinitionSimple("float4","A float",true, PropertySimpleType.FLOAT));

        definition.put(new PropertyDefinitionSimple("double1","A double",true, PropertySimpleType.DOUBLE));
        definition.put(new PropertyDefinitionSimple("double2","A double",true, PropertySimpleType.DOUBLE));
        definition.put(new PropertyDefinitionSimple("double3","A double",true, PropertySimpleType.DOUBLE));

        definition.put(new PropertyDefinitionSimple("int1","An int",true, PropertySimpleType.INTEGER));
        definition.put(new PropertyDefinitionSimple("int2","An int",true, PropertySimpleType.INTEGER));
        definition.put(new PropertyDefinitionSimple("int3","An int",true, PropertySimpleType.INTEGER));
        definition.put(new PropertyDefinitionSimple("int4","An int",true, PropertySimpleType.INTEGER));

        definition.put(new PropertyDefinitionSimple("long1","A long",true, PropertySimpleType.LONG));
        definition.put(new PropertyDefinitionSimple("long2","A long",true, PropertySimpleType.LONG));
        definition.put(new PropertyDefinitionSimple("long3","A long",true, PropertySimpleType.LONG));

        List<String> errors = ConfigurationHelper.checkConfigurationWrtDefinition(config,definition);

        assert errors!=null;
        assert errors.size()==10 : "Expected 10 errors, but got " + errors.size() + "\n" + StringUtils.getListAsString(errors,",\n");
View Full Code Here


        map.put("Answer",42);

        Configuration config = ConfigurationHelper.mapToConfiguration(map);

        ConfigurationDefinition definition = new ConfigurationDefinition("bla",null);
        definition.put(new PropertyDefinitionSimple("Hello",null,true,PropertySimpleType.STRING));
        definition.put(new PropertyDefinitionSimple("Answer",null,true,PropertySimpleType.INTEGER));
        definition.put(new PropertyDefinitionSimple("Optional",null,false,PropertySimpleType.INTEGER));

        assert config!=null;
        Collection<Property> properties = config.getProperties();
        assert properties.size()==2;
View Full Code Here

        assert config!=null;
        Collection<Property> properties = config.getProperties();
        assert properties.size()==0 : "Expected 0 props, got " + properties.size();

        ConfigurationDefinition definition = new ConfigurationDefinition("bla",null);
        definition.put(new PropertyDefinitionSimple("Answer",null,false,PropertySimpleType.INTEGER));

        List<String> errors = ConfigurationHelper.checkConfigurationWrtDefinition(config,definition);

        assert errors!=null;
        assert errors.size()==0 : "Expected 0 errors, but got " + errors.size() + "\n" + StringUtils.getListAsString(errors,",\n");
View Full Code Here

        Collection<Property> properties = config.getProperties();
        assert properties.size()==2 : "Expected 2 props, got " + properties.size();


        ConfigurationDefinition definition = new ConfigurationDefinition("bla",null);
        definition.put(new PropertyDefinitionSimple("Hello",null,true,PropertySimpleType.STRING));
        definition.put(new PropertyDefinitionSimple("Answer",null,false,PropertySimpleType.INTEGER));
        definition.put(new PropertyDefinitionList("list",null,true,
                new PropertyDefinitionMap("list",null,true,
                    new PropertyDefinitionSimple("list",null,true,PropertySimpleType.STRING))));
        definition.put(new PropertyDefinitionSimple("aString",null,false,PropertySimpleType.INTEGER));


        List<String> errors = ConfigurationHelper.checkConfigurationWrtDefinition(config,definition);

        assert errors!=null;
View Full Code Here

        Collection<Property> properties = config.getProperties();
        assert properties.size()==2 : "Expected 2 props, got " + properties.size();


        ConfigurationDefinition definition = new ConfigurationDefinition("bla",null);
        definition.put(new PropertyDefinitionSimple("Hello",null,true,PropertySimpleType.STRING));
        definition.put(new PropertyDefinitionMap("list",null,true,
                new PropertyDefinitionMap("list",null,true,
                    new PropertyDefinitionSimple("list",null,true,PropertySimpleType.STRING))));


        List<String> errors = ConfigurationHelper.checkConfigurationWrtDefinition(config,definition);

        assert errors!=null;
View Full Code Here

        Collection<Property> properties = config.getProperties();
        assert properties.size()==2 : "Expected 2 props, got " + properties.size();


        ConfigurationDefinition definition = new ConfigurationDefinition("bla",null);
        definition.put(new PropertyDefinitionSimple("Hello",null,true,PropertySimpleType.STRING));
        definition.put(new PropertyDefinitionMap("list",null,true,
                new PropertyDefinitionList("list",null,true,
                    new PropertyDefinitionSimple("list",null,true,PropertySimpleType.STRING))));


        List<String> errors = ConfigurationHelper.checkConfigurationWrtDefinition(config,definition);

        assert errors!=null;
View Full Code Here

        config.put(new PropertySimple("double",2.3d));
        config.put(new PropertySimple("long",Long.MAX_VALUE));


        ConfigurationDefinition definition = new ConfigurationDefinition("bla",null);
        definition.put(new PropertyDefinitionSimple("number",null,false,PropertySimpleType.INTEGER));
        definition.put(new PropertyDefinitionSimple("string",null,false,PropertySimpleType.STRING));
        definition.put(new PropertyDefinitionSimple("bool",null,false,PropertySimpleType.BOOLEAN));
        definition.put(new PropertyDefinitionSimple("float",null,false,PropertySimpleType.FLOAT));
        definition.put(new PropertyDefinitionSimple("double",null,false,PropertySimpleType.DOUBLE));
        definition.put(new PropertyDefinitionSimple("long",null,false,PropertySimpleType.LONG));

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

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

    public void testEmptyConfigToMap() throws Exception {

        Configuration config = new Configuration();

        ConfigurationDefinition definition = new ConfigurationDefinition("bla",null);
        definition.put(new PropertyDefinitionSimple("number",null,false,PropertySimpleType.INTEGER));
        definition.put(new PropertyDefinitionSimple("string",null,false,PropertySimpleType.STRING));

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

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

    public void testNullConfigToMap() throws Exception {

        Configuration config = null;

        ConfigurationDefinition definition = new ConfigurationDefinition("bla",null);
        definition.put(new PropertyDefinitionSimple("number",null,false,PropertySimpleType.INTEGER));
        definition.put(new PropertyDefinitionSimple("string",null,false,PropertySimpleType.STRING));

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

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

        config.put(propertyList);


        ConfigurationDefinition definition = new ConfigurationDefinition("bla",null);
        definition.put(new PropertyDefinitionList("aList",null,false,
            new PropertyDefinitionSimple("string",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

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.