1 karl 1.26 //%2006////////////////////////////////////////////////////////////////////////
|
2 mike 1.2 //
|
3 karl 1.18 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
|
6 karl 1.16 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.18 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
|
9 karl 1.21 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.26 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 mike 1.2 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
15 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
|
20 kumpf 1.9 //
|
21 mike 1.2 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
|
30 karl 1.29 //=============================================================================
|
31 mike 1.2 //
32 //%/////////////////////////////////////////////////////////////////////////////
33
34 #include <fstream>
35 #include <cstring>
36 #include <Pegasus/Common/System.h>
37 #include <Pegasus/Common/Tracer.h>
|
38 a.arora 1.17 #include <Pegasus/Common/AutoPtr.h>
|
39 sushma.fernandes 1.30 #include <Pegasus/Common/SharedPtr.h>
40 #include <Pegasus/Common/CIMClass.h>
41 #include <Pegasus/Common/CIMMessage.h>
42 #include <Pegasus/Common/XmlWriter.h>
43 #include <Pegasus/Common/AcceptLanguageList.h>
44 #include <Pegasus/Common/ContentLanguageList.h>
|
45 mike 1.2
46 PEGASUS_USING_STD;
47 PEGASUS_USING_PEGASUS;
48
49 // Trace files for test purposes
|
50 kumpf 1.11 // Will be created in the $(PEGASUS_TMP) directory, or if not set,
51 // in the current directory
|
52 kumpf 1.15 CString FILE1;
53 CString FILE2;
54 CString FILE3;
55 CString FILE4;
|
56 mike 1.2
57 //
58 // Reads the last trace message from a given trace file and compares the
59 // given string with the string read from file
60 //
61 // return 0 if the strings match
62 // return 1 if the strings do not match
63 //
|
64 kumpf 1.31 Uint32 compare(const char* fileName, const char* expectedMessage)
|
65 mike 1.2 {
|
66 kumpf 1.31 int expectedMessageLength = strlen(expectedMessage);
67
68 // Compute the size of the message in the trace file. Include the final
69 // EOL character added by the Tracer. This size will be used to seek
70 // from the end of the file back to the beginning of the trace message.
71 int seekBytes = expectedMessageLength + 1;
72
73 #if defined(PEGASUS_OS_TYPE_WINDOWS)
74 // Windows converts all '\n' characters to "\r\n" sequences in the trace
75 // file. Increase the seekBytes by the number of '\r' characters added
76 // when the message is written to the file.
77 for (const char* newlineChar = expectedMessage;
78 ((newlineChar = strchr(newlineChar, '\n')) != 0);
79 newlineChar++)
80 {
81 seekBytes++;
82 }
83
84 // Count the '\r' character added with the final '\n' written by the Tracer
85 seekBytes++;
86 #endif
87 kumpf 1.31
88 AutoArrayPtr<char> actualMessage(new char[expectedMessageLength + 1]);
89
90 // Read the trace message from the file, minus the message prefix and
91 // minus the trailing newline.
|
92 mike 1.2 fstream file;
|
93 kumpf 1.31 file.open(fileName, fstream::in);
|
94 mike 1.2 if (!file.good())
95 {
|
96 kumpf 1.31 return 1;
|
97 mike 1.2 }
|
98 kumpf 1.31 file.seekg(-seekBytes, fstream::end);
99 file.read(actualMessage.get(), expectedMessageLength);
100 file.close();
101 actualMessage[expectedMessageLength] = 0;
102
103 // Compare the expected and actual messages
104 Uint32 retCode = strcmp(expectedMessage, actualMessage.get());
105
106 /* Diagnostic to determine string differences
107 if (retCode)
108 cout << "Compare Error: expectedMessage= \n\"" << expectedMessage <<
109 "\". actualMessage= \n\"" << actualMessage.get() << "\"" << endl;
|
110 karl 1.27 */
111
|
112 mike 1.2 return retCode;
113 }
114
115 //
116 // Description:
117 // Trace properties file, level and component are not set
118 // Should not log a trace message
119 //
120 // Type:
121 // Negative
122 //
123 // return 0 if the test passed
124 // return 1 if the test failed
125 //
126 Uint32 test1()
127 {
128 const char* METHOD_NAME = "test1";
|
129 kumpf 1.10 PEG_METHOD_ENTER(TRC_CONFIG,METHOD_NAME);
|
130 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL2,"%s %d",
131 "This message should not appear value=",123));
|
132 kumpf 1.10 PEG_METHOD_EXIT();
|
133 kumpf 1.34 return System::exists(FILE1) ? 1 : 0;
|
134 mike 1.2 }
135
136 //
137 // Description:
138 // Trace properties level and component are not set
139 // Should not log a trace message
140 //
141 // Type:
142 // Negative
143 //
144 // return 0 if the test passed
145 // return 1 if the test failed
146 //
147 Uint32 test2()
148 {
149 const char* METHOD_NAME = "test2";
150 Tracer::setTraceFile(FILE1);
|
151 kumpf 1.10 PEG_METHOD_ENTER(TRC_CONFIG,METHOD_NAME);
|
152 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL2,"%s %d",
153 "This message should not appear value=",123));
|
154 kumpf 1.34 Uint32 fileSize;
155 System::getFileSize(FILE1, fileSize);
156 return (fileSize == 0) ? 0 : 1;
|
157 mike 1.2 }
158
159 //
160 // Description:
161 // Trace properties component is not set
162 // Should not log a trace message
163 //
164 // Type:
165 // Negative
166 //
167 // return 0 if the test passed
168 // return 1 if the test failed
169 //
170 Uint32 test3()
171 {
172 const char* METHOD_NAME = "test3";
173 Tracer::setTraceLevel(Tracer::LEVEL1);
|
174 kumpf 1.10 PEG_METHOD_ENTER(TRC_CONFIG,METHOD_NAME);
|
175 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL2,"%s",
176 "This message should not appear"));
|
177 kumpf 1.34 Uint32 fileSize;
178 System::getFileSize(FILE1, fileSize);
179 return (fileSize == 0) ? 0 : 1;
|
180 mike 1.2 }
181
182 //
183 // Description:
184 // Trace properties file, level and component are set
185 // should log a trace message
186 //
187 // Type:
188 // Positive
189 //
190 // return 0 if the test passed
191 // return 1 if the test failed
192 //
193 Uint32 test4()
194 {
195 const char* METHOD_NAME = "test4";
196 Tracer::setTraceComponents("Config");
|
197 kumpf 1.10 PEG_METHOD_ENTER(TRC_CONFIG,METHOD_NAME);
|
198 mike 1.2 return(compare(FILE1,"Entering method test4"));
199 }
200
201 //
202 // Description:
203 // Trace component is set to an invalid component
204 // should not log a trace message
205 //
206 // Type:
207 // Negative
208 //
209 // return 0 if the test passed
210 // return 1 if the test failed
211 //
212 Uint32 test5()
213 {
214 const char* METHOD_NAME = "test5";
215 Tracer::setTraceComponents("Wrong Component Name");
|
216 karl 1.27
217 PEG_METHOD_ENTER(TRC_CONFIG,METHOD_NAME);
218 PEG_METHOD_EXIT();
|
219 mike 1.2 return(compare(FILE1,"Entering method test4"));
220 }
221
222 //
223 // Description:
224 // Trace level is set to LEVEL 2 and logs a LEVEL 4 message
225 // should not log a trace message
226 //
227 // Type:
228 // Negative
229 //
230 // return 0 if the test passed
231 // return 1 if the test failed
232 //
233
234 Uint32 test6()
235 {
236 const char* METHOD_NAME = "test6";
237 Tracer::setTraceComponents("Config");
238 Tracer::setTraceLevel(Tracer::LEVEL2);
|
239 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL2,"%s %s",
240 "Test Message for Level2 in",METHOD_NAME));
241 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL2,"%s %s",
242 "Test Message for Level2 in",METHOD_NAME));
243 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL4,"%s",
244 "This Message should not appear"));
|
245 mike 1.2 return(compare(FILE1,"Test Message for Level2 in test6"));
246 }
247
248 //
249 // Description:
250 // Trace level is set to an invalid level
251 // should not log a trace message
252 //
253 // Type:
254 // Negative
255 //
256 // return 0 if the test passed
257 // return 1 if the test failed
258 //
259 Uint32 test7()
260 {
261 const char* METHOD_NAME = "test7";
262 Tracer::setTraceLevel(100);
|
263 karl 1.27 PEG_METHOD_ENTER(TRC_CONFIG,METHOD_NAME);
264 PEG_METHOD_EXIT();
|
265 mike 1.2 return(compare(FILE1,"Test Message for Level2 in test6"));
266 }
267
268 //
269 // Description:
270 // Changes the trace file to FILE2
271 //
272 // Type:
273 // Positive
274 //
275 // return 0 if the test passed
276 // return 1 if the test failed
277 //
278 Uint32 test9()
279 {
280 const char* METHOD_NAME = "test9";
281 Tracer::setTraceLevel(Tracer::LEVEL3);
282 Tracer::setTraceFile(FILE2);
283
|
284 kumpf 1.10 PEG_METHOD_ENTER(TRC_CONFIG,METHOD_NAME);
|
285 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL3,"%s %s",
286 "Test Message for Level3 in",METHOD_NAME));
|
287 mike 1.2 return(compare(FILE2,"Test Message for Level3 in test9"));
288 }
289
290 //
291 // Description:
292 // Passes invalid component in the trace call
293 // should not log a trace message
294 //
295 // Type:
296 // Negative
297 //
298 // return 0 if the test passed
299 // return 1 if the test failed
300 //
|
301 karl 1.27 // This test not required with change t0
302 // use and test macros only.
|
303 mike 1.2
304 Uint32 test10()
305 {
306 const char* METHOD_NAME = "test10";
307 Tracer::setTraceComponents("ALL");
|
308 karl 1.27 PEG_METHOD_ENTER(TRC_CONFIG,METHOD_NAME);
309 PEG_METHOD_EXIT();
|
310 mike 1.2 return(compare(FILE2,"Test Message for Level3 in test9"));
311 }
312
313 //
314 // Description:
315 // Implements trace call for Tracer::Level1
316 // should log a trace message
317 //
318 // Type:
319 // Positive
320 //
321 // return 0 if the test passed
322 // return 1 if the test failed
323 //
324
325 Uint32 test11()
326 {
327 const char* METHOD_NAME = "test11";
328 Tracer::setTraceComponents("ALL");
329 Tracer::setTraceLevel(Tracer::LEVEL4);
|
330 kumpf 1.10 PEG_METHOD_ENTER(TRC_CONFIG,METHOD_NAME);
|
331 mike 1.2 return(compare(FILE2,"Entering method test11"));
332 }
333
334 //
335 // Description:
336 // Implements trace call for Tracer::Level1
337 // should log a trace message
338 //
339 // Type:
340 // Positive
341 //
342 // return 0 if the test passed
343 // return 1 if the test failed
344 //
345
346 Uint32 test12()
347 {
348 const char* METHOD_NAME = "test12";
349 Tracer::setTraceComponents("ALL");
350 Tracer::setTraceLevel(Tracer::LEVEL4);
|
351 karl 1.27 PEG_METHOD_ENTER(TRC_CONFIG,METHOD_NAME);
352 PEG_METHOD_EXIT();
|
353 mike 1.2 return(compare(FILE2,"Exiting method test12"));
354 }
355
356 //
357 // Description:
358 // Implements trace call for Tracer::Level2
359 // should log a trace message
360 //
361 // Type:
362 // Positive
363 //
364 // return 0 if the test passed
365 // return 1 if the test failed
366 //
367
368 Uint32 test13()
369 {
370 const char* METHOD_NAME = "test13";
371 Tracer::setTraceComponents("ALL");
372 Tracer::setTraceLevel(Tracer::LEVEL4);
|
373 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL2,"%s %s",
374 "Test Message for Level2 in",METHOD_NAME));
|
375 mike 1.2 return(compare(FILE2,"Test Message for Level2 in test13"));
376 }
377
378 //
379 // Description:
380 // Implements trace call for Tracer::Level3
381 // should log a trace message
382 //
383 // Type:
384 // Positive
385 //
386 // return 0 if the test passed
387 // return 1 if the test failed
388 //
389
390 Uint32 test14()
391 {
392 const char* METHOD_NAME = "test14";
393 Tracer::setTraceComponents("ALL");
394 Tracer::setTraceLevel(Tracer::LEVEL4);
395 Tracer::setTraceFile(FILE3);
|
396 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL3,"%s %s",
397 "Test Message for Level3 in",METHOD_NAME));
|
398 mike 1.2 return(compare(FILE3,"Test Message for Level3 in test14"));
399 }
400
401 //
402 // Description:
403 // Implements trace call for Tracer::Level4
404 // should log a trace message
405 //
406 // Type:
407 // Positive
408 //
409 // return 0 if the test passed
410 // return 1 if the test failed
411 //
412
413 Uint32 test15()
414 {
415 const char* METHOD_NAME = "test15";
416 Tracer::setTraceComponents("ALL");
417 Tracer::setTraceLevel(Tracer::LEVEL4);
|
418 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL4,"%s %s",
419 "Test Message for Level4 in",METHOD_NAME));
|
420 mike 1.2 return(compare(FILE3,"Test Message for Level4 in test15"));
421 }
422
423 //
424 // Description:
425 // calls the setTraceComponents with null string
426 // should log a trace message
427 //
428 // Type:
429 // Negative
430 //
431 // return 0 if the test passed
432 // return 1 if the test failed
433 //
434
435 Uint32 test16()
436 {
437 const char* METHOD_NAME = "test16";
438 Tracer::setTraceComponents("");
439 Tracer::setTraceLevel(Tracer::LEVEL4);
|
440 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL4,"%s %s",
441 "This Message should not appear in",METHOD_NAME));
|
442 mike 1.2 return(compare(FILE3,"Test Message for Level4 in test15"));
443 }
444
445 //
446 // Description:
447 // calls the setTraceComponents with one valid and another invalid component
448 // should log a trace message
449 //
450 // Type:
451 // Negative
452 //
453 // return 0 if the test passed
454 // return 1 if the test failed
455 //
456
457 Uint32 test17()
458 {
459 const char* METHOD_NAME = "test17";
|
460 kumpf 1.3 Tracer::setTraceComponents("InvalidComp");
|
461 mike 1.2 Tracer::setTraceLevel(Tracer::LEVEL4);
|
462 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL4,"%s %s",
463 "This Message should not appear in",METHOD_NAME));
|
464 mike 1.2 return(compare(FILE3,"Test Message for Level4 in test15"));
465 }
|
466 kumpf 1.3 //
467 // Description:
468 // calls the _traceBuffer call
469 // should log a trace message
470 //
471 // Type:
472 // Positive
473 //
474 // return 0 if the test passed
475 // return 1 if the test failed
476 //
477
478 Uint32 test18()
479 {
480 const char* METHOD_NAME = "test18";
481 Tracer::setTraceComponents("Config,InvalidComp");
482 Tracer::setTraceLevel(Tracer::LEVEL4);
|
483 marek 1.33 PEG_TRACE_CSTRING(TRC_CONFIG,Tracer::LEVEL4,
|
484 marek 1.28 "This Message should appear in");
485 return(compare(FILE3,"This Message should appear in"));
|
486 kumpf 1.3 }
|
487 mike 1.2
|
488 kumpf 1.4 //
489 // Description:
490 // Trace a string.
|
491 marek 1.33 // Calls the PEG_TRACE macro
|
492 kumpf 1.4 // should log a trace message
493 //
494 // Type:
495 // Positive
496 //
497 // return 0 if the test passed
498 // return 1 if the test failed
499 //
500
501 Uint32 test20()
502 {
503 const char* METHOD_NAME = "test20";
504 Tracer::setTraceFile(FILE4);
505 Tracer::setTraceComponents("ALL");
506 Tracer::setTraceLevel(Tracer::LEVEL4);
507
508 PEG_METHOD_ENTER(TRC_CONFIG, METHOD_NAME);
|
509 marek 1.33 PEG_TRACE((TRC_CONFIG,Tracer::LEVEL4,
510 "Test Message for Level4 in test20"));
|
511 kumpf 1.4 return(compare(FILE4,"Test Message for Level4 in test20"));
512 }
513
514 //
515 // Description:
516 // Trace a CIMException.
517 // Calls the traceCIMException() method
518 // should log a trace message
519 //
520 // Type:
521 // Positive
522 //
523 // return 0 if the test passed
524 // return 1 if the test failed
525 //
526
527 Uint32 test21()
528 {
529 const char* METHOD_NAME = "test21";
530 Tracer::setTraceFile(FILE4);
531 Tracer::setTraceComponents("ALL");
532 kumpf 1.4 Tracer::setTraceLevel(Tracer::LEVEL4);
533
534 PEG_METHOD_ENTER(TRC_CONFIG, METHOD_NAME);
535
536 // test tracing CIMException
537 try
538 {
539 throw PEGASUS_CIM_EXCEPTION(
540 CIM_ERR_NOT_SUPPORTED,
541 "CIM Exception Message for Level4 in test21.");
542 }
|
543 kumpf 1.12 catch (CIMException& e)
|
544 kumpf 1.4 {
545 Tracer::traceCIMException(TRC_CONFIG,Tracer::LEVEL4, e);
546 }
547
548 return 0;
549 }
550
551 //
552 // Description:
553 // Trace a string using macro.
554 // should log a trace message
555 //
556 // Type:
557 // Positive
558 //
559 // return 0 if the test passed
560 // return 1 if the test failed
561 //
562 Uint32 test22()
563 {
564 const char* METHOD_NAME = "test22";
565 kumpf 1.4 Tracer::setTraceFile(FILE4);
566 Tracer::setTraceComponents("ALL");
567 Tracer::setTraceLevel(Tracer::LEVEL4);
568
569 PEG_METHOD_ENTER(TRC_CONFIG, METHOD_NAME);
570
|
571 karl 1.29 PEG_TRACE_STRING(TRC_CONFIG,Tracer::LEVEL4,
|
572 marek 1.33 String("Test message for Level4 in test22."));
|
573 kumpf 1.4
574 return(compare(FILE4,"Test message for Level4 in test22."));
575 }
576
|
577 marek 1.28 //
578 // Description:
579 // Trace a character string using macro.
580 // should log a trace message
581 //
582 // Type:
583 // Positive
584 //
585 // return 0 if the test passed
586 // return 1 if the test failed
587 //
588 Uint32 test23()
589 {
590 const char* METHOD_NAME = "test23";
591 Tracer::setTraceFile(FILE4);
592 Tracer::setTraceComponents("ALL");
593 Tracer::setTraceLevel(Tracer::LEVEL4);
594
595 PEG_METHOD_ENTER(TRC_CONFIG, METHOD_NAME);
596
|
597 karl 1.29 PEG_TRACE_CSTRING(TRC_CONFIG,Tracer::LEVEL4,
598 "Test message for Level4 in test23.");
|
599 marek 1.28
600 return(compare(FILE4,"Test message for Level4 in test23."));
601 }
602
|
603 sushma.fernandes 1.30 //
604 // Description:
605 // Test the getHTTPRequestMessage method.
606 //
607 // Type:
608 // Positive
609 // Tests with a HTTP Request without a basic authorization header.
610 // Message is written to trace file without any changes.
611 //
612 // return 0 if the test passed
613 // return 1 if the test failed
614 //
615 Uint32 test24()
616 {
617 Tracer::setTraceFile(FILE4);
618 Tracer::setTraceComponents("xmlio");
619 Tracer::setTraceLevel(Tracer::LEVEL2);
620
621 Uint32 queueId = 18;
622 CIMPropertyList propertyList;
623 Buffer params;
624 sushma.fernandes 1.30 AcceptLanguageList al;
625 ContentLanguageList cl;
626
627 XmlWriter::appendClassNameIParameter(
628 params, "ClassName", CIMName("testclass"));
629 Buffer buffer = XmlWriter::formatSimpleIMethodReqMessage(
630 "localhost",
631 CIMNamespaceName("test/cimv2"),
632 CIMName ("EnumerateInstanceNames"),
633 "12345",
634 HTTP_METHOD__POST,
635 "Basic: Authorization AAAAA",
636 al,
637 cl,
638 params);
639
640 SharedArrayPtr<char> reqMsg(Tracer::getHTTPRequestMessage(
641 buffer));
642
643 PEG_TRACE((
644 TRC_XML_IO,
645 sushma.fernandes 1.30 Tracer::LEVEL2,
646 "<!-- Request: queue id: %u -->\n%s",
647 queueId,
648 reqMsg.get()));
649
650 return(compare(FILE4, buffer.getData()));
651 }
652
653 //
654 // Description:
655 // Test the getHTTPRequestMessage method.
656 //
657 // Type:
658 // Positive
659 // Tests with a HTTP Request that contains a Basic authorization header.
660 // The user/password info in the message is suppressed before writing it to
661 // the trace file.
662 //
663 // return 0 if the test passed
664 // return 1 if the test failed
665 //
666 sushma.fernandes 1.30 Uint32 test25()
667 {
668 Tracer::setTraceFile(FILE4);
669 Tracer::setTraceComponents("xmlio");
670 Tracer::setTraceLevel(Tracer::LEVEL2);
671
672 Uint32 queueId = 18;
673 CIMPropertyList propertyList;
674 Buffer params;
675 AcceptLanguageList al;
676 ContentLanguageList cl;
677 String authHeader = "Authorization: Basic ABCDEABCDE==";
678 String MSGID = "32423424";
679
680 XmlWriter::appendClassNameIParameter(
681 params,
682 "ClassName",
683 CIMName("testclass"));
684 Buffer buffer = XmlWriter::formatSimpleIMethodReqMessage(
685 "localhost",
686 CIMNamespaceName("test/cimv2"),
687 sushma.fernandes 1.30 CIMName ("EnumerateInstanceNames"),
688 MSGID,
689 HTTP_METHOD__POST,
690 authHeader,
691 al,
692 cl,
693 params);
694
695 PEG_TRACE((
696 TRC_XML_IO,
697 Tracer::LEVEL2,
698 "<!-- Request: queue id: %u -->\n%s",
699 queueId,
700 Tracer::getHTTPRequestMessage(
701 buffer).get()));
702
703 String testStr(buffer.getData());
704 Uint32 pos = testStr.find("ABCDEABCDE==");
705
706 for ( Uint32 i = pos; i < pos+strlen("ABCDEABCDE=="); i++)
707 testStr[i] = 'X';
708 sushma.fernandes 1.30
709 return(compare(FILE4, testStr.getCString()));
710 }
711
|
712 karl 1.7 int main(int argc, char** argv)
|
713 mike 1.2 {
714
715 // Execute the tests only if trace calls are included
716
717 #ifdef PEGASUS_REMOVE_TRACE
|
718 karl 1.7 cout << argv[0] << " +++++ passed all tests" << endl;
|
719 mike 1.2 return 0;
720 #else
|
721 kumpf 1.11
722 const char* tmpDir = getenv ("PEGASUS_TMP");
723 if (tmpDir == NULL)
724 {
725 tmpDir = ".";
726 }
727 String f1 (tmpDir);
|
728 kumpf 1.13 f1.append("/testtracer1.trace");
|
729 kumpf 1.14 FILE1 = f1.getCString();
|
730 kumpf 1.11 String f2 (tmpDir);
|
731 kumpf 1.13 f2.append("/testtracer2.trace");
|
732 kumpf 1.14 FILE2 = f2.getCString();
|
733 kumpf 1.11 String f3 (tmpDir);
|
734 kumpf 1.13 f3.append("/testtracer3.trace");
|
735 kumpf 1.14 FILE3 = f3.getCString();
|
736 kumpf 1.11 String f4 (tmpDir);
|
737 kumpf 1.13 f4.append("/testtracer4.trace");
|
738 kumpf 1.14 FILE4 = f4.getCString();
|
739 kumpf 1.11
|
740 mike 1.2 System::removeFile(FILE1);
741 System::removeFile(FILE2);
742 System::removeFile(FILE3);
|
743 kumpf 1.4 System::removeFile(FILE4);
|
744 kumpf 1.34 if (test1() != 0)
|
745 mike 1.2 {
746 cout << "Tracer test (test1) failed" << endl;
747 exit(1);
748 }
|
749 kumpf 1.34 if (test2() != 0)
|
750 mike 1.2 {
751 cout << "Tracer test (test2) failed" << endl;
752 exit(1);
753 }
|
754 kumpf 1.34 if (test3() != 0)
|
755 mike 1.2 {
756 cout << "Tracer test (test3) failed" << endl;
757 exit(1);
758 }
759 if (test4() != 0)
760 {
761 cout << "Tracer test (test4) failed" << endl;
762 exit(1);
763 }
764 if (test5() != 0)
765 {
766 cout << "Tracer test (test5) failed" << endl;
767 exit(1);
768 }
769 if (test6() != 0)
770 {
771 cout << "Tracer test (test6) failed" << endl;
772 exit(1);
773 }
774 if (test7() != 0)
775 {
776 mike 1.2 cout << "Tracer test (test7) failed" << endl;
777 exit(1);
778 }
779 if (test9() != 0)
780 {
781 cout << "Tracer test (test9) failed" << endl;
782 exit(1);
783 }
|
784 karl 1.27 /***************************
785 Test 10 bypassed when tests changed to
786 use macros. It did an invalid call which is
787 not possible with macros
788
|
789 mike 1.2 if (test10() != 0)
790 {
791 cout << "Tracer test (test10) failed" << endl;
792 exit(1);
793 }
|
794 karl 1.27 ******************************/
|
795 mike 1.2 if (test11() != 0)
796 {
797 cout << "Tracer test (test11) failed" << endl;
798 exit(1);
799 }
800 if (test12() != 0)
801 {
802 cout << "Tracer test (test12) failed" << endl;
803 exit(1);
804 }
805 if (test13() != 0)
806 {
807 cout << "Tracer test (test13) failed" << endl;
808 exit(1);
809 }
810 if (test14() != 0)
811 {
812 cout << "Tracer test (test14) failed" << endl;
813 exit(1);
814 }
815 if (test15() != 0)
816 mike 1.2 {
817 cout << "Tracer test (test15) failed" << endl;
818 exit(1);
819 }
820 if (test16() != 0)
821 {
822 cout << "Tracer test (test16) failed" << endl;
|
823 kumpf 1.3 exit(1);
824 }
825 if (test17() != 0)
826 {
827 cout << "Tracer test (test17) failed" << endl;
828 exit(1);
829 }
830 if (test18() != 0)
831 {
832 cout << "Tracer test (test18) failed" << endl;
833 exit(1);
834 }
|
835 kumpf 1.4 if (test20() != 0)
836 {
837 cout << "Tracer test (test20) failed" << endl;
838 exit(1);
839 }
840 if (test21() != 0)
841 {
842 cout << "Tracer test (test21) failed" << endl;
843 exit(1);
844 }
845 if (test22() != 0)
846 {
847 cout << "Tracer test (test22) failed" << endl;
848 exit(1);
849 }
|
850 marek 1.28 if (test23() != 0)
851 {
852 cout << "Tracer test (test23) failed" << endl;
853 exit(1);
854 }
|
855 sushma.fernandes 1.30 if (test24() != 0)
856 {
857 cout << "Tracer test (test24) failed" << endl;
858 exit(1);
859 }
860
861 if (test25() != 0)
862 {
863 cout << "Tracer test (test25) failed" << endl;
864 exit(1);
865 }
866
|
867 karl 1.7 cout << argv[0] << " +++++ passed all tests" << endl;
|
868 mike 1.2 System::removeFile(FILE1);
869 System::removeFile(FILE2);
870 System::removeFile(FILE3);
|
871 kumpf 1.4 System::removeFile(FILE4);
|
872 mike 1.2 return 0;
873 #endif
874 }
|