*/
public void testDateComplex()
{
String configString = createXml(TEST_DATE_COMPLEX);
InputStream reader = new ByteArrayInputStream(configString.getBytes());
XmlReader xmlReader = null;
// Configure date/timestamp formats
XmlIOConfig config = XmlIOConfig.getInstance();
DateConverter dconv = new DateConverter("yyyy-MM-dd");
config.addConverter(dconv);
TimestampConverter tconv = new TimestampConverter("yyyy-MM-dd HH:mm");
config.addConverter(tconv);
List plist = new LinkedList();
PropertyMap pmap = new PropertyMap("created");
plist.add(pmap);
pmap = new PropertyMap("startDate");
plist.add(pmap);
pmap = new PropertyMap("startTime");
dconv = new DateConverter("HH:mm:ss");
pmap.setConverter(dconv);
plist.add(pmap);
pmap = new PropertyMap("endTime");
pmap.setConverter(dconv);
plist.add(pmap);
ObjectMap omap = new ObjectMap("TestHelperDate", "TestHelperDate", plist);
config.addObjectMap(omap);
try
{
xmlReader = new XmlReader(reader, "org.bifrost.xmlio.test.helpers");
}
catch (XmlException e)
{
fail("Unexpected error: " + e.toString());
}
assertNotNull(xmlReader);
TestHelperDate helper = (TestHelperDate)xmlReader.getRootObject();
assertNotNull(helper);
Calendar cal = new GregorianCalendar();
// Validate that the timestamp property was set correctly
cal.setTime(helper.getCreated());
assertTrue(cal.get(Calendar.YEAR) == 2003);