public void testTransformParsePrimitive()
{
Message csvMessage = m_metadata.getMessage("CSVTestSuiteResult");
MessageParser csvParser = (MessageParser)csvMessage.getFormat().getParser().getInstance(m_context);
StringInput in;
TransferObject root, result, sub;
List list;
in = new StringInput("date,status,result\n" +
"2009-09-23T17:34:00,PASS,\"<XMLTestResult seed=\\\"5\\\"><a>aValue</a></XMLTestResult>\"\n" +
"2009-09-23T17:36:00,FAIL,\"<XMLTestResult><a>aValue2</a><b>bValue</b></XMLTestResult>\"\n"
);
root = csvParser.parse(in, csvMessage);
assertEquals("CSVTestSuiteResult", root.getClassName());
assertEquals(2, ((List)root.getValue("rows")).size());
result = m_tf.transform(root, m_metadata.getTransformation("CSVTestSuiteResultToXMLTestSuiteResult"));
assertEquals("XMLTestSuiteResult", result.getClassName());
list = (List)result.getValue("tests");
assertEquals(2, list.size());
sub = (TransferObject)list.get(0);
assertEquals(Primitive.toTimestamp("2009-09-23T17:34:00"), sub.getValue("date"));
assertEquals("PASS", sub.getValue("status"));
sub = (TransferObject)sub.getValue("data");
assertEquals("XMLTestResult", sub.getClassName());
assertEquals("5", sub.getValue("seed"));
assertEquals("aValue", sub.getValue("a"));
assertFalse(sub.hasValue("b"));
sub = (TransferObject)list.get(1);
assertEquals(Primitive.toTimestamp("2009-09-23T17:36:00"), sub.getValue("date"));
assertEquals("FAIL", sub.getValue("status"));
sub = (TransferObject)sub.getValue("data");
assertEquals("XMLTestResult", sub.getClassName());
assertEquals("bValue", sub.getValue("b"));
assertEquals("aValue2", sub.getValue("a"));
assertFalse(sub.hasValue("seed"));
// Try using a message that is referred to by a message with no format
TransferObject outer = new TransferObject(1);
outer.setValue("csv", root);
result = m_tf.transform(outer, m_metadata.getTransformation("TestSuiteResult"));
assertEquals("MultiFormatReferrer", result.getClassName());
assertFalse(result.hasValue("csv"));
result = (TransferObject)result.getValue("xml");