assertEquals("r", tobj.getValue("s"));
}
public void testHealthCareUseCase()
{
TransferObject msg = new TransferObject("HL7_25_ADT_A04");
TransferObject pid = new TransferObject(3);
msg.setValue("patientIdentification", pid);
List idList = new ArrayList(2);
pid.setValue("patientIdentifierList", idList);
TransferObject id = new TransferObject(2);
id.setValue("idNumber", "1234567890");
TransferObject auth = new TransferObject(1);
auth.setValue("universalId", "OHIP");
id.setValue("assigningAuthority", auth);
idList.add(id);
id = new TransferObject(2);
id.setValue("idNumber", "234567890");
auth = new TransferObject(1);
auth.setValue("universalId", "SIN");
id.setValue("assigningAuthority", auth);
idList.add(id);
List nameList = new ArrayList(1);
pid.setValue("patientName", nameList);
TransferObject name = new TransferObject(4);
name.setValue("givenName", "Joe");
name.setValue("initials", "F.");
name.setValue("degree", "Ph.D.");
TransferObject family = new TransferObject(1);
family.setValue("surname", "Test");
name.setValue("familyName", family);
nameList.add(name);
TransferObject dob = new TransferObject(1);
dob.setValue("time", new Timestamp(100000));
pid.setValue("dateTimeOfBirth", dob);
pid.setValue("administrativeSex", "N");
List addressList = new ArrayList(2);
pid.setValue("patientAddress", addressList);
TransferObject address = new TransferObject();
TransferObject street = new TransferObject(1);
street.setValue("streetAddress", "123 45th St.");
address.setValue("streetAddress", street);
address.setValue("otherDesignation", "#456");
address.setValue("city", "Toronto");
address.setValue("state", "ON");
address.setValue("zip", "A1B 2C3");
address.setValue("country", "Canada");
address.setValue("addressType", "B");
addressList.add(address);
address = new TransferObject();
street = new TransferObject(1);
street.setValue("streetAddress", "789 Geek Blvd.");
address.setValue("streetAddress", street);
address.setValue("otherDesignation", "basement");
address.setValue("city", "Richmond Hill");
address.setValue("state", "ON");
address.setValue("zip", "M4N 4H5");
address.setValue("country", "Canada");
address.setValue("addressType", "H");
addressList.add(address);
List phoneList = new ArrayList(2);
TransferObject phone = new TransferObject(2);
phone.setValue("telephoneNumber", "(905) 123-4567");
phone.setValue("emailAddress", "jtest@yahoo.ca");
phoneList.add(phone);
phone = new TransferObject(2);
phone.setValue("telephoneNumber", "(905) 765-4321");
phone.setValue("emailAddress", "haxx0r16@yahoo.ca");
phoneList.add(phone);
pid.setValue("phoneNumberHome", phoneList);
phoneList = new ArrayList(2);
phone = new TransferObject(2);
phone.setValue("telephoneNumber", "(416) 123-4567");
phone.setValue("emailAddress", "jtest@dot.com");
phoneList.add(phone);
phone = new TransferObject(2);
phone.setValue("telephoneNumber", "(416) 765-4321");
phone.setValue("emailAddress", "joe.test@dot.com");
phoneList.add(phone);
pid.setValue("phoneNumberBusiness", phoneList);
Logger.getLogger(TransformerTest.class).info("src" + msg.toString());
TransferObject res = m_tf.transform(msg, m_metadata.getTransformation("HL7_25_ADT_A04_Object_PatientDemographics"));
Logger.getLogger(TransformerTest.class).info("dst" + res.toString());
assertEquals("Object_PatientDemographics", res.getClassName());
assertEquals(1, res.getValueCount());
TransferObject player = (TransferObject)res.getValue("player");
assertEquals(11, player.getValueCount());
assertEquals("Joe", player.getValue("firstName"));
assertEquals("F.", player.getValue("initials"));
assertEquals("Test", player.getValue("lastName"));
assertEquals("Test, Joe", player.getValue("fullName"));
assertEquals("Ph.D.", player.getValue("title"));
assertEquals("Ph.D.", player.getValue("affix"));
assertEquals(new Timestamp(100000), player.getValue("birthTime"));
// Validate ids
List list = (List)player.getValue("ids");
assertEquals(2, list.size());
TransferObject tobj = (TransferObject)list.get(0);
assertEquals(2, tobj.getValueCount());
assertEquals("OHIP", tobj.getValue("type"));
assertEquals("1234567890", tobj.getValue("id"));
tobj = (TransferObject)list.get(1);
assertEquals(2, tobj.getValueCount());
assertEquals("SIN", tobj.getValue("type"));
assertEquals("234567890", tobj.getValue("id"));
// Validate addrs
list = (List)player.getValue("addrs");
assertEquals(2, list.size());
tobj = (TransferObject)list.get(0);
assertEquals(7, tobj.getValueCount());
assertEquals("Toronto", tobj.getValue("city"));
assertEquals("123 45th St.", tobj.getValue("address1"));
assertEquals("#456", tobj.getValue("address2"));
assertEquals("ON", tobj.getValue("state"));
assertEquals("Canada", tobj.getValue("country"));
assertEquals("A1B 2C3", tobj.getValue("zip"));
tobj = (TransferObject)tobj.getValue("type");
assertEquals(1, tobj.getValueCount());
tobj = (TransferObject)tobj.getValue("useCodes");
assertEquals(1, tobj.getValueCount());
assertEquals("WP", tobj.getValue("code"));
tobj = (TransferObject)list.get(1);
assertEquals(7, tobj.getValueCount());
assertEquals("Richmond Hill", tobj.getValue("city"));
assertEquals("789 Geek Blvd.", tobj.getValue("address1"));
assertEquals("basement", tobj.getValue("address2"));
assertEquals("ON", tobj.getValue("state"));
assertEquals("Canada", tobj.getValue("country"));
assertEquals("M4N 4H5", tobj.getValue("zip"));
tobj = (TransferObject)tobj.getValue("type");
assertEquals(1, tobj.getValueCount());
tobj = (TransferObject)tobj.getValue("useCodes");
assertEquals(1, tobj.getValueCount());
assertEquals("HP", tobj.getValue("code"));
// Validate telcoms
list = (List)player.getValue("telcoms");
assertEquals(6, list.size());
tobj = (TransferObject)list.get(0);
assertEquals(2, tobj.getValueCount());
assertEquals("(905) 123-4567", tobj.getValue("address"));
tobj = (TransferObject)tobj.getValue("type");
assertEquals(1, tobj.getValueCount());
List list2 = (List)tobj.getValue("useCodes");
assertEquals(1, list2.size());
tobj = (TransferObject)list2.get(0);
assertEquals(1, tobj.getValueCount());
assertEquals("HP", tobj.getValue("code"));
tobj = (TransferObject)list.get(1);
assertEquals(2, tobj.getValueCount());
assertEquals("jtest@yahoo.ca", tobj.getValue("address"));
tobj = (TransferObject)tobj.getValue("type");
assertEquals(1, tobj.getValueCount());
list2 = (List)tobj.getValue("useCodes");
assertEquals(1, list2.size());
tobj = (TransferObject)list2.get(0);
assertEquals(1, tobj.getValueCount());
assertEquals("EMAIL", tobj.getValue("code"));
tobj = (TransferObject)list.get(2);
assertEquals(2, tobj.getValueCount());
assertEquals("(905) 765-4321", tobj.getValue("address"));
tobj = (TransferObject)tobj.getValue("type");
assertEquals(1, tobj.getValueCount());
list2 = (List)tobj.getValue("useCodes");
assertEquals(1, list2.size());
tobj = (TransferObject)list2.get(0);
assertEquals(1, tobj.getValueCount());
assertEquals("HP", tobj.getValue("code"));
tobj = (TransferObject)list.get(3);
assertEquals(2, tobj.getValueCount());
assertEquals("haxx0r16@yahoo.ca", tobj.getValue("address"));
tobj = (TransferObject)tobj.getValue("type");
assertEquals(1, tobj.getValueCount());
list2 = (List)tobj.getValue("useCodes");
assertEquals(1, list2.size());
tobj = (TransferObject)list2.get(0);
assertEquals(1, tobj.getValueCount());
assertEquals("EMAIL", tobj.getValue("code"));
tobj = (TransferObject)list.get(4);
assertEquals(2, tobj.getValueCount());
assertEquals("(416) 123-4567", tobj.getValue("address"));
tobj = (TransferObject)tobj.getValue("type");
assertEquals(1, tobj.getValueCount());
list2 = (List)tobj.getValue("useCodes");
assertEquals(1, list2.size());
tobj = (TransferObject)list2.get(0);
assertEquals(1, tobj.getValueCount());
assertEquals("WP", tobj.getValue("code"));
tobj = (TransferObject)list.get(5);
assertEquals(2, tobj.getValueCount());
assertEquals("(416) 765-4321", tobj.getValue("address"));
tobj = (TransferObject)tobj.getValue("type");
assertEquals(1, tobj.getValueCount());
list2 = (List)tobj.getValue("useCodes");
assertEquals(1, list2.size());
tobj = (TransferObject)list2.get(0);
assertEquals(1, tobj.getValueCount());
assertEquals("WP", tobj.getValue("code"));
// Validate genderCode
tobj = (TransferObject)player.getValue("genderCode");
assertEquals(1, tobj.getValueCount());
assertEquals("N", tobj.getValue("value"));
}