View Javadoc
1   /*
2    * Copyright 2012 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.openehealth.ipf.commons.ihe.core.atna;
17  
18  import org.junit.Test;
19  import org.openehealth.ipf.commons.ihe.core.atna.custom.CustomPixAuditor;
20  import org.openhealthtools.ihe.atna.auditor.codes.rfc3881.RFC3881EventCodes.RFC3881EventOutcomeCodes;
21  
22  import static org.junit.Assert.assertEquals;
23  
24  /**
25   * @author Dmytro Rud
26   */
27  public class PixAuditorTest extends OhtAuditorTestBase {
28  
29      private static final String SENDING_FACILITY        = "sendingFacility";
30      private static final String SENDING_APPLICATION     = "sendingApplication";
31      private static final String RECEIVING_FACILITY      = "receivingFacility";
32      private static final String RECEIVING_APPLICATION   = "receivingApplication";
33      private static final String LOCAL_PATIENT_ID        = "local^^^&1.2.3&ISO";
34      private static final String SUBSUMED_PATIENT_ID     = "subsumed^^^&1.2.3&ISO";
35      private static final String NEW_PATIENT_ID          = "new^^^&1.3.14&ISO";
36      private static final String PREVIOUS_PATIENT_ID     = "previous^^^&1.8.7&ISO";
37      private static final String SUBMISSION_SET_UUID     = "submisson-set-uuid";
38  
39  
40      @Test
41      public void testAuditors() {
42          final CustomPixAuditor auditor = AuditorManager.getCustomPixAuditor();
43  
44          auditor.auditIti64(
45                  true,
46                  RFC3881EventOutcomeCodes.SUCCESS,
47                  CLIENT_IP_ADDRESS,
48                  SENDING_FACILITY,
49                  SENDING_APPLICATION,
50                  SERVER_URI,
51                  RECEIVING_FACILITY,
52                  RECEIVING_APPLICATION,
53                  MESSAGE_ID,
54                  LOCAL_PATIENT_ID,
55                  SUBSUMED_PATIENT_ID,
56                  NEW_PATIENT_ID,
57                  PREVIOUS_PATIENT_ID,
58                  SUBMISSION_SET_UUID);
59  
60          auditor.auditIti64(
61                  false,
62                  RFC3881EventOutcomeCodes.SUCCESS,
63                  CLIENT_IP_ADDRESS,
64                  SENDING_FACILITY,
65                  SENDING_APPLICATION,
66                  SERVER_URI,
67                  RECEIVING_FACILITY,
68                  RECEIVING_APPLICATION,
69                  MESSAGE_ID,
70                  LOCAL_PATIENT_ID,
71                  SUBSUMED_PATIENT_ID,
72                  NEW_PATIENT_ID,
73                  PREVIOUS_PATIENT_ID,
74                  SUBMISSION_SET_UUID);
75  
76          assertEquals(2, sender.getMessages().size());
77      }
78  
79  }