source: Scheduling/trunk/m/BSDXUT1.m@ 1463

Last change on this file since 1463 was 1463, checked in by Sam Habiel, 12 years ago

Moved some unit tests around; Unit tests for BSDX25; minor refactoring for BSDX25

File size: 15.0 KB
Line 
1BSDXUT1 ; VEN/SMH - Unit Tests for Scheduling GUI - cont. ; 6/28/12 10:17am
2 ;;1.7T1;BSDX;;Aug 31, 2011;Build 18
3 ;
4 ;
5UT08 ; Unit Tests for BSDX08; Must have patients 1,2,3,4,5 defined in system
6 N RESNAM S RESNAM="UTCLINIC"
7 N HLRESIENS ; holds output of UTCR^BSDXUT - HL IEN^Resource IEN
8 D
9 . N $ET S $ET="D ^%ZTER B"
10 . S HLRESIENS=$$UTCR^BSDXUT(RESNAM)
11 . I HLRESIENS<0 S $EC=",U1," ; not supposed to happen - hard crash if so
12 ;
13 N HLIEN,RESIEN
14 S HLIEN=$P(HLRESIENS,U)
15 S RESIEN=$P(HLRESIENS,U,2)
16 ;
17 ; Get start and end times
18 N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
19 N APPTTIME S APPTTIME=$P(TIMES,U)
20 N ENDTIME S ENDTIME=$P(TIMES,U,2)
21 ;
22 ; Test 1: Make normal appointment and cancel it. See if every thing works
23 N ZZZ,DFN
24 S DFN=3
25 D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
26 S APPID=+$P(^BSDXTMP($J,1),U)
27 D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note")
28 I $P(^BSDXAPPT(APPID,0),U,12)'>0 W "Error in Cancellation-1",!
29 I $O(^SC(HLIEN,"S",APPTTIME,1,0))]"" W "Error in Cancellation-2",!
30 I $P(^DPT(DFN,"S",APPTTIME,0),U,2)'="PC" W "Error in Cancellation-3",!
31 I ^DPT(DFN,"S",APPTTIME,"R")'="Sam's Cancel Note" W "Error in Cancellation-4",!
32 ;
33 ; Test 2: Check for -1 -- TODO: Fix later... Can't do right now automatically
34 ; Make appt
35 D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
36 ; Lock the node in another job
37 S APPID=+$P(^BSDXTMP($J,1),U)
38 ; W "Lock ^BSDXAPPT("_APPID_") in another session. You have 10 seconds." H 10
39 D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note")
40 ;
41 ; Test 3: Check for -100
42 N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
43 N APPTTIME S APPTTIME=$P(TIMES,U)
44 N ENDTIME S ENDTIME=$P(TIMES,U,2)
45 D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
46 S APPID=+$P(^BSDXTMP($J,1),U)
47 N BSDXDIE1 S BSDXDIE1=1
48 D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Reasons")
49 I $P(^BSDXTMP($J,1),"~")'=-100 W "Error in -100",!
50 K BSDXDIE1
51 ;
52 ; Test 3.5: Check for -100 with an appointment to rollback.
53 N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
54 N APPTTIME S APPTTIME=$P(TIMES,U)
55 N ENDTIME S ENDTIME=$P(TIMES,U,2)
56 D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
57 S APPID=+$P(^BSDXTMP($J,1),U)
58 N BSDXDIE2 S BSDXDIE2=1
59 D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Reasons")
60 I $P(^BSDXTMP($J,1),"~")'=-100 W "Error in -100-1",!
61 I $P(^BSDXAPPT(APPID,0),U,12)'="" W "Error in -100-2",!
62 K BSDXDIE2
63 ; Test 4: Restartable transaction -- retired in V 1.7
64 ; Test 5: for invalid Appointment ID (-2 and -3)
65 D APPDEL^BSDX08(.ZZZ,0,"PC",1,"Reasons")
66 I $P(^BSDXTMP($J,1),"~")'=-2 W "Error in -2",!
67 D APPDEL^BSDX08(.ZZZ,999999,"PC",1,"Reasons")
68 I $P(^BSDXTMP($J,1),"~")'=-3 W "Error in -3",!
69 ; More unit Tests
70 ;
71 ; Test 6: for Cancelling walkin and checked-in appointments
72 N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
73 N APPTTIME S APPTTIME=$P(TIMES,U)
74 N ENDTIME S ENDTIME=$P(TIMES,U,2)
75 S DFN=4
76 D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,10,"Sam's Note",1) ; Add appt
77 S APPID=+$P(^BSDXTMP($J,1),U)
78 I APPID=0 W "Error in test 6",!
79 D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; check-in
80 D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") ; Delete appt
81 I $P(^BSDXTMP($J,1),$C(30))'="" W "Error in test 6",!
82 ;
83 ; Test 7: for cancelling walkin and checked-in appointments
84 N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
85 N APPTTIME S APPTTIME=$P(TIMES,U)
86 N ENDTIME S ENDTIME=$P(TIMES,U,2)
87 S DFN=4
88 D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,10,"Sam's Note",1) ; Add appt
89 S APPID=+$P(^BSDXTMP($J,1),U)
90 I APPID=0 W "Error in test 6",!
91 D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; Checkin
92 S BSDXRESULT=$$RMCI^BSDXAPI(DFN,HLIEN,APPTTIME) ; remove checkin
93 D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") ; delete appt
94 I $P(^BSDXTMP($J,1),$C(30))'="" W "Error in test 6",!
95 ;
96 ; Unlinked Clinic Tests
97 N RESNAM S RESNAM="UTCLINICUL" ; Unlinked Clinic
98 N RESIEN
99 D
100 . N $ET S $ET="D ^%ZTER B"
101 . S RESIEN=$$UTCRRES^BSDXUT(RESNAM)
102 . I RESIEN<0 S $EC=",U1," ; not supposed to happen - hard crash if so
103 ;
104 ; Get start and end times
105 N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
106 N APPTTIME S APPTTIME=$P(TIMES,U)
107 N ENDTIME S ENDTIME=$P(TIMES,U,2)
108 ;
109 ; Test 1: Make normal appointment and cancel it. See if every thing works
110 N ZZZ,DFN
111 S DFN=3
112 D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
113 S APPID=+$P(^BSDXTMP($J,1),U)
114 D APPDEL^BSDX08(.ZZZ,APPID,"PC",1,"Sam's Cancel Note")
115 I $P(^BSDXAPPT(APPID,0),U,12)'>0 W "Error in Cancellation-1"
116 ;
117 ; Test 6: for Cancelling walkin and checked-in appointments
118 N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
119 N APPTTIME S APPTTIME=$P(TIMES,U)
120 N ENDTIME S ENDTIME=$P(TIMES,U,2)
121 S DFN=4
122 D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,10,"Sam's Note",1) ; Add appt
123 S APPID=+$P(^BSDXTMP($J,1),U)
124 I APPID=0 W "Error in test 6",!
125 D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; check-in
126 D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") ; Delete appt
127 I $P(^BSDXTMP($J,1),$C(30))'="" W "Error in test 6",!
128 ;
129 ; Test 7: for cancelling walkin and checked-in appointments
130 N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
131 N APPTTIME S APPTTIME=$P(TIMES,U)
132 N ENDTIME S ENDTIME=$P(TIMES,U,2)
133 S DFN=5
134 D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,10,"Sam's Note",1) ; Add appt
135 S APPID=+$P(^BSDXTMP($J,1),U)
136 I APPID=0 W "Error in test 6",!
137 D CHECKIN^BSDX25(.ZZZ,APPID,$$NOW^XLFDT) ; Checkin
138 S BSDXRESULT=$$RMCI^BSDXAPI(DFN,HLIEN,APPTTIME) ; remove checkin
139 D APPDEL^BSDX08(.ZZZ,APPID,"PC",10,"Cancel Note") ; delete appt
140 I $P(^BSDXTMP($J,1),$C(30))'="" W "Error in test 6",!
141 QUIT
142 ;
143UT29 ; Unit Test for BSDX29
144 ; HLs/Resources are created as part of the UT
145 ; Patients 1,2,3,4,5 must exist
146 ;
147 I '$$TM^%ZTLOAD() W "Cannot test. Taskman is not running!" QUIT
148 ;
149 ; Set-up - Create Clinics
150 N RESNAM S RESNAM="UTCLINIC"
151 N HLRESIENS ; holds output of UTCR^BSDXUT - HL IEN^Resource IEN
152 D
153 . N $ET S $ET="D ^%ZTER B"
154 . S HLRESIENS=$$UTCR^BSDXUT(RESNAM)
155 . I HLRESIENS<0 S $EC=",U1," ; not supposed to happen - hard crash if so
156 ;
157 N HLIEN,RESIEN
158 S HLIEN=$P(HLRESIENS,U)
159 S RESIEN=$P(HLRESIENS,U,2)
160 ;
161 ; Turn off SDAM APPT PROTOCOL BSDX Entries
162 N BSDXNOEV
163 S BSDXNOEV=1 ;Don't execute BSDX ADD APPOINTMENT protocol
164 ;
165 ; Create a bunch of appointments in PIMS (25 actually)
166 N DFN
167 N BSDXAPPT,BSDXDATE
168 N BSDXI
169 F BSDXI=1:1:5 D
170 . N APPTTIME S APPTTIME=$$TIMEHL^BSDXUT(HLIEN) ; appt time
171 . F DFN=1,2,3,4,5 D
172 . . N % S %=$$MAKE1^BSDXAPI(DFN,HLIEN,3,APPTTIME,15,"Sam Test Appt"_DFN)
173 . . I % W "Error in $$MAKE1^BSDXAPI for TIME "_APPTTIME_" for DFN "_DFN,!,%,!
174 . . E S BSDXAPPT(DFN,APPTTIME)="",BSDXDATE(APPTTIME)=""
175 ;
176 ; Check that appointments are not in ^BSDXAPPT
177 N DFN,APPTTIME S (DFN,APPTTIME)=""
178 F S DFN=$O(BSDXAPPT(DFN)) Q:'DFN D
179 . F S APPTTIME=$O(BSDXAPPT(DFN,APPTTIME)) Q:'APPTTIME D
180 . . I $D(^BSDXAPPT("APAT",DFN,APPTTIME)) W "Appt for "_DFN_" @ "_APPTTIME_" present",!
181 ;
182 ; Now, copy those appointments using BSDX29 to ^BSDXAPPT
183 N FIRSTDATE S FIRSTDATE=$O(BSDXDATE(""))
184 N LASTDATE S LASTDATE=$O(BSDXDATE(""),-1)
185 N ZZZ ; garbage
186 D BSDXCP^BSDX29(.ZZZ,RESIEN,HLIEN,FIRSTDATE,LASTDATE)
187 I +^BSDXTMP($J,1)=0 W "Error... task not created",! QUIT
188 ;
189 W "Waiting for 5 seconds for it to finish",! HANG 5
190 N DFN,APPTTIME S (DFN,APPTTIME)=""
191 F S DFN=$O(BSDXAPPT(DFN)) Q:'DFN D
192 . F S APPTTIME=$O(BSDXAPPT(DFN,APPTTIME)) Q:'APPTTIME D
193 . . I '$D(^BSDXAPPT("APAT",DFN,APPTTIME)) W "Appt for "_DFN_" @ "_APPTTIME_" missing",!
194 ;
195 ; Do all of this again making sure that events execute.
196 K BSDXNOEV
197 ;
198 ; Create a bunch of appointments in PIMS (25 actually)
199 N DFN
200 N BSDXAPPT,BSDXDATE
201 N BSDXI
202 F BSDXI=1:1:5 D
203 . N APPTTIME S APPTTIME=$$TIMEHL^BSDXUT(HLIEN) ; appt time
204 . F DFN=1,2,3,4,5 D
205 . . N % S %=$$MAKE1^BSDXAPI(DFN,HLIEN,3,APPTTIME,15,"Sam Test Appt"_DFN)
206 . . I % W "Error in $$MAKE1^BSDXAPI for TIME "_APPTTIME_" for DFN "_DFN,!,%,!
207 . . E S BSDXAPPT(DFN,APPTTIME)="",BSDXDATE(APPTTIME)=""
208 ;
209 ; Check that appointments are in ^BSDXAPPT (different from last time)
210 N DFN,APPTTIME S (DFN,APPTTIME)=""
211 F S DFN=$O(BSDXAPPT(DFN)) Q:'DFN D
212 . F S APPTTIME=$O(BSDXAPPT(DFN,APPTTIME)) Q:'APPTTIME D
213 . . I '$D(^BSDXAPPT("APAT",DFN,APPTTIME)) W "Appt for "_DFN_" @ "_APPTTIME_" present",!
214 ;
215 ; Now, copy those appointments using BSDX29 to ^BSDXAPPT
216 N FIRSTDATE S FIRSTDATE=$O(BSDXDATE(""))
217 N LASTDATE S LASTDATE=$O(BSDXDATE(""),-1)
218 N ZZZ ; garbage
219 D BSDXCP^BSDX29(.ZZZ,RESIEN,HLIEN,FIRSTDATE,LASTDATE)
220 I +^BSDXTMP($J,1)=0 W "Error... task not created",! QUIT
221 ;
222 W "Waiting for 5 seconds for it to finish",! HANG 5
223 W ^BSDXTMP("BSDXCOPY",+^BSDXTMP($J,1)),!
224 W "Last line should say 0",!
225 QUIT
226 ;
227UT26 ; Unit Tests - BSDX26
228 ;
229 ; Test 1: Make sure this damn thing works
230 ; Set-up - Create Clinics
231 N RESNAM S RESNAM="UTCLINIC"
232 N HLRESIENS ; holds output of UTCR^BSDXUT - HL IEN^Resource IEN
233 D
234 . N $ET S $ET="D ^%ZTER B"
235 . S HLRESIENS=$$UTCR^BSDXUT(RESNAM)
236 . I HLRESIENS<0 S $EC=",U1," ; not supposed to happen - hard crash if so
237 ;
238 N HLIEN,RESIEN
239 S HLIEN=$P(HLRESIENS,U)
240 S RESIEN=$P(HLRESIENS,U,2)
241 ;
242 ; Get start and end times
243 N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
244 N APPTTIME S APPTTIME=$P(TIMES,U)
245 N ENDTIME S ENDTIME=$P(TIMES,U,2)
246 ;
247 ; Make appt
248 N ZZZ,DFN
249 S DFN=3
250 D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
251 N APPID S APPID=+$P(^BSDXTMP($J,1),U)
252 ;
253 ; Now edit the note - basic test
254 N %H S %H=$H
255 N NOTE S NOTE="New Note "_%H
256 D EDITAPT^BSDX26(.ZZZ,APPID,NOTE)
257 I ^BSDXAPPT(APPID,1,1,0)'=NOTE W "ERROR 1",!
258 I $P(^SC(HLIEN,"S",APPTTIME,1,1,0),U,4)'=NOTE W "Error in HL Section",!
259 ;
260 ; Test 2: Test Error -1
261 ; -1 --> ApptID not a number
262 N ZZZ
263 N NOTE S NOTE="Nothing important"
264 D EDITAPT^BSDX26(.ZZZ,"BLAHBLAH",NOTE)
265 I +^BSDXTMP($J,1)'=-1 W "ERROR IN -1",!
266 ;
267 ; Test 3: Test Error -2
268 ; -2 --> ApptID not in ^BSDXAPPT
269 D EDITAPT^BSDX26(.ZZZ,298734322,NOTE)
270 I +^BSDXTMP($J,1)'=-2 W "ERROR IN -2",!
271 ;
272 ; Test 4: M Error
273 N BSDXDIE S BSDXDIE=1
274 D EDITAPT^BSDX26(.ZZZ,188,NOTE)
275 I +^BSDXTMP($J,1)'=-100 W "ERROR IN -100",!
276 K BSDXDIE
277 ; Test 5: Trestart -- retired in v1.7
278 ;
279 ; Test 6: UTs for an unlinked resource (not linked to PIMS)
280 N RESNAM S RESNAM="UTCLINICUL" ; Unlinked Clinic
281 N RESIEN
282 D
283 . N $ET S $ET="D ^%ZTER B"
284 . S RESIEN=$$UTCRRES^BSDXUT(RESNAM)
285 . I RESIEN<0 S $EC=",U1," ; not supposed to happen - hard crash if so
286 ;
287 ; Get start and end times
288 N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
289 N APPTTIME S APPTTIME=$P(TIMES,U)
290 N ENDTIME S ENDTIME=$P(TIMES,U,2)
291 ;
292 N ZZZ,DFN
293 S DFN=3
294 D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
295 N APPID S APPID=+$P(^BSDXTMP($J,1),U)
296 ; Now edit the note - basic test
297 N %H S %H=$H
298 N NOTE S NOTE="New Note "_%H
299 D EDITAPT^BSDX26(.ZZZ,APPID,NOTE)
300 I ^BSDXAPPT(APPID,1,1,0)'=NOTE W "ERROR 2",!
301 ;
302 ; Test 7: Simulated failure in BSDXAPI
303 N RESNAM S RESNAM="UTCLINIC"
304 N HLRESIENS ; holds output of UTCR^BSDXUT - HL IEN^Resource IEN
305 D
306 . N $ET S $ET="D ^%ZTER B"
307 . S HLRESIENS=$$UTCR^BSDXUT(RESNAM)
308 . I HLRESIENS<0 S $EC=",U1," ; not supposed to happen - hard crash if so
309 ;
310 N HLIEN,RESIEN
311 S HLIEN=$P(HLRESIENS,U)
312 S RESIEN=$P(HLRESIENS,U,2)
313 ;
314 ; Get start and end times
315 N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
316 N APPTTIME S APPTTIME=$P(TIMES,U)
317 N ENDTIME S ENDTIME=$P(TIMES,U,2)
318 ;
319 ; Make appt
320 N ZZZ,DFN
321 S DFN=3
322 N ORIGNOTE S ORIGNOTE="Sam's Note"
323 D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,ORIGNOTE,1)
324 N APPID S APPID=+$P(^BSDXTMP($J,1),U)
325 ;
326 ; Create the error condition
327 N BSDXSIMERR1 S BSDXSIMERR1=1
328 ;
329 ; Try to edit the note. Should still be "Sam's Note"
330 N %H S %H=$H
331 N NOTE S NOTE="New Note "_%H
332 D EDITAPT^BSDX26(.ZZZ,APPID,NOTE)
333 I +^BSDXTMP($J,1)'=-4 W "Simulated error not triggered",!
334 I ^BSDXAPPT(APPID,1,1,0)'=ORIGNOTE W "ERROR 3",!
335 I $P(^SC(HLIEN,"S",APPTTIME,1,1,0),U,4)'=ORIGNOTE W "ERROR 4",!
336 QUIT
337 ;
338UT31 ; Unit Tests for BSDX31
339 ; Set-up - Create Clinics
340 N RESNAM S RESNAM="UTCLINIC"
341 N HLRESIENS ; holds output of UTCR^BSDXUT - HL IEN^Resource IEN
342 D
343 . N $ET S $ET="D ^%ZTER B"
344 . S HLRESIENS=$$UTCR^BSDXUT(RESNAM)
345 . I HLRESIENS<0 S $EC=",U1," ; not supposed to happen - hard crash if so
346 ;
347 N HLIEN,RESIEN
348 S HLIEN=$P(HLRESIENS,U)
349 S RESIEN=$P(HLRESIENS,U,2)
350 ;
351 ; Get start and end times
352 N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
353 N APPTTIME S APPTTIME=$P(TIMES,U)
354 N ENDTIME S ENDTIME=$P(TIMES,U,2)
355 ;
356 ; Make appt
357 N ZZZ,DFN
358 S DFN=3
359 D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
360 N APPID S APPID=+$P(^BSDXTMP($J,1),U)
361 ; Test 1: Sanity Check
362 D NOSHOW^BSDX31(.ZZZ,APPID,1)
363 I $P(^BSDXAPPT(APPID,0),U,10)'=1 W "ERROR T1",!
364 I $P(^DPT(DFN,"S",APPTTIME,0),U,2)'="N" W "ERROR T1",!
365 ; Test 2: Undo NOSHOW
366 D NOSHOW^BSDX31(.ZZZ,APPID,0)
367 I $P(^BSDXAPPT(APPID,0),U,10)'="" W "ERROR T2",!
368 I $P(^DPT(DFN,"S",APPTTIME,0),U,2)'="" W "ERROR T2",!
369 ; Test 3: -1
370 D NOSHOW^BSDX31(.ZZZ,"",0)
371 I $P(^BSDXTMP($J,1),U)'=-1 W "ERROR T3",!
372 ; Test 4: -2
373 D NOSHOW^BSDX31(.ZZZ,2938748233,0)
374 I $P(^BSDXTMP($J,1),U)'=-2 W "ERROR T4",!
375 ; Test 5: -3
376 D NOSHOW^BSDX31(.ZZZ,APPID,3)
377 I $P(^BSDXTMP($J,1),U)'=-3 W "ERROR T5",!
378 ; Test 6: Mumps error (-100)
379 N BSDXDIE S BSDXDIE=1
380 D NOSHOW^BSDX31(.ZZZ,APPID,1)
381 I $P(^BSDXTMP($J,1),U)'=-100 W "ERROR T6",!
382 K BSDXDIE
383 ;
384 ; Test 9
385 ; Error Simulations
386 ; Get start and end times
387 N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
388 N APPTTIME S APPTTIME=$P(TIMES,U)
389 N ENDTIME S ENDTIME=$P(TIMES,U,2)
390 ;
391 ; This tests if we fail without filing anything
392 N ZZZ,DFN
393 S DFN=3
394 D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
395 N APPID S APPID=+$P(^BSDXTMP($J,1),U)
396 N BSDXSIMERR1 S BSDXSIMERR1=1
397 D NOSHOW^BSDX31(.ZZZ,APPID,1)
398 I $P(^BSDXTMP($J,1),U)'=-4 W "ERROR T9.1",!
399 I $P(^BSDXAPPT(APPID,0),U,10)'="" W "ERROR T9.2",!
400 I $P(^DPT(DFN,"S",APPTTIME,0),U,2)'="" W "ERROR T9.3",!
401 K BSDXSIMERR1
402 ;
403 ; This tests if we fail inside BSDXAPI and have to rollback ^BSDXAPPT
404 N BSDXSIMERR2 S BSDXSIMERR2=1
405 D NOSHOW^BSDX31(.ZZZ,APPID,1)
406 I $P(^BSDXTMP($J,1),U)'=-5 W "ERROR T9.4",!
407 I $P(^BSDXAPPT(APPID,0),U,10)'="" W "ERROR T9.5",!
408 I $P(^DPT(DFN,"S",APPTTIME,0),U,2)'="" W "ERROR T9.6",!
409 K BSDXSIMERR2
410 ;
411 ; This test a mumps error in BSDXAPI
412 N BSDXSIMERR3 S BSDXSIMERR3=1
413 D NOSHOW^BSDX31(.ZZZ,APPID,1)
414 I +$P(^BSDXTMP($J,1),U)'=-100 W "ERROR T9.7",!
415 I $P(^BSDXAPPT(APPID,0),U,10)'="" W "ERROR T9.8",!
416 K BSDXSIMERR3
417 ;
418 ; Test 7: Restartable transaction ; Retired
419 ;
420 ; Test 8: UTs for an unlinked resource (not linked to PIMS)
421 N RESNAM S RESNAM="UTCLINICUL" ; Unlinked Clinic
422 N RESIEN
423 D
424 . N $ET S $ET="D ^%ZTER B"
425 . S RESIEN=$$UTCRRES^BSDXUT(RESNAM)
426 . I RESIEN<0 S $EC=",U1," ; not supposed to happen - hard crash if so
427 ;
428 ; Get start and end times
429 N TIMES S TIMES=$$TIMES^BSDXUT ; appt time^end time
430 N APPTTIME S APPTTIME=$P(TIMES,U)
431 N ENDTIME S ENDTIME=$P(TIMES,U,2)
432 ;
433 ; Make appt
434 N ZZZ,DFN
435 S DFN=3
436 D APPADD^BSDX07(.ZZZ,APPTTIME,ENDTIME,DFN,RESNAM,30,"Sam's Note",1)
437 N APPID S APPID=+$P(^BSDXTMP($J,1),U)
438 ; Test 1: Sanity Check
439 D NOSHOW^BSDX31(.ZZZ,APPID,1)
440 I $P(^BSDXAPPT(APPID,0),U,10)'=1 W "ERROR T8.1",!
441 ; Test 2: Undo NOSHOW
442 D NOSHOW^BSDX31(.ZZZ,APPID,0)
443 I $P(^BSDXAPPT(APPID,0),U,10)'="" W "ERROR T8.2",!
444 ; Test 3: Put it back on...
445 D NOSHOW^BSDX31(.ZZZ,APPID,1)
446 I $P(^BSDXAPPT(APPID,0),U,10)'=1 W "ERROR T8.3",!
447 ;
448 ;
449 QUIT
Note: See TracBrowser for help on using the repository browser.