configDef.put(mapRequired1);
configDef.put(mapRequiredDefault1);
// SETUP LIST
PropertyDefinitionList list1 = new PropertyDefinitionList("list1", null, false, a);
PropertyDefinitionList listRequired1 = new PropertyDefinitionList("listRequired1", null, true, a);
PropertyDefinitionList listRequiredDefault1 = new PropertyDefinitionList("listRequiredDefault1", null, true, c);
configDef.put(list1);
configDef.put(listRequired1);
configDef.put(listRequiredDefault1);
// SETUP LIST-O-MAPS
PropertyDefinitionMap map2 = new PropertyDefinitionMap("map2", null, false, a, b, c);
PropertyDefinitionMap mapRequired2 = new PropertyDefinitionMap("mapRequired2", null, true, a, b, c);
PropertyDefinitionMap mapRequiredDefault2 = new PropertyDefinitionMap("mapRequiredDefault2", null, true, a, b,
c);
PropertyDefinitionList listX = new PropertyDefinitionList("listX", null, true, map2);
PropertyDefinitionList listY = new PropertyDefinitionList("listY", null, true, mapRequired2);
PropertyDefinitionList listZ = new PropertyDefinitionList("listZ", null, true, mapRequiredDefault2);
configDef.put(listX);
configDef.put(listY);
configDef.put(listZ);
// get the default config
Configuration config = ConfigurationUtility.createDefaultConfiguration(configDef);
assert config != null;
assert config.getProperties().size() == 10;
// ASSERT SIMPLE
assert config.getSimple(simple.getName()) == null;
assert config.getSimpleValue(simpleRequired.getName(), null) == null;
assert config.getSimpleValue(simpleDefault.getName(), null).equals("!!simpleDefaultValue!!");
assert config.getSimpleValue(simpleRequiredDefault.getName(), null).equals("!!simpleRequiredDefaultValue!!");
// ASSERT MAP
assert config.getMap(map1.getName()) == null;
// the two required maps have the same definitions - a,b,c as above. since a isn't required with no default, its not there
PropertyMap mapProp1 = config.getMap(mapRequired1.getName());
assert mapProp1 != null;
assert mapProp1.getSimple(a.getName()) == null;
assert mapProp1.getSimpleValue(b.getName(), null).equals("!!bDefaultValue!!");
assert mapProp1.getSimpleValue(c.getName(), null).equals("!!cDefaultValue!!");
mapProp1 = config.getMap(mapRequiredDefault1.getName());
assert mapProp1 != null;
assert mapProp1.getSimple(a.getName()) == null;
assert mapProp1.getSimpleValue(b.getName(), null).equals("!!bDefaultValue!!");
assert mapProp1.getSimpleValue(c.getName(), null).equals("!!cDefaultValue!!");
// ASSERT LIST
assert config.getList(list1.getName()) == null;
PropertyList listProp1 = config.getList(listRequired1.getName());
assert listProp1 != null;
assert listProp1.getList().isEmpty(); // has "a" definition, which is not required and has no default
listProp1 = config.getList(listRequiredDefault1.getName());
assert listProp1 != null;
assert listProp1.getList().get(0).getName().equals(c.getName());
assert ((PropertySimple) listProp1.getList().get(0)).getStringValue().equals("!!cDefaultValue!!");
// ASSERT LIST-O-MAPS
PropertyList listPropTest = config.getList(listX.getName());
assert listPropTest != null;
assert listPropTest.getList().isEmpty();
listPropTest = config.getList(listY.getName());
assert listPropTest != null;
PropertyMap childMap2 = (PropertyMap) listPropTest.getList().get(0);
listPropTest = config.getList(listZ.getName());
assert listPropTest != null;
PropertyMap childMap3 = (PropertyMap) listPropTest.getList().get(0);
assert childMap2.getName().equals(mapRequired2.getName());
assert childMap3.getName().equals(mapRequiredDefault2.getName());