Package org.rhq.core.domain.configuration

Examples of org.rhq.core.domain.configuration.PropertyList


            new PropertyDefinitionList("list", "list descr", true, new PropertyDefinitionSimple("prop", "prop descr",
                false, PropertySimpleType.FLOAT));
        def.put(listDef);

        Configuration config = new Configuration();
        PropertyList list =
            new PropertyList("list", new PropertySimple("prop", "value1"), new PropertySimple("prop", "value2"));
        config.put(list);

        ConfigurationInstanceDescriptor instance =
            ConfigurationInstanceDescriptorUtil.createConfigurationInstance(def, config);
View Full Code Here


                new PropertyDefinitionSimple("prop1", "prop1 descr", true, PropertySimpleType.BOOLEAN),
                new PropertyDefinitionSimple("prop2", "prop2 descr", false, PropertySimpleType.PASSWORD)));
        def.put(listDef);

        Configuration config = new Configuration();
        PropertyList list =
            new PropertyList("list", new PropertyMap("map", new PropertySimple("prop1", "value1"), new PropertySimple(
                "prop2", "value1")), new PropertyMap("map", new PropertySimple("prop1", "value2"), new PropertySimple(
                "prop2", "value2")));
        config.put(list);

        ConfigurationInstanceDescriptor instance =
View Full Code Here

        assertEquals(propDef.getClass(), PropertyDefinitionList.class, "Unexpected type of the property definition");
        assertEquals(prop.getClass(), PropertyList.class, "Unexpecetd type of the property");

        PropertyDefinitionList listDef = (PropertyDefinitionList) propDef;
        PropertyList listProp = (PropertyList) prop;

        PropertyDefinition memberDef = listDef.getMemberDefinition();
        assertEquals(memberDef.getClass(), PropertyDefinitionSimple.class, "Unexpected type of the list member property definition");

        PropertyDefinitionSimple memberSimpleDef = (PropertyDefinitionSimple) memberDef;
        assertEquals(memberSimpleDef.getName(), "member");
        assertEquals(memberSimpleDef.getType(), PropertySimpleType.INTEGER);

        assertEquals(listProp.getList().size(), 3, "Unexpected number of list members");

        for(int i = 0; i < 3; ++i) {
            Property memberProp = listProp.getList().get(i);
            assertEquals(memberProp.getClass(), PropertySimple.class, "Unexpected type of the property in the list on index " + i);
            assertEquals(memberProp.getName(), "member");
            assertEquals(((PropertySimple)memberProp).getIntegerValue(), Integer.valueOf(i + 1));
        }
    }
View Full Code Here

        assertEquals(def.getPropertyDefinitions().size(), 1, "Unexpected number of defined properties");
        assertEquals(conf.getProperties().size(), 1, "Unexpected number of properties");

        PropertyDefinitionList listDef = (PropertyDefinitionList) def.get("list");
        PropertyList listProp = (PropertyList) conf.get("list");

        PropertyDefinitionMap mapDef = (PropertyDefinitionMap) listDef.getMemberDefinition();
        PropertyDefinitionSimple m1Def = (PropertyDefinitionSimple) mapDef.get("m1");
        PropertyDefinitionSimple m2Def = (PropertyDefinitionSimple) mapDef.get("m2");

        assertEquals(mapDef.getName(), "map");
        assertEquals(m1Def.getType(), PropertySimpleType.INTEGER);
        assertEquals(m2Def.getType(), PropertySimpleType.STRING);

        assertEquals(listProp.getList().size(), 2, "Unexpected number of maps in the list");

        PropertyMap firstMapValue = (PropertyMap) listProp.getList().get(0);
        PropertyMap secondMapValue = (PropertyMap) listProp.getList().get(1);

        assertEquals(firstMapValue.getName(), "map");
        assertEquals(secondMapValue.getName(), "map");

        assertEquals(firstMapValue.getSimpleValue("m1", null), "1", "Unexpected value of m1 property in the first map.");
View Full Code Here

                if (searchRegex != null) {
                    pattern = Pattern.compile(searchRegex);
                }

                Configuration results = controlResults.getComplexResults();
                PropertyList list = new PropertyList("distros");
                results.put(list);

                Collection<Distro> distros = getAllCobblerDistros().values();
                for (Distro d : distros) {
                    if (pattern == null || pattern.matcher(d.getName()).matches()) {
                        PropertyMap map = new PropertyMap("distro");
                        map.put(new PropertySimple("name", d.getName()));
                        map.put(new PropertySimple("breed", d.getBreed()));
                        map.put(new PropertySimple("osversion", d.getOsVersion()));
                        map.put(new PropertySimple("arch", d.getArch()));
                        map.put(new PropertySimple("initrd", d.getInitrd()));
                        map.put(new PropertySimple("kernel", d.getKernel()));
                        list.add(map);
                    }
                }
            } else if (name.equals("getCobblerProfiles")) {
                String searchRegex = parameters.getSimpleValue("searchRegex", null);
                Pattern pattern = null;
                if (searchRegex != null) {
                    pattern = Pattern.compile(searchRegex);
                }

                Configuration results = controlResults.getComplexResults();
                PropertyList list = new PropertyList("profiles");
                results.put(list);

                List<Profile> profiles = getAllCobblerProfiles();
                for (Profile p : profiles) {
                    if (pattern == null || pattern.matcher(p.getName()).matches()) {
                        PropertyMap map = new PropertyMap("profile");
                        map.put(new PropertySimple("name", p.getName()));
                        map.put(new PropertySimple("distro", p.getDistro()));
                        map.put(new PropertySimple("kickstart", p.getKickstart()));
                        list.add(map);
                    }
                }
            } else if (name.equals("removeCobblerDistros")) {
                String searchRegex = parameters.getSimpleValue("searchRegex", null);
                Pattern pattern = null;
View Full Code Here

                    switch (refProp.getContext()) {
                    case PLUGIN_CONFIGURATION:
                        switch (refProp.getType()) {
                        case LIST:
                            PropertyList list = pluginConfiguration.getList(refProp.getName()).deepCopy(false);
                            list.setName(refProp.getTargetName());

                            transferred.put(list);
                            break;
                        case MAP:
                            PropertyMap map = pluginConfiguration.getMap(refProp.getName()).deepCopy(false);
                            map.setName(refProp.getTargetName());

                            transferred.put(map);
                            break;
                        case SIMPLE:
                            PropertySimple simple = pluginConfiguration.getSimple(refProp.getName()).deepCopy(false);
                            simple.setName(refProp.getTargetName());

                            transferred.put(simple);
                            break;
                        case FULL:
                            for (Property p : pluginConfiguration.getProperties()) {
                                Property copy = p.deepCopy(false);
                                if (refProp.getTargetName() != null) {
                                    copy.setName(refProp.getTargetName() + copy.getName());
                                }
                                transferred.put(copy);
                            }
                            break;
                        }
                        break;
                    case RESOURCE_CONFIGURATION:
                        switch (refProp.getType()) {
                        case LIST:
                            PropertyList list = resourceConfiguration.getList(refProp.getName()).deepCopy(false);
                            list.setName(refProp.getTargetName());

                            transferred.put(list);
                            break;
                        case MAP:
                            PropertyMap map = resourceConfiguration.getMap(refProp.getName()).deepCopy(false);
View Full Code Here

        assert prop==null;

        prop = config.get("list");
        assert prop instanceof PropertyList : "list is no list";

        PropertyList pl = (PropertyList) prop;
        List<Property> propertyList = pl.getList();
        assert propertyList.size()==1;
        PropertyMap innerMapProperty = (PropertyMap) propertyList.get(0);

        Map<String, Property> propertyMap = innerMapProperty.getMap();
        assert propertyMap.size()==1;
View Full Code Here

        Property prop = config.get("Inner");
        assert prop!=null;
        assert prop instanceof PropertyList : "Inner is no list";

        PropertyList plist = (PropertyList) prop;
        List<Property> propertyList = plist.getList();
        assert propertyList.size()==2;
        for (Property innerProp : propertyList) {
            assert innerProp instanceof PropertySimple;
            PropertySimple ps = (PropertySimple) innerProp;
            assert ps.getName().equals("Inner");
View Full Code Here

    @Test
    public void testConfigToMapComplexList() throws Exception {

        Configuration config = new Configuration();
        PropertyList propertyList = new PropertyList("aList");
        propertyList.add(new PropertySimple("string", "Hello"));
        propertyList.add(new PropertySimple("string", "World"));
        config.put(propertyList);


        ConfigurationDefinition definition = new ConfigurationDefinition("bla",null);
        definition.put(new PropertyDefinitionList("aList",null,false,
View Full Code Here

    public void testConfigToMapComplexMap() throws Exception {

        Configuration config = new Configuration();
        PropertyMap propertyMap = new PropertyMap("aMap");
        config.put(propertyMap);
        PropertyList propertyList = new PropertyList("aList");
        propertyList.add(new PropertySimple("string", "Hello"));
        propertyList.add(new PropertySimple("string", "World"));
        propertyMap.put(propertyList);

        propertyMap.put(new PropertySimple("aString","Frobnitz"));

View Full Code Here

TOP

Related Classes of org.rhq.core.domain.configuration.PropertyList

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.