m_surgeon = null;
}
public void testFormatRootInheritance()
{
ObjectOutput out;
TransferObject root;
Instance result;
// Format the super-message (no polymorphism)
root = new TransferObject("Object_Inherit_Contact", 3);
root.setValue("firstName", "Simon");
root.setValue("lastName", "Lee");
root.setValue("middleName", "K");
out = new ObjectOutput();
m_formatter.format(root, m_contactMsg, out);
result = (Instance)out.getObject();
assertEquals("Contact", result.getMetaclass().getName());
assertEquals("Simon", result.getValue("firstName"));
assertNull(result.findValue("lastName"));
assertNull(result.findValue("middleName"));
assertEquals(Instance.NEW, result.getState());
rollback();
// Format the sub-message (no polymorphism)
root = new TransferObject("Object_Inherit_Patient", 3);
root.setValue("firstName", "Simon");
root.setValue("lastName", "Lee");
root.setValue("middleName", "K");
out = new ObjectOutput();
m_formatter.format(root, m_patientMsg, out);
result = (Instance)out.getObject();
assertEquals("Patient", result.getMetaclass().getName());
assertEquals("Simon", result.getValue("firstName"));
assertEquals("Lee", result.getValue("lastName"));
assertEquals("K", result.getValue("middleName"));
assertEquals(Instance.NEW, result.getState());
rollback();
// Format the sub-message polymorphically
root = new TransferObject("Object_Inherit_Patient", 3);
root.setValue("firstName", "Simon");
root.setValue("lastName", "Lee");
root.setValue("middleName", "K");
out = new ObjectOutput();
m_formatter.format(root, m_contactMsg, out);
result = (Instance)out.getObject();
assertEquals("Patient", result.getMetaclass().getName());
assertEquals("Simon", result.getValue("firstName"));
assertEquals("Lee", result.getValue("lastName"));
assertEquals("K", result.getValue("middleName"));
assertEquals(Instance.NEW, result.getState());
rollback();
// Format Patient2 with Contact_NonPoly (should fail polymorphic check)
root = new TransferObject("Object_Inherit_Patient2", 3);
root.setValue("firstName", "Simon");
root.setValue("lastName", "Lee");
root.setValue("middleName", "K");
out = new ObjectOutput();
try
{
m_formatter.format(root, m_contactNonPolyMsg, out);
fail("Expected IntegrationException");