script/ISOtypetest.pm untested

filter: Statementstmt 0.0% 0 / 352 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 85 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 438 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/local/bin/perl
2  
3 # Program: ISOtypetest.pm
4 # Purpose: excersise the types - note that this is not exhaustively testing the modules,
5 # just verifying that they do what you would expect.
6 #
7  
8 BEGIN{push @INC, "./../lib/"}
9  
10 use Biblio::ILL::ISO::ILLASNtype;
11  
12 use Biblio::ILL::ISO::AccountNumber;
13 use Biblio::ILL::ISO::AlreadyTriedListType;
14 use Biblio::ILL::ISO::Amount;
15 use Biblio::ILL::ISO::AmountString;
16 use Biblio::ILL::ISO::ClientId;
17 use Biblio::ILL::ISO::CostInfoType;
18 use Biblio::ILL::ISO::DateTime;
19 use Biblio::ILL::ISO::DeliveryAddress;
20 use Biblio::ILL::ISO::DeliveryService;
21 use Biblio::ILL::ISO::EDeliveryDetails;
22 use Biblio::ILL::ISO::ElectronicDeliveryService;
23 use Biblio::ILL::ISO::ElectronicDeliveryServiceSequence;
24 use Biblio::ILL::ISO::ENUMERATED;
25 use Biblio::ILL::ISO::ExpiryFlag;
26 use Biblio::ILL::ISO::Flag;
27 use Biblio::ILL::ISO::ILLServiceType;
28 use Biblio::ILL::ISO::ILLServiceTypeSequence;
29 use Biblio::ILL::ISO::ILLString;
30 use Biblio::ILL::ISO::ISODate;
31 use Biblio::ILL::ISO::ISOTime;
32 use Biblio::ILL::ISO::ItemId;
33 use Biblio::ILL::ISO::ItemType;
34 use Biblio::ILL::ISO::MediumType;
35 use Biblio::ILL::ISO::NameOfPersonOrInstitution;
36 use Biblio::ILL::ISO::PersonOrInstitutionSymbol;
37 use Biblio::ILL::ISO::PlaceOnHoldType;
38 use Biblio::ILL::ISO::PostalAddress;
39 use Biblio::ILL::ISO::Preference;
40 use Biblio::ILL::ISO::ProtocolVersionNum;
41 use Biblio::ILL::ISO::RequesterCHECKEDIN;
42 use Biblio::ILL::ISO::RequesterOptionalMessageType;
43 use Biblio::ILL::ISO::RequesterSHIPPED;
44 use Biblio::ILL::ISO::SearchType;
45 use Biblio::ILL::ISO::SendToListType;
46 use Biblio::ILL::ISO::SendToListTypeSequence;
47 use Biblio::ILL::ISO::SEQUENCE_OF;
48 use Biblio::ILL::ISO::ServiceDateTime;
49 use Biblio::ILL::ISO::SupplyMediumInfoType;
50 use Biblio::ILL::ISO::SupplyMediumInfoTypeSequence;
51 use Biblio::ILL::ISO::SupplyMediumType;
52 use Biblio::ILL::ISO::SystemAddress;
53 use Biblio::ILL::ISO::SystemId;
54 use Biblio::ILL::ISO::ThirdPartyInfoType;
55 use Biblio::ILL::ISO::TransactionId;
56 use Biblio::ILL::ISO::TransactionType;
57 use Biblio::ILL::ISO::TransportationMode;
58 # Extensions
59 use Biblio::ILL::ISO::Extension;
60 # Answer (new types)
61 use Biblio::ILL::ISO::ConditionalResults;
62 use Biblio::ILL::ISO::EstimateResults;
63 use Biblio::ILL::ISO::HoldPlacedResults;
64 use Biblio::ILL::ISO::LocationInfo;
65 use Biblio::ILL::ISO::LocationsResults;
66 use Biblio::ILL::ISO::ResponderOptionalMessageType;
67 use Biblio::ILL::ISO::ResponderRECEIVED;
68 use Biblio::ILL::ISO::ResponderRETURNED;
69 use Biblio::ILL::ISO::ResultsExplanation;
70 use Biblio::ILL::ISO::RetryResults;
71 use Biblio::ILL::ISO::TransactionResults;
72 use Biblio::ILL::ISO::UnfilledResults;
73 use Biblio::ILL::ISO::WillSupplyResults;
74  
75 # Forward-Notification (new types)
76 # -- none
77  
78 # Shipped (new types)
79 use Biblio::ILL::ISO::DateDue;
80 use Biblio::ILL::ISO::ShippedConditions;
81 use Biblio::ILL::ISO::ShippedServiceType;
82 use Biblio::ILL::ISO::ShippedVia;
83 use Biblio::ILL::ISO::SupplyDetails;
84 use Biblio::ILL::ISO::UnitsPerMediumType;
85  
86 # Conditional-Reply (new types)
87 # -- none
88  
89 # Cancel (new types)
90 # -- none
91  
92 # Cancel-Reply (new types)
93 # -- none
94  
95 # Received (new types)
96 # External, so not defined:
97 # use Biblio::ILL::ISO::SupplementalItemDescription;
98  
99 # Recall (new types)
100 # -- none
101  
102 # Returned (new types)
103 # -- none
104  
105 # Checked-In (new types)
106 # -- none
107  
108 # Overdue (new types)
109 # -- none
110  
111 # Renew (new types)
112 # -- none
113  
114 # Renew-Answer (new types)
115 # -- none
116  
117 # Lost (new types)
118 # -- none
119  
120 # Damaged (new types)
121 # Currently unsupported:
122 # use Biblio::ILL::ISO::DamagedDetails;
123  
124 # Message (new types)
125 # -- none
126  
127 # Status-Query (new types)
128 # -- none
129  
130 # Status-Or-Error-Report (new types)
131 use Biblio::ILL::ISO::ReasonNoReport;
132 use Biblio::ILL::ISO::MostRecentService;
133 use Biblio::ILL::ISO::CurrentState;
134 use Biblio::ILL::ISO::HistoryReport;
135 use Biblio::ILL::ISO::StatusReport;
136 use Biblio::ILL::ISO::ErrorReport;
137 use Biblio::ILL::ISO::ReportSource;
138 use Biblio::ILL::ISO::AlreadyForwarded;
139 use Biblio::ILL::ISO::IntermediaryProblem;
140 use Biblio::ILL::ISO::SecurityProblem;
141 use Biblio::ILL::ISO::UnableToPerform;
142 use Biblio::ILL::ISO::UserErrorReport;
143 use Biblio::ILL::ISO::GeneralProblem;
144 use Biblio::ILL::ISO::TransactionIdProblem;
145 use Biblio::ILL::ISO::ILLAPDUtype;
146 use Biblio::ILL::ISO::StateTransitionProhibited;
147 use Biblio::ILL::ISO::ProviderErrorReport;
148  
149 # Expired (new types)
150 # -- none
151  
152  
153 my %hsh = ();
154 my $obj;
155 my $obj2;
156  
157 $hsh{"01.ILLString"} = new Biblio::ILL::ISO::ILLString("A string");
158 $hsh{"02.AccountNumber"} = new Biblio::ILL::ISO::AccountNumber("1234567890");
159 $hsh{"03.PersonOrInstitutionSymbol"} = new Biblio::ILL::ISO::PersonOrInstitutionSymbol("MWPL");
160 $hsh{"04.NameOfPersonOrInstitution"} = new Biblio::ILL::ISO::NameOfPersonOrInstitution("Manitoba Public Library Services");
161  
162 $hsh{"05.SystemId"} = new Biblio::ILL::ISO::SystemId();
163 $hsh{"05.SystemId"}->set_person_name("David A. Christensen");
164 $hsh{"05.SystemId"}->set_institution_symbol("MWPL");
165  
166 $hsh{"06.AlreadyTriedListType"} = new Biblio::ILL::ISO::AlreadyTriedListType( new Biblio::ILL::ISO::SystemId("BVAS") );
167 $obj = new Biblio::ILL::ISO::SystemId();
168 $obj->set_institution_name("Winnipeg Public Library");
169 $hsh{"06.AlreadyTriedListType"}->add($obj);
170 $obj = new Biblio::ILL::ISO::SystemId();
171 $obj->set_person_name("Frank Emil Urwald");
172 $hsh{"06.AlreadyTriedListType"}->add($obj);
173 $hsh{"06.AlreadyTriedListType"}->add( new Biblio::ILL::ISO::SystemId("MBOM"));
174  
175 $hsh{"07.AmountString"} = new Biblio::ILL::ISO::AmountString("\$123.45");
176 $hsh{"08.Amount"} = new Biblio::ILL::ISO::Amount("\$67.89","CAD");
177 $hsh{"09.ClientId"} = new Biblio::ILL::ISO::ClientId("David Christensen","Most excellent","007");
178  
179 $hsh{"10.CostInfoType"} = new Biblio::ILL::ISO::CostInfoType("","","","PLS001","\$40.00");
180 $hsh{"11.PostalAddress"} = new Biblio::ILL::ISO::PostalAddress("Manitoba Public Library Services",
181 "",
182 "Unit 200",
183 "1525 First Street South",
184 "",
185 "Brandon",
186 "MB",
187 "CANADA",
188 "R7A 7A1"
189 );
190 $hsh{"12.SystemAddress"} = new Biblio::ILL::ISO::SystemAddress("SMTP","DChristensen\@westman.wave.ca");
191  
192 $hsh{"13.DeliveryAddress"} = new Biblio::ILL::ISO::DeliveryAddress( new Biblio::ILL::ISO::SystemAddress("SMTP","DChristens\@gov.mb.ca"),
193 new Biblio::ILL::ISO::PostalAddress("Manitoba Public Library Services",
194 "",
195 "Unit 200",
196 "1525 First Street South",
197 "",
198 "Brandon",
199 "MB",
200 "CANADA",
201 "R7A 7A1"
202 )
203 );
204  
205 $obj = new Biblio::ILL::ISO::EDeliveryDetails( new Biblio::ILL::ISO::SystemAddress("SMTP","bob\@hope.com") );
206 $hsh{"14.ElectronicDeliveryService"} = new Biblio::ILL::ISO::ElectronicDeliveryService($obj);
207 $hsh{"14.ElectronicDeliveryService"}->set_description("Just a dummy");
208 $hsh{"14.ElectronicDeliveryService"}->set_name_or_code("MSG ID: 1001");
209 $hsh{"14.ElectronicDeliveryService"}->set_delivery_time("235959");
210  
211 $hsh{"15.ILLServiceTypeSequence"} = new Biblio::ILL::ISO::ILLServiceTypeSequence( new Biblio::ILL::ISO::ILLServiceType("loan"),
212 new Biblio::ILL::ISO::ILLServiceType("copy-non-returnable")
213 );
214 $hsh{"15.ILLServiceTypeSequence"}->add(new Biblio::ILL::ISO::ILLServiceType("locations"));
215  
216 $hsh{"16.ItemType"} = new Biblio::ILL::ISO::ItemType("monograph");
217 $hsh{"17.MediumType"} = new Biblio::ILL::ISO::MediumType("printed");
218  
219 $hsh{"18.ItemId"} = new Biblio::ILL::ISO::ItemId("My Book","David Christensen","CHR001.1");
220 $hsh{"18.ItemId"}->set_item_type("monograph");
221 $hsh{"18.ItemId"}->set_medium_type("printed");
222 $hsh{"18.ItemId"}->set_pagination("456");
223 $hsh{"18.ItemId"}->set_publication_date("2003");
224  
225 $hsh{"19.RequesterOptionalMessageType"} = new Biblio::ILL::ISO::RequesterOptionalMessageType(1,1,"desires","requires");
226 $hsh{"20.SearchType"} = new Biblio::ILL::ISO::SearchType("no-Expiry","1","","20030720");
227  
228 $hsh{"21.SendToListTypeSequence"} = new Biblio::ILL::ISO::SendToListTypeSequence( new Biblio::ILL::ISO::SendToListType( new Biblio::ILL::ISO::SystemId("MBOM") ));
229 $hsh{"21.SendToListTypeSequence"}->add(new Biblio::ILL::ISO::SendToListType( new Biblio::ILL::ISO::SystemId("MWPL"),
230 new Biblio::ILL::ISO::AccountNumber("PLS001"),
231 new Biblio::ILL::ISO::SystemAddress("SMTP","pls\@gov.mb.ca")
232 )
233 );
234  
235 $hsh{"22.ServiceDateTime"} = new Biblio::ILL::ISO::ServiceDateTime( new Biblio::ILL::ISO::DateTime("20030623") );
236 $hsh{"23.ServiceDateTime test 2"} = new Biblio::ILL::ISO::ServiceDateTime( new Biblio::ILL::ISO::DateTime("20030623","114400"),
237 new Biblio::ILL::ISO::DateTime("20030623","114015")
238 );
239  
240 $hsh{"24.SupplyMediumInfoType"} = new Biblio::ILL::ISO::SupplyMediumInfoType("photocopy","legal-size paper");
241  
242 $hsh{"25.ThirdPartyInfoType"} = new Biblio::ILL::ISO::ThirdPartyInfoType();
243 $hsh{"26.ThirdPartyInfoType test 2"} = new Biblio::ILL::ISO::ThirdPartyInfoType(1,1,1,1,"ordered",
244 new Biblio::ILL::ISO::SystemAddress("SMTP","David_A_Christensen\@hotmail.com"),
245 $hsh{"21.SendToListTypeSequence"},
246 $hsh{"06.AlreadyTriedListType"}
247 );
248  
249 $hsh{"27.TransactionId"} = new Biblio::ILL::ISO::TransactionId("PLS","001","", new Biblio::ILL::ISO::SystemId("MWPL"));
250  
251 $hsh{"28.DeliveryService"} = new Biblio::ILL::ISO::DeliveryService( new Biblio::ILL::ISO::TransportationMode("Canada Post") );
252 $hsh{"29.DeliveryService test 2"} = new Biblio::ILL::ISO::ElectronicDeliveryServiceSequence( $hsh{"14.ElectronicDeliveryService"});
253 $obj = new Biblio::ILL::ISO::ElectronicDeliveryService( new Biblio::ILL::ISO::EDeliveryDetails( new Biblio::ILL::ISO::SystemAddress("SMTP","david\@alnitak.cxm")));
254 $obj->set_description("Another dummy");
255 $obj->set_name_or_code("MSG ID: 1002");
256 $obj->set_delivery_time("083000");
257 $hsh{"29.DeliveryService test 2"}->add( $obj );
258  
259 # Answer types (those not covered by Request, anyway).
260  
261 $hsh{"30.TransactionResults"} = new Biblio::ILL::ISO::TransactionResults("will-supply");
262 $hsh{"31.ConditionalResultsCondition"} = new Biblio::ILL::ISO::ConditionalResultsCondition("library-use-only");
263  
264 $obj = new Biblio::ILL::ISO::SystemId();
265 $obj->set_person_name("David A. Christensen");
266 $obj->set_institution_symbol("MWPL");
267 $hsh{"32.LocationInfo"} = new Biblio::ILL::ISO::LocationInfo($obj,
268 new Biblio::ILL::ISO::SystemAddress("SMTP","DChristensen\@westman.wave.ca"),
269 new Biblio::ILL::ISO::ILLString("This is a location note.")
270 );
271  
272 $hsh{"33.LocationInfoSequence"} = new Biblio::ILL::ISO::LocationInfoSequence( $hsh{"32.LocationInfo"} );
273 $obj = new Biblio::ILL::ISO::SystemId();
274 $obj->set_institution_name("Brandon Public Library");
275 $obj2 = new Biblio::ILL::ISO::LocationInfo($obj, new Biblio::ILL::ISO::SystemAddress("SMTP","library\@brandon.mb.ca") );
276 $hsh{"33.LocationInfoSequence"}->add($obj2);
277  
278 $hsh{"34.ConditionalResults"} = new Biblio::ILL::ISO::ConditionalResults(new Biblio::ILL::ISO::ConditionalResultsCondition("charges"),
279 new Biblio::ILL::ISO::ISODate("20030727"),
280 $hsh{"33.LocationInfoSequence"},
281 new Biblio::ILL::ISO::DeliveryService( new Biblio::ILL::ISO::TransportationMode("Canada Post") )
282 );
283  
284  
285 $hsh{"35.RetryResults"} = new Biblio::ILL::ISO::RetryResults(new Biblio::ILL::ISO::ReasonNotAvailable("in-use-on-loan"),
286 new Biblio::ILL::ISO::ISODate("20030731"),
287 $hsh{"33.LocationInfoSequence"}
288 );
289 $hsh{"36.UnfilledResults"} = new Biblio::ILL::ISO::UnfilledResults(new Biblio::ILL::ISO::ReasonUnfilled("lost"),
290 $hsh{"33.LocationInfoSequence"}
291 );
292 $hsh{"37.LocationsResults"} = new Biblio::ILL::ISO::LocationsResults(new Biblio::ILL::ISO::ReasonLocsProvided("not-owned"),
293 $hsh{"33.LocationInfoSequence"}
294 );
295 $hsh{"38.WillSupplyResults"} = new Biblio::ILL::ISO::WillSupplyResults(new Biblio::ILL::ISO::ReasonWillSupply("at-bindery"),
296 new Biblio::ILL::ISO::ISODate("20030729"),
297 $hsh{"11.PostalAddress"},
298 $hsh{"33.LocationInfoSequence"}
299 );
300 $hsh{"39.HoldPlacedResults"} = new Biblio::ILL::ISO::HoldPlacedResults(new Biblio::ILL::ISO::ISODate("20030730"),
301 new Biblio::ILL::ISO::MediumType("printed"),
302 $hsh{"33.LocationInfoSequence"}
303 );
304 $hsh{"40.EstimateResults"} = new Biblio::ILL::ISO::EstimateResults(new Biblio::ILL::ISO::ILLString("56.78"),
305 $hsh{"33.LocationInfoSequence"}
306 );
307  
308 $hsh{"41.ResponderOptionalMessage"} = new Biblio::ILL::ISO::ResponderOptionalMessageType(1,1,"desires","requires");
309  
310 # Shipped types
311 $hsh{"42.DateDue"} = new Biblio::ILL::ISO::DateDue("20030813","false");
312 $hsh{"43.ShippedConditions"} = new Biblio::ILL::ISO::ShippedConditions("client-signature-required");
313 $hsh{"44.ShippedServiceType"} = new Biblio::ILL::ISO::ShippedServiceType("loan");
314 $hsh{"45.ShippedVia"} = new Biblio::ILL::ISO::ShippedVia( new Biblio::ILL::ISO::TransportationMode("Canada Post") );
315 $hsh{"46.UnitsPerMediumType"} = new Biblio::ILL::ISO::UnitsPerMediumType( new Biblio::ILL::ISO::SupplyMediumType("audio-recording"), 3);
316 $hsh{"47.SupplyDetails"} = new Biblio::ILL::ISO::SupplyDetails("20030813",
317 "20030920",
318 123,
319 "45.67",
320 new Biblio::ILL::ISO::ShippedConditions("no-reproduction"),
321 $hsh{"45.ShippedVia"},
322 new Biblio::ILL::ISO::Amount("50.00"),
323 "50.00",
324 $hsh{"46.UnitsPerMediumType"}
325 );
326  
327 # Status-Or-Error-Report
328 $hsh{"48.ReasonNoReport"} = new Biblio::ILL::ISO::ReasonNoReport("permanent");
329 $hsh{"49.MostRecentService"} = new Biblio::ILL::ISO::MostRecentService("sTATUS-QUERY");
330 $hsh{"50.CurrentState"} = new Biblio::ILL::ISO::CurrentState("sHIPPED");
331 $hsh{"51.HistoryReport"} = new Biblio::ILL::ISO::HistoryReport("20030811",
332 "fORWARD",
333 "20030813",
334 $hsh{"05.SystemId"},
335 "20030815",
336 "Anne Author",
337 "A Title",
338 "",
339 "",
340 "loan",
341 $hsh{"30.TransactionResults"},
342 "This is a history report."
343 );
344 $hsh{"52.StatusReport"} = new Biblio::ILL::ISO::StatusReport($hsh{"51.HistoryReport"},
345 $hsh{"50.CurrentState"}
346 );
347 $hsh{"53.ProviderErrorReport"} = new Biblio::ILL::ISO::ProviderErrorReport( new Biblio::ILL::ISO::TransactionIdProblem("duplicate-transaction-id") );
348 $hsh{"54.ErrorReport"} = new Biblio::ILL::ISO::ErrorReport("Some correlation information",
349 "provider",
350 $hsh{"53.ProviderErrorReport"}
351 );
352 $hsh{"55.AlreadyForwarded"} = new Biblio::ILL::ISO::AlreadyForwarded($hsh{"05.SystemId"},
353 $hsh{"12.SystemAddress"}
354 );
355 $hsh{"56.IntermediaryProblem"} = new Biblio::ILL::ISO::IntermediaryProblem("cannot-send-onward");
356 $hsh{"57.SecurityProblem"} = new Biblio::ILL::ISO::SecurityProblem("This is a security problem.");
357 $hsh{"58.UnableToPerform"} = new Biblio::ILL::ISO::UnableToPerform("resource-limitation");
358 $hsh{"59.UserErrorReport"} = new Biblio::ILL::ISO::UserErrorReport($hsh{"57.SecurityProblem"});
359 $hsh{"60.GeneralProblem"} = new Biblio::ILL::ISO::GeneralProblem("protocol-version-not-supported");
360 $hsh{"61.ILLAPDUtype"} = new Biblio::ILL::ISO::ILLAPDUtype("eXPIRED");
361 $hsh{"62.StateTransitionProhibited"} = new Biblio::ILL::ISO::StateTransitionProhibited($hsh{"61.ILLAPDUtype"},
362 $hsh{"50.CurrentState"}
363 );
364  
365  
366 print "\n---------\n";
367 foreach my $key (sort keys %hsh) {
368 print "\n[$key]\n" . $hsh{$key}->as_pretty_string();
369 }
370  
371