[507] | 1 | /*
|
---|
| 2 | * To change this template, choose Tools | Templates
|
---|
| 3 | * and open the template in the editor.
|
---|
| 4 | */
|
---|
| 5 | package gov.hhs.fha.nhinc.transform.audit;
|
---|
| 6 |
|
---|
| 7 | import com.services.nhinc.schema.auditmessage.AuditMessageType;
|
---|
| 8 | import com.services.nhinc.schema.auditmessage.AuditSourceIdentificationType;
|
---|
| 9 | import com.services.nhinc.schema.auditmessage.ParticipantObjectIdentificationType;
|
---|
| 10 | import java.util.ArrayList;
|
---|
| 11 |
|
---|
| 12 | import org.hl7.v3.*;
|
---|
| 13 | import javax.xml.bind.JAXBElement;
|
---|
| 14 |
|
---|
| 15 | import gov.hhs.fha.nhinc.common.nhinccommon.PersonNameType;
|
---|
| 16 | import gov.hhs.fha.nhinc.common.nhinccommon.HomeCommunityType;
|
---|
| 17 | import gov.hhs.fha.nhinc.common.nhinccommon.UserType;
|
---|
| 18 | import gov.hhs.fha.nhinc.common.auditlog.LogSubjectAddedRequestType;
|
---|
| 19 | import gov.hhs.fha.nhinc.common.auditlog.SubjectAddedMessageType;
|
---|
| 20 | import gov.hhs.fha.nhinc.common.auditlog.LogSubjectRevisedRequestType;
|
---|
| 21 | import gov.hhs.fha.nhinc.common.auditlog.SubjectRevisedMessageType;
|
---|
| 22 | import gov.hhs.fha.nhinc.common.auditlog.LogSubjectRevokedRequestType;
|
---|
| 23 | import gov.hhs.fha.nhinc.common.auditlog.SubjectRevokedMessageType;
|
---|
| 24 | import gov.hhs.fha.nhinc.common.auditlog.NhinSubjectDiscoveryAckMessageType;
|
---|
| 25 | import gov.hhs.fha.nhinc.common.auditlog.LogNhinSubjectDiscoveryAckRequestType;
|
---|
| 26 | import gov.hhs.fha.nhinc.common.auditlog.SubjectReidentificationRequestMessageType;
|
---|
| 27 | import gov.hhs.fha.nhinc.common.auditlog.LogSubjectReidentificationRequestType;
|
---|
| 28 | import gov.hhs.fha.nhinc.common.auditlog.SubjectReidentificationResponseMessageType;
|
---|
| 29 | import gov.hhs.fha.nhinc.common.auditlog.LogSubjectReidentificationResponseType;
|
---|
| 30 | import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType;
|
---|
| 31 | import gov.hhs.fha.nhinc.transform.subdisc.*;
|
---|
| 32 | import gov.hhs.fha.nhinc.common.auditlog.LogEventRequestType;
|
---|
| 33 |
|
---|
| 34 | import org.junit.After;
|
---|
| 35 | import org.junit.AfterClass;
|
---|
| 36 | import org.junit.Before;
|
---|
| 37 | import org.junit.BeforeClass;
|
---|
| 38 | import org.junit.Test;
|
---|
| 39 | import static org.junit.Assert.*;
|
---|
| 40 |
|
---|
| 41 | import org.apache.commons.logging.Log;
|
---|
| 42 | import org.apache.commons.logging.LogFactory;
|
---|
| 43 |
|
---|
| 44 | /**
|
---|
| 45 | *
|
---|
| 46 | * @author MFLYNN02
|
---|
| 47 | */
|
---|
| 48 | public class SubjectDiscoveryTransformsTest {
|
---|
| 49 |
|
---|
| 50 | private static Log log = LogFactory.getLog(SubjectDiscoveryTransformsTest.class);
|
---|
| 51 |
|
---|
| 52 | public SubjectDiscoveryTransformsTest() {
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | @BeforeClass
|
---|
| 56 | public static void setUpClass() throws Exception {
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | @AfterClass
|
---|
| 60 | public static void tearDownClass() throws Exception {
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | @Before
|
---|
| 64 | public void setUp() {
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | @After
|
---|
| 68 | public void tearDown() {
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 | /**
|
---|
| 72 | * Test of transformPRPA2013012AuditMsg method, of class SubjectDiscoveryTransforms.
|
---|
| 73 | */
|
---|
| 74 | @Test
|
---|
| 75 | public void testTransformPRPA2013012AuditMsg() {
|
---|
| 76 | log.debug("Begin - testTransformPRPA2013012AuditMsg");
|
---|
| 77 |
|
---|
| 78 | MCCIMT000100UV01Sender sender = new MCCIMT000100UV01Sender();
|
---|
| 79 | II typeId = new II();
|
---|
| 80 | PersonNameType personName = new PersonNameType();
|
---|
| 81 | HomeCommunityType home = new HomeCommunityType();
|
---|
| 82 | AssertionType assertion = new AssertionType();
|
---|
| 83 |
|
---|
| 84 | LogSubjectAddedRequestType logMessage = new LogSubjectAddedRequestType();
|
---|
| 85 | personName.setFamilyName("Jefferson");
|
---|
| 86 | personName.setGivenName("Thomas");
|
---|
| 87 | UserType userInfo = new UserType();
|
---|
| 88 | userInfo.setPersonName(personName);
|
---|
| 89 | home.setHomeCommunityId("2.16.840.1.113883.3.198");
|
---|
| 90 | home.setName("Federal - DoD");
|
---|
| 91 | userInfo.setOrg(home);
|
---|
| 92 | assertion.setUserInfo(userInfo);
|
---|
| 93 |
|
---|
| 94 | typeId.setRoot("2.16.840.1.113883.3.198");
|
---|
| 95 | typeId.setExtension("user111");
|
---|
| 96 | sender.setTypeId(typeId);
|
---|
| 97 | PRPAMT201301UVPatient patient = new PRPAMT201301UVPatient();
|
---|
| 98 | JAXBElement<PRPAMT201301UVPerson> person = HL7PatientTransforms.create201301PatientPerson("Joe", "Smith", "M", "20080226", "123456789");
|
---|
| 99 | patient = HL7PatientTransforms.create201301Patient(person, typeId);
|
---|
| 100 |
|
---|
| 101 | PRPAIN201301UV message201301 = HL7PRPA201301Transforms.createPRPA201301(patient, home.getHomeCommunityId(), home.getHomeCommunityId(), home.getHomeCommunityId());
|
---|
| 102 |
|
---|
| 103 | message201301.setSender(sender);
|
---|
| 104 |
|
---|
| 105 | // Assign to logMessage
|
---|
| 106 | SubjectAddedMessageType subjectAdded = new SubjectAddedMessageType();
|
---|
| 107 | subjectAdded.setAssertion(assertion);
|
---|
| 108 | subjectAdded.setPRPAIN201301UV(message201301);
|
---|
| 109 | logMessage.setMessage(subjectAdded);
|
---|
| 110 |
|
---|
| 111 | AuditMessageType expResult = new AuditMessageType();
|
---|
| 112 | AuditMessageType.ActiveParticipant participant = new AuditMessageType.ActiveParticipant();
|
---|
| 113 | participant.setUserName("Thomas Jefferson");
|
---|
| 114 | expResult.getActiveParticipant().add(participant);
|
---|
| 115 | AuditSourceIdentificationType auditSource = new AuditSourceIdentificationType();
|
---|
| 116 | auditSource.setAuditEnterpriseSiteID(home.getName());
|
---|
| 117 | expResult.getAuditSourceIdentification().add(auditSource);
|
---|
| 118 | ParticipantObjectIdentificationType partObjectId = new ParticipantObjectIdentificationType();
|
---|
| 119 | partObjectId.setParticipantObjectID(typeId.getExtension() + "^^^&" + home.getHomeCommunityId() + "&ISO");
|
---|
| 120 | expResult.getParticipantObjectIdentification().add(partObjectId);
|
---|
| 121 |
|
---|
| 122 | LogEventRequestType expected = new LogEventRequestType();
|
---|
| 123 | expected.setAuditMessage(expResult);
|
---|
| 124 |
|
---|
| 125 | LogEventRequestType result = SubjectDiscoveryTransforms.transformPRPA2013012AuditMsg(logMessage);
|
---|
| 126 | assertEquals(expected.getAuditMessage().getActiveParticipant().get(0).getUserName(), result.getAuditMessage().getActiveParticipant().get(0).getUserName());
|
---|
| 127 | log.debug("result.userName : " + result.getAuditMessage().getActiveParticipant().get(0).getUserName());
|
---|
| 128 | assertEquals(expected.getAuditMessage().getAuditSourceIdentification().get(0).getAuditEnterpriseSiteID(),
|
---|
| 129 | result.getAuditMessage().getAuditSourceIdentification().get(0).getAuditEnterpriseSiteID());
|
---|
| 130 | assertEquals(expected.getAuditMessage().getParticipantObjectIdentification().get(0).getParticipantObjectID(),
|
---|
| 131 | result.getAuditMessage().getParticipantObjectIdentification().get(0).getParticipantObjectID());
|
---|
| 132 | log.debug("result.patientId : " + result.getAuditMessage().getParticipantObjectIdentification().get(0).getParticipantObjectID());
|
---|
| 133 |
|
---|
| 134 | log.debug("End - testTransformPRPA2013012AuditMsg");
|
---|
| 135 | }
|
---|
| 136 |
|
---|
| 137 | /**
|
---|
| 138 | * Test of transformPRPA2013012AuditMsg method, of class SubjectDiscoveryTransforms.
|
---|
| 139 | */
|
---|
| 140 | @Test
|
---|
| 141 | public void testTransformPRPA2013022AuditMsg() {
|
---|
| 142 | log.debug("Begin - testTransformPRPA2013022AuditMsg");
|
---|
| 143 |
|
---|
| 144 | MCCIMT000100UV01Sender sender = new MCCIMT000100UV01Sender();
|
---|
| 145 | II typeId = new II();
|
---|
| 146 | PersonNameType personName = new PersonNameType();
|
---|
| 147 | HomeCommunityType home = new HomeCommunityType();
|
---|
| 148 | AssertionType assertion = new AssertionType();
|
---|
| 149 |
|
---|
| 150 | LogSubjectRevisedRequestType logMessage = new LogSubjectRevisedRequestType();
|
---|
| 151 |
|
---|
| 152 | typeId.setRoot("2.16.840.1.113883.3.200");
|
---|
| 153 | sender.setTypeId(typeId);
|
---|
| 154 | PRPAIN201302UV message = new PRPAIN201302UV();
|
---|
| 155 | message.setSender(sender);
|
---|
| 156 |
|
---|
| 157 | personName.setFamilyName("Kennedy");
|
---|
| 158 | personName.setGivenName("John");
|
---|
| 159 | UserType userInfo = new UserType();
|
---|
| 160 | userInfo.setPersonName(personName);
|
---|
| 161 | home.setHomeCommunityId("2.16.840.1.113883.3.200");
|
---|
| 162 | home.setName("Federal - VA");
|
---|
| 163 | userInfo.setOrg(home);
|
---|
| 164 | assertion.setUserInfo(userInfo);
|
---|
| 165 |
|
---|
| 166 | typeId.setRoot("2.16.840.1.113883.3.200");
|
---|
| 167 | typeId.setExtension("11111");
|
---|
| 168 | sender.setTypeId(typeId);
|
---|
| 169 | PRPAMT201301UVPatient patient = new PRPAMT201301UVPatient();
|
---|
| 170 | JAXBElement<PRPAMT201301UVPerson> person = HL7PatientTransforms.create201301PatientPerson("Joe", "Smith", "M", "20080226", "123456789");
|
---|
| 171 | patient = HL7PatientTransforms.create201301Patient(person, typeId);
|
---|
| 172 |
|
---|
| 173 | PRPAIN201302UV message201302 = HL7PRPA201302Transforms.createPRPA201302(patient, home.getHomeCommunityId(), home.getHomeCommunityId(), home.getHomeCommunityId(), home.getHomeCommunityId());
|
---|
| 174 |
|
---|
| 175 | message201302.setSender(sender);
|
---|
| 176 |
|
---|
| 177 | // Assign to logMessage
|
---|
| 178 | SubjectRevisedMessageType subjectRevised = new SubjectRevisedMessageType();
|
---|
| 179 | subjectRevised.setAssertion(assertion);
|
---|
| 180 | subjectRevised.setPRPAIN201302UV(message201302);
|
---|
| 181 | logMessage.setMessage(subjectRevised);
|
---|
| 182 |
|
---|
| 183 | AuditMessageType expResult = new AuditMessageType();
|
---|
| 184 | AuditMessageType.ActiveParticipant participant = new AuditMessageType.ActiveParticipant();
|
---|
| 185 | participant.setUserName("John Kennedy");
|
---|
| 186 | expResult.getActiveParticipant().add(participant);
|
---|
| 187 | AuditSourceIdentificationType auditSource = new AuditSourceIdentificationType();
|
---|
| 188 | auditSource.setAuditEnterpriseSiteID(home.getName());
|
---|
| 189 | expResult.getAuditSourceIdentification().add(auditSource);
|
---|
| 190 | ParticipantObjectIdentificationType partObjectId = new ParticipantObjectIdentificationType();
|
---|
| 191 | partObjectId.setParticipantObjectID(typeId.getExtension() + "^^^&" + home.getHomeCommunityId() + "&ISO");
|
---|
| 192 | expResult.getParticipantObjectIdentification().add(partObjectId);
|
---|
| 193 |
|
---|
| 194 | LogEventRequestType expected = new LogEventRequestType();
|
---|
| 195 | expected.setAuditMessage(expResult);
|
---|
| 196 |
|
---|
| 197 | LogEventRequestType result = SubjectDiscoveryTransforms.transformPRPA2013022AuditMsg(logMessage);
|
---|
| 198 | assertEquals(expected.getAuditMessage().getActiveParticipant().get(0).getUserName(), result.getAuditMessage().getActiveParticipant().get(0).getUserName());
|
---|
| 199 | log.debug("result.userName : " + result.getAuditMessage().getActiveParticipant().get(0).getUserName());
|
---|
| 200 | assertEquals(expected.getAuditMessage().getAuditSourceIdentification().get(0).getAuditEnterpriseSiteID(),
|
---|
| 201 | result.getAuditMessage().getAuditSourceIdentification().get(0).getAuditEnterpriseSiteID());
|
---|
| 202 | assertEquals(expected.getAuditMessage().getParticipantObjectIdentification().get(0).getParticipantObjectID(),
|
---|
| 203 | result.getAuditMessage().getParticipantObjectIdentification().get(0).getParticipantObjectID());
|
---|
| 204 | log.debug("result.patientId : " + result.getAuditMessage().getParticipantObjectIdentification().get(0).getParticipantObjectID());
|
---|
| 205 |
|
---|
| 206 | log.debug("End - testTransformPRPA2013022AuditMsg");
|
---|
| 207 |
|
---|
| 208 | }
|
---|
| 209 |
|
---|
| 210 | /**
|
---|
| 211 | * Test of transformPRPA2013012AuditMsg method, of class SubjectDiscoveryTransforms.
|
---|
| 212 | */
|
---|
| 213 | @Test
|
---|
| 214 | public void testTransformPRPA2013032AuditMsg() {
|
---|
| 215 | log.debug("Begin - testTransformPRPA2013032AuditMsg");
|
---|
| 216 |
|
---|
| 217 | MCCIMT000100UV01Sender sender = new MCCIMT000100UV01Sender();
|
---|
| 218 | II typeId = new II();
|
---|
| 219 | PersonNameType personName = new PersonNameType();
|
---|
| 220 | HomeCommunityType home = new HomeCommunityType();
|
---|
| 221 | AssertionType assertion = new AssertionType();
|
---|
| 222 |
|
---|
| 223 | LogSubjectRevokedRequestType logMessage = new LogSubjectRevokedRequestType();
|
---|
| 224 |
|
---|
| 225 | typeId.setRoot("2.16.840.1.113883.3.166.4");
|
---|
| 226 | typeId.setExtension("12345");
|
---|
| 227 | sender.setTypeId(typeId);
|
---|
| 228 | PRPAIN201303UV message = new PRPAIN201303UV();
|
---|
| 229 | message.setSender(sender);
|
---|
| 230 |
|
---|
| 231 | personName.setFamilyName("Franklin");
|
---|
| 232 | personName.setGivenName("Benjamin");
|
---|
| 233 | UserType userInfo = new UserType();
|
---|
| 234 | userInfo.setPersonName(personName);
|
---|
| 235 | home.setHomeCommunityId("2.16.840.1.113883.3.166.4");
|
---|
| 236 | home.setName("CareSpark");
|
---|
| 237 | userInfo.setOrg(home);
|
---|
| 238 | assertion.setUserInfo(userInfo);
|
---|
| 239 |
|
---|
| 240 | typeId.setRoot("2.16.840.1.113883.3.166.4");
|
---|
| 241 | typeId.setExtension("12345");
|
---|
| 242 | sender.setTypeId(typeId);
|
---|
| 243 | PRPAMT201305UVPatient patient = new PRPAMT201305UVPatient();
|
---|
| 244 | log.debug("= = = = = = = = extension " + typeId.getExtension());
|
---|
| 245 | JAXBElement<PRPAMT201305UVPerson> person = HL7PatientTransforms.create201305PatientPerson("Joe", "Smith", "M", "20080226", "123456789", typeId);
|
---|
| 246 | patient = HL7PatientTransforms.create201305Patient(person, typeId);
|
---|
| 247 |
|
---|
| 248 | PRPAIN201303UV message201303 = HL7PRPA201303Transforms.createPRPA201303(patient, home.getHomeCommunityId(), home.getHomeCommunityId(), home.getHomeCommunityId());
|
---|
| 249 |
|
---|
| 250 | message201303.setSender(sender);
|
---|
| 251 |
|
---|
| 252 | // Assign to logMessage
|
---|
| 253 | SubjectRevokedMessageType subjectRevoked = new SubjectRevokedMessageType();
|
---|
| 254 | subjectRevoked.setAssertion(assertion);
|
---|
| 255 | subjectRevoked.setPRPAIN201303UV(message201303);
|
---|
| 256 | logMessage.setMessage(subjectRevoked);
|
---|
| 257 |
|
---|
| 258 |
|
---|
| 259 | AuditMessageType expResult = new AuditMessageType();
|
---|
| 260 | AuditMessageType.ActiveParticipant participant = new AuditMessageType.ActiveParticipant();
|
---|
| 261 | participant.setUserName("Benjamin Franklin");
|
---|
| 262 | expResult.getActiveParticipant().add(participant);
|
---|
| 263 | AuditSourceIdentificationType auditSource = new AuditSourceIdentificationType();
|
---|
| 264 | auditSource.setAuditEnterpriseSiteID(home.getName());
|
---|
| 265 | expResult.getAuditSourceIdentification().add(auditSource);
|
---|
| 266 | ParticipantObjectIdentificationType partObjectId = new ParticipantObjectIdentificationType();
|
---|
| 267 | partObjectId.setParticipantObjectID(typeId.getExtension() + "^^^&" + home.getHomeCommunityId() + "&ISO");
|
---|
| 268 | expResult.getParticipantObjectIdentification().add(partObjectId);
|
---|
| 269 |
|
---|
| 270 | LogEventRequestType expected = new LogEventRequestType();
|
---|
| 271 | expected.setAuditMessage(expResult);
|
---|
| 272 |
|
---|
| 273 | LogEventRequestType result = SubjectDiscoveryTransforms.transformPRPA2013032AuditMsg(logMessage);
|
---|
| 274 | assertEquals(expected.getAuditMessage().getActiveParticipant().get(0).getUserName(), result.getAuditMessage().getActiveParticipant().get(0).getUserName());
|
---|
| 275 | log.debug("result.userName : " + result.getAuditMessage().getActiveParticipant().get(0).getUserName());
|
---|
| 276 | assertEquals(expected.getAuditMessage().getAuditSourceIdentification().get(0).getAuditEnterpriseSiteID(),
|
---|
| 277 | result.getAuditMessage().getAuditSourceIdentification().get(0).getAuditEnterpriseSiteID());
|
---|
| 278 | assertEquals(expected.getAuditMessage().getParticipantObjectIdentification().get(0).getParticipantObjectID(),
|
---|
| 279 | result.getAuditMessage().getParticipantObjectIdentification().get(0).getParticipantObjectID());
|
---|
| 280 | log.debug("result.patientId : " + result.getAuditMessage().getParticipantObjectIdentification().get(0).getParticipantObjectID());
|
---|
| 281 |
|
---|
| 282 | log.debug("End - testTransformPRPA2013032AuditMsg");
|
---|
| 283 |
|
---|
| 284 | }
|
---|
| 285 | /**
|
---|
| 286 | * Test of transformPRPA2013012AuditMsg method, of class SubjectDiscoveryTransforms.
|
---|
| 287 | */
|
---|
| 288 | @Test
|
---|
| 289 | public void testTransformAck2AuditMsg() {
|
---|
| 290 | log.debug("Begin - testTransformAck2AuditMsg");
|
---|
| 291 |
|
---|
| 292 | MCCIMT000200UV01Receiver receiver = new MCCIMT000200UV01Receiver();
|
---|
| 293 | MCCIMT000200UV01Device device = new MCCIMT000200UV01Device();
|
---|
| 294 | II typeId = new II();
|
---|
| 295 | PersonNameType personName = new PersonNameType();
|
---|
| 296 | AssertionType assertion = new AssertionType();
|
---|
| 297 |
|
---|
| 298 | LogNhinSubjectDiscoveryAckRequestType logMessage = new LogNhinSubjectDiscoveryAckRequestType();
|
---|
| 299 |
|
---|
| 300 | typeId.setRoot("2.16.840.1.113883.13.25");
|
---|
| 301 | typeId.setExtension("Bloomington Hospital");
|
---|
| 302 | MCCIIN000002UV01 MCCImessage = new MCCIIN000002UV01();
|
---|
| 303 | device.getId().add(typeId);
|
---|
| 304 | receiver.setDevice(device);
|
---|
| 305 | MCCImessage.getReceiver().add(receiver);
|
---|
| 306 | log.debug("receiver ext " + MCCImessage.getReceiver().get(0).getDevice().getId().get(0).getExtension());
|
---|
| 307 | log.debug("receiver root " + MCCImessage.getReceiver().get(0).getDevice().getId().get(0).getRoot());
|
---|
| 308 | personName.setFamilyName("Jones");
|
---|
| 309 | personName.setGivenName("Jennifer");
|
---|
| 310 | UserType userInfo = new UserType();
|
---|
| 311 | userInfo.setPersonName(personName);
|
---|
| 312 | assertion.setUserInfo(userInfo);
|
---|
| 313 | assertion.getUniquePatientId().add(0, "888888");
|
---|
| 314 |
|
---|
| 315 | AuditMessageType expResult = new AuditMessageType();
|
---|
| 316 | AuditMessageType.ActiveParticipant participant = new AuditMessageType.ActiveParticipant();
|
---|
| 317 | participant.setUserName("Jennifer Jones");
|
---|
| 318 | expResult.getActiveParticipant().add(participant);
|
---|
| 319 | AuditSourceIdentificationType auditSource = new AuditSourceIdentificationType();
|
---|
| 320 | auditSource.setAuditEnterpriseSiteID(typeId.getExtension());
|
---|
| 321 | expResult.getAuditSourceIdentification().add(auditSource);
|
---|
| 322 | ParticipantObjectIdentificationType partObjectId = new ParticipantObjectIdentificationType();
|
---|
| 323 | partObjectId.setParticipantObjectID(assertion.getUniquePatientId().get(0) + "^^^&" + typeId.getRoot() + "&ISO");
|
---|
| 324 | expResult.getParticipantObjectIdentification().add(partObjectId);
|
---|
| 325 |
|
---|
| 326 | NhinSubjectDiscoveryAckMessageType ackMessage = new NhinSubjectDiscoveryAckMessageType();
|
---|
| 327 | PIXConsumerMCCIIN000002UV01RequestType ack = new PIXConsumerMCCIIN000002UV01RequestType();
|
---|
| 328 | ack.setAssertion(assertion);
|
---|
| 329 | ack.setMCCIIN000002UV01(MCCImessage);
|
---|
| 330 | ackMessage.setPIXConsumerMCCIIN000002UV01Request(ack);
|
---|
| 331 | logMessage.setMessage(ackMessage);
|
---|
| 332 | LogEventRequestType expected = new LogEventRequestType();
|
---|
| 333 | expected.setAuditMessage(expResult);
|
---|
| 334 |
|
---|
| 335 | LogEventRequestType result = SubjectDiscoveryTransforms.transformAck2AuditMsg(logMessage);
|
---|
| 336 | assertEquals(expected.getAuditMessage().getActiveParticipant().get(0).getUserName(), result.getAuditMessage().getActiveParticipant().get(0).getUserName());
|
---|
| 337 | log.debug("result.userName : " + result.getAuditMessage().getActiveParticipant().get(0).getUserName());
|
---|
| 338 | assertEquals(expected.getAuditMessage().getAuditSourceIdentification().get(0).getAuditEnterpriseSiteID(),
|
---|
| 339 | result.getAuditMessage().getAuditSourceIdentification().get(0).getAuditEnterpriseSiteID());
|
---|
| 340 | assertEquals(expected.getAuditMessage().getParticipantObjectIdentification().get(0).getParticipantObjectID(),
|
---|
| 341 | result.getAuditMessage().getParticipantObjectIdentification().get(0).getParticipantObjectID());
|
---|
| 342 | log.debug("result.patientId : " + result.getAuditMessage().getParticipantObjectIdentification().get(0).getParticipantObjectID());
|
---|
| 343 |
|
---|
| 344 | log.debug("End - testTransformAck2AuditMsg");
|
---|
| 345 |
|
---|
| 346 | }
|
---|
| 347 |
|
---|
| 348 | /**
|
---|
| 349 | * Test of transformPRPA2013092AuditMsg method, of class SubjectDiscoveryTransforms.
|
---|
| 350 | */
|
---|
| 351 | @Test
|
---|
| 352 | public void testTransformPRPA2013092AuditMsg() {
|
---|
| 353 | log.debug("Begin - testTransformPRPA2013092AuditMsg");
|
---|
| 354 |
|
---|
| 355 | II typeId = new II();
|
---|
| 356 | PersonNameType personName = new PersonNameType();
|
---|
| 357 | HomeCommunityType home = new HomeCommunityType();
|
---|
| 358 | AssertionType assertion = new AssertionType();
|
---|
| 359 |
|
---|
| 360 | LogSubjectReidentificationRequestType logMessage = new LogSubjectReidentificationRequestType();
|
---|
| 361 | personName.setFamilyName("Franklin");
|
---|
| 362 | personName.setGivenName("Aretha");
|
---|
| 363 | UserType userInfo = new UserType();
|
---|
| 364 | userInfo.setPersonName(personName);
|
---|
| 365 | home.setHomeCommunityId("2.16.840.1.113883.3.190");
|
---|
| 366 | home.setName("Health Information Exchange of Medvirginia");
|
---|
| 367 | userInfo.setOrg(home);
|
---|
| 368 | assertion.setUserInfo(userInfo);
|
---|
| 369 |
|
---|
| 370 | typeId.setRoot("2.16.840.1.113883.3.190");
|
---|
| 371 | typeId.setExtension("4444");
|
---|
| 372 |
|
---|
| 373 | PRPAIN201309UV message201309 = HL7PRPA201309Transforms.createPRPA201309(home.getHomeCommunityId(), typeId.getExtension());
|
---|
| 374 |
|
---|
| 375 |
|
---|
| 376 | // Assign to logMessage
|
---|
| 377 | SubjectReidentificationRequestMessageType subjectReident = new SubjectReidentificationRequestMessageType();
|
---|
| 378 | subjectReident.setAssertion(assertion);
|
---|
| 379 | subjectReident.setPRPAIN201309UV(message201309);
|
---|
| 380 | logMessage.setMessage(subjectReident);
|
---|
| 381 |
|
---|
| 382 | AuditMessageType expResult = new AuditMessageType();
|
---|
| 383 | AuditMessageType.ActiveParticipant participant = new AuditMessageType.ActiveParticipant();
|
---|
| 384 | participant.setUserName("Aretha Franklin");
|
---|
| 385 | expResult.getActiveParticipant().add(participant);
|
---|
| 386 | AuditSourceIdentificationType auditSource = new AuditSourceIdentificationType();
|
---|
| 387 | auditSource.setAuditEnterpriseSiteID(home.getName());
|
---|
| 388 | expResult.getAuditSourceIdentification().add(auditSource);
|
---|
| 389 | ParticipantObjectIdentificationType partObjectId = new ParticipantObjectIdentificationType();
|
---|
| 390 | partObjectId.setParticipantObjectID(typeId.getExtension() + "^^^&" + home.getHomeCommunityId() + "&ISO");
|
---|
| 391 | expResult.getParticipantObjectIdentification().add(partObjectId);
|
---|
| 392 |
|
---|
| 393 | LogEventRequestType expected = new LogEventRequestType();
|
---|
| 394 | expected.setAuditMessage(expResult);
|
---|
| 395 |
|
---|
| 396 | LogEventRequestType result = SubjectDiscoveryTransforms.transformPRPA2013092AuditMsg(logMessage);
|
---|
| 397 | assertEquals(expected.getAuditMessage().getActiveParticipant().get(0).getUserName(), result.getAuditMessage().getActiveParticipant().get(0).getUserName());
|
---|
| 398 | log.debug("result.userName : " + result.getAuditMessage().getActiveParticipant().get(0).getUserName());
|
---|
| 399 | assertEquals(expected.getAuditMessage().getAuditSourceIdentification().get(0).getAuditEnterpriseSiteID(),
|
---|
| 400 | result.getAuditMessage().getAuditSourceIdentification().get(0).getAuditEnterpriseSiteID());
|
---|
| 401 | assertEquals(expected.getAuditMessage().getParticipantObjectIdentification().get(0).getParticipantObjectID(),
|
---|
| 402 | result.getAuditMessage().getParticipantObjectIdentification().get(0).getParticipantObjectID());
|
---|
| 403 | log.debug("result.patientId : " + result.getAuditMessage().getParticipantObjectIdentification().get(0).getParticipantObjectID());
|
---|
| 404 |
|
---|
| 405 | log.debug("End - testTransformPRPA2013092AuditMsg");
|
---|
| 406 | }
|
---|
| 407 |
|
---|
| 408 | /**
|
---|
| 409 | * Test of transformPRPA2013092AuditMsg method, of class SubjectDiscoveryTransforms.
|
---|
| 410 | */
|
---|
| 411 | @Test
|
---|
| 412 | public void testTransformPRPA2013102AuditMsg() {
|
---|
| 413 | log.debug("Begin - testTransformPRPA2013102AuditMsg");
|
---|
| 414 |
|
---|
| 415 | II typeId = new II();
|
---|
| 416 | PersonNameType personName = new PersonNameType();
|
---|
| 417 | HomeCommunityType home = new HomeCommunityType();
|
---|
| 418 | AssertionType assertion = new AssertionType();
|
---|
| 419 |
|
---|
| 420 | LogSubjectReidentificationResponseType logMessage = new LogSubjectReidentificationResponseType();
|
---|
| 421 | personName.setFamilyName("Joplin");
|
---|
| 422 | personName.setGivenName("Janis");
|
---|
| 423 | UserType userInfo = new UserType();
|
---|
| 424 | userInfo.setPersonName(personName);
|
---|
| 425 | home.setHomeCommunityId("2.16.840.1.113883.3.74");
|
---|
| 426 | home.setName("West Virginia Health Information Network");
|
---|
| 427 | userInfo.setOrg(home);
|
---|
| 428 | assertion.setUserInfo(userInfo);
|
---|
| 429 |
|
---|
| 430 | typeId.setRoot("2.16.840.1.113883.3.74");
|
---|
| 431 | typeId.setExtension("09890");
|
---|
| 432 |
|
---|
| 433 | PRPAMT201307UVQueryByParameter queryByParam = new PRPAMT201307UVQueryByParameter();
|
---|
| 434 | PRPAIN201310UV message201310 = HL7PRPA201310Transforms.createPRPA201310(typeId.getExtension(), typeId.getRoot(), typeId.getRoot(), home.getHomeCommunityId(), home.getHomeCommunityId(), queryByParam);
|
---|
| 435 |
|
---|
| 436 | // Assign to logMessage
|
---|
| 437 | SubjectReidentificationResponseMessageType subjectReident = new SubjectReidentificationResponseMessageType();
|
---|
| 438 | subjectReident.setPRPAIN201310UV(message201310);
|
---|
| 439 | logMessage.setMessage(subjectReident);
|
---|
| 440 | logMessage.setAssertion(assertion);
|
---|
| 441 |
|
---|
| 442 | AuditMessageType expResult = new AuditMessageType();
|
---|
| 443 | AuditMessageType.ActiveParticipant participant = new AuditMessageType.ActiveParticipant();
|
---|
| 444 | participant.setUserName("Janis Joplin");
|
---|
| 445 | expResult.getActiveParticipant().add(participant);
|
---|
| 446 | AuditSourceIdentificationType auditSource = new AuditSourceIdentificationType();
|
---|
| 447 | auditSource.setAuditEnterpriseSiteID(home.getName());
|
---|
| 448 | expResult.getAuditSourceIdentification().add(auditSource);
|
---|
| 449 | ParticipantObjectIdentificationType partObjectId = new ParticipantObjectIdentificationType();
|
---|
| 450 | partObjectId.setParticipantObjectID(typeId.getExtension() + "^^^&" + home.getHomeCommunityId() + "&ISO");
|
---|
| 451 | expResult.getParticipantObjectIdentification().add(partObjectId);
|
---|
| 452 |
|
---|
| 453 | LogEventRequestType expected = new LogEventRequestType();
|
---|
| 454 | expected.setAuditMessage(expResult);
|
---|
| 455 |
|
---|
| 456 | LogEventRequestType result = SubjectDiscoveryTransforms.transformPRPA2013102AuditMsg(logMessage);
|
---|
| 457 | assertEquals(expected.getAuditMessage().getActiveParticipant().get(0).getUserName(), result.getAuditMessage().getActiveParticipant().get(0).getUserName());
|
---|
| 458 | log.debug("result.userName : " + result.getAuditMessage().getActiveParticipant().get(0).getUserName());
|
---|
| 459 | log.debug("Expected AuditEnterpriseSiteID " + expected.getAuditMessage().getAuditSourceIdentification().get(0).getAuditEnterpriseSiteID());
|
---|
| 460 | log.debug("Actual " + result.getAuditMessage().getAuditSourceIdentification().get(0).getAuditEnterpriseSiteID());
|
---|
| 461 |
|
---|
| 462 | assertEquals(expected.getAuditMessage().getAuditSourceIdentification().get(0).getAuditEnterpriseSiteID(),
|
---|
| 463 | result.getAuditMessage().getAuditSourceIdentification().get(0).getAuditEnterpriseSiteID());
|
---|
| 464 | log.debug("Expected ParticipantObjectID " + expected.getAuditMessage().getParticipantObjectIdentification().get(0).getParticipantObjectID());
|
---|
| 465 | log.debug("Actual " + result.getAuditMessage().getParticipantObjectIdentification().get(0).getParticipantObjectID());
|
---|
| 466 | assertEquals(expected.getAuditMessage().getParticipantObjectIdentification().get(0).getParticipantObjectID(),
|
---|
| 467 | result.getAuditMessage().getParticipantObjectIdentification().get(0).getParticipantObjectID());
|
---|
| 468 | log.debug("result.patientId : " + result.getAuditMessage().getParticipantObjectIdentification().get(0).getParticipantObjectID());
|
---|
| 469 |
|
---|
| 470 | log.debug("End - testTransformPRPA2013102AuditMsg");
|
---|
| 471 | }
|
---|
| 472 |
|
---|
| 473 | }
|
---|