1 | /*
|
---|
2 | * To change this template, choose Tools | Templates
|
---|
3 | * and open the template in the editor.
|
---|
4 | */
|
---|
5 |
|
---|
6 | package gov.hhs.fha.nhinc.auditrepository;
|
---|
7 |
|
---|
8 | import javax.xml.bind.JAXBElement;
|
---|
9 |
|
---|
10 | import gov.hhs.fha.nhinc.common.nhinccommonadapter.FindCommunitiesAndAuditEventsResponseType;
|
---|
11 | import gov.hhs.fha.nhinc.common.nhinccommon.ResponseType;
|
---|
12 | import gov.hhs.fha.nhinc.common.nhinccommonadapter.FindAuditEventsRequestType;
|
---|
13 | import gov.hhs.fha.nhinc.common.nhinccommonadapter.RespondingGatewayCrossGatewayQueryRequestType;
|
---|
14 | import gov.hhs.fha.nhinc.common.nhinccommonadapter.RespondingGatewayCrossGatewayQueryResponseType;
|
---|
15 | import gov.hhs.fha.nhinc.common.nhinccommonadapter.RespondingGatewayCrossGatewayRetrieveRequestType;
|
---|
16 | import gov.hhs.fha.nhinc.common.nhinccommonadapter.RespondingGatewayCrossGatewayRetrieveResponseType;
|
---|
17 | import ihe.iti.xds_b._2007.RetrieveDocumentSetRequestType;
|
---|
18 | import ihe.iti.xds_b._2007.RetrieveDocumentSetResponseType;
|
---|
19 | import ihe.iti.xds_b._2007.ProvideAndRegisterDocumentSetRequestType;
|
---|
20 | import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryResponse;
|
---|
21 | import oasis.names.tc.ebxml_regrep.xsd.query._3.AdhocQueryRequest;
|
---|
22 | import org.hl7.v3.PIXConsumerMCCIIN000002UV01RequestType;
|
---|
23 | import org.hl7.v3.PIXConsumerPRPAIN201301UVRequestType;
|
---|
24 | import org.hl7.v3.PIXConsumerPRPAIN201302UVRequestType;
|
---|
25 | import org.hl7.v3.PIXConsumerPRPAIN201303UVRequestType;
|
---|
26 |
|
---|
27 | import org.hl7.v3.PRPAIN201301UV;
|
---|
28 | import org.hl7.v3.PRPAIN201302UV;
|
---|
29 | import org.hl7.v3.PRPAIN201303UV;
|
---|
30 | import org.hl7.v3.MCCIIN000002UV01;
|
---|
31 | import org.hl7.v3.MCCIMT000200UV01Receiver;
|
---|
32 | import org.hl7.v3.MCCIMT000200UV01Device;
|
---|
33 | import org.hl7.v3.II;
|
---|
34 |
|
---|
35 | import gov.hhs.fha.nhinc.common.nhinccommonadapter.FindAuditEventsRequestType;
|
---|
36 | import gov.hhs.fha.nhinc.common.nhinccommonadapter.FindCommunitiesAndAuditEventsResponseType;
|
---|
37 | import gov.hhs.fha.nhinc.common.nhinccommonadapter.FindCommunitiesAndAuditEventsRequestType;
|
---|
38 | import com.services.nhinc.schema.auditmessage.FindAuditEventsType;
|
---|
39 |
|
---|
40 | import org.apache.commons.logging.Log;
|
---|
41 | import org.apache.commons.logging.LogFactory;
|
---|
42 |
|
---|
43 |
|
---|
44 | import org.junit.After;
|
---|
45 | import org.junit.AfterClass;
|
---|
46 | import org.junit.Before;
|
---|
47 | import org.junit.BeforeClass;
|
---|
48 | import org.junit.Test;
|
---|
49 | import static org.junit.Assert.*;
|
---|
50 |
|
---|
51 | import gov.hhs.fha.nhinc.common.nhinccommon.AssertionType;
|
---|
52 | import gov.hhs.fha.nhinc.common.nhinccommon.PersonNameType;
|
---|
53 | import gov.hhs.fha.nhinc.common.nhinccommon.UserType;
|
---|
54 | import gov.hhs.fha.nhinc.common.nhinccommon.HomeCommunityType;
|
---|
55 | /**
|
---|
56 | *
|
---|
57 | * @author mflynn02
|
---|
58 | */
|
---|
59 | public class AuditRepositoryTest {
|
---|
60 | private static Log log = LogFactory.getLog(AuditRepositoryTest.class);
|
---|
61 |
|
---|
62 | public AuditRepositoryTest() {
|
---|
63 | }
|
---|
64 |
|
---|
65 | @BeforeClass
|
---|
66 | public static void setUpClass() throws Exception {
|
---|
67 | }
|
---|
68 |
|
---|
69 | @AfterClass
|
---|
70 | public static void tearDownClass() throws Exception {
|
---|
71 | }
|
---|
72 |
|
---|
73 | @Before
|
---|
74 | public void setUp() {
|
---|
75 | }
|
---|
76 |
|
---|
77 | @After
|
---|
78 | public void tearDown() {
|
---|
79 | }
|
---|
80 |
|
---|
81 | /**
|
---|
82 | * Test of queryAuditEvents method, of class AuditRepository.
|
---|
83 | */
|
---|
84 | @Test
|
---|
85 | public void testQueryAuditEvents() {
|
---|
86 | log.debug("Begin - testQueryAuditEvents");
|
---|
87 |
|
---|
88 | FindCommunitiesAndAuditEventsRequestType queryAuditEventsRequest = new FindCommunitiesAndAuditEventsRequestType();
|
---|
89 | FindAuditEventsType event = new FindAuditEventsType();
|
---|
90 | event.setPatientId("3333333^^^&2.16.840.1.113883.13.25&ISO");
|
---|
91 | queryAuditEventsRequest.setFindAuditEvents(event);
|
---|
92 | AuditRepository instance = new AuditRepository();
|
---|
93 | FindCommunitiesAndAuditEventsResponseType expResult = new FindCommunitiesAndAuditEventsResponseType();
|
---|
94 | FindCommunitiesAndAuditEventsResponseType result = instance.queryAuditEvents(queryAuditEventsRequest);
|
---|
95 |
|
---|
96 | log.debug("result. : " + result.getFindAuditEventResponse().getFindAuditEventsReturn().size());
|
---|
97 |
|
---|
98 | // assertEquals(expResult, result);
|
---|
99 |
|
---|
100 | log.debug("Begin - testQueryAuditEvents");
|
---|
101 | }
|
---|
102 |
|
---|
103 | public II createII(String root, String extension) {
|
---|
104 | II newII = new II();
|
---|
105 |
|
---|
106 | newII.setRoot(root);
|
---|
107 | newII.setExtension(extension);
|
---|
108 |
|
---|
109 | return newII;
|
---|
110 | }
|
---|
111 |
|
---|
112 | public PersonNameType createPersonName (String givenName, String familyName) {
|
---|
113 | PersonNameType newPerson = new PersonNameType();
|
---|
114 |
|
---|
115 | newPerson.setFamilyName(familyName);
|
---|
116 | newPerson.setGivenName(givenName);
|
---|
117 |
|
---|
118 | return newPerson;
|
---|
119 | }
|
---|
120 | public HomeCommunityType createHomeCommunity (String homeCommunityId, String homeCommunityName) {
|
---|
121 | HomeCommunityType newHC = new HomeCommunityType();
|
---|
122 |
|
---|
123 | newHC.setHomeCommunityId(homeCommunityId);
|
---|
124 | newHC.setName(homeCommunityName);
|
---|
125 |
|
---|
126 | return newHC;
|
---|
127 | }
|
---|
128 |
|
---|
129 | public UserType createUserType (String given, String family, String homeCommunityId, String homeCommunityName) {
|
---|
130 | UserType newUser = new UserType();
|
---|
131 |
|
---|
132 | newUser.setPersonName(createPersonName(given, family));
|
---|
133 | newUser.setUserName(given + " " + family);
|
---|
134 | newUser.setOrg(createHomeCommunity(homeCommunityId, homeCommunityName));
|
---|
135 |
|
---|
136 | return newUser;
|
---|
137 | }
|
---|
138 |
|
---|
139 | }
|
---|