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

Last change on this file since 1627 was 1625, checked in by Tariq Hamkari, 12 years ago

Ayman Ghaith : adding the correct routines which not has the transactions.

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