public void testTable() throws Exception
{
Message tableMessage = getMessage("Table");
StringWriter writer = new StringWriter();
XMLMetadataExporter exporter = new XMLMetadataExporter(writer);
exporter.exportMessage(tableMessage);
assertEquals(tableMessage.getRoot().getPartCount(), 2);
CompositeMessagePart rowPart = (CompositeMessagePart)tableMessage.getRoot().getPart("Row");
PrimitiveMessagePart namePart = (PrimitiveMessagePart)rowPart.getPart("name");
assertEquals(namePart.getType(), Primitive.STRING);
PrimitiveMessagePart timePart = (PrimitiveMessagePart)rowPart.getPart("time");
assertEquals(timePart.getType(), Primitive.LONG);
PrimitiveMessagePart booleanPart = (PrimitiveMessagePart)rowPart.getPart("required");
assertEquals(booleanPart.getType(), Primitive.BOOLEAN);
PrimitiveMessagePart enumPart = (PrimitiveMessagePart)rowPart.getPart("type");
assertEquals(enumPart.getType(), Primitive.STRING);
assertEquals( enumPart.getEnumerationCount(), 10);
//System.err.println(XMLUtil.formatXML(writer.toString()));
Message recursiveElement = getMessage("recursiveElement");
MessagePart elem2 = recursiveElement.getRoot().getPart("recursiveElement2");
assertTrue(elem2 instanceof CompositeMessagePartRef);
CompositeMessagePartRef msgRef = (CompositeMessagePartRef)elem2;
assertEquals("recursiveElement2", msgRef.getName());
assertEquals(msgRef.getRefPart(), getMessage("recursiveElement2").getRoot());
writer = new StringWriter();
exporter = new XMLMetadataExporter(writer);
exporter.exportMessage(recursiveElement);
}